oSumAtrIX / DownOnSpot

🎧 A Spotify music and playlist downloader working with free Spotify accounts written in Rust
https://osumatrix.me
GNU General Public License v3.0
548 stars 45 forks source link

Fast downloads freeze the process (please add a delay) #64

Open Roolio247 opened 9 months ago

Roolio247 commented 9 months ago

When downloading a playlist without the MP3 conversion the process gets stuck sometimes, almost every time at some point (the completion % freezes forever). It does not happen when the conversion option is enabled. My guess is that the conversion allows for a little delay between two downloads.

Maybe adding a small delay beween two successive track downloads could do the trick?

oSumAtrIX commented 9 months ago

I can not reproduce, please include reproduction steps.

Roolio247 commented 9 months ago

sure: note that i am using a paid spotify account

using windows powershell in release directory: .\down_on_spot.exe https://open.spotify.com/playlist/5P0I08xQbvhzdRpZnrory9?si=570a78bc5b344d7f

settings: "refresh_ui_seconds": 1, "downloader": { "concurrent_downloads": 1, "quality": "Q320", "path": "D:\Backup\Musique\DownOnSpOGG\_LAST", "filename_template": "%title%", "id3v24": false, "convert_to_mp3": false, "separator": ", ", "skip_existing": true }

At some random point a song download freezes and only interrupting the process can be done

oSumAtrIX commented 9 months ago

For testing purposes, could you try this branch https://github.com/oSumAtrIX/DownOnSpot/tree/rewrite. It can only download songs for now.

Roolio247 commented 9 months ago

Sure i'll try it and let you know. However if it can only download one song at the time the issue can't be reproduced. Only happens to me when a few songs are cued

01110111000001 commented 9 months ago

I forked the script from hammadxp to work with the current REWRITE branch of DownOnSpot. This script allows to download entire playlists instead of doing it manually (as the playlists links are not currently supported by the rewrite). In the background, it simply parses the playlists and use DownOnSpot to download each song.

Note that I did not optimized the script at all, I just made some quick modifications for it to work. I'll maybe update it later but don't count on it.

You can find my fork here: https://github.com/01110111000001/unify-for-spotify

oSumAtrIX commented 9 months ago

Implementing downloads of playlists is something I can easily implement, but I haven't had the time to yet, nor do I know if this branch actually fixes said issue, if I download concurrently. Stay tuned.

01110111000001 commented 9 months ago

Implementing downloads of playlists is something I can easily implement, but I haven't had the time to yet, nor do I know if this branch actually fixes said issue, if I download concurrently. Stay tuned.

No problem! I'm really grateful for having an app that actually downloads from Spotify. So thanks @oSumAtrIX !

I replied here cause I modified this sript a month ago and by reading this issue I thought it could be useful so I shared it.

Roolio247 commented 9 months ago

For testing purposes, could you try this branch https://github.com/oSumAtrIX/DownOnSpot/tree/rewrite. It can only download songs for now.

So I did try and without surprise i could not replicate. Maybe by implementing cueuing downloads we could investigate further.

In the meantime i'll be using the approach proposed by @01110111000001, fetching individual songs URLs from playlists using the Spotify API using python (I'm not quite there yet rust-wise).

Roolio247 commented 9 months ago

So i was fiddling with the spotify API myself and came accross this limitation which might -in my uneducated and humble opinion though- be related to the issue: https://developer.spotify.com/documentation/web-api/concepts/rate-limits

oSumAtrIX commented 9 months ago

Shouldn't be hitting any rate limit, you can inspect the network traffic for any rate limit response codes though.

ckcr4lyf commented 4 months ago

Looking a bit more into it, with logs enable (export RUST_LOG=DEBUG) , and concurrent downloads, it seems the error is related to some channel logic in librespot_audio::fetch::receive:

(on current master branch, downloading an album). Will look into this

[2024-02-14T04:07:10Z ERROR librespot_core::channel] channel error: 2 1
[2024-02-14T04:07:10Z WARN  librespot_audio::fetch::receive] Error from channel for data receiver for range 9711616 (+16384).
[2024-02-14T04:07:10Z ERROR librespot_core::channel] channel error: 2 1
[2024-02-14T04:07:10Z WARN  librespot_audio::fetch::receive] Error from channel for data receiver for range 9326592 (+16384).
[2024-02-14T04:07:10Z ERROR librespot_core::channel] channel error: 2 1
[2024-02-14T04:07:10Z WARN  librespot_audio::fetch::receive] Error from channel for data receiver for range 9641984 (+16384).
[2024-02-14T04:07:10Z ERROR librespot_core::channel] channel error: 2 1
[2024-02-14T04:07:10Z WARN  librespot_audio::fetch::receive] Error from channel for data receiver for range 9326592 (+16384).
[2024-02-14T04:07:10Z ERROR librespot_core::channel] channel error: 2 1
[2024-02-14T04:07:10Z ERROR librespot_core::channel] channel error: 2 1
ckcr4lyf commented 4 months ago

FYI: if i remove concurrency and do one song at a time, it works (even for the whole album).

oSumAtrIX commented 4 months ago

I am unsure if this is related to librespot thought. It might be worth a shot to open an issue there if you think that makes sense.