[grilo-plugins] lua-factory: port grl-guardianvideos.lua to the new lua system
- From: Victor Toso de Carvalho <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] lua-factory: port grl-guardianvideos.lua to the new lua system
- Date: Sat, 30 Jan 2016 11:25:14 +0000 (UTC)
commit ccfa70cfe911129c8bdb936fda99dd11cc60bff4
Author: George Sedov <radist morse gmail com>
Date: Wed Dec 16 18:26:56 2015 +0300
lua-factory: port grl-guardianvideos.lua to the new lua system
https://bugzilla.gnome.org/show_bug.cgi?id=753141
Acked-by: Victor Toso <me victortoso com>
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 092ee0b..644caf4 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_id)
- local count = grl.get_options("count")
- local skip = grl.get_options("skip")
+function grl_source_browse(media, options, callback)
+ local count = options.count
+ local skip = options.skip
local urls = {}
local page = skip / count + 1
@@ -63,8 +63,8 @@ function grl_source_browse(media_id)
grl.debug ("Fetching URL: " .. url .. " (count: " .. count .. " skip: " .. skip .. ")")
table.insert(urls, url)
end
-
- grl.fetch(urls, "guardianvideos_fetch_cb")
+ local userdata = {callback = callback, count = count}
+ grl.fetch(urls, guardianvideos_fetch_cb, userdata)
end
------------------------
@@ -72,21 +72,21 @@ end
------------------------
-- return all the media found
-function guardianvideos_fetch_cb(results)
- local count = grl.get_options("count")
+function guardianvideos_fetch_cb(results, userdata)
+ local count = userdata.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
- grl.callback()
+ userdata.callback()
return
end
for index, item in pairs(json.response.results) do
local media = create_media(item)
count = count - 1
- grl.callback(media, count)
+ userdata.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]