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
This commit is contained in:
parent
68be1fe204
commit
420bc469a4
2 changed files with 8 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
|||
*~
|
||||
*.pyc
|
||||
#*#
|
||||
\#*\#
|
||||
.*
|
7
4grab.py
7
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())
|
||||
|
||||
|
|
Loading…
Reference in a new issue