Code Monkey home page Code Monkey logo

Comments (17)

ManiMatter avatar ManiMatter commented on May 23, 2024 1

Pls only leave the REMOVE_STALLED on true and the others on false; spares me the irrelevant logs
Thx

from decluttarr.

ManiMatter avatar ManiMatter commented on May 23, 2024

Hi
Could you switch to loglevel DEBUG please and paste the result to pastebin?

do you know when this occurs?

from decluttarr.

TheNetworkGuy avatar TheNetworkGuy commented on May 23, 2024

Sure, i'll post the debug output to pastebin.

Occurs right away when first starting the container. Other services such as Radarr do not show this error.

from decluttarr.

TheNetworkGuy avatar TheNetworkGuy commented on May 23, 2024

All checks disabled exect for slow check. Test = false.

https://pastebin.com/hL21fmNj

decluttarr:
image: ghcr.io/manimatter/decluttarr:latest
environment:
- TZ=Europe/Amsterdam
- PUID=1000
- PGID=1000
# General
- LOG_LEVEL=DEBUG
# - TEST_RUN=True
# Features
- REMOVE_TIMER=3
- REMOVE_FAILED=False
- REMOVE_METADATA_MISSING=False
- REMOVE_MISSING_FILES=False
- REMOVE_ORPHANS=False
- REMOVE_SLOW=True
- REMOVE_STALLED=False
- REMOVE_UNMONITORED=False
- MIN_DOWNLOAD_SPEED=100
- PERMITTED_ATTEMPTS=3
- NO_STALLED_REMOVAL_QBIT_TAG=Don't Kill
- IGNORE_PRIVATE_TRACKERS=True
# Radarr
- RADARR_URL=http://radarr:7878
- RADARR_KEY=
# Sonarr
- SONARR_URL=http://sonarr:8989
- SONARR_KEY=
# qBittorrent
- QBITTORRENT_URL=http://qbittorrent:8081
- QBITTORRENT_USERNAME=
- QBITTORRENT_PASSWORD=

from decluttarr.

ManiMatter avatar ManiMatter commented on May 23, 2024

Thanks, that's helpful.

Good news is: I can tell exactly in which 20+- lines the bug occurs, but I need more granular logs.
I added that into the :dev version, can you please switch to that and provide the logs again?

If it's possible, would you be able to also share them with timestamp? (I use amir20/dozzle:latest for that)

from decluttarr.

TheNetworkGuy avatar TheNetworkGuy commented on May 23, 2024

I can share everything and downloaded Dozzle :) However get the following output back and i presume that this isn't what you inteded to happen with the dev version? (guess on my end, if this is supposed to be the output then i can share my full Dozzle output.)

downloader-decluttarr-1  | [WARNING]: >>> Queue cleaning failed on Sonarr. (File: remove_slow.py / Line: 21 / Error Message: name 'NAME' is not defined / Error Type: <class 'NameError'>)
downloader-decluttarr-1  | [DEBUG]: IndexError: list index out of range
downloader-decluttarr-1  | 
downloader-decluttarr-1  | During handling of the above exception, another exception occurred:
downloader-decluttarr-1  | 
downloader-decluttarr-1  | NameError: name 'NAME' is not defined
downloader-decluttarr-1  | 

from decluttarr.

ManiMatter avatar ManiMatter commented on May 23, 2024

My bad, sry! Can you pls try again, the new issue I had introduced should be fixed and we should now see the logs

from decluttarr.

TheNetworkGuy avatar TheNetworkGuy commented on May 23, 2024

https://pastebin.com/xE9kvzEh

Seems like an expected list variable is not actually a list and instead is declared as a None. I'll take a look at the code as well to check if i can see something obvious :)

from decluttarr.

ManiMatter avatar ManiMatter commented on May 23, 2024

My hypothesis: the qbit call does not find the hash, ie when already removed in the meantime, probs need to deal with that scenario

can you paste a screenshot of qbit at the moment decluttarr crashes; pls make sure we see the hash if the torrent that breaks it is there

from decluttarr.

TheNetworkGuy avatar TheNetworkGuy commented on May 23, 2024

This could be the problem yeah. I can see the same error appearing with Radarr as well and since that list is shorter i used that to compare the setups.

[{'downloadId': '590DCD68719882177C9A56FEEF596E7804A0BA36', 'downloadTitle': 'The Prestige 2006.4K.HDR.DV.2160p.BDRemux Ita Eng x265-NAHOM', 'IDs': [1160672294]}, {'downloadId': 'SABnzbd_nzo_5qaahqic', 'downloadTitle': 'No Escape 2015 BluRay 1080p REMUX AVC DTS-HD MA 5.1-LEGi0N', 'IDs': [1433654272]}]

2 entries, one of which is in qBittorrent (verified with the hash.) The other one is downloading in Sabnzbd. Could the Sabnzbd entry be a problem? Since the queue won't be properly generated with only items from qBittorrent.

from decluttarr.

TheNetworkGuy avatar TheNetworkGuy commented on May 23, 2024

Just ran this code and seems to be working for both Radarr as well as Sonarr. Its dirty and needs some proper error handeling instead of a hardcoded "SABnzbd_", probably won't work in use-cases with NZBget and other clients. Or query the API of Radarr and Sonarr for downloads which are only communicated towards qBittorrent. Anyhow:

async def remove_slow(settings_dict, BASE_URL, API_KEY, NAME, deleted_downloads, defective_tracker, protectedDownloadIDs, privateDowloadIDs, download_sizes_tracker):
    # Detects slow downloads and triggers delete. Adds to blocklist
    try:
        failType = 'slow'
        queue = await get_queue(BASE_URL, API_KEY)
        logger.debug('remove_slow/queue IN: %s', formattedQueueInfo(queue))
        if not queue: return 0
        # Find items affected
        affectedItems = []
        alreadyCheckedDownloadIDs = []
        nzb_clients_id_prefix = ('SABnzbd_')
        for queueItem in queue['records']:
            if 'downloadId' in queueItem and 'size' in queueItem and 'sizeleft' in queueItem and 'status' in queueItem:
                if queueItem['downloadId'] not in alreadyCheckedDownloadIDs:
                    # Check if the downloadID is from an NZB client: if so skip this download entry since its not in the torrent client.
                    if queueItem['downloadId'].startswith(nzb_clients_id_prefix ):
                        continue
                    alreadyCheckedDownloadIDs.append(queueItem['downloadId']) # One downloadId may occur in multiple queueItems - only check once for all of them per iteration
                    # determine if the downloaded bit on average between this and the last iteration is greater than the min threshold
                    downloadedSize, previousSize, increment, speed = await getDownloadedSize(settings_dict, queueItem, download_sizes_tracker, NAME)

worked for me. Simple continue statement.

from decluttarr.

TheNetworkGuy avatar TheNetworkGuy commented on May 23, 2024

Check. I've updated the code above so that it reflects a bit more of a permanent solution. However i would recommend having the variable nzb_clients_id_prefix in a more global place since it might come in use with multiple functions / classes.

from decluttarr.

ManiMatter avatar ManiMatter commented on May 23, 2024

Check the getDownloadedSize()
Can you look at the queueitem and see if theres sn attribute that tells which downloadclient it is?

If not qbit default back to using progressinfo from the arrapp.. (there‘s a confition in the beginning already that checks if qbit is even specified; could that be extdnded)?

from decluttarr.

TheNetworkGuy avatar TheNetworkGuy commented on May 23, 2024

This seems useful...

{'seriesId': 20, 'episodeId': 2201, 'seasonNumber': 4, 'languages': [{'id': 1, 'name': 'English'}], 'quality': {'quality': {'id': 2, 'name': 'DVD', 'source': 'dvd', 'resolution': 480}, 'revision': {'version': 1, 'real': 0, 'isRepack': False}}, 'customFormats': [], 'customFormatScore': 0, 'size': 353558855, 'title': 'Flashpoint.S04E17.DVDRip.X264-OSiTV', 'sizeleft': 353558855, 'added': '2024-02-19T14:47:53Z', 'status': 'paused', 'trackedDownloadStatus': 'ok', 'trackedDownloadState': 'downloading', 'statusMessages': [], 'downloadId': 'SABnzbd_nzo_lpu5uxe0', 'protocol': 'usenet', 'downloadClient': 'Sabnzbd', 'downloadClientHasPostImportCategory': False, 'indexer': 'altHUB (Prowlarr)', 'episodeHasFile': False, 'id': 1685199207}

The value of a torrent based download is "torrent". This seems like a great way to filter out usenet downloads :)

async def remove_slow(settings_dict, BASE_URL, API_KEY, NAME, deleted_downloads, defective_tracker, protectedDownloadIDs, privateDowloadIDs, download_sizes_tracker):
    # Detects slow downloads and triggers delete. Adds to blocklist
    try:
        failType = 'slow'
        queue = await get_queue(BASE_URL, API_KEY)
        logger.debug('remove_slow/queue IN: %s', formattedQueueInfo(queue))
        if not queue: return 0
        # Find items affected
        affectedItems = []
        alreadyCheckedDownloadIDs = []
        for queueItem in queue['records']:
            # Check if download protocol is torrent. If not, skip download
            if 'protocol' in queueItem:
                if not queueItem['protocol'] == 'torrent':
                    continue
            if 'downloadId' in queueItem and 'size' in queueItem and 'sizeleft' in queueItem and 'status' in queueItem:

I've created #37 to fix this issue for the slow download detection.

from decluttarr.

ManiMatter avatar ManiMatter commented on May 23, 2024

Thx for the pr; does dev image work for you now?

from decluttarr.

TheNetworkGuy avatar TheNetworkGuy commented on May 23, 2024

Just pulled the latest :dev with docker compose and works like a charm! :)

from decluttarr.

ManiMatter avatar ManiMatter commented on May 23, 2024

Sweet. Pr‘ing to main then

from decluttarr.

Related Issues (20)

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.