Nova actualització de orgafotos

  • warning: tempnam(): open_basedir restriction in effect. File() is not within the allowed path(s): (/srv/www/gilug.org/www/site.tree/) in /srv/www/gilug.org/www/site.tree/public/includes/file.inc on line 802.
  • warning: fopen(): Filename cannot be empty in /srv/www/gilug.org/www/site.tree/public/includes/file.inc on line 803.
  • El fitxer no s'ha pogut crear.

Res que ara amb una nova versió del exif 0.6.15
S'ha de retocar una mica el programa
A més m'he enterat que hi ha un ianqui que el fa servir!!!
i amb aquestes l'he pasat a l'anglès, que sempre fa més pijo :o

Podeu trobar la nova versió penjada del meu server

o copiar d'aqui:

#!/bin/bash
#	This script is GPL v3 or greater 
#	If you modify, use this script please send-me a email.
#	I'll very happy it this script was useful for anyone more.
#	My mail is festuc(arrova)festuc.info
#	"BAD" English version  
#	orgafotos is a script for order your photos in a structured directory 
#	Some times people like me put lots of fotos in a various directorys, 
#	and duplicate lots of them.
#	orgafotos works for me put fotos from a unstructured directory and
#	creates a new structured directory ordered by date
# 
#	destination_directory/
#	   |--YYYY/
#	      |--MM-DD/
#	      |--MM-DD/
#	      ...
#	   |--YYYY/
#	   ....
#	This funtion is recursive, it uses a recursive call for every subdirectory
#	in origin_directory.
#	For this you need to put orgafotos in a path. Maybe ~/bin/ can be a good idea
#	
#	for call orgafotos you need parameters
#	orgafotos -o /origin/directory/of/your/fotos/ -e /destination/directory/for/your/fotos
#
#
#
#
#			Eduard Vidal i Tulsà
#			Salt, Catalonia, Europe
#
#
#
#
#agafo els parametres!
echo "Entry at `date` with theses parameters: $1 $2 $3 $4"
while test "$1" #reading parameters:
do
        if test "$1" = -o #This is origin directory
        then o="$2";fi
        if test "$1" = -e #This is destination directory
        then e="$2" ;fi
        shift;shift; #next parameter
done
#echo entering into for
#ls $o/*.jpg
#echo com a llistax
ara="$PWD"
cd "$e"
e="$PWD"
cd $ara
if test -d "$o" #ask if $o is a directory 
then
#       echo "directory entered" #debug message
        cd "$o"
        o=`pwd`
        echo "o = $o"
        #for tipus in jpg JPG TIFF jpeg TIF tif tiff
        # i desactivate this for maybe you only want order some kinds of files, then you should use it...
        for a in `ls -A --quoting-style=shell-always`
        
        #list every file and directorys of $o don't care if they have blanc spaces into path
        do
                #echo a $a #debug echo
                #this is for work whit spaces whit bash
                plletra=`echo $a |head -c1` #last letter of  $a
                ulletra=`echo $a |tail -c2` #first letter of $a
                #echo  ulletra $ulletra #debug
                if [ $ulletra = "'" ]
                then #si el ja tinc el final de el nom de l'arxiu
                        if ! [ $plletra = "'" ]
                        then # if not first char isn't "'" it don't work.. 
                               #I can do work
                               # if not sarts well my start name is $ar
                               a="$ar $a";
                        fi
                        #now us file name is without "'"
                        a=`echo $a  |cut -d "'" -f 2 |cut -d "'"  -f 1`

                        #echo trying "$a" #debug
                        #echo "a $a e $e"; #more debug
                        if ! test -d "$a" # ask if directory as
                        then

				# this 3 next lines don't work with new exif
				#
				#exif=`exif -t 0x9003 "$a" |grep Value` #maybe in new versions of exif is not 0x9003 and is DateTime ?
				#any=year, mes=month, dia=day
                                #any=`echo $exif |cut -d :  -f 2| cut -d ' ' -f 2`
                                #mes=`echo $exif |cut -d :  -f 3`

                                #dia=`echo $exif |cut -d :  -f 4 |cut -d ' ' -f 1`				
				#these works with exif 0.6.15:
				any=`exif -i "$a" |grep 0x9003 |cut -d \| -f 2 |cut -d : -f 1`
				mes=`exif -i "$a" |grep 0x9003 |cut -d \| -f 2 |cut -d : -f 2`

				dia=`exif -i "$a" |grep 0x9003 |cut -d \| -f 2 |cut -d : -f 3 |cut -d ' ' -f 1`

                                ara="$PWD"
                                cd "$e"
                                #echo a: $a any:$any #debug
                                if  test -z  $any #if not exif info as tacken i put into special directory...
                                        then    if ! test -d $e/noexif
                                                        then mkdir $e/noexif #-v
                                                fi
                                        cd "$ara"
                                        cp "$a" $e/noexif -f #v
                                else #exif data exist ...
                                        if ! test -d $any #maybe make directory
                                                then mkdir $any #-v
                                        fi 
                                        cd $any
                                        if ! test -d $mes-$dia #maybe make month-day directory
                                                then mkdir $mes-$dia
                                        fi
                                        cd "$ara"
                                        cp "$a" $e/$any/$mes-$dia -fv
                                fi

                        else
                                #echo preparing recursive call

                        diri=0; #change spaces for blackslash spaces...
                                for x in $a;  do
                                        #echo x=$x #debug 
                                        if test $diri -eq 0
                                                then dirr="$x"
                                                        diri=1
                                        else dirr="$dirr\ $x" 
                                        fi
                                done
                                #echo dirr=$dirr
                                or=$o/$dirr/
                                 orgafotos -o $or -e $e  #recursive call
                        fi
                elif [ $plletra = "'" ]
                        then ar="$a";   #this file/directory has a space at least 
                else ar="$ar $a" #this element has more than one space
                fi
        done
else echo "($o) ins't a directory?";
fi #del i f que diu si existeix el $o com a directori!!
echo "end of orgafotos -o $o -e $e : at date `date` ";