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

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

Open
esskayesss opened this issue May 28, 2023 · 14 comments

Comments

@esskayesss
Copy link

esskayesss commented May 28, 2023

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
Copy link
Owner

mkb79 commented May 28, 2023

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
Copy link
Author

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
Copy link

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
Copy link
Owner

mkb79 commented Mar 9, 2024

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

@dadegroot
Copy link

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

@mkb79
Copy link
Owner

mkb79 commented Mar 10, 2024

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
Copy link

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

@philgoetz
Copy link

philgoetz commented Mar 22, 2024

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
Copy link

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
Copy link
Owner

mkb79 commented Mar 22, 2024

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.

@philgoetz
Copy link

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
Copy link
Owner

mkb79 commented Mar 22, 2024

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
Copy link

philgoetz commented Mar 26, 2024 via email

@mkb79
Copy link
Owner

mkb79 commented Mar 26, 2024

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.

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

No branches or pull requests

4 participants