]> git.sesse.net Git - vlc/commitdiff
lua soundcloud: fetch artwork
authorLudovic Fauvet <etix@videolan.org>
Wed, 12 Sep 2012 13:15:15 +0000 (15:15 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 12 Sep 2012 22:40:40 +0000 (00:40 +0200)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
share/lua/playlist/soundcloud.lua

index 7b324dc7e43cb861e846a927ba17a4bd13617d44..bd9f5d6f231dc1001ed1872d6f994d25a24e361b 100644 (file)
@@ -29,6 +29,7 @@ end
 -- Parse function.
 function parse()
     if string.match ( vlc.path, "soundcloud%.com" ) then
+        arturl = nil
         while true do
             line = vlc.readline()
             if not line then break end
@@ -42,9 +43,13 @@ function parse()
                 -- we only want the first one of these lines
                 break
             end
+            -- try to get the art url
+            if string.match( line, "artwork--download--link" ) then
+                _,_,arturl = string.find( line, " href=\"(.*)\" " )
+            end
         end
         path = "http://media.soundcloud.com/stream/"..uid.."?stream_token="..token
-        return { { path = path; name = name } }
+        return { { path = path; name = name; arturl = arturl } }
     end
     return {}
 end