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

check if transmission is running when using -t, close #26

This commit is contained in:
Viktor Stanchev 2015-03-23 20:24:38 -04:00
parent 9fe74e506b
commit cc2459b338

View File

@ -26,6 +26,7 @@ import gzip
import configparser import configparser
import argparse import argparse
import builtins import builtins
import subprocess
import webbrowser import webbrowser
import urllib.request as request import urllib.request as request
@ -423,6 +424,14 @@ def main():
action='store_false', default=True, action='store_false', default=True,
help='disable colored output') help='disable colored output')
args = parser.parse_args() 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: if args.list_categories:
cur_color = 'zebra_0' cur_color = 'zebra_0'
for key, value in sorted(categories.items()) : for key, value in sorted(categories.items()) :