diff --git a/bin/exif-fixdatetime b/bin/exif-fixdatetime index c3a01c8..d97effb 100755 --- a/bin/exif-fixdatetime +++ b/bin/exif-fixdatetime @@ -4,11 +4,15 @@ export SCRIPT_LOG=./$(basename $0).log [ -z "${move+x}" ] && move=false [ -z "${forcedate+x}" ] && forcedate=false [ -z "${setdate+x}" ] && setdate=true + + +# Pathdefinitions Default [ -z "${dest+x}" ] && dest=/srv/nfs/data/userdata/SHARED && dest=${dest%/} [ -z "${mimedestpicdefault+x}" ] && mimedestpicdefault="Bilder" [ -z "${mimedestviddefault+x}" ] && mimedestviddefault="Videos" -[ -z "${subdestdefault+x}" ] && subdestdefault="Tina_und_Jakob" +[ -z "${subdestdefault+x}" ] && subdestdefault="Familie" +# Pathdefinitions Runtime [ -z "${mimedestpic+x}" ] && mimedestpic="${mimedestpicdefault}" [ -z "${mimedestvid+x}" ] && mimedestvid="${mimedestviddefault}" [ -z "${subdestpic+x}" ] && subdestpic="${subdestdefault}" @@ -55,7 +59,7 @@ help () { # set datetimeoriginal and createdate from given file (only one is possible) # overwrite existing tags - # move file to destination dir (${dest}/${mimedestpicdefault}|${mimedestviddefault}) in subdirectories %Y/%Y_%m/. + # move file to destination dir (${dest}/${mimedestpicdefault}/${subdestpic} or ${dest}/${mimedestviddefault}/${subdestvid}) in subdirectories %Y/%Y_%m/. move=true forcedate=true $(basename $0) @@ -126,43 +130,42 @@ run_fix () { newDateTimeOriginal="$(parsedatetime "$file")" loginfo "newDateTimeOriginal: $newDateTimeOriginal" - if [ -n "$newDateTimeOriginal" ]; then - case $mime in - image/png) - $setdate && exiftool "-creationtime=$newDateTimeOriginal" -if '(not $creationtime)' "$file" - $setdate && fix_datetime "$file" - MIMEDEST="${mimedestpic}/${subdestpic}" - ;; - image/jpeg) - $setdate && fix_datetime "$file" - MIMEDEST="${mimedestpic}/${subdestpic}" - ;; - video/mp4|video/m4a) - $setdate && fix_datetime "$file" - MIMEDEST="${mimedestvid}/${subdestvid}" - ;; - *) - logwarn "unsupportet mimetype »${mime}« for »${file}«" - ;; - esac - fi - - loginfo "$(exiftool -filename -createdate -datetimeoriginal "$file")" - - - case $move in - true) - echo move to ${dest}/${MIMEDEST}/%Y/%Y_%m - loginfo "$(exiftool '-Directory&1 |tee -a dest_exists)" + case $mime in + image/png) + MIMEDEST="${mimedestpic}/${subdestpic}" ;; - copy) - echo copy to ${dest}/${MIMEDEST}/%Y/%Y_%m - loginfo "$(exiftool -o . '-Directory&1 |tee -a dest_exists)" + ;; + copy) + echo copy to ${dest}/${MIMEDEST}/%Y/%Y_%m + loginfo "$(exiftool -o . '-Directory