[grilo-plugins] itunes-podcast: Sort the thumbnails in descending size



commit 83c0636e09bd626e010ed87cb8be185a4952b39e
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Oct 30 22:31:58 2016 +0100

    itunes-podcast: Sort the thumbnails in descending size
    
    So that the first thumbnail is the biggest one.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773702

 src/lua-factory/sources/grl-itunes-podcast.lua |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/lua-factory/sources/grl-itunes-podcast.lua b/src/lua-factory/sources/grl-itunes-podcast.lua
index 194e5cc..f11217f 100644
--- a/src/lua-factory/sources/grl-itunes-podcast.lua
+++ b/src/lua-factory/sources/grl-itunes-podcast.lua
@@ -151,10 +151,15 @@ function fetch_browse_results_cb(results)
       media.genre = result.category.attributes.label
       media.id = result.id.attributes["im:id"]
       media.artist = result["im:artist"].label
+
       media.thumbnail = {}
+      local last_thumb_size = 0
       for j, image in ipairs(result["im:image"]) do
-        -- FIXME sort images with the biggest first
-        table.insert(media.thumbnail, image.label)
+        if tonumber(image.attributes.height) > last_thumb_size then
+          table.insert(media.thumbnail, 1, image.label)
+        else
+          table.insert(media.thumbnail, image.label)
+        end
       end
       if result["im:releaseDate"] then
         media.modification_date = result["im:releaseDate"].label


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