Code Monkey home page Code Monkey logo

decluttarr's People

Contributors

craggles17 avatar fxsch avatar gaelmagnan avatar manimatter avatar matszwe02 avatar swatcats avatar thenetworkguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

decluttarr's Issues

[Feature request] Remove by setting post import category

I'm currently using qBit_Manage to manage my torrent in qBitTorrent. Mainly for private tracker requirements.
I'm using post import categories in Radarr/Sonarr so qBit_Manage knows which torrents it's allowed to delete.

I'd like an option to set the post import category instead of deleting. (Like the option you can now select in Radarr/Sonarr)

Error in config.conf-Example

Installed via git under Windows 10. The readme says to rename and use config.conf-Example. However, it contains the string "REMOVE_MISSING_FILES = True" twice, which causes decluttarr to error out and not continue. After removing the 2nd instance of the string the app runs and repeats every 10 mins (in test mode) as expected.

[Feature Req] - Attempt to Pause and Unpause Download to Unstall

Sometimes pausing and unpausing stalled downloads helps get things moving again, perhaps it would be worth including this as a feature? Not sure what metadata is available to Decluttarr but woulld be most handy if there is a count of peers—otherwise just skip the pause/unpause step?

TypeError

Hi again,

Still having issue with trying to get decluttarr to run with sonarr. I submitted this before but I was in the process of moving and had to shutdown my server and couldn't get back with you. I tried pulling a new image but still getting the same error.

Still no change, still getting same error...

TypeError: unsupported operand type(s) for +: 'dict' and 'dict'
TypeError: unsupported operand type(s) for +: 'dict' and 'dict'
TypeError: unsupported operand type(s) for +: 'dict' and 'dict'

Using the below docker compose:

version: "3.3"
services:
sonarr-decluttarr:
image: ghcr.io/manimatter/decluttarr:dev
container_name: sonarr-decluttarr
restart: always
environment:
- TZ=America/Chicago
- PUID=1000
- PGID=1000
## General
- LOG_LEVEL=DEBUG
#- TEST_RUN=True
#- SSL_VERIFICATION=False
## Features
- REMOVE_TIMER=10
- REMOVE_FAILED=True
- REMOVE_METADATA_MISSING=True
- REMOVE_MISSING_FILES=True
- REMOVE_ORPHANS=True
- REMOVE_SLOW=False
- REMOVE_STALLED=True
- REMOVE_UNMONITORED=True
#- MIN_DOWNLOAD_SPEED=100
- PERMITTED_ATTEMPTS=3
- NO_STALLED_REMOVAL_QBIT_TAG=Don't Kill
- IGNORE_PRIVATE_TRACKERS=False
## Sonarr
- SONARR_URL=https://sonarr.myrealm.site
- SONARR_KEY=Removed
## qBittorrent
- QBITTORRENT_URL=https://sqbit.myrealm.site
- QBITTORRENT_USERNAME=Removed
- QBITTORRENT_PASSWORD=Removed

Queue cleaning failed on Lidarr.

I get the following error output:
Queue cleaning failed on Lidarr. (File: queue_cleaner.py / Line: 233 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)

Only deletes slow downloads

During the initial testing of the script, I was running it in a Docker container against the qBittorrent default ASUSTOR App with great success. As this was a temporary setup, I decided to move the qBittorrent client to a Docker container as well. That’s when the problem started.

I have created a scenario where there are 3 files with different conditions for deletion. As you can see by the picture below, there is one stalled download, one downloading metadata, and one slow. According to the log, the slow download is deleted successfully, but not the others. The logs keep saying “Queue is clean”. Am I missing something obvious? Is this related to issue #56?

before:
image

after:

image

DEBUG log:

_Decluttarr_logs_DEBUG.txt

The setup is as follow:

qBittorrent container -> V4.6.4 pulled from lscr.io/linuxserver/qbittorrent:latest
gluetu container -> pulled from qmcgaw/gluetun (Used as a VPN tunnel for the qBittorrent container)
raddar container -> V5.3.6.8612 from lscr.io/linuxserver/radarr:latest
sonarr container -> V4.0.3.1413 from lscr.io/linuxserver/sonarr :latest
decluttarr container -> docker compose as follows:

 version: "3.3"
 services:
   decluttarr:
     image: ghcr.io/manimatter/decluttarr:latest
     container_name: Decluttarr
     restart: always
     environment:
       - TZ=America/Sao_Paulo
       - PUID=1000
       - PGID=1000
       ## General
       - LOG_LEVEL=DEBUG
       #- TEST_RUN=True
       #- SSL_VERIFICATION=False
       ## Features 
       - REMOVE_TIMER=5
       - REMOVE_FAILED=True
       - REMOVE_METADATA_MISSING=True
       - REMOVE_MISSING_FILES=True     
       - REMOVE_ORPHANS=True
       - REMOVE_SLOW=True
       - REMOVE_STALLED=True
       - REMOVE_UNMONITORED=False
       - MIN_DOWNLOAD_SPEED=20
       - PERMITTED_ATTEMPTS=3
       - NO_STALLED_REMOVAL_QBIT_TAG=Don't Kill
       - IGNORE_PRIVATE_TRACKERS=False
       ## Radarr
       - RADARR_URL=http://192.168.68.113:17878
       - RADARR_KEY=REDACTED
       ## Sonarr
       - SONARR_URL=http://192.168.68.113:18989
       - SONARR_KEY=REDACTED
       ## Lidarr
       - LIDARR_URL=
       - LIDARR_KEY=$LIDARR_API_KEY
       ## Readarr
       - READARR_URL=
       - READARR_KEY=$READARR_API_KEY
       ## qBittorrent
       - QBITTORRENT_URL=http://192.168.68.113:8080
       - QBITTORRENT_USERNAME=REDACTED
       - QBITTORRENT_PASSWORD=REDACTED

Not deleting orphans from qbittorrent

I've set decluttarr to delete orphans from qbittorrent, but for some reason they are not removed.

docker-compose:

  decluttarr:
    image: ghcr.io/manimatter/decluttarr:latest
    container_name: decluttarr
    restart: unless-stopped
    environment:
      - TZ=Etc/UTC
      - PUID=1001
      - PGID=1001
      ## General
      - LOG_LEVEL=VERBOSE
      #- TEST_RUN=True
      #- SSL_VERIFICATION=False
      ## Features
      - REMOVE_TIMER=10
      - REMOVE_FAILED=True
      - REMOVE_METADATA_MISSING=True
      - REMOVE_MISSING_FILES=True
      - REMOVE_NO_FORMAT_UPGRADE=True
      - REMOVE_ORPHANS=True
      - REMOVE_SLOW=False
      - REMOVE_STALLED=True
      - REMOVE_UNMONITORED=True
      - MIN_DOWNLOAD_SPEED=100
      - PERMITTED_ATTEMPTS=3
      - NO_STALLED_REMOVAL_QBIT_TAG=Don't Kill
      - IGNORE_PRIVATE_TRACKERS=False
      ## Radarr
      - RADARR_URL=http://radarr:7878
      - RADARR_KEY=
      ## Sonarr
      - SONARR_URL=http://sonarr:8989
      - SONARR_KEY=
      ## Lidarr
      - LIDARR_URL=http://lidarr:8686
      - LIDARR_KEY=
      ## Readarr
      - READARR_URL=http://readarr:8787
      - READARR_KEY=
      ## qBittorrent
      - QBITTORRENT_URL=http://qbittorrent:22222
      - QBITTORRENT_USERNAME=
      - QBITTORRENT_PASSWORD=

Log:

