fixup! Refactoring collection options (2)
This commit is contained in:
parent
ea37849eae
commit
14234f12cb
|
@ -3,7 +3,7 @@ exclude= ["**/.directory", "**/.DS_Store"]
|
||||||
|
|
||||||
[Geolocation]
|
[Geolocation]
|
||||||
geocoder=Nominatim
|
geocoder=Nominatim
|
||||||
prefer_english_names=hjkh
|
prefer_english_names=False
|
||||||
timeout=1
|
timeout=1
|
||||||
|
|
||||||
[Path]
|
[Path]
|
||||||
|
|
|
@ -31,10 +31,10 @@ _dry_run_options = [
|
||||||
default=False,
|
default=False,
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help='Dry run only, no change made to the filesystem.',
|
help='Dry run only, no change made to the filesystem.',
|
||||||
)
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
_filter_options = [
|
_exclude_options = [
|
||||||
click.option(
|
click.option(
|
||||||
'--exclude',
|
'--exclude',
|
||||||
'-E',
|
'-E',
|
||||||
|
@ -42,6 +42,9 @@ _filter_options = [
|
||||||
multiple=True,
|
multiple=True,
|
||||||
help='Directories or files to exclude.',
|
help='Directories or files to exclude.',
|
||||||
),
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
_filter_options = [
|
||||||
click.option(
|
click.option(
|
||||||
'--ext',
|
'--ext',
|
||||||
'-e',
|
'-e',
|
||||||
|
@ -222,7 +225,6 @@ def _clean(**kwargs):
|
||||||
root,
|
root,
|
||||||
{
|
{
|
||||||
"dry_run": kwargs['dry_run'],
|
"dry_run": kwargs['dry_run'],
|
||||||
"exclude": kwargs['exclude'],
|
|
||||||
"extensions": kwargs['ext'],
|
"extensions": kwargs['ext'],
|
||||||
"glob": kwargs['glob'],
|
"glob": kwargs['glob'],
|
||||||
},
|
},
|
||||||
|
@ -325,7 +327,6 @@ def _compare(**kwargs):
|
||||||
collection = Collection(
|
collection = Collection(
|
||||||
root,
|
root,
|
||||||
{
|
{
|
||||||
"exclude": kwargs['exclude'],
|
|
||||||
"extensions": kwargs['ext'],
|
"extensions": kwargs['ext'],
|
||||||
"glob": kwargs['glob'],
|
"glob": kwargs['glob'],
|
||||||
"dry_run": kwargs['dry_run'],
|
"dry_run": kwargs['dry_run'],
|
||||||
|
@ -369,6 +370,7 @@ def _init(**kwargs):
|
||||||
@add_options(_logger_options)
|
@add_options(_logger_options)
|
||||||
@add_options(_input_options)
|
@add_options(_input_options)
|
||||||
@add_options(_dry_run_options)
|
@add_options(_dry_run_options)
|
||||||
|
@add_options(_exclude_options)
|
||||||
@add_options(_filter_options)
|
@add_options(_filter_options)
|
||||||
@add_options(_sort_options)
|
@add_options(_sort_options)
|
||||||
@click.option(
|
@click.option(
|
||||||
|
@ -456,7 +458,6 @@ def _sort(**kwargs):
|
||||||
'ignore_tags': kwargs['ignore_tags'],
|
'ignore_tags': kwargs['ignore_tags'],
|
||||||
'use_date_filename': kwargs['use_date_filename'],
|
'use_date_filename': kwargs['use_date_filename'],
|
||||||
'use_file_dates': kwargs['use_file_dates'],
|
'use_file_dates': kwargs['use_file_dates'],
|
||||||
'exclude': kwargs['exclude'],
|
|
||||||
'extensions': kwargs['ext'],
|
'extensions': kwargs['ext'],
|
||||||
'glob': kwargs['glob'],
|
'glob': kwargs['glob'],
|
||||||
'dry_run': kwargs['dry_run'],
|
'dry_run': kwargs['dry_run'],
|
||||||
|
|
|
@ -27,7 +27,6 @@ class TestOrdigi:
|
||||||
cls.src_path, cls.file_paths = sample_files_paths
|
cls.src_path, cls.file_paths = sample_files_paths
|
||||||
cls.logger_options = (('--verbose', 'DEBUG'),)
|
cls.logger_options = (('--verbose', 'DEBUG'),)
|
||||||
cls.filter_options = (
|
cls.filter_options = (
|
||||||
('--exclude', '.DS_Store'),
|
|
||||||
('--ignore-tags', 'CreateDate'),
|
('--ignore-tags', 'CreateDate'),
|
||||||
('--ext', 'jpg'),
|
('--ext', 'jpg'),
|
||||||
('--glob', '*'),
|
('--glob', '*'),
|
||||||
|
@ -175,6 +174,7 @@ class TestOrdigi:
|
||||||
|
|
||||||
arg_options = (
|
arg_options = (
|
||||||
*self.logger_options,
|
*self.logger_options,
|
||||||
|
('--exclude', '.DS_Store'),
|
||||||
*self.filter_options,
|
*self.filter_options,
|
||||||
('--path-format', '{%Y}/{folder}/{stem}.{ext}'),
|
('--path-format', '{%Y}/{folder}/{stem}.{ext}'),
|
||||||
|
|
||||||
|
|
|
@ -143,10 +143,10 @@ class TestCollection:
|
||||||
summary = collection.sort_files([self.src_path],
|
summary = collection.sort_files([self.src_path],
|
||||||
self.path_format, loc, imp='copy')
|
self.path_format, loc, imp='copy')
|
||||||
|
|
||||||
self.assert_import(summary, 30)
|
self.assert_import(summary, 29)
|
||||||
|
|
||||||
summary = collection.check_files()
|
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 summary.success_table.sum('update') == 0
|
||||||
assert not summary.errors
|
assert not summary.errors
|
||||||
|
|
||||||
|
@ -174,8 +174,8 @@ class TestCollection:
|
||||||
collection.summary = Summary(tmp_path)
|
collection.summary = Summary(tmp_path)
|
||||||
assert collection.summary.success_table.sum() == 0
|
assert collection.summary.success_table.sum() == 0
|
||||||
summary = collection.update(loc)
|
summary = collection.update(loc)
|
||||||
assert summary.success_table.sum('update') == 30
|
assert summary.success_table.sum('update') == 29
|
||||||
assert summary.success_table.sum() == 30
|
assert summary.success_table.sum() == 29
|
||||||
assert not summary.errors
|
assert not summary.errors
|
||||||
collection.summary = Summary(tmp_path)
|
collection.summary = Summary(tmp_path)
|
||||||
summary = collection.update(loc)
|
summary = collection.update(loc)
|
||||||
|
|
Loading…
Reference in New Issue