This commit is contained in:
Visorask 2021-02-19 23:29:45 -06:00
parent 42909982ca
commit fe42fc2bb0

View file

@ -4,22 +4,15 @@ from qbittorrentapi import Client
import yaml import yaml
import argparse import argparse
parser = argparse.ArgumentParser("qBittorrent scripts.", parser = argparse.ArgumentParser("qBittorrent Manager.",
description='A mix of scripts combined for managing qBittorrent.') description='A mix of scripts combined for managing qBittorrent.')
parser.add_argument('-c', '--config-file', parser.add_argument('-c', '--config-file', dest='config', action='store', default='config.yml',
dest='config',
action='store',
default='config.yml',
help='This is used if you want to use different names for your config.yml. Example: tv.yml') help='This is used if you want to use different names for your config.yml. Example: tv.yml')
parser.add_argument('--cat-update', parser.add_argument('--manage', dest='command', action='store_const', const='manage',
dest='command', help='Use this if you would like to update your tags AND categories.')
action='store_const', parser.add_argument('--cat-update', dest='command', action='store_const', const='cat-update',
const='cat-update',
help='Use this if you would like to update your categories.') help='Use this if you would like to update your categories.')
parser.add_argument('--tag-update', parser.add_argument('--tag-update', dest='command', action='store_const', const='tag-update',
dest='command',
action='store_const',
const='tag-update',
help='Use this if you would like to update your tags.') help='Use this if you would like to update your tags.')
args = parser.parse_args() args = parser.parse_args()
@ -42,7 +35,6 @@ def get_category(path):
return category return category
# Main command that does the work.
def update_category(): def update_category():
num_cat = 0 num_cat = 0
for torrent in torrent_list: for torrent in torrent_list:
@ -87,10 +79,13 @@ def update_tags():
def main(): def main():
if args.command == 'cat-update': if args.command == 'manage':
update_category() update_category()
update_tags()
elif args.command == 'tag-update': elif args.command == 'tag-update':
update_tags() update_tags()
elif args.command == 'cat-update':
update_category()
if __name__ == "__main__": if __name__ == "__main__":