mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-08 21:06:28 +08:00
Bug fix: Additional error handling
This commit is contained in:
parent
2cea69749f
commit
d7e232b60c
1 changed files with 11 additions and 5 deletions
|
@ -8,7 +8,7 @@ from pathlib import Path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import yaml, schedule
|
import yaml, schedule
|
||||||
from qbittorrentapi import Client
|
from qbittorrentapi import Client, LoginFailed, APIConnectionError
|
||||||
from modules.docker import GracefulKiller
|
from modules.docker import GracefulKiller
|
||||||
from modules import util
|
from modules import util
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
|
@ -180,10 +180,12 @@ if 'pass' in cfg['qbt']:
|
||||||
else:
|
else:
|
||||||
password = ''
|
password = ''
|
||||||
|
|
||||||
client = Client(host=host,
|
client = Client(host=host, username=username, password=password)
|
||||||
username=username,
|
try:
|
||||||
password=password)
|
client.auth_log_in()
|
||||||
|
except (LoginFailed,APIConnectionError)as e:
|
||||||
|
logger.error(e)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
############FUNCTIONS##############
|
############FUNCTIONS##############
|
||||||
#truncate the value of the torrent url to remove sensitive information
|
#truncate the value of the torrent url to remove sensitive information
|
||||||
|
@ -559,6 +561,7 @@ def set_rem_unregistered():
|
||||||
def set_rem_orphaned():
|
def set_rem_orphaned():
|
||||||
if rem_orphaned:
|
if rem_orphaned:
|
||||||
util.separator(f"Checking for Orphaned Files", space=False, border=False)
|
util.separator(f"Checking for Orphaned Files", space=False, border=False)
|
||||||
|
global torrent_list
|
||||||
torrent_files = []
|
torrent_files = []
|
||||||
root_files = []
|
root_files = []
|
||||||
orphaned_files = []
|
orphaned_files = []
|
||||||
|
@ -569,6 +572,9 @@ def set_rem_orphaned():
|
||||||
root_files = [os.path.join(path.replace(remote_path,root_path), name) for path, subdirs, files in os.walk(remote_path) for name in files if os.path.join(remote_path,'orphaned_data') not in path and os.path.join(remote_path,'.RecycleBin') not in path]
|
root_files = [os.path.join(path.replace(remote_path,root_path), name) for path, subdirs, files in os.walk(remote_path) for name in files if os.path.join(remote_path,'orphaned_data') not in path and os.path.join(remote_path,'.RecycleBin') not in path]
|
||||||
else:
|
else:
|
||||||
root_files = [os.path.join(path, name) for path, subdirs, files in os.walk(root_path) for name in files if os.path.join(root_path,'orphaned_data') not in path and os.path.join(root_path,'.RecycleBin') not in path]
|
root_files = [os.path.join(path, name) for path, subdirs, files in os.walk(root_path) for name in files if os.path.join(root_path,'orphaned_data') not in path and os.path.join(root_path,'.RecycleBin') not in path]
|
||||||
|
|
||||||
|
#Get an updated list of torrents
|
||||||
|
torrent_list = client.torrents.info(sort='added_on')
|
||||||
|
|
||||||
for torrent in torrent_list:
|
for torrent in torrent_list:
|
||||||
for file in torrent.files:
|
for file in torrent.files:
|
||||||
|
|
Loading…
Add table
Reference in a new issue