diff --git a/wrolpi/plugins/videos/api.py b/wrolpi/plugins/videos/api.py index 482ac53a..7404c15c 100644 --- a/wrolpi/plugins/videos/api.py +++ b/wrolpi/plugins/videos/api.py @@ -19,7 +19,8 @@ well as its meta files) is relative to its Channel's directory. video['poster_path'] = 'foo.jpg' video['video_path'] = 'subdir/bar.mp4' -Relative DB paths allow files to be moved without having to rebuild the entire collection. +Relative DB paths allow files to be moved without having to rebuild the entire collection. It also ensures that when +a file is moved, it will not be duplicated in the DB. """ import json import pathlib diff --git a/wrolpi/plugins/videos/test/test_api.py b/wrolpi/plugins/videos/test/test_api.py index 6e44bb15..2fd855b0 100644 --- a/wrolpi/plugins/videos/test/test_api.py +++ b/wrolpi/plugins/videos/test/test_api.py @@ -162,7 +162,8 @@ class TestAPI(unittest.TestCase): description3 = pathlib.Path(channel_path / 'channel name_20000103_cdefghijklm_title.description') description3.touch() - # A orphan meta-file should be ignored. This shouldn't show up anywhere. + # A orphan meta-file should be ignored. This shouldn't show up anywhere. But, it shouldn't be deleted. + # WROLPi should never delete a file. poster3 = pathlib.Path(channel_path / 'channel name_20000104_defghijklmn_title.jpg') poster3.touch() @@ -183,3 +184,5 @@ class TestAPI(unittest.TestCase): {(i['video_path'], i['poster_path'], i['description_path']) for i in channel['videos']}, expected ) + + assert poster3.is_file(), 'Orphan jpg file was deleted! WROLPi should never delete files.'