add: save the originals too

main
rrr-marble 5 years ago
parent fc81b97891
commit cbf5362588

@ -3,14 +3,16 @@ from wand.image import Image
import filetype
# Built-in
from os import path
from os import path, walk
from sys import argv, stderr
from shutil import move
# update database residing here
DB_LOCATION = "photovoter.dblite"
# place compressed images here
# place compressed images here (needs to exist)
DEST_STRUNK = "image/"
# move originals here (needs to exist)
DEST_ORIGINAL = "original/"
def usage():
@ -29,6 +31,7 @@ def process_pictures():
# Ignore any nested directories
(root, _, filenames) = next(walk(argv[1], topdown=True), (None, None, []))
for filename in filenames:
# FIXME:what if picture with the same name already exists?
# skip any non-image files
if not filetype.image_match(path.join(root, filename)):
continue
@ -45,6 +48,10 @@ def process_pictures():
# move them to the processed folder
cloned.save(filename=path.join(DEST_STRUNK, filename))
# move the originals out of the working directory
# Q: do we strip exif from originals?
move(path.join(root, filename), DEST_ORIGINAL)
# update the database
pass

Loading…
Cancel
Save