allow to breakdown per month only
This commit is contained in:
parent
5ee10da858
commit
01b7f57aee
|
@ -13,6 +13,7 @@ DELETE=0
|
||||||
DEBUG=0
|
DEBUG=0
|
||||||
YES=0
|
YES=0
|
||||||
NO_JPEG=0
|
NO_JPEG=0
|
||||||
|
MONTH_ONLY=0
|
||||||
|
|
||||||
import_photo()
|
import_photo()
|
||||||
{
|
{
|
||||||
|
@ -80,9 +81,15 @@ import_photo()
|
||||||
|
|
||||||
# prepare dir name
|
# prepare dir name
|
||||||
local dir
|
local dir
|
||||||
dir=$((exiftool -q -d "%Y/%Y-%m-%d" -if '($datetimeoriginal and ($datetimeoriginal ne "0000:00:00 00:00:00"))' -datetimeoriginal -s3 "${image}" 2>/dev/null ; \
|
local pattern
|
||||||
exiftool -q -d "%Y/%Y-%m-%d" -if '($createdate and ($createdate ne "0000:00:00 00:00:00"))' -createdate -s3 "${image}" 2>/dev/null ; \
|
pattern="%Y/%Y-%m-%d"
|
||||||
exiftool -q -d "%Y/%Y-%m-%d" -filemodifydate -s3 "${image}" 2>/dev/null) | head -n 1)
|
if [ ${MONTH_ONLY} -eq 1 ]
|
||||||
|
then
|
||||||
|
pattern="%Y/%Y-%m"
|
||||||
|
fi
|
||||||
|
dir=$((exiftool -q -d "${pattern}" -if '($datetimeoriginal and ($datetimeoriginal ne "0000:00:00 00:00:00"))' -datetimeoriginal -s3 "${image}" 2>/dev/null ; \
|
||||||
|
exiftool -q -d "${pattern}" -if '($createdate and ($createdate ne "0000:00:00 00:00:00"))' -createdate -s3 "${image}" 2>/dev/null ; \
|
||||||
|
exiftool -q -d "${pattern}" -filemodifydate -s3 "${image}" 2>/dev/null) | head -n 1)
|
||||||
if [ "x${title}" != "x" ]
|
if [ "x${title}" != "x" ]
|
||||||
then
|
then
|
||||||
dir="${dir} - ${title}"
|
dir="${dir} - ${title}"
|
||||||
|
@ -124,13 +131,14 @@ import_photo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while getopts "hdjn:y" flag
|
while getopts "hdjmn:y" flag
|
||||||
do
|
do
|
||||||
case $flag in
|
case $flag in
|
||||||
h)
|
h)
|
||||||
echo "Usage: $0 [options] <file|directory>..."
|
echo "Usage: $0 [options] <file|directory>..."
|
||||||
echo "-d : delete source"
|
echo "-d : delete source"
|
||||||
echo "-j : RAW+jpeg, skip jpeg"
|
echo "-j : RAW+jpeg, skip jpeg"
|
||||||
|
echo "-m : breakdown by month"
|
||||||
echo "-n <name> : title"
|
echo "-n <name> : title"
|
||||||
echo "-y : force-yes"
|
echo "-y : force-yes"
|
||||||
exit
|
exit
|
||||||
|
@ -141,6 +149,9 @@ do
|
||||||
j)
|
j)
|
||||||
NO_JPEG=1
|
NO_JPEG=1
|
||||||
;;
|
;;
|
||||||
|
m)
|
||||||
|
MONTH_ONLY=1
|
||||||
|
;;
|
||||||
n)
|
n)
|
||||||
TITLE=${OPTARG}
|
TITLE=${OPTARG}
|
||||||
case ${TITLE} in
|
case ${TITLE} in
|
||||||
|
@ -171,6 +182,10 @@ if [ ${DELETE} -eq 1 ]
|
||||||
then
|
then
|
||||||
echo "--- Deletion of source image enabled ---"
|
echo "--- Deletion of source image enabled ---"
|
||||||
fi
|
fi
|
||||||
|
if [ ${MONTH_ONLY} -eq 1 ]
|
||||||
|
then
|
||||||
|
echo "--- Image breakdown per month only ---"
|
||||||
|
fi
|
||||||
if [ ${YES} -ne 1 ]
|
if [ ${YES} -ne 1 ]
|
||||||
then
|
then
|
||||||
read -p "Proceed? [Y/n] "
|
read -p "Proceed? [Y/n] "
|
||||||
|
|
Loading…
Reference in New Issue