summaryrefslogtreecommitdiffstats
path: root/download.py
diff options
context:
space:
mode:
Diffstat (limited to 'download.py')
-rw-r--r--download.py20
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"