diff --git a/src/config_parser.py b/src/config_parser.py index 03a596396..3de281311 100644 --- a/src/config_parser.py +++ b/src/config_parser.py @@ -357,7 +357,7 @@ def get_region(config): return region -def get_folder_format(config): +def get_photos_folder_format(config): """Return filename format or None.""" fmt = None config_path = ["photos", "folder_format"] diff --git a/src/sync_photos.py b/src/sync_photos.py index 95b8466c6..cc7501e19 100644 --- a/src/sync_photos.py +++ b/src/sync_photos.py @@ -97,7 +97,10 @@ def download_photo(photo, file_size, destination_path): def process_photo(photo, file_size, destination_path, files, folder_fmt): """Process photo details.""" photo_path = generate_file_name( - photo=photo, file_size=file_size, destination_path=destination_path, folder_fmt=folder_fmt + photo=photo, + file_size=file_size, + destination_path=destination_path, + folder_fmt=folder_fmt, ) if file_size not in photo.versions: LOGGER.warning( @@ -112,7 +115,9 @@ def process_photo(photo, file_size, destination_path, files, folder_fmt): return True -def sync_album(album, destination_path, file_sizes, extensions=None, files=None, folder_fmt=None): +def sync_album( + album, destination_path, file_sizes, extensions=None, files=None, folder_fmt=None +): """Sync given album.""" if album is None or destination_path is None or file_sizes is None: return None @@ -131,7 +136,7 @@ def sync_album(album, destination_path, file_sizes, extensions=None, files=None, file_sizes, extensions, files, - folder_fmt + folder_fmt, ) return True @@ -157,7 +162,7 @@ def sync_photos(config, photos): filters = config_parser.get_photos_filters(config=config) files = set() download_all = config_parser.get_photos_all_albums(config=config) - folder_fmt = config_parser.get_folder_format(config=config) + folder_fmt = config_parser.get_photos_folder_format(config=config) if download_all: for album in photos.albums.keys(): sync_album( diff --git a/tests/test_config_parser.py b/tests/test_config_parser.py index f4df78bae..c2b1c9966 100644 --- a/tests/test_config_parser.py +++ b/tests/test_config_parser.py @@ -417,14 +417,13 @@ def test_get_all_albums_false(self): config["photos"]["all_albums"] = False self.assertFalse(config_parser.get_photos_all_albums(config=config)) - def test_folder_fmt_empty(self): + def test_get_photos_folder_format_empty(self): """Empty folder_format.""" config = read_config(config_path=tests.CONFIG_PATH) - self.assertIsNone(config_parser.get_folder_format(config=config)) + self.assertIsNone(config_parser.get_photos_folder_format(config=config)) - def test_folder_fmt_set(self): + def test_get_photos_folder_format_valid(self): """folder_format is set.""" config = read_config(config_path=tests.CONFIG_PATH) config["photos"]["folder_format"] = "%Y/%m" - self.assertEqual(config_parser.get_folder_format(config=config), "%Y/%m") - + self.assertEqual(config_parser.get_photos_folder_format(config=config), "%Y/%m")