From 380460503bc17935ed399dadaec585baa8295825 Mon Sep 17 00:00:00 2001 From: mvpossum Date: Thu, 8 May 2014 12:17:24 -0300 Subject: [PATCH] Added the ability to run a custom command --- pirate-get.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pirate-get.py b/pirate-get.py index 46efa92..24f02e3 100755 --- a/pirate-get.py +++ b/pirate-get.py @@ -65,6 +65,7 @@ def main(): parser = argparse.ArgumentParser(description='Finds and downloads torrents from the Pirate Bay') parser.add_argument('q', metavar='search_term', help="The term to search for") parser.add_argument('-t',dest='transmission',action='store_true', help="call transmission-remote to start the download", default=False) + parser.add_argument('--custom',dest='command', help="call custom command, %%s will be replaced with the url") parser.add_argument('--local', dest='database', help="An xml file containing the Pirate Bay database") parser.add_argument('-p', dest='pages', help="The number of pages to fetch (doesn't work with --local)", default=1) parser.add_argument('-0', dest='first', action='store_true', help="choose the top result", default=False) @@ -254,6 +255,8 @@ def main(): if args.transmission: os.system("""transmission-remote --add "%s" """ % (url)) os.system("transmission-remote -l") + elif args.command: + os.system(args.custom % (url)) else: webbrowser.open(url)