[INFO   ]: ##################################################
[INFO   ]: Decluttarr - Application Started!
[INFO   ]:
[INFO   ]: *** Current Settings ***
[INFO   ]: Version: v1.41.0
[INFO   ]: Commit: 66ea31b
[INFO   ]:
[INFO   ]: True | Removing failed downloads
[INFO   ]: True | Removing downloads missing metadata
[INFO   ]: True | Removing downloads missing files
[INFO   ]: True | Removing downloads that fail on import (no format upgrade)
[INFO   ]: True | Removing orphan downloads
[INFO   ]: False | Removing slow downloads
[INFO   ]: True | Removing stalled downloads
[INFO   ]: True | Removing downloads belonging to unmonitored items
[INFO   ]:
[INFO   ]: Running every: 0 days 0 hours 10.0 minutes
[INFO   ]: Permitted number of times before stalled/missing metadata/slow downloads are removed: 3
[INFO   ]: Downloads with this tag will be skipped: "Don't Kill"
[INFO   ]: Private Trackers will be skipped: False
[INFO   ]:
[INFO   ]: *** Configured Instances ***
[INFO   ]: Radarr: http://radarr:7878/api/v3
[INFO   ]: Sonarr: http://sonarr:8989/api/v3
[INFO   ]: Lidarr: http://lidarr:8686/api/v1
[INFO   ]: Readarr: http://readarr:8787/api/v1
[INFO   ]: qBittorrent: http://qbittorrent:22222/api/v2
[INFO   ]:
[INFO   ]: *** Check Instances ***
[INFO   ]: OK  | Radarr
[INFO   ]: OK  | Sonarr
[INFO   ]: OK  | Lidarr
[INFO   ]: OK  | Readarr
[INFO   ]: OK | qBittorrent
[INFO   ]:
[INFO   ]: ##################################################
[INFO   ]:
[VERBOSE]: --------------------------------------------------
[VERBOSE]: Cleaning queue on Radarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Lidarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Readarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]:
[VERBOSE]: Queue clean-up complete!
[VERBOSE]: --------------------------------------------------
[VERBOSE]: Cleaning queue on Radarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Lidarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Readarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]:
[VERBOSE]: Queue clean-up complete!

Manifest unknown when pulling dev and latest

Hi @craggles17
I adapted the dev.yml in the same way as you did main.yml and now the ‚manifest unknown‘ error seems back when pulling the dev image as well as the latest image.

would you mind having a look?
Thank you so much for your experience here

[Feature Request] Handle "Not a custom format upgrade"

My setup is fully automated using the trash guides but I've noticed quite a lot of downloads get stuck in queue with message. (Not a Custom Format upgrade for existing movie file(s))

I was wondering if could get something to remove these items as well?

TypeError on Start (unsupported operand)

Hey,

So trying to setup a Decluttarr instance for Sonarr but keep getting this TypeError. My Radarr instance is working.

I have two different VM's one for Radarr and one for Sonarr because I needed two instances of qBittorrent to separate movies and tv.

I thought it was my compose file at first but i'm confident that's not the issue now. I don't know why this is happening.

image

version: "3.3"
services:
sonarr-decluttarr:
image: ghcr.io/manimatter/decluttarr:latest
container_name: sonarr-decluttarr
restart: always
environment:
- TZ=America/Chicago
- PUID=1000
- PGID=1000
## General
- LOG_LEVEL=VERBOSE
#- TEST_RUN=True
#- SSL_VERIFICATION=False
## Features
- REMOVE_TIMER=10
- REMOVE_FAILED=True
- REMOVE_METADATA_MISSING=True
- REMOVE_MISSING_FILES=True
- REMOVE_ORPHANS=True
- REMOVE_SLOW=False
- REMOVE_STALLED=True
- REMOVE_UNMONITORED=True
#- MIN_DOWNLOAD_SPEED=100
- PERMITTED_ATTEMPTS=3
- NO_STALLED_REMOVAL_QBIT_TAG=Don't Kill
- IGNORE_PRIVATE_TRACKERS=True
## Sonarr
- SONARR_URL=https://sonarr.myrealm.site
- SONARR_KEY=e1f4a15d1f594487ade60439e3020336
## qBittorrent
- QBITTORRENT_URL=https://sqbit.myrealm.site
- QBITTORRENT_USERNAME=Removed
- QBITTORRENT_PASSWORD=Removed

[Feature request] remove 0% download from private tracker

Hi

Awesome app by the way. I have a scenario that isn't covered by the available options. Quite often I'll have a download from a private tracker that never downloads anything. I 'd like the option of removing these entries which won't risk a Hit 'n' Run. Currently there's only an options for stalled downloads that may have partially downloaded

Thanks

[Feature Request] Optionally track "strikes" via a text file

First, thanks for building and sharing this tool.

Right now, every time the script is restarted, the "strikes" are reset back to 0.

I would be nice being able to log this "strikes" onto a text file so that even if the computer or the script are restarted, the history of the torrents is not lost

Possible to restart container on missing qbittorrent connection

Hi there,
My Decluttarr container doesn’t restart when it can't connect to qbittorrent. Every time my server restarts both start at the same time, but Decluttarr gives errors like:

2023-12-12 12:33:48
 [WARNING]: >>> Queue cleaning failed on Radarr. (File: queue_cleaner.py / Line: 227 / Error Message: 'NoneType' object is not iterable / Error Type: )
2023-12-12 12:43:48
 [ERROR]: Error making API request to http://qbittorrent:8080/api/v2/torrents/info: 403 Client Error: Forbidden for url: http://qbittorrent:8080/api/v2/torrents/info?tag=keep

Is it possible to make Decluttarr restart itself when it can't connect with qbittorrent? Right now I’m doing it manually, which does work.
I have my container set as "Restart unless stopped" so I think simply setting the container as failed on these errors should resolve my problem.

You can reproduce this by starting both containers and then restarting the qbittorrent container.

Thanks!

Log claims qBittorrent is outdated

With the newer versions of decluttarr i've noticed that it doesn't want to connect to my qBittorrent instance, since it's outdated.
Im on version 4.6.0 which gets correctly recognized in the log message and it asks me to update to 4.6.0 which is the same version.
Error: Please update qBittorrent to at least version 4.6.0. Current version: 4.6.0

This happens since at least v1.25.0. I've tested older versions, but the next lower version is already v1.20.0 which can establish a connection with no problems.

I've also tested an updated version of qBit (v4.6.2) which also gets recognized correctly in the log message, but it also does not work.
Error: Please update qBittorrent to at least version 4.6.0. Current version: 4.6.2

I'm honestly out of ideas on what to test.
Therefore, I would be glad for help and in the meantime use v1.20.0 of decluttarr.

Thanks for your help and work on the project!

Using A Self-signed Certificate Causes An Error

I am using an https connection for my download client and a self-signed certificate seems to be causing an issue. It would be nice if there was an option to ignore any SSL verification errors.

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1007)

During handling of the above exception, another exception occurred:

urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1007)

The above exception was the direct cause of the following exception:

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='192.168.1.138', port=9080): Max retries exceeded with url: /api/v2/auth/login (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1007)')))

During handling of the above exception, another exception occurred:

requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.1.138', port=9080): Max retries exceeded with url: /api/v2/auth/login (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1007)')))

During handling of the above exception, another exception occurred:

UnboundLocalError: local variable 'response' referenced before assignment

Manifest unknown when pulling latest

Hello, I'm getting below error

Failure
failed to deploy a stack: decluttarr Pulling manifest unknown

i'm using: image: ghcr.io/manimatter/decluttarr:latest

Looked at the previous Issue #64 concerning

Manifest unknown when pulling latest

Looks almost the same but does not give a solution

I'm i doing something wrong?

Sonarr queue cleaning failed - List out of range

Hey, cool project!

Running into the following issue:

Queue cleaning failed on Sonarr. (File: remove_slow.py / Line: 21 / Error Message: list index out of range / Error Type: <class 'IndexError'>)

If you need any extra debug stuff feel free to ask :) I'm running with the latest version of the script (at the time of writing) with a standard docker-compose setup. Running develop version of Sonarr and latest of qBittorrent.

Not removing any torrents

Hi again, so I've been running with the below docker compose for 19+hrs. I have 223 torrents in my Radarr queue and Decluttarr still has not removed any of the torrents.

My understanding of this is that this is supposed to loop every 10mins and check for stalled, failed, missing files, orphaned, metadate missing, unmonitored and/or slow torrents and remove and/or block them after 3 checks, which means after 30mins it should have removed the torrents right? I have slow torrents turned off because most of my torrents are slow, less than 100kbs and a lot of those do eventually download.

What am I missing?

Radarr version: 5.3.6.8612
qBittorrent image: markusmcnugen/qbittorrentvpn

_radarr-decluttarr_logs.txt

version: "3.3"
services:
radarr-decluttarr:
image: ghcr.io/manimatter/decluttarr:latest
container_name: radarr-decluttarr
restart: always
environment:
- TZ=America/Chicago
- PUID=1000
- PGID=1000
## General
- LOG_LEVEL=VERBOSE
#- TEST_RUN=True
#- SSL_VERIFICATION=False
## Features
- REMOVE_TIMER=10
- REMOVE_FAILED=True
- REMOVE_METADATA_MISSING=True
- REMOVE_MISSING_FILES=True
- REMOVE_ORPHANS=True
- REMOVE_SLOW=False
- REMOVE_STALLED=True
- REMOVE_UNMONITORED=True
#- MIN_DOWNLOAD_SPEED=100
- PERMITTED_ATTEMPTS=3
- NO_STALLED_REMOVAL_QBIT_TAG=Don't Kill
- IGNORE_PRIVATE_TRACKERS=True
## Radarr
- RADARR_URL=http://192.168.12.123:7878
- RADARR_KEY=7ede388de16047bc826c825b6c70d13b
## qBittorrent
- QBITTORRENT_URL=http://192.168.12.123:8080
- QBITTORRENT_USERNAME=Removed
- QBITTORRENT_PASSWORD=Removed

download id warning

what is causing these errors?

[WARNING]: >>> Queue cleaning failed on Lidarr. (File: remove_failed.py / Line: 12 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)

[WARNING]: >>> Queue cleaning failed on Lidarr. (File: remove_stalled.py / Line: 11 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)

[WARNING]: >>> Queue cleaning failed on Lidarr. (File: remove_metadata_missing.py / Line: 12 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)

[WARNING]: >>> Queue cleaning failed on Lidarr. (File: remove_unmonitored.py / Line: 12 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)

[WARNING]: >>> Queue cleaning failed on Lidarr. (File: remove_missing_files.py / Line: 12 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)

[WARNING]: >>> Queue cleaning failed on Lidarr. (File: remove_slow.py / Line: 11 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)

KeyError: 'indexer'

I'm running into this issue with sonarr when there are stalled torrents in qbit. It may happen with other arrs, but I've only seen it with sonarr specifically. It forces the container to stop. The logs don't provide much information when using debug on the dev image. The error also occurs with the lastest image tag. When there are no stalled torrents the image continues to run.

$ docker logs -f decluttarr
[DEBUG]: Using selector: EpollSelector
[DEBUG]: Starting new HTTP connection (1): sonarr:8989
[DEBUG]: http://sonarr:8989 "GET /api/v3/system/status HTTP/1.1" 200 None
[INFO]: ##################################################
[INFO]: Decluttarr - Application Started!
[INFO]: 
[INFO]: *** Current Settings ***
[INFO]: Version: dev
[INFO]: Commit: 3490d4d
[INFO]: 
[INFO]: True | Removing failed downloads
[INFO]: True | Removing downloads missing metadata
[INFO]: False | Removing downloads missing files
[INFO]: False | Removing orphan downloads
[INFO]: False | Removing slow downloads
[INFO]: True | Removing stalled downloads
[INFO]: False | Removing downloads belonging to unmonitored items
[INFO]: 
[INFO]: Running every: 0 days 0 hours 10.0 minutes
[INFO]: Permitted number of times before stalled/missing metadata/slow downloads are removed: 3
[INFO]: Downloads with this tag will be skipped: "Keep"
[INFO]: Private Trackers will be skipped: True
[INFO]: 
[INFO]: *** Configured Instances ***
[INFO]: Sonarr: http://sonarr:8989/api/v3
[INFO]: qBittorrent: http://qbit:8888/api/v2
[INFO]: 
[INFO]: *** Check Instances ***
[DEBUG]: Starting new HTTP connection (1): sonarr:8989
[DEBUG]: http://sonarr:8989 "GET /api/v3/system/status HTTP/1.1" 200 None
[DEBUG]: Starting new HTTP connection (1): sonarr:8989
[DEBUG]: http://sonarr:8989 "GET /api/v3/system/status HTTP/1.1" 200 None
[INFO]: OK  | Sonarr
[DEBUG]: Current version of SONARR: 4.0.3.1413
[DEBUG]: Starting new HTTP connection (1): qbit:8888
[DEBUG]: http://qbit:8888 "POST /api/v2/auth/login HTTP/1.1" 200 3
[DEBUG]: Starting new HTTP connection (1): qbit:8888
[DEBUG]: http://qbit:8888 "GET /api/v2/app/version HTTP/1.1" 200 6
[INFO]: OK | qBittorrent
[DEBUG]: Current version of qBittorrent: 4.6.4
[INFO]: 
[DEBUG]: Starting new HTTP connection (1): qbit:8888
[DEBUG]: http://qbit:8888 "GET /api/v2/torrents/tags HTTP/1.1" 200 8
[INFO]: ##################################################
[INFO]: 
[VERBOSE]: --------------------------------------------------
[DEBUG]: Starting new HTTP connection (1): qbit:8888
[DEBUG]: http://qbit:8888 "GET /api/v2/torrents/info?tag=Keep HTTP/1.1" 200 2
[DEBUG]: main/protectedDowloadItems: []
[DEBUG]: Starting new HTTP connection (1): qbit:8888
[DEBUG]: http://qbit:8888 "GET /api/v2/torrents/info HTTP/1.1" 200 5458
[VERBOSE]: Cleaning queue on Sonarr:
[DEBUG]: Starting new HTTP connection (1): sonarr:8989
[DEBUG]: http://sonarr:8989 "POST /api/v3/command HTTP/1.1" 201 None
[DEBUG]: Starting new HTTP connection (1): sonarr:8989
[DEBUG]: http://sonarr:8989 "GET /api/v3/queue?includeUnknownSeriesItems=True HTTP/1.1" 200 None
[DEBUG]: Starting new HTTP connection (1): sonarr:8989
[DEBUG]: http://sonarr:8989 "GET /api/v3/queue?page=1&pageSize=156&includeUnknownSeriesItems=True HTTP/1.1" 200 None
KeyError: 'indexer'

dict error?

/I seem to be getting a dict error on all connections. Any ideas on what this might be?

INFO: Application Started!
INFO:
INFO: *** Current Settings ***
INFO: True | Removing failed downloads
INFO: True | Removing stalled downloads
INFO: True | Removing downloads missing metadata
INFO: True | Removing orphan downloads
INFO: True | Removing downloads belonging to unmonitored TV shows/movies
INFO:
INFO: Running every: 0 days 0 hours 10 minutes
INFO: Permitted number of times before stalled/missing metadata downloads are removed: 3
INFO: Downloads with this tag will be skipped: "Don't Kill If Stalled"
INFO:
INFO: *** Configured Instances ***
INFO: Radarr: http://radarr:7878/api/v3
INFO: Sonarr: http://sonarr:8989/api/v3
INFO: Lidarr: http://lidarr:8686/api/v1
INFO: qBittorrent: http://qbittorrent:8033/api/v2
INFO:
INFO: *** Check Instances ***
INFO: OK | Radarr
INFO: OK | Sonarr
INFO: OK | Lidarr
INFO: OK | qBittorrent
INFO:
INFO: ##################################################
INFO: LOG_LEVEL = INFO: Only logging changes (switch to VERBOSE for more info)
[WARNING]: >>> Queue cleaning failed on Radarr. (File: queue_cleaner.py / Line: 224 / Error Message: 'bool' object has no attribute 'dict' / Error Type: <class 'AttributeError'>)
[WARNING]: >>> Queue cleaning failed on Sonarr. (File: queue_cleaner.py / Line: 224 / Error Message: 'bool' object has no attribute 'dict' / Error Type: <class 'AttributeError'>)
[WARNING]: >>> Queue cleaning failed on Lidarr. (File: queue_cleaner.py / Line: 224 / Error Message: 'bool' object has no attribute 'dict' / Error Type: <class 'AttributeError'>)

