Skip to content
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

Merged
merged 4 commits into from Oct 20, 2022

Conversation

Tamriel
Copy link
Contributor

@Tamriel Tamriel commented Aug 6, 2022

Fixes #4082

@@ -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'
Copy link
Member

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?

Copy link
Contributor Author

@Tamriel Tamriel Sep 8, 2022

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?

Copy link
Member

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...

Tamriel and others added 2 commits September 8, 2022 20:56
Co-authored-by: Nick Boultbee <declension@users.noreply.github.com>
@declension declension merged commit 4b2f299 into quodlibet:master Oct 20, 2022
@declension
Copy link
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The sync_to_device plugin shouldn't delete files named 'cover.jpg'
2 participants