From 4bd89ebdedf429186bb1381a61c3adf9eaeb5eb9 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 11 Jun 2011 11:34:43 +0200 Subject: [PATCH] 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. --- 4grab.py | 62 ++------------------------------------------------------ 1 file changed, 2 insertions(+), 60 deletions(-) diff --git a/4grab.py b/4grab.py index 99e6058..821adc1 100755 --- a/4grab.py +++ b/4grab.py @@ -38,43 +38,6 @@ base_url = "http://boards.4chan.org/" parser = optparse.OptionParser() 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(): conf = config.Configuration() parser.set_usage( @@ -100,12 +63,6 @@ under certain conditions.""") metavar="THREAD", help="Download only THREAD. If THREAD is only an ID, " "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", "--sort", action="store_true", @@ -127,13 +84,6 @@ under certain conditions.""") print "Can't configure something and do something else too." 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: sort = sorter.Sorter() for item in os.listdir(conf.get_download_location()): @@ -142,7 +92,7 @@ under certain conditions.""") if options.confval: 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])) exit(1) print "Setting", options.confval[0], "to", options.confval[1] @@ -151,14 +101,6 @@ under certain conditions.""") conf.save() 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: try: if options.thread[:7] == "http://": @@ -185,7 +127,7 @@ under certain conditions.""") elif options.loglevel is not None: util.loglevel = util.LogType.from_int(options.loglevel) - + if __name__ == "__main__": conf = config.Configuration() sort = sorter.Sorter()