New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the sync_to_device plugin shouldn't delete files named 'cover.jpg' #4083
Conversation
@@ -1079,14 +1081,18 @@ def _remove_empty_dirs(self): | |||
for root, dirs, __ in os.walk(self.expanded_destination, topdown=False): | |||
for dirname in dirs: | |||
dir_path = os.path.realpath(os.path.join(root, dirname)) | |||
if not os.listdir(dir_path): | |||
files = os.listdir(dir_path) | |||
last_file_is_cover = files and files[0] == 'cover.jpg' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the first file, no? What if there are lots and 'cover.jpg'
just happens to be the first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are other files than the music and cover.jpg
, deleting the folder will fail. And I think that is okay, since the user shall notice that's not the way how this plugin sync process is designed. Then an error message explaining that would be nice I think. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah that makes sense. Perhaps you could add a comment to explain this in the code...
Co-authored-by: Nick Boultbee <declension@users.noreply.github.com>
Thanks |
Fixes #4082