Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
455 stars 61 forks source link

Date aka Recorded Date. #42

Closed JeepNL closed 4 years ago

JeepNL commented 4 years ago

The problem

I'd like to use the recorded date of the podcasts I download in my program. With MediaInfo I can see that date as "Recorded_Date" (which is 'Date', see: this link)

But "theTrack.Date.ToString()" always produces "1-1-0001 00:00:00"

Environment

Visual Studio 16.5.0`Preview 1 .NET Core 3.1 ATL 2.14.0 Windows 10 Pro 1909

Code To Reproduce Issue [ Good To Have ]

Any mp3/m4a Podcast (I thnk) but here's an RSS Podcast feed: http://feeds.feedburner.com/pod-save-america

JeepNL commented 4 years ago

Oops, it seems my podcast downloader (Media Monkey) gets the recorded date from the RSS file and updates that date to the MP3/M4A 'date' field which is "Recorded Date" in MediaInfo. Format yyyy-MM-dd ie: 2019-12-17

But still, ATLdotnet doesn't read it. I'm also in the process of programming my own RSS feed podcast downloader and I would like to use that date field.

Zeugma440 commented 4 years ago

Could you please provide a tagged file so that I can use it for tests?

JeepNL commented 4 years ago

One moment please ...

JeepNL commented 4 years ago

Here's a link to drive where you can download 2 files, one MP3 and one M4A https://drive.google.com/drive/folders/1KzQSyzjS58ZWmgDICfY8uC-6oBP8Stba

Zeugma440 commented 4 years ago

Should I assume the following dates are the ones ATL should be reading ?

“The Do Something Democrats.”.mp3 -> 2019/12/12 Episode 34- Royce White, Elite Athlete and Mental Health Advocate.m4a -> 2019/12/16

JeepNL commented 4 years ago

I googled about mp3 "YEAR" & "DATE" and see there's some confusion, see this link and this link. It seems "YEAR" is a timestamp field and "DATE" a string?

The string format for DATE (if it's a string) should be yyyy-MM-dd I think.

So it would be: 2019-12-16 or (for example) 2019-12-01 (December 1st 2019, with a leading zero)

JeepNL commented 4 years ago

But yes, those are the dates MediaMonkey updated the DATE field with. But it looks like different apps use that field differently.

JeepNL commented 4 years ago

Oh. one minute please ... I remembered something. I need to look it up.

JeepNL commented 4 years ago

For MP3 files MediaMonkey puts the date in the "TDRC" field. And that is completely okay to use.

string recordedDate = theTrack.AdditionalFields["TDRC"];

But with the M4A example it isn't there,. Not in the TDRC or any other 'Additional Field' (I checked with your code snippet.

But it shows up in MediaInfo. I don't know where it gets this value, Or how to read it with ATL. I just want to read it from the M4A file.

Zeugma440 commented 4 years ago

For MP3 files MediaMonkey puts the date in the "TDRC" field. And that is completely okay to use.

Well, yes and no. TDRC is a legit field according to the ID3v2.4 standard, that's true. The problem is in the file you've sent, MediaMonkey has written that field in an ID3v2.3 header, which renders it invalid. ID3v2.3 standard field for the date is not TDRC but a combination between TDAT (day & month) and TYER (year).

Now that I'm done with the normative explanation, I can tweak the library to accept reading TDAT even in an ID3v2.3 header. That's kinda dirty but works easily

Zeugma440 commented 4 years ago

M4A's own tagging standard uses the ©day field to store that date. However that's the first time I've seen ©day containing an entire date. I'm more used to seeing it containing a simple year.

I just checked the spec that in unclear about that. I'll make it so ©day can store either entire dates or simple years.

JeepNL commented 4 years ago

FYI: With ATL I already could read the by Mediamonkey added "TDRC" in the MP3. So I don't think a change to the library is needed for that.

But I recently got M4A files in my (MediaMonkey) podcast feed and I can't get the date from that (M4A) format. I can see the 'recording date' in MediaInfo and I would like to read that value.

And if I'm correct I should (when converting) put the date in "TDAT" and "TYER" for MP3 and M4A as you described earlier?

JeepNL commented 4 years ago

With MediaMonkey there's an option in settings to 'touch' the files directly after download. It puts a couple of setting in the tags. Two I can think of are "Genre" and "Album" which you can define as a user in MediaMonkey. And it will store the recording date (which it reads from the RSS) as well as described in my previous comment.

Zeugma440 commented 4 years ago

I've just publised version 2.15 that is able to read dates on both of the files you submitted.

If you have any other topic to discuss, please open a new issue. Thanks~

JeepNL commented 4 years ago

It works! I installed version 2.15 and I now can read the date with theTrack.Date This works for both MP3 and M4A files.

FYI: previously with 2.14 (and earlier versions) I could read the date in "MediaMonkey MP3" files with:

string recordedDate = "";
if (theTrack.AdditionalFields.ContainsKey("TDRC"))
{
    recordedDate = theTrack.AdditionalFields["TDRC"];
} 

but that doesn't work anymore. If other people are using this, it would be a breaking change. I don't need to use this code anymore because I now can read the date with theTrack.Date

Thank you for adding this feature!