1
0
mirror of https://github.com/vikstrous/pirate-get synced 2025-01-10 10:04:21 +01:00

Merge pull request #48 from jebaum/transmission-port

add option to set transmission rpc port
This commit is contained in:
Viktor Stanchev 2015-05-21 11:19:44 +03:00
commit 09f7f24411

View File

@ -488,6 +488,8 @@ def main():
parser.add_argument('-t', '--transmission', parser.add_argument('-t', '--transmission',
action='store_true', action='store_true',
help='open magnets with transmission-remote') help='open magnets with transmission-remote')
parser.add_argument('-P', '--port', dest='port',
help='transmission-remote rpc port. default is 9091')
parser.add_argument('-C', '--custom', dest='command', parser.add_argument('-C', '--custom', dest='command',
help='open magnets with a custom command' help='open magnets with a custom command'
' (%%s will be replaced with the url)') ' (%%s will be replaced with the url)')
@ -514,8 +516,12 @@ def main():
if args.save_directory: if args.save_directory:
config.set('Save', 'directory', args.save_directory) config.set('Save', 'directory', args.save_directory)
transmission_command = ['transmission-remote']
if args.port:
transmission_command.append(args.port)
if args.transmission or config.getboolean('Misc', 'transmission'): if args.transmission or config.getboolean('Misc', 'transmission'):
ret = subprocess.call(['transmission-remote', '-l'], ret = subprocess.call(transmission_command + ['-l'],
stdout=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) stderr=subprocess.DEVNULL)
if ret != 0: if ret != 0:
@ -667,8 +673,8 @@ def main():
url = mags[int(choice)][0] url = mags[int(choice)][0]
if args.transmission or config.getboolean('Misc', 'transmission'): if args.transmission or config.getboolean('Misc', 'transmission'):
subprocess.call(['transmission-remote', '--add', url], shell=False) subprocess.call(transmission_command + ['-l', '--add', url], shell=False)
subprocess.call(['transmission-remote', '-l']) subprocess.call(transmission_command + ['-l'])
elif args.command or config.get('Misc', 'openCommand'): elif args.command or config.get('Misc', 'openCommand'):
command = config.get('Misc', 'openCommand') command = config.get('Misc', 'openCommand')