my compose:

decluttarr:
image: ghcr.io/manimatter/decluttarr:latest
container_name: decluttarr
restart: always
environment:
TZ: Europe/Brussels
PUID: ${PUID}
PGID: ${PGID}
# General
LOG_LEVEL: INFO
#TEST_RUN: True
# Features
REMOVE_TIMER: 10
REMOVE_FAILED: True
REMOVE_STALLED: True
REMOVE_METADATA_MISSING: True
REMOVE_ORPHANS: True
REMOVE_UNMONITORED: True
PERMITTED_ATTEMPTS: 3
NO_STALLED_REMOVAL_QBIT_TAG: Don't Kill If Stalled
# Radarr
RADARR_URL: http://radarr:7878
RADARR_KEY: REDACTED
# Sonarr
SONARR_URL: http://sonarr:8989
SONARR_KEY: REDACTED
# Lidarr
LIDARR_URL: http://lidarr:8686
LIDARR_KEY: REDACTED
# qBitorrent
QBITTORRENT_URL: http://qbittorrent:8033
QBITTORRENT_USERNAME: admin
QBITTORRENT_PASSWORD: REDACTED

A humble feature request!

First off, I really appreciate your help in trying to rid us all of the issue surrounding qBit and the ARRs doing absolutely nothing with stagnant torrents. THANK YOU!

My request:

I would like to split apart the scheduling for the various modes of failure. Ideally, I would like to differentiate between stalled DLs and those that never download metadata. My opinion is that those that do not download metadata are hard failures and should be treated differently from stalls. As such, the removal and reattempt should be much quicker.

My config allows the script to run every 10 minutes and removes torrents after 72 attempts. That's 720 minutes or 12 hours. I figured that was a nice period of time for SOMETHING to happen with a given torrent. BUT, if it fails to even download metadata, I'd like to get rid of it after an hour or 6 attempts. "If it doesn't get the metadata after an hour, it probably never will."

What are your thoughts on this?

not removing "downloading metadata" on sonarr/qbit

HI, as in the title, i have stuck episode on sonarr "queued" and in qbitorrent it says "downloading metadata"

i did left it for ~12h hours yesterday but nothing happened, the following logs are only for 5 attempts i guess, which is above of the 3 in compose file

> version: "3.7"
> services:
>  decluttarr:
>    image: ghcr.io/manimatter/decluttarr:latest   
>    container_name: decluttarr
>    restart: always
>    environment:
>      TZ: Asia/Riyadh
>      PUID: 1000
>      PGID: 1000
>      # General
>      LOG_LEVEL: VERBOSE
>      #TEST_RUN: True 
>      # Features 
>      REMOVE_TIMER: 10
>      REMOVE_FAILED: True
>      REMOVE_STALLED: True
>      REMOVE_METADATA_MISSING: True     
>      REMOVE_ORPHANS: True
>      REMOVE_UNMONITORED: True
>      PERMITTED_ATTEMPTS: 3
>      NO_STALLED_REMOVAL_QBIT_TAG: Don't Kill If Stalled
>      # Radarr
>      RADARR_URL: http://192.168.100.60:7878
>      RADARR_KEY: REMOVED
>      # Sonarr
>      SONARR_URL: http://192.168.100.60:8989
>      SONARR_KEY: REMOVED
>      # Lidarr
>      #LIDARR_URL: http://lidarr:8686
>      #LIDARR_KEY: $LIDARR_KEY     
>      # qBitorrent
>      QBITTORRENT_URL: http://192.168.100.60:8043
>      QBITTORRENT_USERNAME: REMOVED
>      QBITTORRENT_PASSWORD: REMOVED
[INFO   ]: ##################################################
[INFO   ]: Application Started!
[INFO   ]: 
[INFO   ]: *** Current Settings ***
[INFO   ]: True | Removing failed downloads
[INFO   ]: True | Removing stalled downloads
[INFO   ]: True | Removing downloads missing metadata
[INFO   ]: True | Removing orphan downloads
[INFO   ]: True | Removing downloads belonging to unmonitored TV shows/movies
[INFO   ]: 
[INFO   ]: Running every: 0 days 0 hours 10 minutes
[INFO   ]: Permitted number of times before stalled/missing metadata downloads are removed: 3
[INFO   ]: Downloads with this tag will be skipped: "Don't Kill If Stalled"
[INFO   ]: 
[INFO   ]: *** Configured Instances ***
[INFO   ]: Radarr: http://192.168.100.60:7878/api/v3
[INFO   ]: Sonarr: http://192.168.100.60:8989/api/v3
[INFO   ]: qBittorrent: http://192.168.100.60:8043/api/v2
[INFO   ]: 
[INFO   ]: *** Check Instances ***
[INFO   ]: OK | Radarr
[INFO   ]: OK | Sonarr
[INFO   ]: OK | qBittorrent
[INFO   ]: 
[INFO   ]: ##################################################
[INFO   ]: 
[VERBOSE]: --------------------------------------------------
[VERBOSE]: Cleaning queue on Radarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!
[VERBOSE]: --------------------------------------------------
[VERBOSE]: Cleaning queue on Radarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!
[VERBOSE]: --------------------------------------------------
[VERBOSE]: Cleaning queue on Radarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!
[VERBOSE]: --------------------------------------------------
[VERBOSE]: Cleaning queue on Radarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!
[VERBOSE]: --------------------------------------------------
[VERBOSE]: Cleaning queue on Radarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!
CleanShot 2023-12-07 at 13 23 12@2x CleanShot 2023-12-07 at 13 22 50@2x

Container not starting

I am getting this error when trying to start the container using docker-compose:

decluttarr  | [INFO]: Application Started!
decluttarr  | [INFO]: 
decluttarr  | [INFO]: *** Current Settings ***
decluttarr  | [INFO]: True | Removing failed downloads
decluttarr  | [INFO]: True | Removing stalled downloads
decluttarr  | [INFO]: True | Removing downloads missing metadata
decluttarr  | [INFO]: True | Removing orphan downloads
decluttarr  | [INFO]: True | Removing downloads belonging to unmonitored TV shows/movies
decluttarr  | [INFO]: 
decluttarr  | [INFO]: Running every: 0 days 0 hours 10 minutes
decluttarr  | [INFO]: Permitted number of times before stalled/missing metadata downloads are removed: 3
decluttarr  | [INFO]: Downloads with this tag will be skipped: Don't Kill If Stalled
decluttarr  | [INFO]: 
decluttarr  | [INFO]: *** Configured Instances ***
decluttarr  | [INFO]: Radarr: http://192.168.0.208:7878/api/v3
decluttarr  | [INFO]: Sonarr: http://192.168.0.208:8989/api/v3
decluttarr  | [INFO]: qBittorrent: http://192.168.0.208:8080/api/v2
decluttarr  | [INFO]: 
decluttarr  | [INFO]: ##################################################
decluttarr  | [INFO]: [LOG_LEVEL = INFO]: Only logging changes (switch to VERBOSE for more info)
decluttarr  | [ERROR]: Error making API request to http://192.168.0.208:8080/api/v2/torrents/tags: 403 Client Error: Forbidden for url: http://192.168.0.208:8080/api/v2/torrents/tags
decluttarr  | TypeError: argument of type 'NoneType' is not iterable

This is my docker-compose.yaml file:

# decluttarr - Keeps radarr and sonarr download queues free of stalled and redundant items
  decluttarr:
    container_name: decluttarr
    image: ghcr.io/manimatter/decluttarr:latest
    environment:
      - PUID=${PUID} # default user id, defined in .env
      - PGID=${PGID} # default group id, defined in .env
      - TZ=${TZ} # timezone, defined in .en
      # General
      - LOG_LEVEL=INFO
      # Features 
      - REMOVE_TIMER=10
      - REMOVE_FAILED=True
      - REMOVE_STALLED=True
      - REMOVE_METADATA_MISSING=True
      - REMOVE_ORPHANS=True
      - REMOVE_UNMONITORED=True
      - PERMITTED_ATTEMPTS=3
      - NO_STALLED_REMOVAL_QBIT_TAG="Don't Kill If Stalled"
      # Radarr
      - RADARR_URL=http://192.168.0.208:7878
      - RADARR_KEY=***KEY_REMOVED***
      # Sonarr
      - SONARR_URL=http://192.168.0.208:8989
      - SONARR_KEY=***KEY_REMOVED***
      # qBitorrent
      - QBITTORRENT_URL=http://192.168.0.208:8080

Lidarr support

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.

🐛 Decluttarr not working?

What I've done so far:

  • Created a new stack in portainer, using the provided example docker-compose from the readme.
  • Changed the docker-compose to:
version: "3.3"
services:
  decluttarr:
    image: ghcr.io/manimatter/decluttarr:latest
    container_name: decluttarr
    restart: always
    environment:
      - TZ=Europe/Zurich
      - PUID=1000
      - PGID=1000
      ## General
      - LOG_LEVEL=VERBOSE
      #- TEST_RUN=True
      #- SSL_VERIFICATION=False
      ## Features 
      - REMOVE_TIMER=5
      - REMOVE_FAILED=True
      - REMOVE_METADATA_MISSING=True
      - REMOVE_MISSING_FILES=True     
      - REMOVE_NO_FORMAT_UPGRADE=True
      - REMOVE_ORPHANS=True
      - REMOVE_SLOW=True
      - REMOVE_STALLED=True
      - REMOVE_UNMONITORED=True
      - MIN_DOWNLOAD_SPEED=100
      - PERMITTED_ATTEMPTS=3
      - NO_STALLED_REMOVAL_QBIT_TAG=Don't Kill
      - IGNORE_PRIVATE_TRACKERS=False
      ## Radarr
      - RADARR_URL=http://server:7878
      - RADARR_KEY=xxxx
      ## Sonarr
      - SONARR_URL=http://server:8989
      - SONARR_KEY=xxxx
      ## Lidarr
      #- LIDARR_URL=http://server:8686
      #- LIDARR_KEY=$LIDARR_API_KEY
      ## Readarr
      #- READARR_URL=http://server:8787
      #- READARR_KEY=$READARR_API_KEY
      ## qBittorrent
      - QBITTORRENT_URL=http://server:8080
      - QBITTORRENT_USERNAME=username
      - QBITTORRENT_PASSWORD=password

The container logs are constantly logging this:

2024-04-17T21:58:18.974860691Z [VERBOSE]: --------------------------------------------------
2024-04-17T21:59:21.293052555Z [INFO   ]: ##################################################
2024-04-17T21:59:21.293093160Z [INFO   ]: Decluttarr - Application Started!
2024-04-17T21:59:21.293105513Z [INFO   ]: 
2024-04-17T21:59:21.293113498Z [INFO   ]: *** Current Settings ***
2024-04-17T21:59:21.293176615Z [INFO   ]: Version: v1.39.0
2024-04-17T21:59:21.293204126Z [INFO   ]: Commit: 83fe333
2024-04-17T21:59:21.293225986Z [INFO   ]: 
2024-04-17T21:59:21.293253267Z [INFO   ]: True | Removing failed downloads
2024-04-17T21:59:21.293279145Z [INFO   ]: True | Removing downloads missing metadata
2024-04-17T21:59:21.293305143Z [INFO   ]: True | Removing downloads missing files
2024-04-17T21:59:21.293335119Z [INFO   ]: True | Removing downloads that fail on import (no format upgrade)
2024-04-17T21:59:21.293365565Z [INFO   ]: True | Removing orphan downloads
2024-04-17T21:59:21.293386825Z [INFO   ]: True | Removing slow downloads
2024-04-17T21:59:21.293416981Z [INFO   ]: True | Removing stalled downloads
2024-04-17T21:59:21.293439853Z [INFO   ]: True | Removing downloads belonging to unmonitored items
2024-04-17T21:59:21.293460682Z [INFO   ]: 
2024-04-17T21:59:21.293525181Z [INFO   ]: Running every: 0 days 0 hours 5.0 minutes
2024-04-17T21:59:21.293548605Z [INFO   ]: Minimum speed enforced: 100 KB/s
2024-04-17T21:59:21.293579763Z [INFO   ]: Permitted number of times before stalled/missing metadata/slow downloads are removed: 3
2024-04-17T21:59:21.293609748Z [INFO   ]: Downloads with this tag will be skipped: "Don't Kill"
2024-04-17T21:59:21.293633542Z [INFO   ]: Private Trackers will be skipped: False
2024-04-17T21:59:21.293655704Z [INFO   ]: 
2024-04-17T21:59:21.293681261Z [INFO   ]: *** Configured Instances ***
2024-04-17T21:59:21.293706418Z [INFO   ]: Radarr: http://server:7878/api/v3
2024-04-17T21:59:21.293730532Z [INFO   ]: Sonarr: http://server:8989/api/v3
2024-04-17T21:59:21.293755729Z [INFO   ]: qBittorrent: http://server:8080/api/v2
2024-04-17T21:59:21.293814138Z [INFO   ]: 
2024-04-17T21:59:21.293846858Z [INFO   ]: *** Check Instances ***
2024-04-17T21:59:21.315120174Z [INFO   ]: OK  | Radarr
2024-04-17T21:59:21.332686092Z [INFO   ]: OK  | Sonarr
2024-04-17T21:59:21.479077655Z [INFO   ]: OK | qBittorrent
2024-04-17T21:59:21.479107310Z [INFO   ]: 
2024-04-17T21:59:21.486738878Z [INFO   ]: ##################################################
2024-04-17T21:59:21.486779744Z [INFO   ]: 
2024-04-17T21:59:21.486832893Z [VERBOSE]: --------------------------------------------------
2024-04-17T22:00:23.871312924Z [INFO   ]: ##################################################
2024-04-17T22:00:23.871354591Z [INFO   ]: Decluttarr - Application Started!
2024-04-17T22:00:23.871367535Z [INFO   ]: 
2024-04-17T22:00:23.871376001Z [INFO   ]: *** Current Settings ***
2024-04-17T22:00:23.871559892Z [INFO   ]: Version: v1.39.0
2024-04-17T22:00:23.871602801Z [INFO   ]: Commit: 83fe333
2024-04-17T22:00:23.871618971Z [INFO   ]: 
2024-04-17T22:00:23.871638618Z [INFO   ]: True | Removing failed downloads
2024-04-17T22:00:23.871659456Z [INFO   ]: True | Removing downloads missing metadata
2024-04-17T22:00:23.871712775Z [INFO   ]: True | Removing downloads missing files
2024-04-17T22:00:23.871724988Z [INFO   ]: True | Removing downloads that fail on import (no format upgrade)
2024-04-17T22:00:23.871769310Z [INFO   ]: True | Removing orphan downloads
2024-04-17T22:00:23.871807611Z [INFO   ]: True | Removing slow downloads
2024-04-17T22:00:23.871840613Z [INFO   ]: True | Removing stalled downloads
2024-04-17T22:00:23.871865399Z [INFO   ]: True | Removing downloads belonging to unmonitored items
2024-04-17T22:00:23.871881318Z [INFO   ]: 
2024-04-17T22:00:23.871934557Z [INFO   ]: Running every: 0 days 0 hours 5.0 minutes
2024-04-17T22:00:23.871969722Z [INFO   ]: Minimum speed enforced: 100 KB/s
2024-04-17T22:00:23.871991382Z [INFO   ]: Permitted number of times before stalled/missing metadata/slow downloads are removed: 3
2024-04-17T22:00:23.872005348Z [INFO   ]: Downloads with this tag will be skipped: "Don't Kill"
2024-04-17T22:00:23.872031276Z [INFO   ]: Private Trackers will be skipped: False
2024-04-17T22:00:23.872062504Z [INFO   ]: 
2024-04-17T22:00:23.872083633Z [INFO   ]: *** Configured Instances ***
2024-04-17T22:00:23.872095535Z [INFO   ]: Radarr: http://server:7878/api/v3
2024-04-17T22:00:23.872124449Z [INFO   ]: Sonarr: http://server:8989/api/v3
2024-04-17T22:00:23.872157741Z [INFO   ]: qBittorrent: http://server:8080/api/v2
2024-04-17T22:00:23.872178850Z [INFO   ]: 
2024-04-17T22:00:23.872192385Z [INFO   ]: *** Check Instances ***
2024-04-17T22:00:23.887172556Z [INFO   ]: OK  | Radarr
2024-04-17T22:00:23.903255162Z [INFO   ]: OK  | Sonarr
2024-04-17T22:00:24.035920339Z [INFO   ]: OK | qBittorrent
2024-04-17T22:00:24.035954453Z [INFO   ]: 
2024-04-17T22:00:24.043148739Z [INFO   ]: ##################################################
2024-04-17T22:00:24.043181630Z [INFO   ]: 
2024-04-17T22:00:24.043217527Z [VERBOSE]: --------------------------------------------------

Any ideas?
The debug log doesn't show any errors or warnings. Checks all instances, they are ok 200, afterwards:

[DEBUG]: Starting new HTTP connection (1): server:8080
[DEBUG]: http://server:8080 "GET /api/v2/torrents/info HTTP/1.1" 200 2143543
[DEBUG]: main/getProtectedAndPrivateFromQbit/qbitItems: [{

And contains all of my active torrents it seems

Exanding the code

Hey there,
I'm curious about looking into adding support for things like sickchill, headphones, mylar etc and wondering this is something you would consider or if you could give some guidance on where to start. I use Radarr, but not Sonarr, for example.

Thanks. Love the code already.

Transmission client issues

Hi! Having issues with Transmission client. Running docked. Basically no torrent gets detected as stalled/missing metadata so no torrent gets removed. I've been going over this for a couple of days but can't find the cause. You mention on documentation that it does work with other torrents minus specific qBitorrent features. Or maybe I misread.

Log on verbose mode just spits out endless loop:

decluttarr | [VERBOSE]: Cleaning queue on Radarr:
decluttarr | [VERBOSE]: >>> Queue is clean.

Radarr and Sonarr do get an ok:

decluttarr | [INFO ]: OK | Radarr
decluttarr | [INFO ]: OK | Sonarr

Wanted to narrow down if my install or something was being messed up so installed qBitorrent and sure enough it does work perfectly with it. Anything special I have to do to make it run on Transmission?

Stalled /Metadata downloads not removed eventhough > permitted attempts

I reloaded the docker container after a few settings changes to MAKE SURE that what I was seeing was actually what was happening. I started seeing this a couple days ago, but couldn't make sense of it. Now that I have made a couple changes and waited over a day to see the results, I can finally submit this to you:

2023-10-09T20:33:02.134138252Z [WARNING]: >>> Queue cleaning failed on Radarr. (File: queue_cleaner.py / Line: 153 / Error Message: 'NoneType' object is not subscriptable / Error Type: <class 'TypeError'>)
2023-10-09T20:33:02.134345094Z [VERBOSE]: Cleaning queue on Sonarr:
2023-10-09T20:33:02.142516222Z [VERBOSE]: >>> Queue is empty.
2023-10-09T20:33:02.142548398Z [VERBOSE]: 
2023-10-09T20:33:02.142647650Z [VERBOSE]: Queue clean-up complete!
2023-10-09T20:43:02.186293380Z [VERBOSE]: --------------------------------------------------
2023-10-09T20:43:02.186349815Z [VERBOSE]: Cleaning queue on Radarr:
2023-10-09T20:43:02.190840259Z [ERROR  ]: Error making API request to http://172.17.0.9:7878/api/v3/queue: HTTPConnectionPool(host='172.17.0.9', port=7878): Max retries exceeded with url: /api/v3/queue?includeUnknownMovieItems=true (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7468c9deb0>: Failed to establish a new connection: [Errno 111] Connection refused'))

Basically, I was having a hard time seeing your script actually accomplish anything. After 12 hours, I was starting to see the logs showing

2023-10-08T06:02:41.386772323Z [INFO   ]: >>> Detected missing metadata download (73 out of 72 permitted times): [ext.to] An.Affair.to.Die.For.Relazione.Omicida.2019.iTA.ENG.AMZN.WEBDL.1080p.x264-HDi.mkv
2023-10-08T06:02:41.386788906Z [INFO   ]: >>> Removing missing metadata download: [ext.to] An.Affair.to.Die.For.Relazione.Omicida.2019.iTA.ENG.AMZN.WEBDL.1080p.x264-HDi.mkv

So, if it removed it and re-added it, why would it be at 73 of 72 times?

I don't think the top and bottom messages are related. I think they are separate issues, but you would know better than I.

FYI, I am running Radarr and Sonarr in docker containers (172.17.0.0/24) while qBit is a physical machine (20.0.0.0/20). I am running the develop images and have Watchtower auto-updating everything on 6 hour schedules.

Now, I am going to recreate the docker image for decluttarr so I can futz with the scheduling and see what happens... :) Thanks for your help!

Queue cleaning failed on Sonarr

I set up decluttarr with docker-compose.yml provided in examples of this repo but it seems that it can't get sonar queue for unknown reason.

Here are the errors:

2023/11/09 19:28:37 | stderr | [WARNING]: >>> Queue cleaning failed on Sonarr. (File: queue_cleaner.py / Line: 216 / Error Message: 'NoneType' object is not iterable / Error Type: <class 'TypeError'>)
2023/11/09 19:28:37 | stderr | [ERROR]: Error making API request to http://192.168.1.183:9865/api/v2/torrents/info: 403 Client Error: Forbidden for url: http://192.168.1.183:9865/api/v2/torrents/info?tag=Don%27t+Kill+If+Stalled
2023/11/09 18:28:35 | stderr | [WARNING]: >>> Queue cleaning failed on Sonarr. (File: queue_cleaner.py / Line: 216 / Error Message: 'NoneType' object is not iterable / Error Type: <class 'TypeError'>)
2023/11/09 18:28:35 | stderr | [ERROR]: Error making API request to http://192.168.1.183:9865/api/v2/torrents/info: 403 Client Error: Forbidden for url: http://192.168.1.183:9865/api/v2/torrents/info?tag=Don%27t+Kill+If+Stalled
2023/11/09 17:28:35 | stderr | [WARNING]: >>> Queue cleaning failed on Sonarr. (File: queue_cleaner.py / Line: 216 / Error Message: 'NoneType' object is not iterable / Error Type: <class 'TypeError'>)
2023/11/09 17:28:35 | stderr | [ERROR]: Error making API request to http://192.168.1.183:9865/api/v2/torrents/info: 403 Client Error: Forbidden for url: http://192.168.1.183:9865/api/v2/torrents/info?tag=Don%27t+Kill+If+Stalled
2023/11/09 16:28:33 | stderr | [WARNING]: >>> Queue cleaning failed on Sonarr. (File: queue_cleaner.py / Line: 216 / Error Message: 'NoneType' object is not iterable / Error Type: <class 'TypeError'>)
2023/11/09 16:28:33 | stderr | [ERROR]: Error making API request to http://192.168.1.183:9865/api/v2/torrents/info: 403 Client Error: Forbidden for url: http://192.168.1.183:9865/api/v2/torrents/info?tag=Don%27t+Kill+If+Stalled
2023/11/09 15:28:31 | stderr | [WARNING]: >>> Queue cleaning failed on Sonarr. (File: queue_cleaner.py / Line: 216 / Error Message: 'NoneType' object is not iterable / Error Type: <class 'TypeError'>)

Please let me know if you need more info or maybe you will suggest a way how I can debug it further

Queue cleaning failed on Radarr

I have a download in radarr that is stuck at pending. I get the error message below in the docker logs.

Docker compose

  decluttarr:
    hostname: decluttarr
    image: ghcr.io/manimatter/decluttarr:latest   
    container_name: decluttarr
    restart: always
    environment:
       - TZ=${TZ}
       - PUID=${PUID}
       - PGID=${PGID}
      # General
       - LOG_LEVEL=VERBOSE
      #TEST_RUN: True 
      # Features 
       - REMOVE_TIMER=10
       - REMOVE_FAILED=True
       - REMOVE_STALLED=True
       - REMOVE_METADATA_MISSING=True     
       - REMOVE_ORPHANS=True
       - REMOVE_UNMONITORED=True
       - PERMITTED_ATTEMPTS=3
       - NO_STALLED_REMOVAL_QBIT_TAG=Don't Kill If Stalled
      # Radarr
       - RADARR_URL=http://192.168.1.104:8095/radarr
       - RADARR_KEY=$RADARR_API_KEY
      # Sonarr
       - SONARR_URL=http://192.168.1.104:8079/sonarr
       - SONARR_KEY=$SONARR_API_KEY
      # Lidarr
       - LIDARR_URL=http://192.168.1.104:8686/lidarr
       - LIDARR_KEY=$LIDARR_API_KEY    
      # qBitorrent
       - QBITTORRENT_URL=http://192.168.1.104:8113
       - QBITTORRENT_USERNAME=$USER
       - QBITTORRENT_PASSWORD=$PASSWORD

Docker logs

[INFO   ]: ##################################################
[INFO   ]: Application Started!
[INFO   ]:
[INFO   ]: *** Current Settings ***
[INFO   ]: True | Removing failed downloads
[INFO   ]: True | Removing stalled downloads
[INFO   ]: True | Removing downloads missing metadata
[INFO   ]: True | Removing orphan downloads
[INFO   ]: True | Removing downloads belonging to unmonitored TV shows/movies
[INFO   ]:
[INFO   ]: Running every: 0 days 0 hours 10 minutes
[INFO   ]: Permitted number of times before stalled/missing metadata downloads are removed: 3
[INFO   ]: Downloads with this tag will be skipped: "Don't Kill If Stalled"
[INFO   ]:
[INFO   ]: *** Configured Instances ***
[INFO   ]: Radarr: http://192.168.1.104:8095/radarr/api/v3
[INFO   ]: Sonarr: http://192.168.1.104:8079/sonarr/api/v3
[INFO   ]: Lidarr: http://192.168.1.104:8686/lidarr/api/v1
[INFO   ]: qBittorrent: http://192.168.1.104:8113/api/v2
[INFO   ]:
[INFO   ]: *** Check Instances ***
[INFO   ]: OK | Radarr
[INFO   ]: OK | Sonarr
[INFO   ]: OK | Lidarr
[INFO   ]: OK | qBittorrent
[INFO   ]:
[INFO   ]: ##################################################
[INFO   ]:
[VERBOSE]: --------------------------------------------------
[VERBOSE]: Cleaning queue on Radarr:
[WARNING]: >>> Queue cleaning failed on Radarr. (File: queue_cleaner.py / Line: 233 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Lidarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]:
[VERBOSE]: Queue clean-up complete!

TypeError: string indices must be integers

Getting an error when running this, probably my fault! Any help is appreciated

decluttarr | [INFO]: Decluttarr - Application Started!
decluttarr | [INFO]:
decluttarr | [INFO]: *** Current Settings ***
decluttarr | [INFO]: Version: v1.33.0
decluttarr | [INFO]: Commit: 075dace
decluttarr | [INFO]:
decluttarr | [INFO]: True | Removing failed downloads
decluttarr | [INFO]: True | Removing downloads missing metadata
decluttarr | [INFO]: True | Removing downloads missing files
decluttarr | [INFO]: True | Removing orphan downloads
decluttarr | [INFO]: True | Removing slow downloads
decluttarr | [INFO]: True | Removing stalled downloads
decluttarr | [INFO]: True | Removing downloads belonging to unmonitored TV shows/movies
decluttarr | [INFO]:
decluttarr | [INFO]: Running every: 0 days 1.0 hours 0.0 minutes
decluttarr | [INFO]: Minimum speed enforced: 100 KB/s
decluttarr | [INFO]: Permitted number of times before stalled/missing metadata/slow downloads are removed: 3
decluttarr | [INFO]: Downloads with this tag will be skipped: "Don't Kill"
decluttarr | [INFO]: Private Trackers will be skipped: True
decluttarr | [INFO]:
decluttarr | [INFO]: *** Configured Instances ***
decluttarr | [INFO]: Radarr: http://192.168.1.194:7878//api/v3
decluttarr | [INFO]: Sonarr: http://192.168.1.194:8989//api/v3
decluttarr | [INFO]: Lidarr: http://192.168.1.194:8686//api/v1
decluttarr | [INFO]: Readarr: http://readarr:8787/api/v1
decluttarr | [INFO]: qBittorrent: http://192.168.1.194:8080//api/v2
decluttarr | [INFO]:
decluttarr | [INFO]: *** Check Instances ***
decluttarr | [DEBUG]: Starting new HTTP connection (1): 192.168.1.194:7878
decluttarr | [DEBUG]: http://192.168.1.194:7878 "GET //api/v3/system/status HTTP/1.1" 200 None
decluttarr | [DEBUG]: Starting new HTTP connection (1): 192.168.1.194:7878
decluttarr | [DEBUG]: http://192.168.1.194:7878 "GET //api/v3/system/status HTTP/1.1" 200 None
decluttarr | TypeError: string indices must be integers

Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>

I just started decluttarr for the first time and ran into the following error. I saw a comment in #52 asking for a new issue so I opened this one. I will try out verbose logs to see if there is any other details.

$ docker logs -f decluttarr
[INFO]: ##################################################
[INFO]: Decluttarr - Application Started!
[INFO]: 
[INFO]: *** Current Settings ***
[INFO]: Version: v1.31.0
[INFO]: Commit: dca40aa
[INFO]: 
[INFO]: True | Removing failed downloads
[INFO]: True | Removing downloads missing metadata
[INFO]: False | Removing downloads missing files
[INFO]: False | Removing orphan downloads
[INFO]: False | Removing slow downloads
[INFO]: True | Removing stalled downloads
[INFO]: False | Removing downloads belonging to unmonitored TV shows/movies
[INFO]: 
[INFO]: Running every: 0 days 0 hours 10.0 minutes
[INFO]: Permitted number of times before stalled/missing metadata/slow downloads are removed: 3
[INFO]: Downloads with this tag will be skipped: "Keep"
[INFO]: Private Trackers will be skipped: True
[INFO]: 
[INFO]: *** Configured Instances ***
[INFO]: Radarr: http://radarr:7878/api/v3
[INFO]: Sonarr: http://sonarr:8989/api/v3
[INFO]: Lidarr: http://lidarr:8686/api/v1
[INFO]: qBittorrent: http://qbit:8888/api/v2
[INFO]: 
[INFO]: *** Check Instances ***
[INFO]: OK | Radarr
[INFO]: OK | Sonarr
[INFO]: OK | Lidarr
[INFO]: OK | qBittorrent
[INFO]: 
[INFO]: ##################################################
[INFO]: LOG_LEVEL = INFO: Only logging changes (switch to VERBOSE for more info)
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[INFO]: >>> Detected stalled download (1 out of 3 permitted times): Xxxtentacion - SKINS (2018 - Pop) [Flac 16-44]
[INFO]: >>> Detected stalled download (1 out of 3 permitted times): Xxxtentacion - Bad Vibes Forever (2019 - Pop) [Flac 16-44]
[INFO]: >>> Detected stalled download (1 out of 3 permitted times): Xxxtentacion - NA (2018 - Hip Hop Rap) [Flac 16-44]
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)

