summaryrefslogtreecommitdiffstats
path: root/pyLoadCore.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyLoadCore.py')
-rw-r--r--pyLoadCore.py40
1 files changed, 30 insertions, 10 deletions
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 9501631f8..7bd42c906 100644
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -22,6 +22,7 @@
"""
CURRENT_VERSION = '0.3.2'
+from getopt import GetoptError
from getopt import getopt
import gettext
from glob import glob
@@ -42,10 +43,10 @@ from os.path import isabs
from os.path import join
from re import sub
import subprocess
+import sys
from sys import argv
from sys import executable
from sys import exit
-import sys
from sys import path
from sys import stdout
from sys import version_info
@@ -73,21 +74,40 @@ class Core(object):
self.arg_links = []
if len(argv) > 1:
try:
- options, arguments = getopt(argv[1:], 'vcl:d')
+ options, args = getopt(argv[1:], 'vca:hd', ["version", "clear", "add=", "help", "debug"])
for option, argument in options:
- if option == "-v":
+ if option in ("-v", "--version"):
print "pyLoad", CURRENT_VERSION
exit()
- elif option == "-c":
+ elif option in ("-c", "--clear"):
remove(join("module", "links.pkl"))
print "Removed Linklist"
- elif option == "-l":
+ elif option in ("-a", "--add"):
self.arg_links.append(argument)
print "Added %s" % argument
- elif option == "-d":
+ elif option in ("-h", "--help"):
+ self.print_help()
+ exit()
+ elif option in ("-d", "--debug"):
self.doDebug = True
- except:
+ except GetoptError:
print 'Unknown Argument(s) "%s"' % " ".join(argv[1:])
+ self.print_help()
+ exit()
+
+ def print_help(self):
+ print ""
+ print "pyload %s Copyright (c) 2008-2010 the pyLoad Team" % CURRENT_VERSION
+ print ""
+ print "Usage: [python] pyLoadCore.py [options]"
+ print ""
+ print "<Options>"
+ print " -v, --version", " " * 4, "Print version to terminal"
+ print " -c, --clear", " " * 6, "Delete the saved linklist"
+ print " -a, --add=<list>", " " * 1, "Add the specified links"
+ print " -d, --debug", " " * 6, "Enable debug mode"
+ print " -h, --help", " " * 7, "Display this help screen"
+ print ""
def toggle_pause(self):
if self.thread_list.pause:
@@ -354,7 +374,7 @@ class Core(object):
def check_update(self):
try:
if self.config['updates']['search_updates']:
- version_check = Request().load("http://get.pyload.org/check/%s/" % (CURRENT_VERSION, ))
+ version_check = Request().load("http://get.pyload.org/check/%s/" % (CURRENT_VERSION,))
if version_check == "":
self.logger.info(_("No Updates for pyLoad"))
return False
@@ -372,9 +392,9 @@ class Core(object):
try:
if self.config['updates']['search_updates']:
if self.core.config['updates']['install_updates']:
- version_check = Request().load("http://get.pyload.org/get/update/%s/" % (CURRENT_VERSION, ))
+ version_check = Request().load("http://get.pyload.org/get/update/%s/" % (CURRENT_VERSION,))
else:
- version_check = Request().load("http://get.pyload.org/check/%s/" % (CURRENT_VERSION, ))
+ version_check = Request().load("http://get.pyload.org/check/%s/" % (CURRENT_VERSION,))
if version_check == "":
return False
else: