jo1gi / audiobook-dl

Audiobook CLI downloader
GNU General Public License v3.0
234 stars 38 forks source link

CTOC with over 256 child_element_ids causes crash #19

Open lullius opened 1 year ago

lullius commented 1 year ago

I'm getting a crash when trying to download audiobooks with more than 256 chapters.

ValueError: bytes must be in range(0, 256)

It seems CTOC can't take more than 256 child_element_ids. If I limit the range to 255 it works fine: https://github.com/jo1gi/audiobook-dl/blob/7ff13271e32012fa26c4138735e420d951f84f3b/audiobookdl/output/metadata.py#L72

I also noticed that even if some chapters aren't in child_element_ids they still work fine in mpv and show up in ffprobe. They even work without CTOC. Should we split the chapters up in multiple CTOCs? Do we need the CTOC at all?

A book with more than 256 chapters: https://www.storytel.com/no/books/1984-1109466

jo1gi commented 1 year ago

I just looked in up and it seems like CHAP frames does not need a CTOC frame but it is still recommended.

For now I will just remove the CTOC frame but it would be nice with a better solution.

test2a commented 1 year ago

@lullius hey... what happened to pylibby? i am not able to see the repo

test2a commented 1 year ago

@lullius i dont have that.... i just checked the repo and it is gone.

test2a commented 1 year ago

@lullius ok. i feel your concern. would it be possible for you to take that development "away from your person"? say someone not you? like me for example or any other random non-american?

i am VERY passionate about these things and i am willing to take the blame in "american courts" if that means supporting this project.

I was hoping that we could in future like go and implement this as a backend for lazylibrarian so that we could search for a book, the app would show "here is a copy available on libby, do you want to borrow or hold" and auto download when ready and listen. popcorntime for audiobooks.

there are endless possibilities around audiobooks.

anyway, how is the current audiobook-dl project any different? forget about bookbeat but why remove support for libby or is that working here? i see support for overdrive but not libby here

jo1gi commented 1 year ago

@test2a I think Libby is just an app for Overdrive. audiobook-dl should work with any audibook on Libby.

test2a commented 1 year ago

@jo1gi sure but overdrive is about to be discontinued in a short period of time. Will that still work or should we use code from pylibby?

jo1gi commented 1 year ago

@test2a Is it only the Overdrive app that is going to be discontinued or is it also the websites?

jo1gi commented 1 year ago

@test2a I looked it up. It is only the app. audiobook-dl uses the websites api, so it shouldn't affect audiobook-dl when the app is discontinued.

test2a commented 1 year ago

@jo1gi alright. that makes me more confident.