Port to GTK4, start implementation of Local Music view, Artist and Album Views.
This commit is contained in:
parent
8948a8ec9f
commit
588a68b2cc
28 changed files with 1103 additions and 270 deletions
|
@ -267,7 +267,7 @@ void koto_indexed_album_update_path(KotoIndexedAlbum *self, const gchar* new_pat
|
|||
|
||||
g_free(album_art_no_ext);
|
||||
g_free(lower_art);
|
||||
} else if (g_str_has_prefix(mime_type, "audio/")) { // Is an audio file
|
||||
} else if (g_str_has_prefix(mime_type, "audio/") || g_str_has_prefix(mime_type, "video/ogg")) { // Is an audio file or ogg because it is special
|
||||
KotoIndexedFile *file = koto_indexed_file_new(full_path);
|
||||
|
||||
if (file != NULL) { // Is a file
|
||||
|
|
|
@ -72,9 +72,7 @@ void koto_indexed_library_add_artist(KotoIndexedLibrary *self, KotoIndexedArtist
|
|||
return;
|
||||
}
|
||||
|
||||
if (self->music_artists == NULL) { // Not a HashTable
|
||||
self->music_artists = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
}
|
||||
koto_indexed_library_get_artists(self); // Call to generate if needed
|
||||
|
||||
gchar *artist_name;
|
||||
g_object_get(artist, "name", &artist_name, NULL);
|
||||
|
@ -92,21 +90,25 @@ KotoIndexedArtist* koto_indexed_library_get_artist(KotoIndexedLibrary *self, gch
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (self->music_artists == NULL) { // Not a HashTable
|
||||
return NULL;
|
||||
}
|
||||
koto_indexed_library_get_artists(self); // Call to generate if needed
|
||||
|
||||
return g_hash_table_lookup(self->music_artists, (KotoIndexedArtist*) artist_name);
|
||||
}
|
||||
|
||||
GHashTable* koto_indexed_library_get_artists(KotoIndexedLibrary *self) {
|
||||
if (self->music_artists == NULL) { // Not a HashTable
|
||||
self->music_artists = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
}
|
||||
|
||||
return self->music_artists;
|
||||
}
|
||||
|
||||
void koto_indexed_library_remove_artist(KotoIndexedLibrary *self, KotoIndexedArtist *artist) {
|
||||
if (artist == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->music_artists == NULL) { // Not a HashTable
|
||||
return;
|
||||
}
|
||||
koto_indexed_library_get_artists(self); // Call to generate if needed
|
||||
|
||||
gchar *artist_name;
|
||||
g_object_get(artist, "name", &artist_name, NULL);
|
||||
|
@ -223,6 +225,8 @@ void index_folder(KotoIndexedLibrary *self, gchar *path, guint depth) {
|
|||
}
|
||||
|
||||
void output_artists(gpointer artist_key, gpointer artist_ptr, gpointer data) {
|
||||
(void)artist_key;
|
||||
(void)data;
|
||||
KotoIndexedArtist *artist = (KotoIndexedArtist*) artist_ptr;
|
||||
gchar *artist_name;
|
||||
g_object_get(artist, "name", &artist_name, NULL);
|
||||
|
|
|
@ -28,6 +28,7 @@ KotoIndexedLibrary* koto_indexed_library_new(const gchar *path);
|
|||
|
||||
void koto_indexed_library_add_artist(KotoIndexedLibrary *self, KotoIndexedArtist *artist);
|
||||
KotoIndexedArtist* koto_indexed_library_get_artist(KotoIndexedLibrary *self, gchar* artist_name);
|
||||
GHashTable* koto_indexed_library_get_artists(KotoIndexedLibrary *self);
|
||||
void koto_indexed_library_remove_artist(KotoIndexedLibrary *self, KotoIndexedArtist *artist);
|
||||
void start_indexing(KotoIndexedLibrary *self);
|
||||
void index_folder(KotoIndexedLibrary *self, gchar *path, guint depth);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue