fixup! Refactoring collection options (2)

This commit is contained in:
Cédric Leporcq 2022-04-17 10:18:32 +02:00
parent ea37849eae
commit 14234f12cb
4 changed files with 12 additions and 11 deletions

View File

@ -3,7 +3,7 @@ exclude= ["**/.directory", "**/.DS_Store"]
[Geolocation]
geocoder=Nominatim
prefer_english_names=hjkh
prefer_english_names=False
timeout=1
[Path]

View File

@ -31,10 +31,10 @@ _dry_run_options = [
default=False,
is_flag=True,
help='Dry run only, no change made to the filesystem.',
)
),
]
_filter_options = [
_exclude_options = [
click.option(
'--exclude',
'-E',
@ -42,6 +42,9 @@ _filter_options = [
multiple=True,
help='Directories or files to exclude.',
),
]
_filter_options = [
click.option(
'--ext',
'-e',
@ -222,7 +225,6 @@ def _clean(**kwargs):
root,
{
"dry_run": kwargs['dry_run'],
"exclude": kwargs['exclude'],
"extensions": kwargs['ext'],
"glob": kwargs['glob'],
},
@ -325,7 +327,6 @@ def _compare(**kwargs):
collection = Collection(
root,
{
"exclude": kwargs['exclude'],
"extensions": kwargs['ext'],
"glob": kwargs['glob'],
"dry_run": kwargs['dry_run'],
@ -369,6 +370,7 @@ def _init(**kwargs):
@add_options(_logger_options)
@add_options(_input_options)
@add_options(_dry_run_options)
@add_options(_exclude_options)
@add_options(_filter_options)
@add_options(_sort_options)
@click.option(
@ -456,7 +458,6 @@ def _sort(**kwargs):
'ignore_tags': kwargs['ignore_tags'],
'use_date_filename': kwargs['use_date_filename'],
'use_file_dates': kwargs['use_file_dates'],
'exclude': kwargs['exclude'],
'extensions': kwargs['ext'],
'glob': kwargs['glob'],
'dry_run': kwargs['dry_run'],

View File

@ -27,7 +27,6 @@ class TestOrdigi:
cls.src_path, cls.file_paths = sample_files_paths
cls.logger_options = (('--verbose', 'DEBUG'),)
cls.filter_options = (
('--exclude', '.DS_Store'),
('--ignore-tags', 'CreateDate'),
('--ext', 'jpg'),
('--glob', '*'),
@ -175,6 +174,7 @@ class TestOrdigi:
arg_options = (
*self.logger_options,
('--exclude', '.DS_Store'),
*self.filter_options,
('--path-format', '{%Y}/{folder}/{stem}.{ext}'),

View File

@ -143,10 +143,10 @@ class TestCollection:
summary = collection.sort_files([self.src_path],
self.path_format, loc, imp='copy')
self.assert_import(summary, 30)
self.assert_import(summary, 29)
summary = collection.check_files()
assert summary.success_table.sum('import') == 30
assert summary.success_table.sum('import') == 29
assert summary.success_table.sum('update') == 0
assert not summary.errors
@ -174,8 +174,8 @@ class TestCollection:
collection.summary = Summary(tmp_path)
assert collection.summary.success_table.sum() == 0
summary = collection.update(loc)
assert summary.success_table.sum('update') == 30
assert summary.success_table.sum() == 30
assert summary.success_table.sum('update') == 29
assert summary.success_table.sum() == 29
assert not summary.errors
collection.summary = Summary(tmp_path)
summary = collection.update(loc)