mkb79 / audible-cli

A command line interface for audible package. With the cli you can download your Audible books, cover, chapter files.
GNU Affero General Public License v3.0
451 stars 46 forks source link

download error: peer closed connection without sending the complete message body #146

Open esskayesss opened 1 year ago

esskayesss commented 1 year ago

a lot of the longer file downloads are failing with this same error message. is there a way for the application to try and resume the download?

the download is also only slow for aax files ar about 600Kbps. aaxc downloads are faster at around 20Mbps

mkb79 commented 1 year ago

a lot of the longer file downloads are failing with this same error message. is there a way for the application to try and resume the download?

I‘m thinking about how to implement a resume function in Python. In the meantime you can try to use --timeout 0 with the download command. This will disable all timeouts.

the download is also only slow for aax files ar about 600Kbps. aaxc downloads are faster at around 20Mbps

aax files are downloaded from another Amazon server (in another country?). So this can result in a slow download speed.

esskayesss commented 1 year ago

thank you for the quick response. i will try to use --timeout 0 with the download command and see if it works better. if i'm not wrong, aax files have become almost unnecessary as long as the aaxc version is available.

i wish you all the best with your project. the library is also really great and i am looking forward to using it in my application. thanks for putting your time into this.

dadegroot commented 6 months ago

I have this issue as well. I use --timeout 0 but it still takes many attempts to download a file. The command issues:

error: peer closed connection without sending complete message body (received 4626768 bytes, expected 1205266010) No new files downloaded.

However, it exits with exit code 0. I figure it's just amazon being a pain with third party downloads, terminating abnormally, but it'd be nice if when that happened the command set the exit code to something other than 0, then at least you could script the retries if there was an error.

mkb79 commented 6 months ago

Occur this error by downloading aax files, aaxc files or both?

dadegroot commented 6 months ago

aax files (since I'm later converting to mfb files with ffmpeg and that seems easier than aaxc)

mkb79 commented 6 months ago

I would prefer you to download aaxc files. This issue is aax related. I don't want to go to deep in the technical background. But there are two ways to download aax files. Both are implemented in audible_cli.models.LibraryItem class, but only the oldest one are used by audible-cli. Because downloading aaxc files is much faster than aax and will support resume function very soon (this feature is implemented in the master branch but not released yet), I don't want to spend time to rework the aax part.

Here you can find a decrypt plugin which helps you decrypting aaxc files.

dadegroot commented 6 months ago

Oh fair enough. I'll give that plugin a go. It should streamline the workflow somewhat :)

philgoetz commented 5 months ago

Here you can find a decrypt plugin which helps you decrypting aaxc files.

Is there a way to invoke that through the command line of audible-cli? Or instructions on how to run it? I don't know Python, and I can't tell from the code how to run it. Also I don't know what you mean here by "plugin". What does it plug into?

I‘m thinking about how to implement a resume function in Python. In the meantime you can try to use --timeout 0 with the download command. This will disable all timeouts.

I had the same problem as the OP, using --timeout 0:

$ audible download -o aax --all --aax-fallback --timeout 0 ... Language_of_the_Spirit_An_Introduction_to_Classical_Music-LC_64_22050_stereo.aax: 9%|▉ | 25.3M/271M [01:10<11:22, 378kB/s] error: peer closed connection without sending complete message body (received 26575490 bytes, expected 284615161)

I realize you aren't going to fix this for aax, so I will switch to downloading aaxc, which I was avoiding bcoz I don't know how to decrypt aaxc.

philgoetz commented 5 months ago

Is there a way to invoke that through the command line of audible-cli? Or instructions on how to run it? I don't know Python, and I can't tell from the code how to run it. Also I don't know what you mean here by "plugin". What does it plug into?

Ah, I found the README in the plugin directory. Hopefully I can figure it out from that.

mkb79 commented 5 months ago

Is there a way to invoke that through the command line of audible-cli? Or instructions on how to run it? I don't know Python, and I can't tell from the code how to run it. Also I don't know what you mean here by "plugin". What does it plug into?

If you run an audible-cli command with debug messages turned on (e.g. audible -v debug wishlist list) then your plugin dir is printed out. In these folder copy the cmddecrypt.py file. Important is, that the file name must be named using the scheme cmd[***].py. Then you can run audible decrypt -h on your shell.

philgoetz commented 5 months ago

If you run an audible-cli command with debug messages turned on (e.g. audible -v debug wishlist list) then your plugin dir is printed out.

The directory it gives as my plugin directory doesn't even exist. It's where the plugin directory was when I installed audible-cli version 0. I thought I recompiled everything when I did "pip install .[pyi]". How can I wipe the registry and everything, and do a fresh install of audible-cli?

mkb79 commented 5 months ago

The directory it gives as my plugin directory doesn't even exist. It's where the plugin directory was when I installed audible-cli version 0.

Yeah, this directory is not be automatically created. You have to do it.

I thought I recompiled everything when I did "pip install .[pyi]". How can I wipe the registry and everything, and do a fresh install of audible-cli?

I'm not familiar with Cygwin. So I need some more information. Do you use a Python virtual environment (e.g. venv)? But theoretically run pip uninstall audible-cli should work to remove the package. Optionally you can remove the dependencies of audible-cli this way.

philgoetz commented 5 months ago

pip uninstall audible-cli didn't clear the setting of AUDIBLE_CONFIG_DIR. I changed it manually, and the new release (0.3.2b1) is running now, and doing fine so far.

Message ID: @.***>

mkb79 commented 5 months ago

If found this information about environment variables and Cygwin. So you have to unset the AUDIBLE_CONFIG_DIR variable and the default one is used. Then you have to make sure to move the content of the config directory to the new location.