Avoid writing unknown track and disc totals#6655
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6655 +/- ##
==========================================
+ Coverage 72.44% 72.62% +0.18%
==========================================
Files 160 162 +2
Lines 20690 20824 +134
Branches 3272 3294 +22
==========================================
+ Hits 14989 15124 +135
- Misses 4976 4978 +2
+ Partials 725 722 -3
🚀 New features to boost your workflow:
|
|
hey @Tsuizxgo! thank you for your contribution :)
Do you know if this always happens or is it a bug in metadata source(s) ? |
Thanks for checking! It does not necessarily mean that the metadata source explicitly returns
|
|
Your change sets those tags back to None if they are However this fix is at the last stage: when we write tags. If my understanding is correct things like
I think that's our core issue here. If we fixed this default value we wouldn't need special handling for these fields, and everything should report None/empty, including the tags. Wdyt? Would you have time to look into that? |
|
Thanks for the guidance. I updated the PR to address the underlying model-level behavior instead of only changing the final tag-writing step. The new version adds a nullable padded integer type for I also added regression coverage for:
Focused local test run: BEETSDIR=/private/tmp/beets-test-config UV_CACHE_DIR=/private/tmp/uv-cache uv run pytest test/test_types.py test/test_library.py test/plugins/test_info.py
# 190 passed, 2 skipped |
Description
Fixes #6194.
This PR fixes how beets represents unknown
tracktotalanddisctotalvalues.When
tracktotalordisctotalis unknown, beets may store it internally as0. Previously that value could surface as00in library/template output and could be written into audio file tags, producing metadata liketrack 1/0ordisc 2/0.This change treats
0totals as unknown at the field type level fortracktotalanddisctotal. Those fields now normalize0toNone, format as empty in library output such asbeet info --library, and naturally omit/clear the corresponding media tags when writing files.The actual
trackanddiscnumbers are still written and formatted normally.To Do
Documentation.This is a bug fix in existing behavior and does not add or change any user-facing command or config option.docs/changelog.rst.beet info --library, field normalization, and file writing.