~carloabelli/bin

d1f707c6c900b9b673afe1f95d65605942558ae3 — Carlo Abelli 2 months ago 6fa374c
Use CreateDate if necessary in import-photos
1 files changed, 1 insertions(+), 2 deletions(-)

M import-photos
M import-photos => import-photos +1 -2
@@ 7,15 7,14 @@ mnt="$(mktemp -d -p $HOME)"
ifuse "$mnt"

pictures="$(xdg-user-dir PICTURES)"

declare -a imported
for file in $(find "$mnt/DCIM/100APPLE" -type f | sort -r); do
    name="$(basename "$file" | sed -r "s/([^.]*)\$/\L\1/")"
    echo -n "Importing $name..."
    date="$(exiftool -DateTime -S "$file" | cut -d ' ' -f 2 | tr : /)"
    [ -z "$date" ] && date="$(exiftool -DateTimeOriginal -S "$file" | cut -d ' ' -f 2 | tr : /)"
    [ -z "$date" ] && date="$(exiftool -CreateDate -S "$file" | cut -d ' ' -f 2 | tr : /)"
    if [ -z "$date" ]; then
        # date="$(stat -c %y "$file" | cut -d ' ' -f 1 | tr - /)"
        echo "failed!"
        continue
    fi