Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koteq/04bb8504cfd84f545d60efb4dc7b73fc to your computer and use it in GitHub Desktop.
Save koteq/04bb8504cfd84f545d60efb4dc7b73fc to your computer and use it in GitHub Desktop.
Adapter to pair Taiga with qBittorrent
#!/usr/bin/env python3
import os
import sys
import argparse
# pip install requests
import requests
def main():
# Sometimes Taiga ends directory argument with slash `\" ` which leads
# to total wreck of argumens. Next code is here to solve the issue.
raw_args = []
for arg in sys.argv[1:]:
if '" ' in arg:
raw_args.extend(arg.split('" '))
else:
raw_args.append(arg)
if len(raw_args) > 3:
raw_args[2:] = [' '.join(raw_args[2:])]
parser = argparse.ArgumentParser(prefix_chars='-/')
parser.add_argument('/directory', action='store')
parser.add_argument('torrent_file')
args = parser.parse_args(raw_args)
if os.path.isfile(args.torrent_file):
with open(args.torrent_file, 'rb') as f:
r = requests.post(
'http://localhost:8080/command/upload',
files={'fileselect[]': f},
data={
'category': 'Taiga',
'savepath': args.directory,
}
)
if __name__ == '__main__':
main()
@taigalover
Copy link

sry to ask, but please can i have a breakdown of what this is how do i use it, in laymans terms. i just really want to use qbittorent with taiga.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment