diff options
Diffstat (limited to '4grab.py')
-rwxr-xr-x | 4grab.py | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -21,11 +21,13 @@ import optparse import sys +import os import config import download import progressbar +import sorter def raw_input_with_default(default, prompt): inp = raw_input("%s (default=%s): " % (prompt, default)) @@ -106,20 +108,34 @@ under certain conditions.""") 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", + dest="sort", + help="Sort downloaded images, most handy if you've used " + "older versions which didn't sort yet") (options, args) = parser.parse_args() if options.confval and (options.tempcat or options.thread - or options.wizard): + or options.wizard + or options.sort): 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.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()): + sort.act(item) + exit(0) + if options.confval: if not conf.option_exists(options.confval[0]): print ("%s: error: %s is not a valid configuration option" @@ -167,7 +183,10 @@ under certain conditions.""") if __name__ == "__main__": conf = config.Configuration() + sort = sorter.Sorter() parse_commands() + + downloader.set_on_downloaded(sort.act) for category in conf.get_categories(): base_url = "%s%s/" % (base_url, category) try: |