TagSpaces is an offline, open source, document manager with tagging support
fixed white space in paths
Borislav Sapundzhievc522c369d3df
diff --git a/data/web/thumbgen.sh b/data/web/thumbgen.shold mode 100644new mode 100755index cb9f69c78..d0ed7c98e--- a/data/web/thumbgen.sh+++ b/data/web/thumbgen.sh@@ -1,42 +1,40 @@#!/bin/bash#===============================================# generate thumbnail images for tagspaces-#-# TODO-# * Handle dirs with spaces in the names-# * Don't create .ts in .ts folders#===============================================generate_thumbnails() {- dirname=$1- thumbdir=$dirname/.ts- echo "-------Current dir: $dirname"- mkdir -p $thumbdir+ dirname="$1"+ thumbdir="$dirname/.ts"+ echo "-------Current dir: $dirname"+ mkdir -p "$thumbdir"- for file in $1/*- do- # next line checks the mime-type of the file- CHECKTYPE=`file --mime-type -b "$file" | awk -F'/' '{print $1}'`- if [ "x$CHECKTYPE" == "ximage" ];+ for file in "$dirname/"*+ #find "$dirname" -type f -maxdepth 1 | while read file+ do+ # next line checks the mime-type of the file+ CHECKTYPE=`file --mime-type -b "$file" | awk -F'/' '{print $1}'`+ if [ "x$CHECKTYPE" == "ximage" ];then- CHECKSIZE=`stat -f "%z" "$file"` # this returns the filesize- CHECKWIDTH=`identify -format "%W" "$file"` # this returns the image width+ CHECKSIZE=`stat -f "%z" "$file"` # this returns the filesize+ CHECKWIDTH=`identify -format "%W" "$file"` # this returns the image width- # next 'if' is true if either filesize >= 200000 bytes OR if image width >=201- if [ $CHECKSIZE -ge 200 ] || [ $CHECKWIDTH -ge 201 ]; then- echo "$file -> $thumbdir/$(basename $file).png"- convert -thumbnail 200 $file $thumbdir/$(basename $file).png- fi- fi- done+ # next 'if' is true if either filesize >= 200000 bytes OR if image width >=201+ if [ $CHECKSIZE -ge 200 ] || [ $CHECKWIDTH -ge 201 ]; then+ thumbfile="$thumbdir/$(basename "$file").png"+ echo "$file -> $thumbfile"+ convert -thumbnail 200 "$file" "$thumbfile"+ fi+ fi+ done}if [ $# -ne 1 ]; then- echo "Usage $0 <path>"- exit 2+ echo "Usage $0 <path>"+ exit 2fi-find $1 -type d | while read dir+find $1 -type d -not -path "*.ts" | while read dirdo- generate_thumbnails $dir+ generate_thumbnails "$dir"done