#!/usr/bin/python # This script copies photos from a PTP camera into the photo directory and # renames them using the Shutter Count EXIF tag (ignoring the camera's file # name). # # Copyright (c) 2007 by Reid Priedhorsky, . # # This script is distributed under the terms of the GNU General Public # License; see http://www.gnu.org/licenses/gpl.txt for more information. # # Usage: ptp-acquire [SUFFIX] import cPickle as pickle import glob import os import re import subprocess import shutil import sys import time TARGET = '/storage/photos' STATEFILE = TARGET + '/ptp-acquire.copied.txt' RE_LIST = re.compile(r'^#(?P\d+)\s+(?P[\w.]+)', re.MULTILINE) RE_FILE = re.compile(r'(?P\d+)\.(?P\w{3})$') RE_INFO = re.compile(r""" ^Information[ ]on[ ]file[ ]'(?P[\w.]+)' .*? ^[ ][ ]Time:\s+(?P