mirror of
https://github.com/ManiMatter/decluttarr.git
synced 2026-04-26 02:35:57 +02:00
Major refactor & code-cleanup
Improved Slow Downloads (more accurate determining of progress) Added possiblity to exclude private Trackers from cleaning
This commit is contained in:
29
src/remove_missing_files.py
Normal file
29
src/remove_missing_files.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from src.utils.shared import (errorDetails, formattedQueueInfo, get_queue, privateTrackerCheck, protectedDownloadCheck, execute_checks, permittedAttemptsCheck, remove_download)
|
||||
import sys, os, traceback
|
||||
import logging, verboselogs
|
||||
logger = verboselogs.VerboseLogger(__name__)
|
||||
|
||||
async def remove_missing_files(settings_dict, BASE_URL, API_KEY, NAME, deleted_downloads, defective_tracker, protectedDownloadIDs, privateDowloadIDs):
|
||||
# Detects downloads broken because of missing files. Does not add to blocklist
|
||||
try:
|
||||
failType = 'missing files'
|
||||
queue = await get_queue(BASE_URL, API_KEY)
|
||||
if not queue: return 0
|
||||
logger.debug('remove_missing_files/queue IN: %s', formattedQueueInfo(queue))
|
||||
# Find items affected
|
||||
affectedItems = []
|
||||
for queueItem in queue['records']:
|
||||
if 'errorMessage' in queueItem and 'status' in queueItem:
|
||||
if (queueItem['status'] == 'warning' and
|
||||
(queueItem['errorMessage'] == 'DownloadClientQbittorrentTorrentStateMissingFiles' or
|
||||
queueItem['errorMessage'] == 'The download is missing files')):
|
||||
affectedItems.append(queueItem)
|
||||
affectedItems = await execute_checks(settings_dict, affectedItems, failType, BASE_URL, API_KEY, NAME, deleted_downloads, defective_tracker, privateDowloadIDs, protectedDownloadIDs,
|
||||
addToBlocklist = False,
|
||||
doPrivateTrackerCheck = False,
|
||||
doProtectedDownloadCheck = False,
|
||||
doPermittedAttemptsCheck = False)
|
||||
return len(affectedItems)
|
||||
except Exception as error:
|
||||
errorDetails(NAME, error)
|
||||
return 0
|
||||
Reference in New Issue
Block a user