summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Sedov <radist.morse@gmail.com>2015-12-16 18:26:56 +0300
committerVictor Toso <me@victortoso.com>2016-01-30 12:14:57 +0100
commit46b127a9ccee3a01f95bee47e81305238ab17f3a (patch)
treeab9caf9e6646ac7171b1a10f4461178ce331480e
parent368693b7a8599941d5bfe3b73f440e16ff115a24 (diff)
lua-factory: port grl-video-title-parsing.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-video-title-parsing.lua27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/lua-factory/sources/grl-video-title-parsing.lua b/src/lua-factory/sources/grl-video-title-parsing.lua
index 9c790d4..d860e8e 100644
--- a/src/lua-factory/sources/grl-video-title-parsing.lua
+++ b/src/lua-factory/sources/grl-video-title-parsing.lua
@@ -129,40 +129,35 @@ function parse_as_episode(media)
return false
end
-function grl_source_resolve()
- local req
- local media = {}
+function grl_source_resolve(media, options, callback)
- req = grl.get_media_keys()
- if not req or not req.title then
- grl.callback()
+ if not media or not media.title then
+ callback()
return
end
- media.title = req.title
-
-- It is easier to identify a tv show due information
-- related to episode and season number
if parse_as_episode(media) then
- grl.debug(req.title .. " is an EPISODE")
- grl.callback(media, 0)
+ grl.debug(media.title .. " is an EPISODE")
+ callback(media, 0)
return
end
if parse_as_movie(media) then
- grl.debug(req.title .. " is a MOVIE")
- grl.callback(media, 0)
+ grl.debug(media.title .. " is a MOVIE")
+ callback(media, 0)
return
end
local suffix_removed
media.title, suffix_removed = remove_suffix(media.title)
if media.title and suffix_removed then
- grl.debug(req.title .. " is a MOVIE (without suffix)")
- grl.callback(media, 0)
+ grl.debug(media.title .. " is a MOVIE (without suffix)")
+ callback(media, 0)
return
end
- grl.debug("Fail to identify video: " .. req.title)
- grl.callback()
+ grl.debug("Fail to identify video: " .. media.title)
+ callback()
end