Swapped role of tag and category

This commit is contained in:
j4nk 2024-08-06 15:48:42 -04:00
parent a7def171e6
commit 66eabdda18
1 changed files with 7 additions and 7 deletions

14
bot.py
View File

@ -122,13 +122,13 @@ class QBittorrentAPICaller():
to_ret += "```" to_ret += "```"
return to_ret return to_ret
def add(self, url, username, tag="unknown"): def add(self, url, username, category="unknown"):
if not url.startswith("magnet:"): if not url.startswith("magnet:"):
return "Please supply a magnet link (begins with \"magnet:\")" return "Please supply a magnet link (begins with \"magnet:\")"
the_url = self.url + "/" + "api/v2/torrents/add" the_url = self.url + "/" + "api/v2/torrents/add"
resp = self.session.post(the_url, data={"urls":url,"category":username,"tags":tag}) resp = self.session.post(the_url, data={"urls":url,"category":category,"tags":username})
if (resp.status_code == 415): if (resp.status_code == 415):
return "Torrent file not valid" return "Torrent file not valid"
@ -300,13 +300,13 @@ class QBBot(slixmpp.ClientXMPP):
message += self.api_caller.torrentList("full") message += self.api_caller.torrentList("full")
case "add": case "add":
tag = "unknown" category = "unknown"
string_start = 2 string_start = 2
if tokens[2].startswith("t="): if tokens[2].startswith("c="):
tag = tokens[2].removeprefix("t=") category = tokens[2].removeprefix("c=")
string_start = 3 string_start = 3
message += self.api_caller.add(tokens[string_start], msg['mucnick'], tag) message += self.api_caller.add(tokens[string_start], msg['mucnick'], category)
case "searchplugins": case "searchplugins":
resp = self.api_caller.get_search_plugins() resp = self.api_caller.get_search_plugins()
@ -404,7 +404,7 @@ class QBBot(slixmpp.ClientXMPP):
message += "help: Displays this help" + "\n" message += "help: Displays this help" + "\n"
message += "list: Lists torrents, names truncated to 25 characters\n" message += "list: Lists torrents, names truncated to 25 characters\n"
message += "fulllist: Lists torrents, no name truncation\n" message += "fulllist: Lists torrents, no name truncation\n"
message += "add [t=TAG] MAGNET_URL: Adds torrent corresponding to MAGNET_URL to the download list.\n\tNote that this will take about 5 seconds, as there's a check for 0 seeds after 5 seconds as a warning.\n\tOptionally include TAG to assist in automated copy.\n\tValid TAG values can be found with the categories in searchplugins\n" message += "add [c=CATEGORY] MAGNET_URL: Adds torrent corresponding to MAGNET_URL to the download list.\n\tNote that this will take about 5 seconds, as there's a check for 0 seeds after 5 seconds as a warning.\n\tOptionally include CATEGORY to assist in automated copy.\n\tValid CATEGORY values can be found with the categories in searchplugins\n"
message += "searchplugins: List the installed search plugins\n" message += "searchplugins: List the installed search plugins\n"
message += "search [c=CATEGORY] search_string: Search from all enabled plugins for search_string, with optional category CATEGORY. Valid categories can be found from the searchplugins command.\n" message += "search [c=CATEGORY] search_string: Search from all enabled plugins for search_string, with optional category CATEGORY. Valid categories can be found from the searchplugins command.\n"
message += "searchselect: Selects a torrent from a previous search to download\n" message += "searchselect: Selects a torrent from a previous search to download\n"