1
0
mirror of https://github.com/sashacmc/photo-importer.git synced 2024-11-16 10:08:40 +02:00

Version 1.2.4

Add time_shift options
Lower case file ext during renaming
This commit is contained in:
sashacmc 2024-05-22 23:27:02 +02:00
parent ab32542882
commit 3e37cb28d4
6 changed files with 21 additions and 7 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
photo-importer (1.2.4) stable; urgency=medium
* Add time_shift options
* Lower case file ext during renaming
-- Alexander Bushnev <Alexander@Bushnev.pro> Wed, 22 May 2024 23:12:07 +0200
photo-importer (1.2.3) stable; urgency=medium photo-importer (1.2.3) stable; urgency=medium
* Update ci workflows * Update ci workflows

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: photo-importer
Section: utils Section: utils
Priority: optional Priority: optional
Maintainer: Alexander Bushnev, <Alexander@Bushnev.pro> Maintainer: Alexander Bushnev, <Alexander@Bushnev.pro>
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 Standards-Version: 3.9.2
XS-Python3-Version: >= 3.2 XS-Python3-Version: >= 3.2

View File

@ -45,7 +45,11 @@ use_shutil = 0
# Add original filename, if it does not contain a timestamp (bool, 0/1) # Add original filename, if it does not contain a timestamp (bool, 0/1)
# (Useful if filename contains some notable information) # (Useful if filename contains some notable information)
add_orig_name = 0 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]
# Server port # Server port
port = 8080 port = 8080

View File

@ -32,6 +32,7 @@ class Config(object):
'use_jpegtran': 0, 'use_jpegtran': 0,
'use_shutil': 0, 'use_shutil': 0,
'add_orig_name': 0, 'add_orig_name': 0,
'time_shift': 0,
}, },
'server': { 'server': {
'port': 8080, 'port': 8080,

View File

@ -90,7 +90,7 @@ class FileProp(object):
def __type_by_ext(self, ext): def __type_by_ext(self, ext):
try: try:
return self.EXT_TO_TYPE[ext.lower()] return self.EXT_TO_TYPE[ext]
except KeyError: except KeyError:
logging.warning('Unknown ext: ' + ext) logging.warning('Unknown ext: ' + ext)
return IGNORE return IGNORE
@ -182,10 +182,14 @@ class FileProp(object):
def get(self, fullname): def get(self, fullname):
path, fname_ext = os.path.split(fullname) path, fname_ext = os.path.split(fullname)
fname, ext = os.path.splitext(fname_ext) fname, ext = os.path.splitext(fname_ext)
ext = ext.lower()
tp = self.__type_by_ext(ext) tp = self.__type_by_ext(ext)
ftime = self.__time(fullname, fname, tp) 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: if ftime:
out_name = ftime.strftime( out_name = ftime.strftime(

View File

@ -4,9 +4,7 @@ import os
def get_long_description(): def get_long_description():
this_directory = os.path.abspath(os.path.dirname(__file__)) this_directory = os.path.abspath(os.path.dirname(__file__))
with open( with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
os.path.join(this_directory, 'README.md'), encoding='utf-8'
) as f:
long_description = f.read() long_description = f.read()
return long_description return long_description
@ -14,7 +12,7 @@ def get_long_description():
setup( setup(
name='photo-importer', name='photo-importer',
version='1.2.3', version='1.2.4',
description='Photo importer tool', description='Photo importer tool',
author='Alexander Bushnev', author='Alexander Bushnev',
author_email='Alexander@Bushnev.pro', author_email='Alexander@Bushnev.pro',