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

Fixes m4b chapters only taken from first file. #1456

Merged
merged 6 commits into from
Jan 30, 2023
Merged

Conversation

jramer
Copy link
Contributor

@jramer jramer commented Jan 29, 2023

Noticed that I was only getting chapters from the first m4b file and this fixes that.
Only tested with m4b. Don't know if other file formats support chapters.

Code uses let and optional chaining. Hope that's ok.

@advplyr
Copy link
Owner

advplyr commented Jan 29, 2023

There are some cases where the chapters are embedded in every audio file the same. This is assuming that each audio file has its own separate chapters, which is what makes the most sense but is not guaranteed.

@jramer
Copy link
Contributor Author

jramer commented Jan 29, 2023

There are some cases where the chapters are embedded in every audio file the same. This is assuming that each audio file has its own separate chapters, which is what makes the most sense but is not guaranteed.

Interesting.
Ok but from my point of view that case is giving wrong input and should not really be considered. I mean my files have correct chapters but only get them from the first file.
If you provide multiple files with the same chapters. It's the chapters that are wrong. Not the parsing of the chapters.

Or do you mean that those chapters actually span multiple files already? If so I guess I could check that the last chapter is contained within the file duration.

And if not. I guess the check would be to compare the last chapters start/end to the previous file.

@jramer
Copy link
Contributor Author

jramer commented Jan 30, 2023

@advplyr Added a check that keeps original implementation when the first and second audio files chapters titles are the same.
Hope that's enough for the special case.

Is there a way to re-parse chapters for a book?
Tried both to "Force Re-Scan" on the Library and also "Re-Scan" on the Edit details popover. But I need to remove and re-add the book to get correct chapters.

server/objects/mediaTypes/Book.js Outdated Show resolved Hide resolved
server/objects/mediaTypes/Book.js Outdated Show resolved Hide resolved
@advplyr
Copy link
Owner

advplyr commented Jan 30, 2023

Thanks, this should do it. The chapters are only parsed again if any of the audio files are updated. This can be improved but we want to make sure to not overwrite changes someone made in the chapter editor that haven't yet been embedded.

@advplyr
Copy link
Owner

advplyr commented Jan 30, 2023

This is in MediaFileScanner.js line 278

@advplyr advplyr merged commit ba5ad22 into advplyr:master Jan 30, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants