Adds tracker to cross-seed webhook #103

This commit is contained in:
bobokun 2022-02-26 16:20:38 -05:00
parent 026465f882
commit 144bd69aea
No known key found for this signature in database
GPG key ID: 9665BA6CF5DC2671

View file

@ -601,6 +601,7 @@ class Qbt:
os.makedirs(dir_cs_out, exist_ok=True)
for file in cs_files:
t_name = file.split(']', 2)[2].split('.torrent')[0]
t_tracker = file.split(']', 2)[1][1:]
# Substring Key match in dictionary (used because t_name might not match exactly with torrentdict key)
# Returned the dictionary of filtered item
torrentdict_file = dict(filter(lambda item: t_name in item[0], self.torrentinfo.items()))
@ -619,6 +620,7 @@ class Qbt:
body += print_line(util.insert_space(f'Torrent Name: {t_name}', 3), loglevel)
body += print_line(util.insert_space(f'Category: {category}', 7), loglevel)
body += print_line(util.insert_space(f'Save_Path: {dest}', 6), loglevel)
body += print_line(util.insert_space(f'Tracker: {t_tracker}', 8), loglevel)
attr = {
"function": "cross_seed",
"title": "Adding New Cross-Seed Torrent",
@ -626,7 +628,8 @@ class Qbt:
"torrent_name": t_name,
"torrent_category": category,
"torrent_save_path": dest,
"torrent_tag": "cross-seed"
"torrent_tag": "cross-seed",
"torrent_tracker": t_tracker
}
self.config.send_notifications(attr)
added += 1
@ -646,6 +649,7 @@ class Qbt:
t_name = torrent.name
t_cat = torrent.category
if 'cross-seed' not in torrent.tags and self.torrentinfo[t_name]['count'] > 1 and self.torrentinfo[t_name]['first_hash'] != torrent.hash:
tracker = self.config.get_tags([x.url for x in torrent.trackers if x.url.startswith('http')])
tagged += 1
body = print_line(f"{'Not Adding' if dry_run else 'Adding'} 'cross-seed' tag to {t_name}", loglevel)
attr = {
@ -654,7 +658,8 @@ class Qbt:
"body": body,
"torrent_name": t_name,
"torrent_category": t_cat,
"torrent_tag": "cross-seed"
"torrent_tag": "cross-seed",
"torrent_tracker": tracker
}
self.config.send_notifications(attr)
if not dry_run: torrent.add_tags(tags='cross-seed')