[vlc-devel] [PATCH 3/3] musicbrainz.lua: Use MBIDs from files, if they exist

Wieland Hoffmann themineo at gmail.com
Sun Jan 12 23:04:09 CET 2014


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.
---
 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 )
-- 
1.8.5.2




More information about the vlc-devel mailing list