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

-t option for transmission

This commit is contained in:
Viktor Stanchev 2013-12-14 08:30:11 -05:00
parent b9ac972dd3
commit 7957dac8fe

View File

@ -3,6 +3,7 @@ import webbrowser
import urllib
import urllib2
import re
import os
from HTMLParser import HTMLParser
import argparse
from pprint import pprint
@ -40,6 +41,7 @@ class MyHTMLParser(HTMLParser):
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=True)
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)
@ -129,7 +131,15 @@ def main():
choice = None
if not choice == None:
webbrowser.open(mags[choice][0])
url = mags[choice][0]
print
print "url:"
print url
if args.transmission:
os.system("""transmission-remote --add "%s" """ % (url))
os.system("transmission-remote -l")
else:
webbrowser.open(url)
else:
print "Cancelled."
else: