Removed wizard option, never use it
I once implemented it for a friend of mine, but he doesn't use it at all, so I'd best just let it loose.
This commit is contained in:
parent
05724b37b3
commit
4bd89ebded
1 changed files with 2 additions and 60 deletions
62
4grab.py
62
4grab.py
|
@ -38,43 +38,6 @@ base_url = "http://boards.4chan.org/"
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
downloader = download.Downloader(progressbar.Progress)
|
downloader = download.Downloader(progressbar.Progress)
|
||||||
|
|
||||||
def walk_with_wizard(baseurl):
|
|
||||||
conf = config.Configuration()
|
|
||||||
wzrd_msg = "Pilates! *SHAZAM* Here they come!"
|
|
||||||
print "Alright, let me put on my robe and wizard hat."
|
|
||||||
|
|
||||||
# Single or all
|
|
||||||
inp = None
|
|
||||||
prompt = "Would you like to download a single thread, or all? "
|
|
||||||
inp = raw_input(prompt)
|
|
||||||
while (inp != "single" and inp != "all"):
|
|
||||||
print "Please type single or all"
|
|
||||||
inp = raw_input(prompt)
|
|
||||||
|
|
||||||
if inp == "single":
|
|
||||||
inp = raw_input("Which thread would you like to download? ")
|
|
||||||
if inp[:7] == "http://":
|
|
||||||
t = downloader.get_image_links("", [inp])
|
|
||||||
else:
|
|
||||||
thread = inp
|
|
||||||
inp = raw_input("Which category is this thread in? ")
|
|
||||||
print wzrd_msg
|
|
||||||
t = downloader.get_image_links("%s%s/res/" % (baseurl, inp),
|
|
||||||
[thread])
|
|
||||||
else:
|
|
||||||
inp = raw_input("Which category would you like to download? ")
|
|
||||||
conf.set_categories([inp])
|
|
||||||
baseurl = "%s%s/" % (baseurl, conf.get_categories()[0])
|
|
||||||
|
|
||||||
print wzrd_msg
|
|
||||||
t = downloader.get_thread_links(baseurl)
|
|
||||||
t = downloader.get_image_links(baseurl, t)
|
|
||||||
(skipped, failed, downloaded, total) = downloader.get_images(t)
|
|
||||||
print "Downloaded: ", downloaded
|
|
||||||
print "Skipped: ", skipped
|
|
||||||
print "Failed: ", failed
|
|
||||||
print "Total: ", total
|
|
||||||
|
|
||||||
def parse_commands():
|
def parse_commands():
|
||||||
conf = config.Configuration()
|
conf = config.Configuration()
|
||||||
parser.set_usage(
|
parser.set_usage(
|
||||||
|
@ -100,12 +63,6 @@ under certain conditions.""")
|
||||||
metavar="THREAD",
|
metavar="THREAD",
|
||||||
help="Download only THREAD. If THREAD is only an ID, "
|
help="Download only THREAD. If THREAD is only an ID, "
|
||||||
"CATEGORY must also be set. Otherwise, no problem :-)")
|
"CATEGORY must also be set. Otherwise, no problem :-)")
|
||||||
parser.add_option("-w",
|
|
||||||
"--wizard",
|
|
||||||
action="store_true",
|
|
||||||
dest="wizard",
|
|
||||||
help="I'll put on my robe and wizard hat and help you "
|
|
||||||
"get some of those pictures you like")
|
|
||||||
parser.add_option("-s",
|
parser.add_option("-s",
|
||||||
"--sort",
|
"--sort",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
@ -127,13 +84,6 @@ under certain conditions.""")
|
||||||
print "Can't configure something and do something else too."
|
print "Can't configure something and do something else too."
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if options.wizard and (options.tempcat
|
|
||||||
or options.thread
|
|
||||||
or options.confval
|
|
||||||
or options.sort):
|
|
||||||
print "Can't take a walk with the wizard and do something else too."
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
if options.sort:
|
if options.sort:
|
||||||
sort = sorter.Sorter()
|
sort = sorter.Sorter()
|
||||||
for item in os.listdir(conf.get_download_location()):
|
for item in os.listdir(conf.get_download_location()):
|
||||||
|
@ -142,7 +92,7 @@ under certain conditions.""")
|
||||||
|
|
||||||
if options.confval:
|
if options.confval:
|
||||||
if not conf.option_exists(options.confval[0]):
|
if not conf.option_exists(options.confval[0]):
|
||||||
print ("%s: error: %s is not a valid configuration option"
|
print ("%s: error: %s is not a valid configuration option"
|
||||||
% (sys.argv[0], options.confval[0]))
|
% (sys.argv[0], options.confval[0]))
|
||||||
exit(1)
|
exit(1)
|
||||||
print "Setting", options.confval[0], "to", options.confval[1]
|
print "Setting", options.confval[0], "to", options.confval[1]
|
||||||
|
@ -151,14 +101,6 @@ under certain conditions.""")
|
||||||
conf.save()
|
conf.save()
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
elif options.wizard:
|
|
||||||
try:
|
|
||||||
walk_with_wizard(base_url)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print
|
|
||||||
print "Alright, no more wizard hat and robe then. Goodbye"
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
elif options.thread:
|
elif options.thread:
|
||||||
try:
|
try:
|
||||||
if options.thread[:7] == "http://":
|
if options.thread[:7] == "http://":
|
||||||
|
@ -185,7 +127,7 @@ under certain conditions.""")
|
||||||
|
|
||||||
elif options.loglevel is not None:
|
elif options.loglevel is not None:
|
||||||
util.loglevel = util.LogType.from_int(options.loglevel)
|
util.loglevel = util.LogType.from_int(options.loglevel)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
conf = config.Configuration()
|
conf = config.Configuration()
|
||||||
sort = sorter.Sorter()
|
sort = sorter.Sorter()
|
||||||
|
|
Loading…
Reference in a new issue