adding xml2jpg
This commit is contained in:
parent
fa55d1f2f1
commit
42f6e848bb
1 changed files with 28 additions and 0 deletions
28
shell/xml2jpg.sh
Executable file
28
shell/xml2jpg.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Read XML from Flickr and rename corresponding files to 'taken' date
|
||||
# requires xml2 and jhead RPMs
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
for file in *.xml; do
|
||||
FNAME="${file%.*}"
|
||||
if [ ! -e "${FNAME}.jpg" ]; then
|
||||
continue
|
||||
fi
|
||||
echo "Inspecting $file"
|
||||
JPGDT=$(xml2 < "$file" | grep "@taken=" | cut -f2 -d '=')
|
||||
if [ "X${JPGDT}" == "X" ]; then
|
||||
echo "Empty Date/Time."
|
||||
continue
|
||||
else
|
||||
BASE=$(date -d "$JPGDT" +"FLICKR_%Y%m%d_%H%M%S")
|
||||
if [ ! -e "${BASE}.jpg" ]; then
|
||||
echo "New file: ${BASE}.jpg"
|
||||
mv "${FNAME}.jpg" "${BASE}.jpg"
|
||||
touch -d "${JPGDT}" "${BASE}.jpg"
|
||||
jhead -mkexif -dsft "${BASE}.jpg"
|
||||
rm -f "${file}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue