Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found a bug with some stranger bytes in date conversion and copy file as default #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/sortphotos.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def parse_date_exif(date_string):
date_entries = elements[0].split(':') # ['YYYY', 'MM', 'DD']

if len(date_entries) == 3 and date_entries[0] > '0000':
year = int(date_entries[0])
month = int(date_entries[1])
day = int(date_entries[2])
year = int(date_entries[0].strip(' \n\r\t\0'))
month = int(date_entries[1].strip(' \n\r\t\0'))
day = int(date_entries[2].strip(' \n\r\t\0'))
else:
return None

Expand Down Expand Up @@ -407,7 +407,7 @@ def sortPhotos(src_dir, dest_dir, sort_format, rename_format, recursive=False,
parser.add_argument('src_dir', type=str, help='source directory')
parser.add_argument('dest_dir', type=str, help='destination directory')
parser.add_argument('-r', '--recursive', action='store_true', help='search src_dir recursively')
parser.add_argument('-c', '--copy', action='store_true', help='copy files instead of move')
parser.add_argument('-m', '--move', action='store_true', help='move files instead of copy')
parser.add_argument('-s', '--silent', action='store_true', help='don\'t display parsing details.')
parser.add_argument('-t', '--test', action='store_true', help='run a test. files will not be moved/copied\ninstead you will just a list of would happen')
parser.add_argument('--sort', type=str, default='%Y/%m-%b',
Expand Down Expand Up @@ -447,6 +447,6 @@ def sortPhotos(src_dir, dest_dir, sort_format, rename_format, recursive=False,
args = parser.parse_args()

sortPhotos(args.src_dir, args.dest_dir, args.sort, args.rename, args.recursive,
args.copy, args.test, not args.keep_duplicates, args.day_begins,
not args.move, args.test, not args.keep_duplicates, args.day_begins,
args.ignore_groups, args.ignore_tags, args.use_only_groups,
args.use_only_tags, not args.silent)