From cc2459b338fc1ecc1170095ab600ea43ee04a2f9 Mon Sep 17 00:00:00 2001 From: Viktor Stanchev Date: Mon, 23 Mar 2015 20:24:38 -0400 Subject: [PATCH] check if transmission is running when using -t, close #26 --- pirate-get.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pirate-get.py b/pirate-get.py index 60e5e07..35df008 100755 --- a/pirate-get.py +++ b/pirate-get.py @@ -26,6 +26,7 @@ import gzip import configparser import argparse import builtins +import subprocess import webbrowser import urllib.request as request @@ -423,6 +424,14 @@ def main(): action='store_false', default=True, help='disable colored output') args = parser.parse_args() + + if args.transmission: + with open('/dev/null') as dn: + ret = subprocess.call(['transmission-remote', '-l'], stdout=dn, stderr=dn) + if ret != 0: + print('Transmission is not running.') + return + if args.list_categories: cur_color = 'zebra_0' for key, value in sorted(categories.items()) :