improve output
This commit is contained in:
parent
395e0d845e
commit
04e2826d99
1 changed files with 6 additions and 29 deletions
|
@ -1,27 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export FILELOGLEVEL=ERROR
|
export FILELOGLEVEL=ERROR
|
||||||
|
|
||||||
datetime_v1 () {
|
|
||||||
branch="$(basename $1)"
|
|
||||||
if [[ $branch =~ ^([0-9]{4})(\.|-)([0-9]{2})(\.|-)([0-9]{2})( |_)([0-9]{2})(\.|-)([0-9]{2})(\.|-)([0-9]{2}).*$ ]]; then
|
|
||||||
printf "%04d:%02d:%02d %02d:%02d:%02d" "${BASH_REMATCH[1]#0}" "${BASH_REMATCH[3]#0}" "${BASH_REMATCH[5]#0}" "${BASH_REMATCH[7]#0}" "${BASH_REMATCH[9]#0}" "${BASH_REMATCH[11]#0}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
datetime_v2 () {
|
|
||||||
branch="$(basename $1)"
|
|
||||||
if [[ $branch =~ ^([0-9]{4})([0-9]{2})([0-9]{2})(_)([0-9]{2})([0-9]{2})([0-9]{2}).*$ ]]; then
|
|
||||||
printf "%04d:%02d:%02d %02d:%02d:%02d" "${BASH_REMATCH[1]#0}" "${BASH_REMATCH[2]#0}" "${BASH_REMATCH[3]#0}" "${BASH_REMATCH[5]#0}" "${BASH_REMATCH[6]#0}" "${BASH_REMATCH[7]#0}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
datetime_v3 () {
|
|
||||||
branch="$(basename $1)"
|
|
||||||
if [[ $branch =~ ^(IMG-)([0-9]{4})([0-9]{2})([0-9]{2})(-WA)([0-9]{2})([0-9]{2}).*$ ]]; then
|
|
||||||
printf "%04d:%02d:%02d %02d:%02d:%02d" "${BASH_REMATCH[2]#0}" "${BASH_REMATCH[3]#0}" "${BASH_REMATCH[4]#0}" "${BASH_REMATCH[6]#0}" "${BASH_REMATCH[7]#0}" "00"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
parsedatetime() {
|
parsedatetime() {
|
||||||
filename="$(basename "${@}")"
|
filename="$(basename "${@}")"
|
||||||
if [[ $filename =~ ^([0-9]{4})(\.|-)([0-9]{2})(\.|-)([0-9]{2})( |_)([0-9]{2})(\.|-)([0-9]{2})(\.|-)([0-9]{2}).*$ ]]; then
|
if [[ $filename =~ ^([0-9]{4})(\.|-)([0-9]{2})(\.|-)([0-9]{2})( |_)([0-9]{2})(\.|-)([0-9]{2})(\.|-)([0-9]{2}).*$ ]]; then
|
||||||
|
@ -46,17 +25,15 @@ fix_datetime () {
|
||||||
loginfo "file: $file "
|
loginfo "file: $file "
|
||||||
newDateTimeOriginal="$(parsedatetime "$file")"
|
newDateTimeOriginal="$(parsedatetime "$file")"
|
||||||
loginfo "newDateTimeOriginal: $newDateTimeOriginal"
|
loginfo "newDateTimeOriginal: $newDateTimeOriginal"
|
||||||
# logdebug "INFO: DateTimeOrigin and DateCreated set in file
|
|
||||||
#$(exiftool -DateTimeOriginal -CreateDate "$file")"
|
|
||||||
if [ -n "$newDateTimeOriginal" ]; then
|
if [ -n "$newDateTimeOriginal" ]; then
|
||||||
exiftool "-DateTimeOriginal=$newDateTimeOriginal" -if '(not $datetimeoriginal)' "$file"
|
exiftool "-DateTimeOriginal=$newDateTimeOriginal" -if '(not $datetimeoriginal)' "$file"
|
||||||
exiftool '-createdate<datetimeoriginal' -if '(not $createdate and $datetimeoriginal)' "$file"
|
exiftool '-createdate<datetimeoriginal' -if '(not $createdate and $datetimeoriginal)' "$file"
|
||||||
exiftool -createdate -datetimeoriginal "$file"
|
fi
|
||||||
|
loginfo "$(exiftool -filename -createdate -datetimeoriginal "$file")"
|
||||||
loginfo "----------------"
|
loginfo "----------------"
|
||||||
loginfo ""
|
loginfo ""
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
|
|
Loading…
Reference in a new issue