[vlc-commits] musicbrainz.lua: Use MBIDs from files, if they exist

Wieland Hoffmann git at videolan.org
Mon Jan 13 23:18:34 CET 2014


vlc | branch: master | Wieland Hoffmann <themineo at gmail.com> | Sun Jan 12 23:04:09 2014 +0100| [30cd5db56a0002cb9d6e080022e22d28cac0ec3b] | committer: Jean-Baptiste Kempf

musicbrainz.lua: Use MBIDs from files, if they exist

If the MBID of the album is already in the `meta` table, use it to query
the MusicBrainz web service, instead of doing extra requests to the
search server.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30cd5db56a0002cb9d6e080022e22d28cac0ec3b
---

 share/lua/meta/art/00_musicbrainz.lua |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/share/lua/meta/art/00_musicbrainz.lua b/share/lua/meta/art/00_musicbrainz.lua
index 67648d7..0523ec4 100644
--- a/share/lua/meta/art/00_musicbrainz.lua
+++ b/share/lua/meta/art/00_musicbrainz.lua
@@ -63,7 +63,13 @@ function fetch_art()
 
     local releaseid = nil
 
-    if meta["artist"] and meta["album"] then
+    for _, k in ipairs({"MUSICBRAINZ_ALBUMID", "MusicBrainz Album Id"}) do
+        if meta[k] then
+            releaseid = meta[k]
+        end
+    end
+
+    if not releaseid and meta["artist"] and meta["album"] then
         query = "artist:\"" .. meta["artist"] .. "\" AND release:\"" .. meta["album"] .. "\""
         relquery = "http://mb.videolan.org/ws/2/release/?query=" .. vlc.strings.encode_uri_component( query )
         releaseid = get_releaseid( relquery )



More information about the vlc-commits mailing list