ManiMatter / decluttarr

Watches radarr, sonarr, lidarr, readarr and whisparr download queues and removes downloads if they become stalled or no longer needed.
GNU General Public License v3.0
100 stars 15 forks source link

Lidarr support #9

Closed waredrive closed 8 months ago

waredrive commented 8 months ago

Hi, Thanks for the great script. I'm wondering though if it would be possible to add support for Lidarr as well? I'm usually having a lot of stalled downloads or downloads with missing data when it comes to Lidarr.

ManiMatter commented 8 months ago

hi @waredrive , thanks for reaching out.

I had a quick look at the lidarr API doc, and it looks pretty similar to Sonarr/Radarr, so I guess expanding it should not be that difficult. Since I do not use Lidarr myself, what I can offer is that I duplicate the logic from Sonarr for Lidarr, but I'd need your help with testing it and letting me know any issues.

Would you that work for you? If yes, I can put a first attempt with lidarr together, publish it on the dev package, and you can test. How does that sound?

waredrive commented 8 months ago

Sounds great! I'll gladly help out with the testing

ManiMatter commented 8 months ago

Done, it's in the DEV branch (and package). As said: I've added the code completely blind by implementing the same structure as for Sonarr; 99% there will be something that won't work. Please try it out, and let me know :)

waredrive commented 8 months ago

Will do :+1:

waredrive commented 8 months ago

I'm glad to report that everything is working the same way it works in Sonarr and Radarr. Downloads are being removed, added to blocklist and re-fetched. I saw one warning in the log the next run after all the files have been cleaned up, but it seems it didn't affect anything?

[VERBOSE]: Cleaning queue on Radarr:
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: Cleaning queue on Lidarr:
[WARNING]: >>> Queue cleaning failed on Lidarr. (File: queue_cleaner.py / Line: 218 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!
ManiMatter commented 8 months ago

great news, that means we're almost there. That error we see there we need to iron out though.

Can you please do the following:

waredrive commented 8 months ago

Ok, will do

waredrive commented 8 months ago

Just FYI, the error seems to have vanished after restarting the containers. I will run Lidarr for a while, downloading new files, and we'll see if I get it again.

ManiMatter commented 8 months ago

I suspect you can force this bug by 1) add a new artist 2) grab album (so it‘s in the queue) 3) delete the artist (item will still be in queue but „orphaned“) 4) run the script

waredrive commented 8 months ago

Ok, just did what you wrote and the album was deleted directly (on container start) without any error messages..

ManiMatter commented 8 months ago

Ok and you got the corresponding info in the log that it would be removed, right?

so let‘s let it run for a few days and when you are happy with it we merge it to the latest package

waredrive commented 8 months ago

Sure, will report back in a few days.

waredrive commented 8 months ago

Ok, I have been using the dev version now for a couple of days, and the Lidarr part is working as expected. I think it's ok to merge it to latest.