From 489e88c87d409256b0ad7720620cbad041d9868b Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 22 Aug 2022 18:08:17 +0200 Subject: [PATCH] Have the indexer actually set the downloadsdir parameter on the recoll-we-move-files script command line. Previously, a custom directory could only be set for the default recoll configuration or if RECOLL_CONFDIR was set --- src/filters/recoll-we-move-files.py | 24 ++++++++++++------------ src/index/indexer.cpp | 1 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/filters/recoll-we-move-files.py b/src/filters/recoll-we-move-files.py index 9cbc2bb8..c4a3d41e 100755 --- a/src/filters/recoll-we-move-files.py +++ b/src/filters/recoll-we-move-files.py @@ -95,27 +95,27 @@ def list_all_files(dir): ####################### def usage(): - print("Usage: recoll-we-move-files.py []", file=sys.stderr) + print("Usage: recoll-we-move-files.py []", file=sys.stderr) sys.exit(1) config = rclconfig.RclConfig() -# Source dir is parameter, else from config else default Downloads directory -downloadsdir = config.getConfParam("webdownloadsdir") -if not downloadsdir: - downloadsdir = "~/Downloads" -downloadsdir = os.path.expanduser(downloadsdir) - +# The directory where we find the files created by the browser extension is given as parameter, else +# comes from the configuration else we use the default Downloads directory: if len(sys.argv) == 2: - mydir = sys.argv[1] + downloadsdir = sys.argv[1] elif len(sys.argv) == 1: - mydir = downloadsdir + downloadsdir = config.getConfParam("webdownloadsdir") + if not downloadsdir: + downloadsdir = "~/Downloads" + downloadsdir = os.path.expanduser(downloadsdir) else: usage() -if not os.path.isdir(mydir): + +if not os.path.isdir(downloadsdir): usage() -# Get target webqueue recoll directory from recoll configuration +# Get the target webqueue recoll directory from the recoll configuration webqueuedir = config.getConfParam("webqueuedir") if not webqueuedir: if _mswindows: @@ -128,7 +128,7 @@ os.makedirs(webqueuedir, exist_ok = True) # logdeb("webqueuedir is %s" % webqueuedir) # Get the lists of all files created by the browser addon -mfiles, cfiles = list_all_files(mydir) +mfiles, cfiles = list_all_files(downloadsdir) # Only keep the last version mfiles = delete_previous_instances(mfiles, downloadsdir) diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp index aec2d58b..3d67be34 100644 --- a/src/index/indexer.cpp +++ b/src/index/indexer.cpp @@ -65,6 +65,7 @@ bool runWebFilesMoverScript(RclConfig *config) } vector cmdvec; config->pythonCmd("recoll-we-move-files.py", cmdvec); + cmdvec.push_back(downloadsdir); /* Arrange to not actually run the script if the directory did not change */ static time_t dirmtime;