[grilo-plugins/wip/jfelder/acoustid-album-artist] acoustid: Add support for album artist
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/wip/jfelder/acoustid-album-artist] acoustid: Add support for album artist
- Date: Wed, 22 Jan 2020 15:33:27 +0000 (UTC)
commit 39bedae194266e244505580384d9671aced28288
Author: Jean Felder <jfelder src gnome org>
Date: Wed Jan 22 14:34:28 2020 +0100
acoustid: Add support for album artist
src/lua-factory/sources/grl-acoustid.lua | 9 ++++++++-
tests/lua-factory/sources/test_lua_acoustid.c | 26 +++++++++++++++++++++-----
2 files changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/src/lua-factory/sources/grl-acoustid.lua b/src/lua-factory/sources/grl-acoustid.lua
index ec746767..8090f3ad 100644
--- a/src/lua-factory/sources/grl-acoustid.lua
+++ b/src/lua-factory/sources/grl-acoustid.lua
@@ -28,7 +28,7 @@ source = {
id = "grl-acoustid",
name = "Acoustid",
description = "a source that provides audio identification",
- supported_keys = { "title", "album", "artist", "mb-recording-id", "mb-album-id", "mb-artist-id",
"mb-release-group-id", "mb-release-id", "album-disc-number", "publication-date", "track-number",
"creation-date" },
+ supported_keys = { "title", "album", "album-artist", "artist", "mb-recording-id", "mb-album-id",
"mb-artist-id", "mb-release-group-id", "mb-release-id", "album-disc-number", "publication-date",
"track-number", "creation-date" },
supported_media = { 'audio' },
config_keys = {
required = { "api-key" },
@@ -198,6 +198,13 @@ function build_media(record, releasegroup)
media.mb_album_id = keys.mb_album_id and album.id or nil
media.mb_release_group_id = keys.mb_release_group_id and album.id or nil
+ if album.artists and keys.album_artist then
+ media.album_artist = {}
+ for _, artist in ipairs(album.artists) do
+ table.insert(media.album_artist, artist.name)
+ end
+ end
+
-- FIXME: related-keys on lua sources are in the TODO list
-- https://bugzilla.gnome.org/show_bug.cgi?id=756203
-- and for that reason we are only returning first of all metadata
diff --git a/tests/lua-factory/sources/test_lua_acoustid.c b/tests/lua-factory/sources/test_lua_acoustid.c
index 1eeeba2d..263e0056 100644
--- a/tests/lua-factory/sources/test_lua_acoustid.c
+++ b/tests/lua-factory/sources/test_lua_acoustid.c
@@ -63,6 +63,7 @@ test_query_by_fingerprint (void)
keys = grl_metadata_key_list_new (GRL_METADATA_KEY_MB_ARTIST_ID,
GRL_METADATA_KEY_ARTIST,
+ GRL_METADATA_KEY_ALBUM_ARTIST,
GRL_METADATA_KEY_MB_RELEASE_ID,
GRL_METADATA_KEY_MB_RELEASE_GROUP_ID,
GRL_METADATA_KEY_ALBUM,
@@ -86,6 +87,7 @@ test_query_by_fingerprint (void)
media = GRL_MEDIA (results->data);
g_assert_cmpstr (grl_media_get_title (media), ==, "Primavera");
g_assert_cmpstr (grl_media_get_album (media), ==, "Classic FM Summer Guitar");
+ g_assert_cmpstr (grl_media_get_album_artist (media), ==, "Various Artists");
g_assert_cmpstr (grl_media_get_artist (media), ==, "Craig Ogden");
g_assert_cmpstr (grl_media_get_mb_recording_id (media), ==, "5d72b7d4-d0c4-4d0d-ab7f-3a737075e1c9");
g_assert_cmpstr (grl_media_get_mb_release_id (media), ==, "5fd10cc8-30e0-48aa-9ba1-19d05b871a75");
@@ -101,6 +103,7 @@ test_query_by_fingerprint (void)
media = GRL_MEDIA (results->next->next->data);
g_assert_cmpstr (grl_media_get_title (media), ==, "Primavera");
g_assert_cmpstr (grl_media_get_album (media), ==, "Einaudi essentiel");
+ g_assert_cmpstr (grl_media_get_album_artist (media), ==, NULL);
g_assert_cmpstr (grl_media_get_artist (media), ==, "Ludovico Einaudi");
g_assert_cmpstr (grl_media_get_mb_recording_id (media), ==, "75e72e13-cf02-47f8-a4a7-98b916b3b18c");
g_assert_cmpstr (grl_media_get_mb_release_id (media), ==, "7a06eb11-6013-4eb8-8aef-a2302ef4ed79");
@@ -128,6 +131,7 @@ resolve (GrlSource *source,
gchar **out_artist,
gchar **out_mb_album_id,
gchar **out_album,
+ gchar **out_album_artist,
gchar **out_mb_recording_id,
gchar **out_title,
gchar **out_mb_release_id,
@@ -155,6 +159,7 @@ resolve (GrlSource *source,
keys = grl_metadata_key_list_new (GRL_METADATA_KEY_MB_ARTIST_ID,
GRL_METADATA_KEY_ARTIST,
+ GRL_METADATA_KEY_ALBUM_ARTIST,
GRL_METADATA_KEY_MB_ALBUM_ID,
GRL_METADATA_KEY_MB_RELEASE_ID,
GRL_METADATA_KEY_MB_RELEASE_GROUP_ID,
@@ -180,6 +185,7 @@ resolve (GrlSource *source,
*out_artist = g_strdup (grl_media_get_artist (audio));
*out_mb_album_id = g_strdup (grl_media_get_mb_album_id (audio));
*out_album = g_strdup (grl_media_get_album (audio));
+ *out_album_artist = g_strdup (grl_media_get_album_artist (audio));
*out_mb_recording_id = g_strdup (grl_media_get_mb_recording_id (audio));
*out_title = g_strdup (grl_media_get_title (audio));
*out_mb_release_id = g_strdup (grl_media_get_mb_release_id (audio));
@@ -210,6 +216,7 @@ test_resolve_fingerprint (void)
gchar *artist;
gchar *mb_album_id;
gchar *album;
+ gchar *album_artist;
gchar *mb_recording_id;
gchar *title;
gchar *mb_release_id;
@@ -222,30 +229,35 @@ test_resolve_fingerprint (void)
{ FINGERPRINT_LUDOVICO_EI, 445,
"fa34b363-79df-434f-a5b8-be4e6898543f", "Ludovico Einaudi",
"ac615d26-df00-3053-9462-7636375603b4", "The Number One Classical Album 2008",
+ "Various Artists",
"8f6ac978-95cf-41e8-82fb-043624652e04", "Primavera",
"d73e4041-375c-4b9f-8366-46089bca304c", "ac615d26-df00-3053-9462-7636375603b4",
1, "2007-11-26", "2007-11-26", 19 },
{ FINGERPRINT_NORAH_JONES, 160,
"985c709c-7771-4de3-9024-7bda29ebe3f9", "Norah Jones",
"f5cffa96-262c-49af-9747-3f04a1d42c78", "\u00d63 Greatest Hits 49",
+ "Various Artists",
"6d8ba615-d8fe-4f99-b38f-0a17d657b1bb", "Chasing Pirates",
"1ee64f6c-560f-421f-83dc-7fd34e5b0674", "f5cffa96-262c-49af-9747-3f04a1d42c78",
1, "2010-03-12", "2010-03-12", 18 },
{ FINGERPRINT_TROMBONE_SH, 243,
"cae4fd51-4d58-4d48-92c1-6198cc2e45ed", "Trombone Shorty",
"c3418122-387b-4477-90cf-e5e6d110e054", "For True",
+ NULL,
"96483bdd-f219-4ae3-a94e-04feeeef22a4", "Buckjump",
"567621e3-b80f-4c30-af5f-2ecf0882e94a", "c3418122-387b-4477-90cf-e5e6d110e054",
1, "2011-01-01", "2011-01-01", 1 },
{ FINGERPRINT_PHILIP_GLAS, 601,
"5ae54dee-4dba-49c0-802a-a3b3b3adfe9b", "Philip Glass",
"52f1f9d5-5166-4ceb-9289-6fb1a87f367c", "The Passion of Ramakrishna",
+ NULL,
"298e15a1-b29b-4947-9dca-ec3634f9ebde", "Part 2",
"2807def3-7873-4277-b079-c9a963d99993", "52f1f9d5-5166-4ceb-9289-6fb1a87f367c",
1, "2012-01-01", "2012-01-01", 3 },
{ FINGERPRINT_RADIOHEAD_PA, 385,
"a74b1b7f-71a5-4011-9441-d0b5e4122711", "Radiohead",
"dd02a722-bb7f-4771-9a5b-681f5556ce71", "3X plus de bruit!",
+ "Various Artists",
"9f9cf187-d6f9-437f-9d98-d59cdbd52757", "Paranoid Android",
"67016a2b-118d-483d-9e36-49080ae43df4", "dd02a722-bb7f-4771-9a5b-681f5556ce71",
1, "1997-01-01", "1997-01-01", 4,
@@ -258,8 +270,9 @@ test_resolve_fingerprint (void)
GFile *file;
gsize size;
GError *error = NULL;
- gchar *mb_artist_id, *artist, *mb_album_id, *album, *mb_recording_id, *title,
- *mb_release_id, *mb_release_group_id, *publication_date, *creation_date;
+ gchar *mb_artist_id, *artist, *mb_album_id, *album, *album_artist,
+ *mb_recording_id, *title, *mb_release_id, *mb_release_group_id,
+ *publication_date, *creation_date;
gint album_disc_number, track_number;
file = g_file_new_for_uri (audios[i].fingerprint_file);
@@ -268,9 +281,10 @@ test_resolve_fingerprint (void)
g_clear_pointer (&file, g_object_unref);
resolve (source, data, audios[i].duration,
- &mb_artist_id, &artist, &mb_album_id, &album, &mb_recording_id, &title,
- &mb_release_id, &mb_release_group_id, &album_disc_number, &publication_date,
- &creation_date, &track_number);
+ &mb_artist_id, &artist, &mb_album_id, &album, &album_artist,
+ &mb_recording_id, &title, &mb_release_id, &mb_release_group_id,
+ &album_disc_number, &publication_date, &creation_date,
+ &track_number);
g_free (data);
g_assert_cmpstr (audios[i].title, ==, title);
@@ -283,6 +297,8 @@ test_resolve_fingerprint (void)
g_free (mb_album_id);
g_assert_cmpstr (audios[i].album, ==, album);
g_free (album);
+ g_assert_cmpstr (audios[i].album_artist, ==, album_artist);
+ g_free (album_artist);
g_assert_cmpstr (audios[i].mb_recording_id, ==, mb_recording_id);
g_free (mb_recording_id);
g_assert_cmpstr (audios[i].mb_release_id, ==, mb_release_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]