diff options
author | ryuslash | 2010-02-11 21:20:16 +0100 |
---|---|---|
committer | ryuslash | 2010-02-11 21:20:16 +0100 |
commit | 420bc469a486d99f62084841428c325ae769b76a (patch) | |
tree | 5fd98f65fff81d259c5a7c7b51c13ebed214c31d | |
parent | 68be1fe204732b137b5a776b3c4e44876006ac94 (diff) | |
download | 4grab-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-- | .gitignore | 2 | ||||
-rwxr-xr-x | 4grab.py | 7 |
2 files changed, 8 insertions, 1 deletions
@@ -1,4 +1,4 @@ *~ *.pyc -#*# +\#*\# .*
\ No newline at end of file @@ -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()) |