[grilo-plugins] Revert "lua-factory: port grl-guardianvideos.lua to the new lua system"



commit 1934fe43fd8702b4e4b7cb052fbba7e3b8a0585f
Author: Victor Toso <me victortoso com>
Date:   Tue Mar 8 23:27:59 2016 +0100

    Revert "lua-factory: port grl-guardianvideos.lua to the new lua system"
    
    This reverts commit ccfa70cfe911129c8bdb936fda99dd11cc60bff4.
    
    But keeps grl.fetch callback as function instead of string
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763046

 src/lua-factory/sources/grl-guardianvideos.lua |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/lua-factory/sources/grl-guardianvideos.lua b/src/lua-factory/sources/grl-guardianvideos.lua
index 644caf4..9db333f 100644
--- a/src/lua-factory/sources/grl-guardianvideos.lua
+++ b/src/lua-factory/sources/grl-guardianvideos.lua
@@ -44,9 +44,9 @@ source = {
 -- Source utils --
 ------------------
 
-function grl_source_browse(media, options, callback)
-  local count = options.count
-  local skip = options.skip
+function grl_source_browse(media_id)
+  local count = grl.get_options("count")
+  local skip = grl.get_options("skip")
   local urls = {}
 
   local page = skip / count + 1
@@ -63,8 +63,8 @@ function grl_source_browse(media, options, callback)
     grl.debug ("Fetching URL: " .. url .. " (count: " .. count .. " skip: " .. skip .. ")")
     table.insert(urls, url)
   end
-  local userdata = {callback = callback, count = count}
-  grl.fetch(urls, guardianvideos_fetch_cb, userdata)
+
+  grl.fetch(urls, guardianvideos_fetch_cb)
 end
 
 ------------------------
@@ -72,21 +72,21 @@ end
 ------------------------
 
 -- return all the media found
-function guardianvideos_fetch_cb(results, userdata)
-  local count = userdata.count
+function guardianvideos_fetch_cb(results)
+  local count = grl.get_options("count")
 
   for i, result in ipairs(results) do
     local json = {}
     json = grl.lua.json.string_to_table(result)
     if not json or json.stat == "fail" or not json.response or not json.response.results then
-      userdata.callback()
+      grl.callback()
       return
     end
 
     for index, item in pairs(json.response.results) do
       local media = create_media(item)
       count = count - 1
-      userdata.callback(media, count)
+      grl.callback(media, count)
     end
 
     -- Bail out if we've given enough items


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