Verbose Logs:

[INFO   ]: ##################################################
[INFO   ]: 
[VERBOSE]: --------------------------------------------------
[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 formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[INFO   ]: >>> Detected stalled download (1 out of 3 permitted times): Xxxtentacion - SKINS (2018 - Pop) [Flac 16-44]
[INFO   ]: >>> Detected stalled download (1 out of 3 permitted times): Xxxtentacion - Bad Vibes Forever (2019 - Pop) [Flac 16-44]
[INFO   ]: >>> Detected stalled download (1 out of 3 permitted times): Xxxtentacion - NA (2018 - Hip Hop Rap) [Flac 16-44]
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!
[VERBOSE]: --------------------------------------------------
[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 formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[INFO   ]: >>> Detected stalled download (2 out of 3 permitted times): Xxxtentacion - SKINS (2018 - Pop) [Flac 16-44]
[INFO   ]: >>> Detected stalled download (2 out of 3 permitted times): Xxxtentacion - Bad Vibes Forever (2019 - Pop) [Flac 16-44]
[INFO   ]: >>> Detected stalled download (2 out of 3 permitted times): Xxxtentacion - NA (2018 - Hip Hop Rap) [Flac 16-44]
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!
[VERBOSE]: --------------------------------------------------
[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 formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[INFO   ]: >>> Detected stalled download (3 out of 3 permitted times): Xxxtentacion - SKINS (2018 - Pop) [Flac 16-44]
[INFO   ]: >>> Detected stalled download (3 out of 3 permitted times): Xxxtentacion - Bad Vibes Forever (2019 - Pop) [Flac 16-44]
[INFO   ]: >>> Detected stalled download (3 out of 3 permitted times): Xxxtentacion - NA (2018 - Hip Hop Rap) [Flac 16-44]
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[VERBOSE]: >>> Queue is clean.
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!
[VERBOSE]: --------------------------------------------------
[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 formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[INFO   ]: >>> Detected stalled download too many times (4 out of 3 permitted times): Xxxtentacion - SKINS (2018 - Pop) [Flac 16-44]
[INFO   ]: >>> Detected stalled download too many times (4 out of 3 permitted times): Xxxtentacion - Bad Vibes Forever (2019 - Pop) [Flac 16-44]
[INFO   ]: >>> Detected stalled download too many times (4 out of 3 permitted times): Xxxtentacion - NA (2018 - Hip Hop Rap) [Flac 16-44]
[INFO   ]: >>> Removing stalled download: Xxxtentacion - NA (2018 - Hip Hop Rap) [Flac 16-44]
[INFO   ]: >>> Removing stalled download: Xxxtentacion - Bad Vibes Forever (2019 - Pop) [Flac 16-44]
[INFO   ]: >>> Removing stalled download: Xxxtentacion - SKINS (2018 - Pop) [Flac 16-44]
[WARNING]: >>> Queue cleaning failed on formattedQueueInfo. (File: shared.py / Line: 128 / Error Message: 'downloadId' / Error Type: <class 'KeyError'>)
[VERBOSE]: 
[VERBOSE]: Queue clean-up complete!

The stalled torrents were removed from qbit. I'm not sure if there is an API issue with lidarr, but it does seem to work as intended. Removed downloads were not immediately removed from lidarr queue, but replacement downloads had already been searched by the time the queue refreshed.

Container does not restart after an error

This might be considered an improvement, but this container does not restart after an error occurs.

The main issue here is that if this container starts together with radarr/sonarr/qbittorrent containers, this container fails as it tries to connect to the other containers when they are still not ready:

decluttarr  | [ERROR  ]: Error making API request to http://192.168.0.208:7878/api/v3/system/status: HTTPConnectionPool(host='192.168.0.208', port=7878): Max retries exceeded with url: /api/v3/system/status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fedd1960460>: Failed to establish a new connection: [Errno 111] Connection refused'))

One way to solve this would be for the container to restart every time it fails, so in this case it would restart couple of times until the other containers are available.

[Feature Request] Remove downloaded items that failed to auto-import

First of all, thank you for this huge QOL you all made possible with decluttarr.

Often times, lidarr fails to auto-import albums because it cannot match the tracks / wrong tracks/ etc., and gets piled up in the activities queue.

I think it would be a nice option to have these items removed automatically, along with the files. Usually, it's more of a headache than it is worth when I try to import them manually.

Less than lidarr, but radarr and sonarr have fair share of items that fail to auto import and I just do not wish to verify each for manual import anymore...

Thank you for your time in hearing me out!

Detected stalled download, tagged not to be killed for every torrent

Hey,
so, so far I couldn't make this work ( I mean all the connection seems to be working but the container logs are like this:

[VERBOSE]: Cleaning queue on Radarr:
[VERBOSE]: >>> Queue is empty.
[VERBOSE]: Cleaning queue on Sonarr:
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.in.the.Shadows.S03E10.The.Portrait.720p.AMZN.WEBRip.DDP5.1.x264-NTb
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.in.the.Shadows.S04.720p.AMZN.WEBRip.DDP5.1.x264-FLUX[rartv]
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: [Marine-ford] One Piece 27 - HD VOSTFR (1280x720 x264 AAC)
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: [Marine-ford] One Piece 31 - HD VOSTFR (1280x720 x264 AAC)
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.in.the.Shadows.S03E08.The.Wellness.Center.720p.AMZN.WEBRip.DDP5.1.x264-NTb[rarbg]
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: [Marine-ford] One Piece 24 - HD VOSTFR (1280x720 x264 AAC)
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.in.the.Shadows.S05E06.Urgent.Care.720p.DSNP.WEB-DL.DDP5.1.H.264-NTb[TGx]
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.in.the.Shadows.S05E05.Local.News.720p.DSNP.WEB-DL.DDP5.1.H.264-NTb[TGx]
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: [Marine-ford] One Piece 30 - HD VOSTFR (1280x720 x264 AAC)
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What We Do in the Shadows S03E06 720p WEB H264 GGWP TGx
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: [Zero-Raws] One Piece - 05 (CX 1280x720 x264 AAC)
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: [Zero-Raws] One Piece - 06 (CX 1280x720 x264 AAC)
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: [Marine-ford] One Piece 17 - HD VOSTFR (1280x720 x264 AAC)
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: [Marine-ford] One Piece 15 - HD VOSTFR (1280x720 x264 AAC)
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.in.the.Shadows.S02E04.The.Curse.720p.AMZN.WEB-DL.DDP5.1.H.264-NTb[eztv.io].mkv[eztv.li]
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.in.the.Shadows.S02E02.Ghosts.720p.AMZN.WEBRip.DDP5.1.x264-NTb[eztv.io].mkv[eztv.li]
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.in.the.Shadows.S05E07.Hybrid.Creatures.720p.DSNP.WEB-DL.DDP5.1.H.264-NTb[TGx]
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.In.The.Shadows.S03E05.720p.WEB.h264-GOSSIP[eztv.re].mkv[eztv.li]
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: [Zero-Raws] One Piece - 03 (CX 1280x720 x264 AAC)
[VERBOSE]: >>> Detected stalled download, tagged not to be killed: What.We.Do.in.the.Shadows.S03E07.The.Siren.720p.AMZN.WEBRip.DDP5.1.x264-NTb[rarbg]
[VERBOSE]: >>> Queue is clean.

so according to the log it seems like they are tag not to be killed even though they should
On qBit When I filter the tag Dont kill if stalled, it returns that 0 torrent are actually tagged

Any clue on what Im doing wrong ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.