mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-04 02:46:52 +08:00
potential fix for unregistered torrents
This commit is contained in:
parent
cdea2a73d5
commit
c82475400e
1 changed files with 42 additions and 36 deletions
|
@ -423,42 +423,48 @@ class Qbt:
|
||||||
t_msg = self.torrentinfo[t_name]['msg']
|
t_msg = self.torrentinfo[t_name]['msg']
|
||||||
t_status = self.torrentinfo[t_name]['status']
|
t_status = self.torrentinfo[t_name]['status']
|
||||||
check_tags = util.get_list(torrent.tags)
|
check_tags = util.get_list(torrent.tags)
|
||||||
for x in torrent.trackers:
|
try:
|
||||||
if x.url.startswith('http'):
|
for x in torrent.trackers:
|
||||||
tracker = self.config.get_tags([x.url])
|
if x.url.startswith('http'):
|
||||||
msg_up = x.msg.upper()
|
tracker = self.config.get_tags([x.url])
|
||||||
# Tag any potential unregistered torrents
|
msg_up = x.msg.upper()
|
||||||
if not any(m in msg_up for m in unreg_msgs) and x.status == 4 and 'issue' not in check_tags:
|
# Tag any potential unregistered torrents
|
||||||
# Check for unregistered torrents using BHD API if the tracker is BHD
|
if not any(m in msg_up for m in unreg_msgs) and x.status == 4 and 'issue' not in check_tags:
|
||||||
if 'tracker.beyond-hd.me' in tracker['url'] and self.config.BeyondHD is not None:
|
# Check for unregistered torrents using BHD API if the tracker is BHD
|
||||||
json = {"info_hash": torrent.hash}
|
if 'tracker.beyond-hd.me' in tracker['url'] and self.config.BeyondHD is not None:
|
||||||
response = self.config.BeyondHD.search(json)
|
json = {"info_hash": torrent.hash}
|
||||||
if response['total_results'] <= 1:
|
response = self.config.BeyondHD.search(json)
|
||||||
del_unregistered()
|
if response['total_results'] <= 1:
|
||||||
break
|
del_unregistered()
|
||||||
pot_unr = ''
|
break
|
||||||
pot_unr += (util.insert_space(f'Torrent Name: {t_name}', 3)+'\n')
|
pot_unr = ''
|
||||||
pot_unr += (util.insert_space(f'Status: {msg_up}', 9)+'\n')
|
pot_unr += (util.insert_space(f'Torrent Name: {t_name}', 3)+'\n')
|
||||||
pot_unr += (util.insert_space(f'Tracker: {tracker["url"]}', 8)+'\n')
|
pot_unr += (util.insert_space(f'Status: {msg_up}', 9)+'\n')
|
||||||
pot_unr += (util.insert_space("Added Tag: 'issue'", 6)+'\n')
|
pot_unr += (util.insert_space(f'Tracker: {tracker["url"]}', 8)+'\n')
|
||||||
pot_unr_summary += pot_unr
|
pot_unr += (util.insert_space("Added Tag: 'issue'", 6)+'\n')
|
||||||
pot_unreg += 1
|
pot_unr_summary += pot_unr
|
||||||
attr = {
|
pot_unreg += 1
|
||||||
"function": "potential_rem_unregistered",
|
attr = {
|
||||||
"title": "Potential Unregistered Torrents",
|
"function": "potential_rem_unregistered",
|
||||||
"body": pot_unr,
|
"title": "Potential Unregistered Torrents",
|
||||||
"torrent_name": t_name,
|
"body": pot_unr,
|
||||||
"torrent_category": t_cat,
|
"torrent_name": t_name,
|
||||||
"torrent_tag": "issue",
|
"torrent_category": t_cat,
|
||||||
"torrent_status": msg_up,
|
"torrent_tag": "issue",
|
||||||
"torrent_tracker": tracker["url"],
|
"torrent_status": msg_up,
|
||||||
"notifiarr_indexer": tracker["notifiarr"],
|
"torrent_tracker": tracker["url"],
|
||||||
}
|
"notifiarr_indexer": tracker["notifiarr"],
|
||||||
self.config.send_notifications(attr)
|
}
|
||||||
if not dry_run: torrent.add_tags(tags='issue')
|
self.config.send_notifications(attr)
|
||||||
if any(m in msg_up for m in unreg_msgs) and x.status == 4:
|
if not dry_run: torrent.add_tags(tags='issue')
|
||||||
del_unregistered()
|
if any(m in msg_up for m in unreg_msgs) and x.status == 4:
|
||||||
break
|
del_unregistered()
|
||||||
|
break
|
||||||
|
except NotFound404Error:
|
||||||
|
continue
|
||||||
|
except Exception as e:
|
||||||
|
util.print_stacktrace()
|
||||||
|
logger.error(f"Unknown Error: {e}")
|
||||||
if del_tor >= 1 or del_tor_cont >= 1:
|
if del_tor >= 1 or del_tor_cont >= 1:
|
||||||
if del_tor >= 1: print_line(f"{'Did not delete' if dry_run else 'Deleted'} {del_tor} .torrent{'s' if del_tor > 1 else ''} but not content files.", loglevel)
|
if del_tor >= 1: print_line(f"{'Did not delete' if dry_run else 'Deleted'} {del_tor} .torrent{'s' if del_tor > 1 else ''} but not content files.", loglevel)
|
||||||
if del_tor_cont >= 1: print_line(f"{'Did not delete' if dry_run else 'Deleted'} {del_tor_cont} .torrent{'s' if del_tor_cont > 1 else ''} AND content files.", loglevel)
|
if del_tor_cont >= 1: print_line(f"{'Did not delete' if dry_run else 'Deleted'} {del_tor_cont} .torrent{'s' if del_tor_cont > 1 else ''} AND content files.", loglevel)
|
||||||
|
|
Loading…
Add table
Reference in a new issue