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

Support for chapter descriptions and chapter URL descriptions #17

Open
Quppa opened this issue Apr 4, 2024 · 1 comment
Open

Support for chapter descriptions and chapter URL descriptions #17

Quppa opened this issue Apr 4, 2024 · 1 comment

Comments

@Quppa
Copy link
Contributor

Quppa commented Apr 4, 2024

I wanted to float adding support for chapter descriptions (stored in TIT3 frames) and chapter URL descriptions (stored as part of WXXX frames).

Frankly, I'm not sure if any player actually supports these, but I noticed this Auphonic demo MP3 file had the value chapter url set in the WXXX frame. Presently, opening the file in mp3chapters and exporting it will silently strip the text from the output.

getID3 explicitly handles these fields.

Reading and writing these values is easy with node-id3 - URL descriptions are exposed in UserDefinedUrl, and TIT3 just maps to subtitle.

My worry is that 2 extra optional fields might make the current textarea editing approach quite messy. URL descriptions could potentially be handled with Markdown-like syntax, e.g. [My URL description](https://my.url) (retaining the option of just https://my.url for the unadorned case), but chapter descriptions are tricky.

@DominikPeters
Copy link
Contributor

DominikPeters commented Apr 4, 2024

Interesting.

URL descriptions make sense to me as a feature, and I like your markdown syntax idea (since it doesn't interfere with timestamps or with <img> tags). If you're in the mood, feel free to have a go at it. One issue I see is that URL descriptions can contain spaces which breaks the current str.split(" ") approach, so more advanced regex-ing would be needed.

let substrings = str.split(" ");
let url = null, imgTag = null;
for (let i = substrings.length - 1; i >= 0; i--) {
if (!url && urlRegex.test(substrings[i])) {
url = substrings[i];
substrings.splice(i, 1); // Remove the URL from the array
}

For chapter descriptions, I agree it's tricky. The textarea approach would be very incompatible once \n newlines get involved. It's even difficult to come up with a reasonable way in which to preserve them when a file is loaded and only minor edits are made, given that the design assumes that all chapter information is stored inside the textarea. But I suppose one can think about things like 00:00 Chapter title {*Chapter description*}, and newlines could be rendered as \n, i.e., backslash followed by n. My goal would mostly be preservation of existing descriptions, rather than providing a pleasant UI to add or edit them.

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

No branches or pull requests

2 participants