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

Merge pull request #18 from mvpossum/master

Added the ability to run a custom command
This commit is contained in:
Viktor Stanchev 2014-05-09 02:54:35 +00:00
commit 6dda544b82

View File

@ -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)