From 4a9cc7e2b608332f3d41aa47f5f1a893a5eab529 Mon Sep 17 00:00:00 2001 From: ryuslash Date: Wed, 17 Mar 2010 23:11:18 +0100 Subject: optioncreator, extra options config now has an optioncreator property that will allow another module to select how to prompt for a property resolutions and archive options have been added to config file for sorting functionality --- download.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'download.py') diff --git a/download.py b/download.py index 05a5328..378d281 100644 --- a/download.py +++ b/download.py @@ -25,10 +25,12 @@ import htmlparser #import progressbar import config -conf = config.Configuration() -savedir = conf.get_download_location() -if not os.path.exists(savedir): - os.makedirs(savedir) +def get_savedir(): + conf = config.Configuration() + savedir = conf.get_download_location() + if not os.path.exists(savedir): + os.makedirs(savedir) + return savedir class Downloader(object): def __init__(self, progress_reporter): @@ -106,7 +108,7 @@ class Downloader(object): i = 1 for link in t: progress.show_progress(i) - filename = os.path.join(savedir, os.path.split(link)[1]) + filename = os.path.join(get_savedir(), os.path.split(link)[1]) if not os.path.exists(filename): tries = 10 while tries > 0: @@ -127,10 +129,4 @@ class Downloader(object): return (skipped, failed, downloaded, total) if __name__ == "__main__": - # Get a file-like object for the 4chan.org w/imgboard - base_url = "http://boards.4chan.org/" + conf.get_category() + "/" - - # Get the hyperlinks. - t = get_thread_links(base_url) - t = get_image_links(base_url, t) - get_images(t) + print "Don't run me, run 4grab.py" -- cgit v1.2.3-54-g00ecf