Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-issue Usage _ Code Snippet :: how to write the CTOC Additional Field with the ordered chapter UniqueIDs #3

Closed
tarrats opened this issue Feb 2, 2018 · 3 comments
Assignees
Labels

Comments

@tarrats
Copy link

tarrats commented Feb 2, 2018

The problem

This isn´t an issue per se; however, I'm confused as to how do I explicitly add/write the CTOC additional field after writing all chapters.

Environment

  • ATL version 2.3
  • Windows 10

Details

The ID3v2 chapters that get written with the ATLDOTNET library are FLAWLESS! However, some podcast clients like Overcast that do read them, cannot navigate through them. The only difference I've found so far in the ID3v2 tags from my chapter-enabled files and others out there is the CTOC Additional Field that lists the order of said chapters. The files with CTOC information in the ID3v2 tag can be navigated in podcast clients like Overcast.

I tried to no avail, thanks to my novice coding skills, to explicitly add a KeyValuePair<string, string>("CTOC", "toc");into theTag.AdditionalFields

But looking through the ATLDOTNET code I found that you've already added immense support to CTOC in ATL.AudioData.IO.ID3v2.writeChapters

I'd just like to know how to write the CTOC additional field, I thought that either expanding on the Chapter code snippet or creating a new one specifically for CTOC would be very much appreciated.

Code To Reproduce Issue

  1. Create two chapters:

thisChapter = new ATL.ChapterInfo();

thisChapter.UniqueID = chp0;
thisChapter.Title = One;
thisChapter.StartTime = 0;
thisChapter.EndTime = 10000;
theTag.Chapters.Add(thisChapter);

thisChapter.UniqueID = chp1;
thisChapter.Title = Two;
thisChapter.StartTime = 10000;
thisChapter.EndTime = 20000;
theTag.Chapters.Add(thisChapter);

  1. Create the CTOC, this is the request:

theTag.AdditionalFields.AddCTOC();

Persist the chapters and CTOC in the file:

theFile.UpdateTagInFile(theTag, MetaDataIOFactory.TAG_ID3V2);

  1. The result in the ID3v2 tag under AdditionalFields should be:

{[CTOC, toc
Key = "CTOC"
Value = "toc\0\u0003\u0006chp0\0chp1\0TIT2\0\0\0%\0\0\u0001ÿþ"

Thank you so much!

@Zeugma440 Zeugma440 reopened this Feb 2, 2018
@Zeugma440
Copy link
Owner

Closed by 5c83d04

ID3v2 wouldn't create a CTOC frame on empty files, but rather maintain it when the frame already existed.

=> New option Settings.ID3v2_alwaysWriteCTOCFrame allows to write a CTOC frame whenever metadata contain at least one chapter (default value = true)

@Zeugma440 Zeugma440 added the bug label Feb 2, 2018
@Zeugma440 Zeugma440 self-assigned this Feb 2, 2018
@Zeugma440
Copy link
Owner

Zeugma440 commented Feb 2, 2018

Thanks for pointing this out @tarrats !

This was an unintended behaviour, since -as you saw-, ATL is fully capable of generating a valid CTOC frame on its own. It is now done by default when calling UpdateTagInFile, without you having to add anything to your code.

@tarrats
Copy link
Author

tarrats commented Feb 3, 2018

Tested in commit 5c83d0423478d5af954e9d99c87e4e71a3b835f5 the CTOC Additional Field is now written in the ID3v2 tag when UpdateTagFile is called! Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants