]> git.sesse.net Git - vlc/commitdiff
Googleimage to use artist-tag and do url-encode (example taken from
authorIlkka Ollakka <ileoo@videolan.org>
Sun, 19 Aug 2007 16:00:36 +0000 (16:00 +0000)
committerIlkka Ollakka <ileoo@videolan.org>
Sun, 19 Aug 2007 16:00:36 +0000 (16:00 +0000)
http://www.redwiki.net/wiki/wiki.php/LUA/URLencode%B1%B8%C7%F6%C4ڵ%E5 )

share/luameta/googleimage.lua

index baf4336d150deeb840a76b7ae700160bc25cb4b9..5046327601140057be5d7143a697f3695637bfd0 100644 (file)
@@ -3,12 +3,15 @@
 
 -- Replace non alphanumeric char by +
 function get_query( title )
-    return title:gsub( "[^(a-z|A-Z|0-9)]", "+" )
+    return string.gsub( title, "([^%w ])",
+         function (c) return string.format ("%%%02X", string.byte(c)) end)
 end
 
 -- Return the artwork
 function fetch_art()
-    if vlc.title then
+    if vlc.title and vlc.artist then
+        title = vlc.artist.." "..vlc.title
+    elseif vlc.title then
         title = vlc.title
     elseif vlc.name then
         title = vlc.name