eyeD3 icon indicating copy to clipboard operation
eyeD3 copied to clipboard

Passing eyed3.core.Date to recording_date still results in Invalid date text: ...

Open iarp opened this issue 4 years ago • 5 comments

I'm a touch lost as to where to go from here. I need to set the recording_date value to a specific date. I've tried as a string, datetime.datetime, and even eyed3.core.Date objects and all fail in some way.

import eyed3
from eyed3.core import Date
af = eyed3.load(file.path)
dt = file.show_date
print(dt)
af.tag.recording_date = Date(dt.year, dt.month, dt.day)

I don't even have to save, it just spits out the following error

1986-05-04
Invalid date text: 0405

If I do save it only saves the year.

I could understand the error if I were passing a string that you had to parse and attempt to figure out its format, but I'm literally passing it eyed3's own Date object with a specific year month and day, how could it be failing?

Edit: Forgot to mention its id3v2.3

iarp avatar Jan 13 '21 21:01 iarp

Decided to just change https://github.com/nicfit/eyeD3/blob/master/eyed3/id3/tag.py#L558 to the following and it works fine.

self._setDate(b"TDAT", date)

iarp avatar Jan 26 '21 00:01 iarp

Yep, I get this error too when setting dates with the day of the month being less than 10. So setting "recording-date" to "2020-12-25" works but "2020-12-08" fails (or rather just sets the year). Your fix works: replacing "self._setDate(b"TYER", str(date.year))" with "self._setDate(b"TYER", str(date))".

TwoLeaves avatar Oct 13 '22 15:10 TwoLeaves

@iarp @TwoLeaves If you're still using eyed3, this #623 might be the solution for your problem.

TJ-59 avatar Mar 10 '24 01:03 TJ-59