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

Fix convert plugin attempting to process a non-media file #5261

Merged
merged 4 commits into from
Feb 20, 2025

Conversation

pierreay
Copy link

Description

My library is managed using Beets for organization and git-annex as storage backend. Therefore when using this system, while my library files always exists on my filesystem, some files may be empty (without content). In this case, when I'm running the convert plugin, I don't wants it to process files which are empty (same apply for any Beets plugin). Hence, I added a check that the file is readable as a MediaFile before doing any process.

Before this fix, trying to encode an empty file would have lead to an error while leaving convert doing its side-effects and convert would also copy empty files to destination for files that doesn't need to be re-encoded.

In my case, this is empty files, but the problem can be anything else (depending on the storage backend) and/or corrupted files. Conclusion, I think checking that the file is readable is always recommended before proceeding to heavy operation like this.

To Do

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

@pierreay pierreay requested a review from Serene-Arc July 3, 2024 10:29
@pierreay pierreay force-pushed the pr-fix-convert-not-mediafile branch 2 times, most recently from 01f39fb to e773368 Compare July 3, 2024 10:44
@pierreay
Copy link
Author

pierreay commented Feb 6, 2025

Hello, kind reminder, is there anything that I can do on my side to see this PR being merged? :) @Serene-Arc

Copy link
Member

@snejus snejus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - just needs rebasing on master

@snejus snejus enabled auto-merge (squash) February 20, 2025 03:52
auto-merge was automatically disabled February 20, 2025 16:03

Head branch was pushed to by a user without write access

@pierreay pierreay force-pushed the pr-fix-convert-not-mediafile branch from 35a817b to ffc665e Compare February 20, 2025 16:03
@pierreay
Copy link
Author

Thanks, rebasing done. :)

@snejus snejus merged commit 5c8f1c1 into beetbox:master Feb 20, 2025
10 checks passed
@pierreay pierreay deleted the pr-fix-convert-not-mediafile branch February 20, 2025 17:56
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.

3 participants