Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
cbfb9425
Commit
cbfb9425
authored
Jan 20, 2012
by
Konstantin Pavlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Musicbrainz art: try to find image if album name is lacking.
parent
0d9b8704
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
7 deletions
+32
-7
share/lua/meta/art/04_musicbrainz.lua
share/lua/meta/art/04_musicbrainz.lua
+32
-7
No files found.
share/lua/meta/art/04_musicbrainz.lua
View file @
cbfb9425
...
...
@@ -28,18 +28,43 @@ function try_query(query)
_
,
_
,
asin
=
string.find
(
page
,
"<asin>(%w+)</asin>"
)
if
asin
then
return
"http://images.amazon.com/images/P/"
..
asin
..
".01._SCLZZZZZZZ_.jpg"
else
return
nil
end
vlc
.
msg
.
dbg
(
"ASIN not found"
)
return
nil
end
-- Return the mbid for first release
function
try_release
(
query
)
local
s
=
vlc
.
stream
(
query
)
if
not
s
then
return
nil
end
local
page
=
s
:
read
(
65653
)
-- FIXME: multiple results may be available and the first one is not
-- guaranteed to have asin, so if it doesnt, we wouldnt get any art
_
,
_
,
releaseid
=
string.find
(
page
,
"<release id=\"
([
%
x
%-
]
-
)
\
">"
)
if
releaseid
then
return
releaseid
end
return
nil
end
-- Return the artwork
function
fetch_art
()
local
meta
=
vlc
.
item
:
metas
()
if
not
(
meta
[
"artist"
]
and
meta
[
"album"
])
then
return
nil
end
local
query1
=
"http://mb.videolan.org/ws/2/release/?query=artist:"
..
vlc
.
strings
.
encode_uri_component
(
meta
[
"artist"
])
..
"%20AND%20release:\""..vlc.strings.encode_uri_component(meta["
album
"].."
\
""
)
return
try_query
(
query1
)
if
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
)
return
try_query
(
relquery
)
elseif
meta
[
"artist"
]
and
meta
[
"title"
]
then
query
=
"artist:\"" .. meta["
artist
"] .. "
\
" AND recording:\"" .. meta["
title
"] .. "
\
""
recquery
=
"http://mb.videolan.org/ws/2/recording/?query="
..
vlc
.
strings
.
encode_uri_component
(
query
)
releaseid
=
try_release
(
recquery
)
if
releaseid
then
relquery
=
"http://mb.videolan.org/ws/2/release/"
..
releaseid
return
try_query
(
relquery
)
else
return
nil
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment