[grilo-plugins] lastfm-cover: thumbnails ordered from large to small



commit ae252b6580037da6493734a34ce3738b02ca14b9
Author: fosero <fosero users noreply github com>
Date:   Mon Feb 8 00:12:36 2016 +0100

    lastfm-cover: thumbnails ordered from large to small
    
    This makes the plugin return the largest cover first as was previously
    the behaviour with the standalone plugin and is expected by consumer
    applications.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761694

 src/lua-factory/sources/grl-lastfm-cover.lua |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/lua-factory/sources/grl-lastfm-cover.lua b/src/lua-factory/sources/grl-lastfm-cover.lua
index fe24fde..b70b89b 100644
--- a/src/lua-factory/sources/grl-lastfm-cover.lua
+++ b/src/lua-factory/sources/grl-lastfm-cover.lua
@@ -78,9 +78,14 @@ function fetch_page_cb(result, userdata)
   end
 
   userdata.media.thumbnail = {}
-  for k, v in string.gmatch(result, '<image size="(.-)">(.-)</image>') do
-    grl.debug ('Image size ' .. k .. ' = ' .. v)
-    table.insert(userdata.media.thumbnail, v)
+  local image_sizes = { "mega", "extralarge", "large", "medium", "small" }
+
+  for _, size in pairs(image_sizes) do
+    local url
+
+    url = string.match(result, '<image size="' .. size .. '">(.-)</image>')
+    grl.debug ('Image size ' .. size .. ' = ' .. url)
+    table.insert(userdata.media.thumbnail, url)
   end
 
   userdata.callback(userdata.media, 0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]