audiobookshelf-app icon indicating copy to clipboard operation
audiobookshelf-app copied to clipboard

partial downloads break downloading of an audiobook

Open zombiehoffa opened this issue 3 years ago • 6 comments

This appears to be downloading to the download dir and then copying over to storage dir. If audiobook shelf app is interrupted between passing download to whatever is downloading and completing moving to the storage dir you will end up with a fully downloaded audiobook in your download dir but will not be able to play the local copy in the app or initiate a successful download because whatever is actually downloading the book appends -1, -2, etc depending how many copies are in the download dir and when audiobookshelf app tries to copy over the copy not associated with the download request, it fails. You can recreate this behaviour by starting a download but killing the app in between when the download of the audiobook itself is started and when it is finished.

from my previous bug where I figured out what was happening: The issue appears to be the app downloads it expecting it to be named string.mp3 and when the android downloading mechanism finds string.mp3 already in the download dir it puts it in the download dir as string-1.mp3, at which points audiobookshelf app loses its mind and gives all this weird behavior.

zombiehoffa avatar Nov 12 '21 23:11 zombiehoffa

Ah just commented on the other issue you closed basically saying that naming issue needs to be resolved. Thanks for opening another issue on that.

advplyr avatar Nov 13 '21 00:11 advplyr

I figured I would try and save you having to read some of my ramblings by closing that one and opening a more concise one with the actual problem. ;)

zombiehoffa avatar Nov 13 '21 01:11 zombiehoffa

So, playing with this a bit more, it looks like it preallocates the file when the download starts so perhaps the fix is as easy as checking the existence of the file and deleting it in the download dir before download starts if it exists?

zombiehoffa avatar Nov 15 '21 21:11 zombiehoffa

That is basically the fix, but there are some other issues with the downloader I would like to resolve with that.

advplyr avatar Nov 16 '21 02:11 advplyr

based on commits I see to the app, I am very excitedly awaiting closing this bug (and also s uper excited to see sync of progress for downloaded books working!! Nice work!)

zombiehoffa avatar Nov 20 '21 15:11 zombiehoffa

Unfortunately my last release is stuck in review on the play store again, which was fixing some of the sync bugs. The current release available is going to buggy until they approve that release.

advplyr avatar Nov 20 '21 15:11 advplyr