diff options
author | George Sedov <radist.morse@gmail.com> | 2015-12-16 18:26:56 +0300 |
---|---|---|
committer | Victor Toso <me@victortoso.com> | 2016-01-30 12:14:57 +0100 |
commit | 368693b7a8599941d5bfe3b73f440e16ff115a24 (patch) | |
tree | ad6ea67362186e92115e898f02459ddeae6532f8 | |
parent | 9b329f3e5246477f039a1fb2b129706370237c89 (diff) |
lua-factory: port grl-pocket.lua to the new lua system
https://bugzilla.gnome.org/show_bug.cgi?id=753141
Acked-by: Victor Toso <me@victortoso.com>
-rw-r--r-- | src/lua-factory/sources/grl-pocket.lua | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lua-factory/sources/grl-pocket.lua b/src/lua-factory/sources/grl-pocket.lua index 505c624..febc950 100644 --- a/src/lua-factory/sources/grl-pocket.lua +++ b/src/lua-factory/sources/grl-pocket.lua @@ -51,15 +51,15 @@ source = { -- Source utils -- ------------------ -function grl_source_browse(media_id) - local count = grl.get_options("count") - local skip = grl.get_options("skip") - local operation_id = grl.get_options('operation-id') +function grl_source_browse(media, options, callback) + local count = options.count + local skip = options.skip local url = string.format(POCKET_GET_URL, grl.goa_consumer_key(), grl.goa_access_token(), count, skip) grl.debug ("Fetching URL: " .. url .. " (count: " .. count .. " skip: " .. skip .. ")") - grl.fetch(url, "pocket_fetch_cb") + local userdata = {callback = callback, count = count} + grl.fetch(url, pocket_fetch_cb, userdata) end ------------------------ @@ -77,11 +77,11 @@ function string.starts(String,Start) end -- return all the media found -function pocket_fetch_cb(results) - local count = grl.get_options("count") +function pocket_fetch_cb(results, userdata) + local count = userdata.count if not results then - grl.callback () + userdata.callback() return end @@ -96,7 +96,7 @@ function pocket_fetch_cb(results) local media = create_media(item) if media then count = count - 1 - grl.callback(media, count) + userdata.callback(media, count) end -- Bail out if we've given enough items @@ -105,7 +105,7 @@ function pocket_fetch_cb(results) end end - grl.callback() + userdata.callback() end ------------- |