summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ryuslash2010-02-11 21:20:16 +0100
committerGravatar ryuslash2010-02-11 21:20:16 +0100
commit420bc469a486d99f62084841428c325ae769b76a (patch)
tree5fd98f65fff81d259c5a7c7b51c13ebed214c31d
parent68be1fe204732b137b5a776b3c4e44876006ac94 (diff)
download4grab-420bc469a486d99f62084841428c325ae769b76a.tar.gz
4grab-420bc469a486d99f62084841428c325ae769b76a.zip
Added --category
With --category, a category can be specified which will be downloaded, but only that run, next time the configured category will take over again
-rw-r--r--.gitignore2
-rwxr-xr-x4grab.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index fa1554f..58ca1a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
*~
*.pyc
-#*#
+\#*\#
.* \ No newline at end of file
diff --git a/4grab.py b/4grab.py
index adb47ca..dbefd78 100755
--- a/4grab.py
+++ b/4grab.py
@@ -35,9 +35,14 @@ This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.""")
parser.add_option("-e", nargs=2, dest="confval", metavar="CONF VALUE", help="Set configuration option CONF to be VALUE")
+parser.add_option("-c", "--category", dest="tempcat", metavar="CATEGORY", help="Set the category to CATEGORY only for this run")
(options, args) = parser.parse_args()
+if options.confval and options.tempcat:
+ print "Cannot set a value and download"
+ exit(1)
+
if options.confval:
if not config.Configuration().option_exists(options.confval[0]):
print "%s: error: %s is not a valid configuration option" % (sys.argv[0], options.confval[0])
@@ -46,6 +51,8 @@ if options.confval:
config.Configuration().set_option(options.confval[0], options.confval[1])
config.Configuration().save()
exit(0)
+elif options.tempcat:
+ config.Configuration().set_category(options.tempcat)
base_url = "http://boards.4chan.org/%s/" % (config.Configuration().get_category())