Skip to content

Commit

Permalink
Version 1.2.4
Browse files Browse the repository at this point in the history
Add time_shift options
Lower case file ext during renaming
  • Loading branch information
sashacmc committed May 22, 2024
1 parent ab32542 commit 3e37cb2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
photo-importer (1.2.4) stable; urgency=medium

* Add time_shift options
* Lower case file ext during renaming

-- Alexander Bushnev <[email protected]> Wed, 22 May 2024 23:12:07 +0200

photo-importer (1.2.3) stable; urgency=medium

* Update ci workflows
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: photo-importer
Section: utils
Priority: optional
Maintainer: Alexander Bushnev, <[email protected]>
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

Expand Down
6 changes: 5 additions & 1 deletion photo-importer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions photo_importer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Config(object):
'use_jpegtran': 0,
'use_shutil': 0,
'add_orig_name': 0,
'time_shift': 0,
},
'server': {
'port': 8080,
Expand Down
6 changes: 5 additions & 1 deletion photo_importer/fileprop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@

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


setup(
name='photo-importer',
version='1.2.3',
version='1.2.4',
description='Photo importer tool',
author='Alexander Bushnev',
author_email='[email protected]',
Expand Down

0 comments on commit 3e37cb2

Please sign in to comment.