audible-cli icon indicating copy to clipboard operation
audible-cli copied to clipboard

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

Open esskayesss opened this issue 1 year ago • 14 comments

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

esskayesss avatar May 28 '23 05:05 esskayesss

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.

mkb79 avatar May 28 '23 08:05 mkb79

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.

esskayesss avatar May 28 '23 10:05 esskayesss

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.

dadegroot avatar Mar 09 '24 09:03 dadegroot

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

mkb79 avatar Mar 09 '24 19:03 mkb79

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

dadegroot avatar Mar 09 '24 23:03 dadegroot

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.

mkb79 avatar Mar 10 '24 06:03 mkb79

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

dadegroot avatar Mar 10 '24 07:03 dadegroot

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 avatar Mar 22 '24 19:03 philgoetz

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.

philgoetz avatar Mar 22 '24 19:03 philgoetz

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 cmd_decrypt.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.

mkb79 avatar Mar 22 '24 19:03 mkb79

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?

philgoetz avatar Mar 22 '24 20:03 philgoetz

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.

mkb79 avatar Mar 22 '24 21:03 mkb79

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: @.***>

philgoetz avatar Mar 26 '24 19:03 philgoetz

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.

mkb79 avatar Mar 26 '24 20:03 mkb79