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

Exceptions and server errors aren't handled gracefully #4

Open
basdp opened this issue Jan 11, 2024 · 1 comment
Open

Exceptions and server errors aren't handled gracefully #4

basdp opened this issue Jan 11, 2024 · 1 comment

Comments

@basdp
Copy link

basdp commented Jan 11, 2024

When a call fails, it throws an exception to the user. For instance:

  Album: Star Wars, Episode II: Attack of the Clones (8925ee19b2c751dde5ff30a8d854d131)
    p:36 → r:2 | Star Wars Main Title / Ambush on Coruscant
    p:34 → r:2 | Across the Stars (Love Theme From Attack of the Clones)
    p:33 → r:1 | Zam the Assassin / The Chase Through Coruscant
    p:36 → r:2 | Yoda and the Younglings
    p:35 → r:2 | Departing Coruscant
    p:38 → r:2 | Anakin and Padmé
    p:34 → r:2 | Jango’s Escape
    p:34 → r:2 | The Meadow Picnic
    p:35 → r:2 | Bounty Hunter’s Pursuit
    p:34 → r:2 | Return to Tatooine
    p:30 → r:1 | The Tusken Camp / The Homestead
    p:48 → r:2 | Love Pledge / The Arena
    p:38 → r:2 | Confrontation With Count Dooku / Finale
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
  File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 461, in getresponse
    httplib_response = super().getresponse()
  File "/usr/local/lib/python3.9/http/client.py", line 1377, in getresponse
    response.begin()
  File "/usr/local/lib/python3.9/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.9/http/client.py", line 289, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

I would expect the call to be retried on exception, and ultimately, if an exception occurs more than once for a track/album, skip it and continue.

An exponential backoff for retrying would also be cool. Especially when you get rate-limited or the Spotify servers/Navidrome is overloaded.

@SickProdigy
Copy link

SickProdigy commented Apr 22, 2024

My thought:
When it crashes/on startup grep all lines containing artist in logs. Save to ouput.txt
In output.txt find full library, add All other lines that end in ] using some count function i guess.

grep -r 'Artist' /sptnr/logs | awk '{print}' > /sptnr/output.txt
Then just count every line. Subtract 1 for 0. use that number to continue where you left off.

output to .env file probably. Or update a key in .env file.

Maybe when it first starts set the index to 0.

Could go further grep 'artists' find the int at the end should be your full library size of artists. set it as your LIMIT

As far as i got for tonight, been working on beets all day not working hopefully get this working
Edit: it does work, just keeps timing out I'm assuming from spotify rate limit. Just need something to add a little time between each run. Was thinking just have the container restart over and over till finished lol, but think it might need a PR
Edit2: ah or just use -s 1 -l 1 in a bash script to loop around the whole library. Whether crashes on the artist or succeeds atleast will mostly get done? We'll see

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

2 participants