nextcloud picsort: faster, apperently
This commit is contained in:
parent
b52030b830
commit
2549a298a4
1 changed files with 15 additions and 10 deletions
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
USER="$1"
|
USER="$1"
|
||||||
SOURCEPATH="/var/lib/nextcloud/$1/files/$2"
|
SOURCEPATH="/var/lib/nextcloud/$1/files/$2"
|
||||||
DESTINATIONPATH="/var/lib/nextcloud/$1/files/$3"
|
|
||||||
UNSORTABLEPATH="/var/lib/nextcloud/$1/files/$4"
|
REL_DEST_PATH="/$1/files/$3"
|
||||||
|
ABS_DEST_PATH="/var/lib/nextcloud/$1/files/$3"
|
||||||
|
|
||||||
|
REL_UNSORTABLE_PATH="/$1/files/$4"
|
||||||
|
ABS_UNSORTABLE_PATH="/var/lib/nextcloud/$1/files/$4"
|
||||||
|
|
||||||
echo "STARTING..."
|
echo "STARTING..."
|
||||||
|
|
||||||
|
@ -19,7 +23,7 @@ for f in `find "$SOURCEPATH" -iname *.PNG -o -iname *.JPG -o -iname *.CR2 -o -in
|
||||||
if ! echo "$DATE" | grep "Create Date" >/dev/null
|
if ! echo "$DATE" | grep "Create Date" >/dev/null
|
||||||
then
|
then
|
||||||
RELPATH=$(realpath --relative-to="$SOURCEPATH" "$f")
|
RELPATH=$(realpath --relative-to="$SOURCEPATH" "$f")
|
||||||
DIRNAME=$(dirname "$UNSORTABLEPATH/$RELPATH")
|
DIRNAME=$(dirname "$ABS_UNSORTABLE_PATH/$RELPATH")
|
||||||
echo "UNSORTABLE: $f"
|
echo "UNSORTABLE: $f"
|
||||||
mkdir -p "$DIRNAME"
|
mkdir -p "$DIRNAME"
|
||||||
mv "$f" "$DIRNAME"
|
mv "$f" "$DIRNAME"
|
||||||
|
@ -39,7 +43,7 @@ for f in `find "$SOURCEPATH" -iname *.PNG -o -iname *.JPG -o -iname *.CR2 -o -in
|
||||||
else
|
else
|
||||||
RAW=""
|
RAW=""
|
||||||
fi
|
fi
|
||||||
FILE="$DESTINATIONPATH/$YEAR-$MONTH/$RAW$YEAR$MONTH$DAY"-"$HOUR$MINUTE$SECOND"_"$HASH"."$EXT"
|
FILE="$ABS_DEST_PATH/$YEAR-$MONTH/$RAW$YEAR$MONTH$DAY"-"$HOUR$MINUTE$SECOND"_"$HASH"."$EXT"
|
||||||
echo "DESTINATION: $FILE"
|
echo "DESTINATION: $FILE"
|
||||||
mkdir -p "$(dirname "$FILE")"
|
mkdir -p "$(dirname "$FILE")"
|
||||||
mv -v "$f" "$FILE"
|
mv -v "$f" "$FILE"
|
||||||
|
@ -49,12 +53,13 @@ done
|
||||||
if [ "$SCAN" == "TRUE" ]; then
|
if [ "$SCAN" == "TRUE" ]; then
|
||||||
echo "SCANNING..."
|
echo "SCANNING..."
|
||||||
# find "$SOURCEPATH/"* -type d -empty -delete >> /var/echo/nc-picsort.echo # nextcloud app bug when deleting folders
|
# find "$SOURCEPATH/"* -type d -empty -delete >> /var/echo/nc-picsort.echo # nextcloud app bug when deleting folders
|
||||||
chown -R www-data:www-data "$DESTINATIONPATH"
|
chown -R www-data:www-data "$ABS_DEST_PATH"
|
||||||
chown -R www-data:www-data "$UNSORTABLEPATH"
|
chown -R www-data:www-data "$ABS_UNSORTABLE_PATH"
|
||||||
chmod -R 770 "$DESTINATIONPATH"
|
chmod -R 770 "$ABS_DEST_PATH"
|
||||||
chmod -R 770 "$UNSORTABLEPATH"
|
chmod -R 770 "$ABS_UNSORTABLE_PATH"
|
||||||
sudo -u www-data php /opt/nextcloud/occ files:scan "$USER"
|
sudo -u www-data php /opt/nextcloud/occ files:scan --path "$REL_UNSORTABLE_PATH"
|
||||||
sudo -u www-data php /opt/nextcloud/occ preview:generate-all "$USER"
|
sudo -u www-data php /opt/nextcloud/occ files:scan --path "$REL_DEST_PATH"
|
||||||
|
sudo -u www-data php /opt/nextcloud/occ preview:pre-generate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "FINISH."
|
echo "FINISH."
|
||||||
|
|
Loading…
Reference in a new issue