Skip to content

Add raise_on_unsupported_wav parameter to MediaFile.__init__#107

Merged
snejus merged 6 commits intobeetbox:masterfrom
elainec2024:add-raise-on-unsupported-wav
Apr 17, 2026
Merged

Add raise_on_unsupported_wav parameter to MediaFile.__init__#107
snejus merged 6 commits intobeetbox:masterfrom
elainec2024:add-raise-on-unsupported-wav

Conversation

@elainec2024
Copy link
Copy Markdown
Contributor

Following up on #105, this adds a raise_on_unsupported_wav parameter to MediaFile.__init__ (defaults to False) to make the FileTypeError for non-PCM WAV formats optional rather than mandatory.

This allows other mediafile users to continue reading basic audio properties (channels, samplerate, length, bitrate) from non-PCM WAV files, while beets can opt in to the behavior by passing raise_on_unsupported_wav=True.

Addresses the concern raised in #105.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.02%. Comparing base (827b3ee) to head (9091e29).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #107   +/-   ##
=======================================
  Coverage   93.02%   93.02%           
=======================================
  Files          16       16           
  Lines         832      832           
  Branches      117      117           
=======================================
  Hits          774      774           
  Misses         40       40           
  Partials       18       18           

@elainec2024
Copy link
Copy Markdown
Contributor Author

@snejus, please let me know if there is anything I need to edit.

Comment thread mediafile/__init__.py Outdated
Comment thread docs/changelog.rst
elainec2024 and others added 2 commits April 17, 2026 18:21
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
@snejus snejus merged commit 9921ae9 into beetbox:master Apr 17, 2026
13 checks passed
snejus added a commit to beetbox/beets that referenced this pull request Apr 18, 2026
Follow-up to #6526. This change moves the `remux_mpeglayer3_wav` call to
before `library.Item.from_path` in `read_item`, so beets no longer
depends on mediafile raising `FileTypeError` for MPEGLAYER3 WAV files.
This is related to beetbox/mediafile#107.
@kiefermat
Copy link
Copy Markdown
Contributor

Thanks for fixing this so fast!

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.

4 participants