[grilo-plugins] grl-acoustid: Add check for no results



commit 94400f65a75e5247fdc691f8fcabe0f2a3e2e601
Author: Sumaid Syed <sumaidsyed gmail com>
Date:   Tue Aug 13 09:28:20 2019 +0530

    grl-acoustid: Add check for no results
    
    Add check for no json.results or no
    recordings match.
    Ensure grl.callback is invoked in case of
    no output.

 src/lua-factory/sources/grl-acoustid.lua | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/lua-factory/sources/grl-acoustid.lua b/src/lua-factory/sources/grl-acoustid.lua
index 25df967f..71f4b530 100644
--- a/src/lua-factory/sources/grl-acoustid.lua
+++ b/src/lua-factory/sources/grl-acoustid.lua
@@ -90,7 +90,9 @@ function lookup_cb_resolve (feed)
   end
 
   local json = grl.lua.json.string_to_table (feed)
-  if not json or json.status ~= "ok" then
+  if not json or json.status ~= "ok" or
+     not json.results or #json.results <= 0 or
+     not json.results[1].recordings or #json.results[1].recordings <= 0 then
     grl.callback()
   end
 


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