[rhythmbox] rhythmdb: create better ext-db keys for entries that aren't in albums
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] rhythmdb: create better ext-db keys for entries that aren't in albums
- Date: Sun, 2 Nov 2014 07:26:03 +0000 (UTC)
commit 7a1ac3780fcce115440e0c171e81dfbc35f0527a
Author: Jonathan Matthew <jonathan d14n org>
Date: Sun Nov 2 17:22:27 2014 +1000
rhythmdb: create better ext-db keys for entries that aren't in albums
For entries that aren't in albums (indicated by setting the album property
to an empty string), storing and retrieving art based on the title seems
like a reasonable fallback.
rhythmdb/rhythmdb.c | 37 +++++++++++++++++++++++--------------
1 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/rhythmdb/rhythmdb.c b/rhythmdb/rhythmdb.c
index ad6bd40..4cd6dfc 100644
--- a/rhythmdb/rhythmdb.c
+++ b/rhythmdb/rhythmdb.c
@@ -5421,27 +5421,36 @@ rhythmdb_entry_create_ext_db_key (RhythmDBEntry *entry, RhythmDBPropType prop)
switch (prop) {
case RHYTHMDB_PROP_ALBUM:
- key = rb_ext_db_key_create_lookup ("album", rhythmdb_entry_get_string (entry, prop));
- rb_ext_db_key_add_field (key,
- "artist",
- rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST));
- str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM_ARTIST);
+ str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);
if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
- rb_ext_db_key_add_field (key, "artist", str);
- }
+ key = rb_ext_db_key_create_lookup ("album", str);
+ rb_ext_db_key_add_field (key,
+ "artist",
+ rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST));
+ str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM_ARTIST);
+ if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
+ rb_ext_db_key_add_field (key, "artist", str);
+ }
- str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_MUSICBRAINZ_ALBUMID);
- if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
- rb_ext_db_key_add_info (key, "musicbrainz-albumid", str);
+ str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_MUSICBRAINZ_ALBUMID);
+ if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
+ rb_ext_db_key_add_info (key, "musicbrainz-albumid", str);
+ }
+ break;
}
-
- break;
+ /* fall through if there's no album information */
case RHYTHMDB_PROP_TITLE:
key = rb_ext_db_key_create_lookup ("title", rhythmdb_entry_get_string (entry, prop));
/* maybe these should be info? */
- rb_ext_db_key_add_field (key, "artist", rhythmdb_entry_get_string (entry,
RHYTHMDB_PROP_ARTIST));
- rb_ext_db_key_add_field (key, "album", rhythmdb_entry_get_string (entry,
RHYTHMDB_PROP_ALBUM));
+ str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
+ if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
+ rb_ext_db_key_add_field (key, "artist", str);
+ }
+ str = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);
+ if (g_strcmp0 (str, "") != 0 && g_strcmp0 (str, _("Unknown")) != 0) {
+ rb_ext_db_key_add_field (key, "album", str);
+ }
break;
case RHYTHMDB_PROP_ARTIST:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]