diff --git a/modules/videos/lib.py b/modules/videos/lib.py index 4dc523a2..92d0cba8 100644 --- a/modules/videos/lib.py +++ b/modules/videos/lib.py @@ -382,7 +382,7 @@ def save_channels_config(session=None, preserve_favorites: bool = True): def import_channels_config(): """Import channel settings to the DB. Existing channels will be updated.""" if PYTEST and not TEST_CHANNELS_CONFIG: - logger.warning(f'Not importing channels during this test. Use `test_channels_config` fixture if you would' + logger.warning(f'Not importing channels during this test. Use `test_channels_config` fixture if you would ' f'like to call this.') return diff --git a/wrolpi/common.py b/wrolpi/common.py index 2f68ede1..279bcf60 100644 --- a/wrolpi/common.py +++ b/wrolpi/common.py @@ -805,8 +805,10 @@ def register_modeler(modeler: callable): def apply_modelers(files, session: Session): - from wrolpi.files.lib import split_path_stem_and_suffix, get_mimetype - from wrolpi.files.models import File + """ + Group Files by stem, send those groups to the modelers. Each modeler will model what Files are valid. + """ + from wrolpi.files.lib import split_path_stem_and_suffix if not files: return diff --git a/wrolpi/files/lib.py b/wrolpi/files/lib.py index a936f739..e78a3916 100644 --- a/wrolpi/files/lib.py +++ b/wrolpi/files/lib.py @@ -186,7 +186,6 @@ async def _refresh_files_list(paths: List[pathlib.Path], idempotency: datetime.d if new_paths := (chunk - existing_paths): new_files = [File(path=i, idempotency=idempotency, mimetype=get_mimetype(i)) for i in new_paths] session.add_all(new_files) - session.flush(new_files) # Apply models to all files. Many files will have no model. all_files = existing_files + new_files apply_modelers(all_files, session)