mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-09 05:18:03 +08:00
commit
a6f81f9cce
4 changed files with 13 additions and 9 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
3.2.2
|
3.2.3
|
|
@ -18,6 +18,7 @@ class Notifiarr:
|
||||||
self.instance = params["instance"]
|
self.instance = params["instance"]
|
||||||
url, _ = self.get_url("user/validate/")
|
url, _ = self.get_url("user/validate/")
|
||||||
response = self.config.get(url)
|
response = self.config.get(url)
|
||||||
|
response_json = None
|
||||||
try:
|
try:
|
||||||
response_json = response.json()
|
response_json = response.json()
|
||||||
except JSONDecodeError as e:
|
except JSONDecodeError as e:
|
||||||
|
@ -26,6 +27,8 @@ class Notifiarr:
|
||||||
raise Failed("Notifiarr Error (Response: 525): SSL handshake between Cloudflare and the origin web server failed.")
|
raise Failed("Notifiarr Error (Response: 525): SSL handshake between Cloudflare and the origin web server failed.")
|
||||||
else:
|
else:
|
||||||
raise Failed(e)
|
raise Failed(e)
|
||||||
|
if response_json is None:
|
||||||
|
raise Failed("Notifiarr Error: Unable to connect to Notifiarr. It may be down?")
|
||||||
if response.status_code >= 400 or ("result" in response_json and response_json["result"] == "error"):
|
if response.status_code >= 400 or ("result" in response_json and response_json["result"] == "error"):
|
||||||
logger.debug(f"Response: {response_json}")
|
logger.debug(f"Response: {response_json}")
|
||||||
raise Failed(f"({response.status_code} [{response.reason}]) {response_json}")
|
raise Failed(f"({response.status_code} [{response.reason}]) {response_json}")
|
||||||
|
|
|
@ -295,7 +295,7 @@ class Qbt:
|
||||||
# self.config.notify(e, 'Tag No Hard Links', False)
|
# self.config.notify(e, 'Tag No Hard Links', False)
|
||||||
logger.warning(e)
|
logger.warning(e)
|
||||||
continue
|
continue
|
||||||
for torrent in alive_it(torrent_list):
|
for torrent in torrent_list:
|
||||||
tracker = self.config.get_tags([x.url for x in torrent.trackers if x.url.startswith('http')])
|
tracker = self.config.get_tags([x.url for x in torrent.trackers if x.url.startswith('http')])
|
||||||
if any(tag in torrent.tags for tag in nohardlinks[category]['exclude_tags']):
|
if any(tag in torrent.tags for tag in nohardlinks[category]['exclude_tags']):
|
||||||
# Skip to the next torrent if we find any torrents that are in the exclude tag
|
# Skip to the next torrent if we find any torrents that are in the exclude tag
|
||||||
|
@ -430,10 +430,10 @@ class Qbt:
|
||||||
cfg_tag_error = self.config.args['tag_tracker_error']
|
cfg_tag_error = self.config.args['tag_tracker_error']
|
||||||
|
|
||||||
def tag_tracker_error():
|
def tag_tracker_error():
|
||||||
nonlocal dry_run, t_name, msg_up, tracker, t_cat, torrent, tag_error, tor_error_summary, num_tor_error
|
nonlocal dry_run, t_name, msg_up, msg, tracker, t_cat, torrent, tag_error, tor_error_summary, num_tor_error
|
||||||
tor_error = ''
|
tor_error = ''
|
||||||
tor_error += (util.insert_space(f'Torrent Name: {t_name}', 3)+'\n')
|
tor_error += (util.insert_space(f'Torrent Name: {t_name}', 3)+'\n')
|
||||||
tor_error += (util.insert_space(f'Status: {msg_up}', 9)+'\n')
|
tor_error += (util.insert_space(f'Status: {msg}', 9)+'\n')
|
||||||
tor_error += (util.insert_space(f'Tracker: {tracker["url"]}', 8)+'\n')
|
tor_error += (util.insert_space(f'Tracker: {tracker["url"]}', 8)+'\n')
|
||||||
tor_error += (util.insert_space(f"Added Tag: {tag_error}", 6)+'\n')
|
tor_error += (util.insert_space(f"Added Tag: {tag_error}", 6)+'\n')
|
||||||
tor_error_summary += tor_error
|
tor_error_summary += tor_error
|
||||||
|
@ -445,7 +445,7 @@ class Qbt:
|
||||||
"torrent_name": t_name,
|
"torrent_name": t_name,
|
||||||
"torrent_category": t_cat,
|
"torrent_category": t_cat,
|
||||||
"torrent_tag": tag_error,
|
"torrent_tag": tag_error,
|
||||||
"torrent_status": msg_up,
|
"torrent_status": msg,
|
||||||
"torrent_tracker": tracker["url"],
|
"torrent_tracker": tracker["url"],
|
||||||
"notifiarr_indexer": tracker["notifiarr"],
|
"notifiarr_indexer": tracker["notifiarr"],
|
||||||
}
|
}
|
||||||
|
@ -453,17 +453,17 @@ class Qbt:
|
||||||
if not dry_run: torrent.add_tags(tags=tag_error)
|
if not dry_run: torrent.add_tags(tags=tag_error)
|
||||||
|
|
||||||
def del_unregistered():
|
def del_unregistered():
|
||||||
nonlocal dry_run, loglevel, del_tor, del_tor_cont, t_name, msg_up, tracker, t_cat, t_msg, t_status, torrent
|
nonlocal dry_run, loglevel, del_tor, del_tor_cont, t_name, msg_up, msg, tracker, t_cat, t_msg, t_status, torrent
|
||||||
body = []
|
body = []
|
||||||
body += print_line(util.insert_space(f'Torrent Name: {t_name}', 3), loglevel)
|
body += print_line(util.insert_space(f'Torrent Name: {t_name}', 3), loglevel)
|
||||||
body += print_line(util.insert_space(f'Status: {msg_up}', 9), loglevel)
|
body += print_line(util.insert_space(f'Status: {msg}', 9), loglevel)
|
||||||
body += print_line(util.insert_space(f'Tracker: {tracker["url"]}', 8), loglevel)
|
body += print_line(util.insert_space(f'Tracker: {tracker["url"]}', 8), loglevel)
|
||||||
attr = {
|
attr = {
|
||||||
"function": "rem_unregistered",
|
"function": "rem_unregistered",
|
||||||
"title": "Removing Unregistered Torrents",
|
"title": "Removing Unregistered Torrents",
|
||||||
"torrent_name": t_name,
|
"torrent_name": t_name,
|
||||||
"torrent_category": t_cat,
|
"torrent_category": t_cat,
|
||||||
"torrent_status": msg_up,
|
"torrent_status": msg,
|
||||||
"torrent_tracker": tracker["url"],
|
"torrent_tracker": tracker["url"],
|
||||||
"notifiarr_indexer": tracker["notifiarr"],
|
"notifiarr_indexer": tracker["notifiarr"],
|
||||||
}
|
}
|
||||||
|
@ -548,6 +548,7 @@ class Qbt:
|
||||||
if x.url.startswith('http'):
|
if x.url.startswith('http'):
|
||||||
tracker = self.config.get_tags([x.url])
|
tracker = self.config.get_tags([x.url])
|
||||||
msg_up = x.msg.upper()
|
msg_up = x.msg.upper()
|
||||||
|
msg = x.msg
|
||||||
# Tag any error torrents
|
# Tag any error torrents
|
||||||
if cfg_tag_error:
|
if cfg_tag_error:
|
||||||
if x.status == 4 and tag_error not in check_tags:
|
if x.status == 4 and tag_error not in check_tags:
|
||||||
|
|
|
@ -2,5 +2,5 @@ ruamel.yaml==0.17.21
|
||||||
qbittorrent-api>=2022.3.29
|
qbittorrent-api>=2022.3.29
|
||||||
schedule==1.1.0
|
schedule==1.1.0
|
||||||
retrying==1.3.3
|
retrying==1.3.3
|
||||||
alive_progress==2.3.1
|
alive_progress==2.4.1
|
||||||
requests==2.27.1
|
requests==2.27.1
|
Loading…
Add table
Reference in a new issue