diff options
author | ryuslash | 2010-03-17 23:11:18 +0100 |
---|---|---|
committer | ryuslash | 2010-03-17 23:11:18 +0100 |
commit | 4a9cc7e2b608332f3d41aa47f5f1a893a5eab529 (patch) | |
tree | c6a15d7465f584bcb6192c939116bcaaca7d7a9a /download.py | |
parent | 8e101c92f930422f0ec97d8d15511732732a9f37 (diff) | |
download | 4grab-4a9cc7e2b608332f3d41aa47f5f1a893a5eab529.tar.gz 4grab-4a9cc7e2b608332f3d41aa47f5f1a893a5eab529.zip |
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
Diffstat (limited to 'download.py')
-rw-r--r-- | download.py | 20 |
1 files changed, 8 insertions, 12 deletions
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" |