Deprecate KotoFlipperButton, integrate flip functionality with an alt image into KotoButton.
We are now leveraging KotoButton in the KotoPlayerBar and KotoExpander. Dropped Glade UI templating from KotoWindow, set its default size using gtk_widget_set_size_request to force a minimum window size, set window title, WMClass, and icon name. Start implementing KotoIndexedFile class to handle our provided audio files, setting its file name and attempting to parse the file name when we are not using ID3 data. The parsing is as follows: - All `_` are replaced with whitespace - We will attempt to remove nested references to the artist and album name (we need to implemented the relevant classes to leverage that). - Remove any references to ` - ` followed by any stragglers `-` (without the whitespace around it). - Split based on `.` and remove the trailing file extension, preserving the rest (so something like `Ch. 01.ogg` would be considered just `Ch. 01`).
This commit is contained in:
parent
625c1be645
commit
9b6fa4593a
19 changed files with 472 additions and 333 deletions
|
@ -18,14 +18,9 @@
|
|||
#include <dirent.h>
|
||||
#include <magic.h>
|
||||
#include <sys/stat.h>
|
||||
#include "file.h"
|
||||
#include "file-indexer.h"
|
||||
|
||||
struct KotoIndexedFile {
|
||||
GObject parent_instance;
|
||||
gchar *file_name;
|
||||
gchar *path;
|
||||
};
|
||||
|
||||
struct KotoIndexedAlbum {
|
||||
GObject parent_instance;
|
||||
gboolean has_album_art;
|
||||
|
@ -41,7 +36,7 @@ struct _KotoIndexedArtist {
|
|||
gchar *artist_name;
|
||||
GHashTable *albums;
|
||||
gchar *path;
|
||||
}
|
||||
};
|
||||
|
||||
struct _KotoIndexedLibrary {
|
||||
GObject parent_instance;
|
||||
|
@ -74,12 +69,16 @@ static void koto_indexed_library_class_init(KotoIndexedLibraryClass *c) {
|
|||
"Path",
|
||||
"Path to Music",
|
||||
NULL,
|
||||
G_PARAM_CONSTRUCT_ONLY|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_READWRITE
|
||||
G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_READWRITE
|
||||
);
|
||||
|
||||
g_object_class_install_properties(gobject_class, N_PROPERTIES, props);
|
||||
}
|
||||
|
||||
static void koto_indexed_library_init(KotoIndexedLibrary *self) {
|
||||
self->music_artists = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
}
|
||||
|
||||
static void koto_indexed_library_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec) {
|
||||
KotoIndexedLibrary *self = KOTO_INDEXED_LIBRARY(obj);
|
||||
|
||||
|
@ -175,18 +174,29 @@ void index_file(KotoIndexedLibrary *self, gchar *path) {
|
|||
g_str_has_prefix(mime_info[0], "audio/") || // Is audio
|
||||
g_str_has_prefix(mime_info[0], "image/") // Is image
|
||||
) {
|
||||
g_message("File Name: %s", path);
|
||||
//g_message("File Name: %s", path);
|
||||
}
|
||||
|
||||
if (g_str_has_prefix(mime_info[0], "audio/")) { // Is an audio file
|
||||
KotoIndexedFile *file = koto_indexed_file_new(path);
|
||||
gchar *filepath;
|
||||
gchar *parsed_name;
|
||||
|
||||
g_object_get(file,
|
||||
"path", &filepath,
|
||||
"parsed-name", &parsed_name,
|
||||
NULL);
|
||||
|
||||
g_free(filepath);
|
||||
g_free(parsed_name);
|
||||
g_object_unref(file);
|
||||
}
|
||||
|
||||
g_strfreev(mime_info); // Free our mimeinfo
|
||||
}
|
||||
|
||||
static void koto_indexed_library_init(KotoIndexedLibrary *self) {
|
||||
self->files = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
}
|
||||
|
||||
KotoIndexedLibrary* koto_indexed_library_new(const gchar *path) {
|
||||
return g_object_new(KOTO_INDEXED_TYPE_LIBRARY,
|
||||
return g_object_new(KOTO_TYPE_INDEXED_LIBRARY,
|
||||
"path", path,
|
||||
NULL
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue