From e03b0953258716799ac25f3e293db823a69f7d0d Mon Sep 17 00:00:00 2001 From: nachoparker Date: Wed, 13 Mar 2019 00:24:06 -0600 Subject: nc-previews: improvements --- bin/ncp/TOOLS/nc-previews.sh | 16 +++++++++++++++- etc/ncp-config.d/nc-previews.cfg | 23 +++++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/bin/ncp/TOOLS/nc-previews.sh b/bin/ncp/TOOLS/nc-previews.sh index 97388eb0..60296686 100644 --- a/bin/ncp/TOOLS/nc-previews.sh +++ b/bin/ncp/TOOLS/nc-previews.sh @@ -11,7 +11,21 @@ configure() { - sudo -u www-data php /var/www/nextcloud/occ preview:generate-all + [[ "$CLEAN" == "yes" ]] && { + local datadir + datadir=$( ncc config:system:get datadirectory ) || { + echo "data dir not found"; + return 1; + } + + rm -r "$datadir"/appdata_*/preview/* &>/dev/null + mysql nextcloud <<<"delete from oc_filecache where path like \"appdata_%/preview/%\"" + ncc files:scan-app-data -n + } + + [[ "$INCREMENTAL" == "yes" ]] && { ncc preview:pre-generate -n -vvv; return $?; } + + ncc preview:generate-all -n -v -p "$PATH1" } install() { :; } diff --git a/etc/ncp-config.d/nc-previews.cfg b/etc/ncp-config.d/nc-previews.cfg index 0ac9fb4d..6cb85a4b 100644 --- a/etc/ncp-config.d/nc-previews.cfg +++ b/etc/ncp-config.d/nc-previews.cfg @@ -3,7 +3,26 @@ "name": "Nc-previews", "title": "nc-previews", "description": "Generate previews for the gallery", - "info": "This will make browsing the gallery much more smooth.\nFor big collections, this can take a LONG time, depending on your hardware", + "info": "This will make browsing the gallery much more smooth.\nFor big collections, this can take a LONG time, depending on your hardware\nOptionally, include a path in the form '/_user_/files/_path_' (incremental only)", "infotitle": "", - "params": [] + "params": [ + { + "id": "CLEAN", + "name": "Clean first", + "value": "no", + "type": "bool" + }, + { + "id": "INCREMENTAL", + "name": "Incremental", + "value": "yes", + "type": "bool" + }, + { + "id": "PATH1", + "name": "Path", + "value": "", + "suggest": "/ncp/files/Documents" + } + ] } -- cgit v1.2.3