[grilo-plugins] lua-factory: port grl-video-title-parsing.lua to the new lua system



commit 46b127a9ccee3a01f95bee47e81305238ab17f3a
Author: George Sedov <radist morse gmail com>
Date:   Wed Dec 16 18:26:56 2015 +0300

    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>

 .../sources/grl-video-title-parsing.lua            |   27 ++++++++-----------
 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


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