From fa2455a01a56a294c5e250b89ddc4529e3f5434e Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Thu, 7 Nov 2013 15:04:49 +0100 Subject: [PATCH] unity scope: scope is called and returns results. --- .../unity-scope-recoll/unity_recoll_daemon.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/desktop/unity-scope-recoll/unity_recoll_daemon.py b/src/desktop/unity-scope-recoll/unity_recoll_daemon.py index 965ebe0a..88a618fe 100755 --- a/src/desktop/unity-scope-recoll/unity_recoll_daemon.py +++ b/src/desktop/unity-scope-recoll/unity_recoll_daemon.py @@ -86,7 +86,7 @@ def _get_thumbnail_path(url): except Exception as msg: print("_get_thumbnail_path: urllib.parse.quote failed: %s" % msg, file=sys.stderr) - return None + return "" #print("_get_thumbnail: encoded path: [%s]" % path, file=sys.stderr) thumbname = hashlib.md5(path.encode('utf-8')).hexdigest() + ".png" @@ -107,7 +107,7 @@ def _get_thumbnail_path(url): if os.path.exists(tpath): return tpath - return None + return "" class RecollScope(Unity.AbstractScope): @@ -236,8 +236,10 @@ class RecollScopeSearch(Unity.ScopeSearchBase): break titleorfilename = doc.title - if titleorfilename == "": + if titleorfilename is None or titleorfilename == "": titleorfilename = doc.filename + if titleorfilename is None: + titleorfilename = "doc.title and doc.filename are none !" # Results with an ipath get a special mime type so that they # get opened by starting a recoll instance. @@ -258,6 +260,11 @@ class RecollScopeSearch(Unity.ScopeSearchBase): else: category = 1 + #print({"uri":url,"icon":iconname,"category":category, + #"mimetype":mimetype, "title":titleorfilename, + #"comment":abstract, + #"dnd_uri":doc.url}) + result_set.add_result( uri=url, icon=iconname, @@ -307,7 +314,7 @@ class RecollScopeSearch(Unity.ScopeSearchBase): iconname = "text-x-preview" # Results with an ipath get a special mime type so that they # get opened by starting a recoll instance. - thumbnail = None + thumbnail = "" if doc.ipath != "": mimetype = "application/x-recoll" url = doc.url + "#" + doc.ipath @@ -318,7 +325,7 @@ class RecollScopeSearch(Unity.ScopeSearchBase): # Retrieve the binary path for thumbnail access. thumbnail = _get_thumbnail_path(doc.getbinurl()) - iconname = None + iconname = "" if thumbnail: iconname = thumbnail else: