diff --git a/debian/changelog b/debian/changelog index 2c68297..b46e997 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +photo-importer (1.2.4) stable; urgency=medium + + * Add time_shift options + * Lower case file ext during renaming + + -- Alexander Bushnev Wed, 22 May 2024 23:12:07 +0200 + photo-importer (1.2.3) stable; urgency=medium * Update ci workflows diff --git a/debian/control b/debian/control index 69ccc59..c8a2ef7 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: photo-importer Section: utils Priority: optional Maintainer: Alexander Bushnev, -Build-Depends: debhelper (>= 7), python3-all, dh-python, python3-setuptools, dh-systemd, cdbs +Build-Depends: debhelper (>= 7), python3-all, dh-python, python3-setuptools, cdbs Standards-Version: 3.9.2 XS-Python3-Version: >= 3.2 diff --git a/photo-importer.cfg b/photo-importer.cfg index 24f69aa..1107912 100644 --- a/photo-importer.cfg +++ b/photo-importer.cfg @@ -45,7 +45,11 @@ use_shutil = 0 # Add original filename, if it does not contain a timestamp (bool, 0/1) # (Useful if filename contains some notable information) add_orig_name = 0 - + +# This time shift (in seconds) will be added to the original timestamp during renaming +# (useful if original file have a wrong timestamp, timestamp will no affected) +time_shift = 0 + [server] # Server port port = 8080 diff --git a/photo_importer/config.py b/photo_importer/config.py index 0510fe6..52f0c3e 100755 --- a/photo_importer/config.py +++ b/photo_importer/config.py @@ -32,6 +32,7 @@ class Config(object): 'use_jpegtran': 0, 'use_shutil': 0, 'add_orig_name': 0, + 'time_shift': 0, }, 'server': { 'port': 8080, diff --git a/photo_importer/fileprop.py b/photo_importer/fileprop.py index 685fa5c..7fb3352 100755 --- a/photo_importer/fileprop.py +++ b/photo_importer/fileprop.py @@ -90,7 +90,7 @@ def __prepare_ext_to_type(self): def __type_by_ext(self, ext): try: - return self.EXT_TO_TYPE[ext.lower()] + return self.EXT_TO_TYPE[ext] except KeyError: logging.warning('Unknown ext: ' + ext) return IGNORE @@ -182,10 +182,14 @@ def _out_name_full(self, path, out_name, ext): def get(self, fullname): path, fname_ext = os.path.split(fullname) fname, ext = os.path.splitext(fname_ext) + ext = ext.lower() tp = self.__type_by_ext(ext) ftime = self.__time(fullname, fname, tp) + time_shift = self.__config['main']['time_shift'] + if ftime and time_shift: + ftime += datetime.timedelta(seconds=int(time_shift)) if ftime: out_name = ftime.strftime( diff --git a/setup.py b/setup.py index 18f9806..a7ebe5f 100644 --- a/setup.py +++ b/setup.py @@ -4,9 +4,7 @@ def get_long_description(): this_directory = os.path.abspath(os.path.dirname(__file__)) - with open( - os.path.join(this_directory, 'README.md'), encoding='utf-8' - ) as f: + with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() return long_description @@ -14,7 +12,7 @@ def get_long_description(): setup( name='photo-importer', - version='1.2.3', + version='1.2.4', description='Photo importer tool', author='Alexander Bushnev', author_email='Alexander@Bushnev.pro',