Fix Invalid ID3TimeStamp error when writing date tags
Strip non-timestamp characters (BOM, invisible chars) from date/year values both when reading existing tags in metadata_resolver and when writing in executor. Also harden the EasyID3 except block to not wipe existing tags when adding a missing ID3 header, and add per-field try/except in MP3 tag writing so one bad field doesn't abort the entire track. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d91eb36007
commit
460b92aab3
2 changed files with 23 additions and 5 deletions
|
|
@ -337,8 +337,12 @@ def resolve(
|
|||
album = album or Counter(tag_albums).most_common(1)[0][0]
|
||||
|
||||
# Tag year/genre/label
|
||||
import re as _re
|
||||
for t in hints.tracks:
|
||||
year = year or t.existing_tags.get("date") or t.existing_tags.get("year")
|
||||
raw_year = t.existing_tags.get("date") or t.existing_tags.get("year")
|
||||
if raw_year and not year:
|
||||
# Strip invisible chars so ID3TimeStamp validation doesn't fail later
|
||||
year = _re.sub(r"[^\d\-T:+Z]", "", str(raw_year)).strip()[:10] or None
|
||||
genre = genre or t.existing_tags.get("genre")
|
||||
label = label or t.existing_tags.get("label") or t.existing_tags.get("organization")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue