mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-11-12 01:10:50 +08:00
minor fixes
This commit is contained in:
parent
56e397da4b
commit
2ce622f6b9
2 changed files with 25 additions and 7 deletions
|
|
@ -74,6 +74,7 @@ class Category:
|
||||||
"body": "\n".join(body),
|
"body": "\n".join(body),
|
||||||
"torrents": [t_name],
|
"torrents": [t_name],
|
||||||
"torrent_category": new_cat,
|
"torrent_category": new_cat,
|
||||||
|
"torrent_tag": ", ".join(tracker["tag"]),
|
||||||
"torrent_tracker": tracker["url"],
|
"torrent_tracker": tracker["url"],
|
||||||
"notifiarr_indexer": tracker["notifiarr"],
|
"notifiarr_indexer": tracker["notifiarr"],
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +93,11 @@ class Category:
|
||||||
if category not in group_attr:
|
if category not in group_attr:
|
||||||
group_attr[category] = {
|
group_attr[category] = {
|
||||||
"torrent_category": category,
|
"torrent_category": category,
|
||||||
|
"body": attr["body"],
|
||||||
"torrents": [attr["torrents"][0]],
|
"torrents": [attr["torrents"][0]],
|
||||||
|
"torrent_tag": attr["torrent_tag"],
|
||||||
|
"torrent_tracker": attr["torrent_tracker"],
|
||||||
|
"notifiarr_indexer": attr["notifiarr_indexer"],
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
group_attr[category]["torrents"].append(attr["torrents"][0])
|
group_attr[category]["torrents"].append(attr["torrents"][0])
|
||||||
|
|
@ -104,15 +109,21 @@ class Category:
|
||||||
)
|
)
|
||||||
group_attr = group_notifications_by_category(self)
|
group_attr = group_notifications_by_category(self)
|
||||||
for category in group_attr:
|
for category in group_attr:
|
||||||
|
num_torrents_updated = len(group_attr[category]["torrents"])
|
||||||
|
only_one_torrent_updated = num_torrents_updated == 1
|
||||||
|
|
||||||
attr = {
|
attr = {
|
||||||
"function": "cat_update",
|
"function": "cat_update",
|
||||||
"title": f"Updating Category for {category}",
|
"title": f"Updating Category for {category}",
|
||||||
"body": f"Updated {len(group_attr[category]['torrents'])} "
|
"body": group_attr[category]["body"]
|
||||||
f"{'torrents' if len(group_attr[category]['torrents']) > 1 else 'torrent'} with category '{category}'",
|
if only_one_torrent_updated
|
||||||
|
else f"Updated {num_torrents_updated} "
|
||||||
|
f"{'torrent' if only_one_torrent_updated else 'torrents'} with category '{category}'",
|
||||||
"torrents": group_attr[category]["torrents"],
|
"torrents": group_attr[category]["torrents"],
|
||||||
"torrent_category": category,
|
"torrent_category": category,
|
||||||
"torrent_tracker": None,
|
"torrent_tag": group_attr[category]["torrent_tag"] if only_one_torrent_updated else None,
|
||||||
"notifiarr_indexer": None,
|
"torrent_tracker": group_attr[category]["torrent_tracker"] if only_one_torrent_updated else None,
|
||||||
|
"notifiarr_indexer": group_attr[category]["notifiarr_indexer"] if only_one_torrent_updated else None,
|
||||||
}
|
}
|
||||||
self.config.send_notifications(attr)
|
self.config.send_notifications(attr)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,9 @@ class Tags:
|
||||||
if tag not in group_attr:
|
if tag not in group_attr:
|
||||||
group_attr[tag] = {
|
group_attr[tag] = {
|
||||||
"torrent_tag": tag,
|
"torrent_tag": tag,
|
||||||
|
"body": attr["body"],
|
||||||
"torrents": [attr["torrents"][0]],
|
"torrents": [attr["torrents"][0]],
|
||||||
|
"torrent_category": attr["torrent_category"],
|
||||||
"torrent_tracker": attr["torrent_tracker"],
|
"torrent_tracker": attr["torrent_tracker"],
|
||||||
"notifiarr_indexer": attr["notifiarr_indexer"],
|
"notifiarr_indexer": attr["notifiarr_indexer"],
|
||||||
}
|
}
|
||||||
|
|
@ -83,13 +85,18 @@ class Tags:
|
||||||
)
|
)
|
||||||
group_attr = group_notifications_by_tag(self)
|
group_attr = group_notifications_by_tag(self)
|
||||||
for tag in group_attr:
|
for tag in group_attr:
|
||||||
|
num_torrents_updated = len(group_attr[tag]["torrents"])
|
||||||
|
only_one_torrent_updated = num_torrents_updated == 1
|
||||||
|
|
||||||
attr = {
|
attr = {
|
||||||
"function": "tag_update",
|
"function": "tag_update",
|
||||||
"title": f"Updating Tags for {tag}",
|
"title": f"Updating Tags for {tag}",
|
||||||
"body": f"Updated {len(group_attr[tag]['torrents'])} "
|
"body": group_attr[tag]["body"]
|
||||||
f"{'torrents' if len(group_attr[tag]['torrents']) > 1 else 'torrent'} with tag '{tag}'",
|
if only_one_torrent_updated
|
||||||
|
else f"Updated {num_torrents_updated} "
|
||||||
|
f"{'torrent' if only_one_torrent_updated else 'torrents'} with tag '{tag}'",
|
||||||
"torrents": group_attr[tag]["torrents"],
|
"torrents": group_attr[tag]["torrents"],
|
||||||
"torrent_category": None,
|
"torrent_category": group_attr[tag]["torrent_category"] if only_one_torrent_updated else None,
|
||||||
"torrent_tag": tag,
|
"torrent_tag": tag,
|
||||||
"torrent_tracker": group_attr[tag]["torrent_tracker"],
|
"torrent_tracker": group_attr[tag]["torrent_tracker"],
|
||||||
"notifiarr_indexer": group_attr[tag]["notifiarr_indexer"],
|
"notifiarr_indexer": group_attr[tag]["notifiarr_indexer"],
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue