Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
7dbf7908
Commit
7dbf7908
authored
Apr 13, 2010
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua: add art fetcher for last.fm
This can commit bad code and bugs under your name into tree, so beware.
parent
ea900bc7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
share/Makefile.am
share/Makefile.am
+2
-0
share/lua/meta/art/03_lastfm.lua
share/lua/meta/art/03_lastfm.lua
+50
-0
No files found.
share/Makefile.am
View file @
7dbf7908
...
...
@@ -216,6 +216,7 @@ nobase_vlclib_DATA = \
lua/intf/dumpmeta.luac
\
lua/meta/art/01_musicbrainz.luac
\
lua/meta/art/02_frenchtv.luac
\
lua/meta/art/03_lastfm.luac
\
lua/meta/art/10_googleimage.luac
\
lua/meta/fetcher/tvrage.luac
\
lua/meta/reader/filename.luac
\
...
...
@@ -258,6 +259,7 @@ EXTRA_DIST += \
lua/meta/art/README.txt
\
lua/meta/art/01_musicbrainz.lua
\
lua/meta/art/02_frenchtv.lua
\
lua/meta/art/03_lastfm.lua
\
lua/meta/art/10_googleimage.lua
\
lua/meta/fetcher/README.txt
\
lua/meta/fetcher/tvrage.lua
\
...
...
share/lua/meta/art/03_lastfm.lua
0 → 100644
View file @
7dbf7908
--[[
Gets an artwork from last.fm
$Id$
Copyright © 2010 the VideoLAN team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
-- Return the artwork
function
fetch_art
()
if
vlc
.
input
==
nil
then
return
nil
end
local
item
=
vlc
.
input
.
item
()
local
meta
=
item
:
metas
()
if
meta
[
"artist"
]
and
meta
[
"album"
]
then
title
=
meta
[
"artist"
]
..
"/"
..
meta
[
"album"
]
else
return
nil
end
-- remove -.* from string
title
=
string.gsub
(
title
,
" ?%-.*"
,
""
)
-- remove (info..) from string
title
=
string.gsub
(
title
,
"%(.*%)"
,
""
)
-- remove CD2 etc from string
title
=
string.gsub
(
title
,
"CD%d+"
,
""
)
-- remove Disc \w+ from string
title
=
string.gsub
(
title
,
"Disc %w+"
,
""
)
fd
=
vlc
.
stream
(
"http://www.last.fm/music/"
..
title
)
if
not
fd
then
return
nil
end
page
=
fd
:
read
(
65653
)
fd
=
nil
_
,
_
,
arturl
=
string.find
(
page
,
"<img width=\"
174
\
" src=\"
([
^
\
"]+)\"
class
=
\
"art\"
/>
\
n
" )
-- Don't use default album-art (not found one)
if not arturl or string.find( arturl, "
default_album_mega
.
png
") then
return nil
end
return arturl
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