Add filename extension for music files with no extension during import#6457
Add filename extension for music files with no extension during import#6457snejus merged 10 commits intobeetbox:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
PR try fix import for files with no extension by using ffprobe to guess format, then importing file with detected extension so beets keep suffix when building destination path.
Changes:
- Add
ImportTaskFactory.check_extension()to runffprobeon no-extension files and import a.<format>path instead. - Add importer tests + new test resources for “no extension” file and “not music” file.
- Add changelog entry for 🐛
4881.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| beets/importer/tasks.py | Add ffprobe-based extension detection + copy/redirect import to .<ext> path. |
| test/test_importer.py | Add tests for extension recognition, already-existing ext file, and non-music file. |
| test/rsrc/no_ext | Add binary test resource with no extension (mp3 content). |
| test/rsrc/no_ext_not_music | Add non-music test resource with no extension. |
| docs/changelog.rst | Add changelog line for 🐛4881. |
|
Dear maintainers, I have fixed the issues raised by copilot and the automatic checks, which I am surprised it caught some stuff because I have resolved all issues raised by running |
|
Something has gone wrong with the way you merged |
|
I have synced my fork with the master branch and pasted in my changes. This should have reverted all the merge commits. Hopefully this will work now |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6457 +/- ##
=======================================
Coverage 70.01% 70.02%
=======================================
Files 146 147 +1
Lines 18505 18551 +46
Branches 3010 3024 +14
=======================================
+ Hits 12957 12990 +33
- Misses 4920 4927 +7
- Partials 628 634 +6
🚀 New features to boost your workflow:
|
|
I managed to get the checks to work correctly and I got all of them to pass. Thank you for the patience. This PR is ready to be reviewed. |
|
I have applied the improvements you suggested. Thank you for the constructive and instructive advice! |
snejus
left a comment
There was a problem hiding this comment.
Just the last small nit in the changelog to clarify we're dealing with imports and we're good
|
Change committed. Thank you for helping me improve my code, I feel that it is much cleaner compared to the first version. |
|
Looks great - I see there's now just an outstanding conflict left in the changelog |
|
I took extra precaution when merging, considering last time I messed up the whole branch. In hindsight I should have worked on a branch instead of on Master so that I wont have to keep merging changelog. I think this fork is ready for merging. Thank you so much for your continuous support! |
Description
Fixes #4881.
When user imports files with no extension, ffprobe is used to check the format of the file. If its in a music format, a copy of the file is created with the detected extension and that file is imported instead of the original. If it is not a music format, it change nothing (I believe non-music files are already filtered out somewhere else in the import pipeline). If there is a file in the same directory with the same name and has the same extension as the detected format, import that file instead.
To Do