justin025 / onthespot

OnTheSpot is an easy-to-use music downloader built with Python and Qt. Search for songs, albums, or playlists and download them directly to your device.
GNU General Public License v2.0
133 stars 14 forks source link

On certain characters the program goes into infinite loop. #42

Open 0rkaM opened 1 month ago

0rkaM commented 1 month ago

Feature Description

On certain playlists the program downloads almost all songs except for few and on those few the program goes into infinite loop, where the log file create fill up in few seconds: in fact the program create in short succession onthespot.log.1 onthespot.log.2 and than it write over onthespot.log in a loop.

Here is the log:

onthespot.log

To interrupt the infinite loop the only solution is to shut down the program and restart... but it will happen again on similar situation.

Justification

I would like the program to be useable without getting stuck.

Additional Information

I am using Win10 and OnTheSpot v1.0.0rc7

P.S.: in the issue report there is not anymore way to differentiate between Bugs and Feature Requests, also I didn't see the template to fill in standard info as OS, version, etc.

0rkaM commented 1 month ago

Additional information: Interesting is that there is problem downloading always on the same file, when downloading from this playlist link (https://open.spotify.com/playlist/5CMvAWTlDPdZnkleiTHyyo?si=d95924e355704cf6), and specifically exacerbated and rendered more obvious after all other files are downloaded, and the 'Clear Completed/Cancelled Items' button is used... but if the song in question is downloaded using its individual link (from the same playlist (https://open.spotify.com/track/04BNQFaBlFF7WDeTb1V0AP?si=f4ce2de1db974e2d) the file downloads just fine.

P.S.: The same problem happens with v1.0.0rc6.

justin025 commented 1 month ago

I can't reproduce this, have you changed your settings in any way?

0rkaM commented 4 weeks ago

Yes, I did change the setting. here is the config file (changed the suffix to upload it here): otsconfig.txt

justin025 commented 3 weeks ago

I still cannot reproduce this, I will have to try on a windows machine in a bit. I'll keep you posted

justin025 commented 3 weeks ago

I still cannot reproduce this on windows 11 but I believe I fixed the infinite loop on unknown failures, you can check this link and let me know if it RC-9 fixes the issue your machine. https://github.com/justin025/onthespot/releases/tag/v1.0.0

0rkaM commented 3 weeks ago

Still happening. OK let me put down all the steps and maybe a capture of what is actually happening, so you can see what to look for.

  1. enter this link in the 'Search term or url' field in the Search Tab and press enter to queue all the files into the Downloads Tab: https://open.spotify.com/playlist/5CMvAWTlDPdZnkleiTHyyo?si=d95924e355704cf6
  2. After all the files are downloaded one song will show as 'Failed': Song number 72 'The Best Part'. I would assume that the file would try to redownload 1 (one) time after 71 seconds cool-down as set my Settings, but instead it will retry periodically about every 12 seconds on an infinite loop.
  3. To make the loop more obvious, if we now click on the 'Clear Completed/Cancelled Items' button, effectively clearing from the queue all the song downloaded (or already existing in my case, since this is not the first time), we will have only Song number 72 'The Best Part' in the queue and now the loop will be multiple time a second.

Here the resized video: https://github.com/user-attachments/assets/99ee24cc-0684-41f4-9726-7862a8f43d3e

0rkaM commented 3 weeks ago

Happened again with the same song in another context, this is v1.0.0rc9, but it also happens with rc4, rc5, rc6, rc7... I don't have rc8:

https://github.com/user-attachments/assets/da9fc0a0-ba5e-4a2c-bccd-e320322d34e2

What could cause this? Do you think it's something specific to my settings? If so, what should I try to change and test?

justin025 commented 3 weeks ago

Found the loop problem because of that video lol, still don't know why that specific song downloads fine as an individual item but fails inside the playlist.

Could you try this build and see if it still loops https://github.com/justin025/onthespot/actions/runs/11605689302/artifacts/2126521682

0rkaM commented 3 weeks ago

Well, this last version does fail still, but it does not go into a loop.

The error seems relate to the Unicode Character “ē” (U+0113) as the log implies, but why? On position 17 of the (metadata) string? And why would it map to ?

[2024-10-30 22:53:42,497 :: gui.main_ui :: gui\mainui.py -> 523:retry_all_failed_downloads() :: INFO] -> Trying to cancel : 04BNQFaBlFF7WDeTb1V0AP
[2024-10-30 22:53:42,542 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "anamē; gardenstate; Bien"; Allow path separators: False
[2024-10-30 22:53:42,542 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "The Best Part"; Allow path separators: False
[2024-10-30 22:53:42,543 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "gardenstate"; Allow path separators: False
[2024-10-30 22:53:42,543 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "The Best Part"; Allow path separators: False
[2024-10-30 22:53:42,543 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "2021"; Allow path separators: False
[2024-10-30 22:53:42,543 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "melodic house"; Allow path separators: False
[2024-10-30 22:53:42,544 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "Anjunabeats"; Allow path separators: False
[2024-10-30 22:53:42,544 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: ""; Allow path separators: False
[2024-10-30 22:53:42,544 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "Progressive House 2024"; Allow path separators: False
[2024-10-30 22:53:42,545 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "Soave"; Allow path separators: False
[2024-10-30 22:53:42,545 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "Progressive House 2024"; Allow path separators: False
[2024-10-30 22:53:42,546 :: utils :: utils.py -> 35:       sanitize_data() :: INFO] -> Sanitising string: "Soave"; Allow path separators: False
[2024-10-30 22:53:42,547 :: spotify.downloader :: downloader.py -> 256:                 run() :: ERROR] -> Unknown Exception: 'charmap' codec can't encode character '\u0113' in position 17: character maps to <undefined>

Maybe I'll try to clone the repo and run it in VS or VSC stepping the debuggers. To see the actual variable and data.

0rkaM commented 3 weeks ago

One thing is thou, that I still cannot clear it: before because of loop, now even if no loop and I cancel it, it does not clear

https://github.com/user-attachments/assets/1e5aa609-723c-4521-b947-1e123a3431ce

justin025 commented 3 weeks ago

Hopefully this will be the last commit to fix this issue: https://github.com/justin025/onthespot/actions/runs/11619745013/artifacts/2130603840

As for the characters I am still unsure, I'll try out the playlist on a windows 10 pc and get back to you.

0rkaM commented 3 weeks ago

I am away for business; I am going to test when I am back.

I suggest that if this last doesn't fix it, we keep the issue open, but under ice until we find more info... and it does NOT need to be proactively researched by you, you should actually attend to other tasks, or even just take a break.

Sometime by walking away and doing other things solutions are found by allowing yourself space to actuate other ideas, that give you a fresh new approach and inspiration... or just luck.

Also, it could be caused not by your code, but one of the libraries (un)known bugs, or even the service itself, so out of our sphere of control.

I'll post after test and if I find more info. Cheers.

justin025 commented 2 weeks ago

I experienced something similar when debugging in windows, the terminal itself was unable to print extended unicode characters. You can try deleting all logging in downloader that prints the file path and see if this resolves the issue, if you need me to send a build of that let me know