moved css files into their own directory
[photo-tags.git] / create_thumbnails.sh
index 61745386e441d6e4c2c9047388be5776c6cd6877..15cae682d3144f9eabf8445ea04ff04bed6f0bce 100755 (executable)
@@ -1,9 +1,11 @@
 #!/bin/bash
 
 #!/bin/bash
 
+NICE="nice -19"
+
 # init some variables
 removemeta=0
 
 # init some variables
 removemeta=0
 
-# parse ini file 
+# parse ini file
 CONFIG_FILE="config.ini"
 
 # copied and modified from http://mark.aufflick.com/blog/2007/11/08/parsing-ini-files-with-sed
 CONFIG_FILE="config.ini"
 
 # copied and modified from http://mark.aufflick.com/blog/2007/11/08/parsing-ini-files-with-sed
@@ -54,11 +56,11 @@ done=0
 offset=0
 FILES=""
 
 offset=0
 FILES=""
 
-while [ $done -lt 200 ] ; do
-   echo "skipping $offset pics, getting 100 new pics to work on..."
+while [ $done -lt 100 ] ; do
+   echo "skipping $offset pics, getting 50 new pics to work on..."
    # handle white space in filename correctly
    # handle white space in filename correctly
-   FILES=`sqlite3 $LOCALDB "select replace(base_uri||'/'||filename,' ','%20') from photos limit $offset,100"`
-   
+   FILES=`$NICE sqlite3 $LOCALDB "select replace(base_uri||'/'||filename,' ','%20') from photos limit $offset,100"`
+
    if [ "x$FILES" != "x" ] ; then
      #found some files, process them
      for file in $FILES; do
    if [ "x$FILES" != "x" ] ; then
      #found some files, process them
      for file in $FILES; do
@@ -67,29 +69,29 @@ while [ $done -lt 200 ] ; do
         file=${file//\%20/ }
         dir=`dirname "$file"`
         base=`basename "$file"`
         file=${file//\%20/ }
         dir=`dirname "$file"`
         base=`basename "$file"`
-        
+
         if [ ! -s "Photos-tiny/$dir/$base" ] ; then
             mkdir -p Photos-tiny/$dir
         if [ ! -s "Photos-tiny/$dir/$base" ] ; then
             mkdir -p Photos-tiny/$dir
-            nice -19 convert "$dirprefix/$file" -auto-orient -resize x100 -quality 80% "Photos-tiny/$dir/$base"
+            $NICE convert "$dirprefix/$file" -auto-orient -resize x100 -quality 80% "Photos-tiny/$dir/$base"
             if [ $removemeta=1 ]; then
             if [ $removemeta=1 ]; then
-                jhead -q -se -purejpg "Photos-tiny/$dir/$base"
-                jhead -q -se -dt "Photos-tiny/$dir/$base"
-                jhead -q -se -mkexif "Photos-tiny/$dir/$base"
-                jhead -q -se -cl "This photo belongs to $admin and was taken from $webbase. If you want to use this photo, please contact him." "Photos-tiny/$dir/$base"
+                $NICE jhead -q -se -purejpg "Photos-tiny/$dir/$base"
+                $NICE jhead -q -se -dt "Photos-tiny/$dir/$base"
+                $NICE jhead -q -se -mkexif "Photos-tiny/$dir/$base"
+                $NICE jhead -q -se -cl "This photo belongs to $admin and was taken from $webbase. If you want to use this photo, please contact him." "Photos-tiny/$dir/$base"
             fi
             done=$((done+1))
             fi
             done=$((done+1))
-        fi 
+        fi
         if [ ! -s "Photos-small/$dir/$base" ] ; then
             mkdir -p Photos-small/$dir
         if [ ! -s "Photos-small/$dir/$base" ] ; then
             mkdir -p Photos-small/$dir
-            nice -19 convert "$dirprefix/$file" -auto-orient -resize x600 -quality 80% "Photos-small/$dir/$base"
+            $NICE convert "$dirprefix/$file" -auto-orient -resize x600 -quality 80% "Photos-small/$dir/$base"
             if [ $removemeta=1 ]; then
             if [ $removemeta=1 ]; then
-                jhead -q -se -purejpg "Photos-small/$dir/$base"
-                jhead -q -se -dt "Photos-small/$dir/$base"
-                jhead -q -se -mkexif "Photos-small/$dir/$base"
-                jhead -q -se -cl "This photo belongs to $admin and was taken from $webbase. If you want to use this photo, please contact him." "Photos-small/$dir/$base"
+                $NICE jhead -q -se -purejpg "Photos-small/$dir/$base"
+                $NICE jhead -q -se -dt "Photos-small/$dir/$base"
+                $NICE jhead -q -se -mkexif "Photos-small/$dir/$base"
+                $NICE jhead -q -se -cl "This photo belongs to $admin and was taken from $webbase. If you want to use this photo, please contact him." "Photos-small/$dir/$base"
             fi
             done=$((done+1))
             fi
             done=$((done+1))
-        fi 
+        fi
 
         echo -n -e "$((done/2))       \r"
      done
 
         echo -n -e "$((done/2))       \r"
      done
@@ -98,5 +100,5 @@ while [ $done -lt 200 ] ; do
    fi
 
    #get ready to get the next 100
    fi
 
    #get ready to get the next 100
-   offset=$((offset+100))
+   offset=$((offset+50))
 done
 done