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:
parent
b9ac972dd3
commit
7957dac8fe
@ -3,6 +3,7 @@ import webbrowser
|
|||||||
import urllib
|
import urllib
|
||||||
import urllib2
|
import urllib2
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
from HTMLParser import HTMLParser
|
from HTMLParser import HTMLParser
|
||||||
import argparse
|
import argparse
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
@ -40,6 +41,7 @@ class MyHTMLParser(HTMLParser):
|
|||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Finds and downloads torrents from the Pirate Bay')
|
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('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('--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('-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
|
choice = None
|
||||||
|
|
||||||
if not 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:
|
else:
|
||||||
print "Cancelled."
|
print "Cancelled."
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user