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 \
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 \
--- /dev/null
+--[[
+ 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