From 2db5555609b4ab157ea836f9611c6faa80508cf3 Mon Sep 17 00:00:00 2001 From: ryuslash Date: Thu, 8 Apr 2010 15:14:12 +0200 Subject: [PATCH] Archive lookup 4grab was saving the archived images to the wrong place, which is now fixed --- config.py | 8 ++------ download.py | 9 ++++----- util.py | 7 +++++++ 3 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 util.py diff --git a/config.py b/config.py index 7230285..f3795bb 100644 --- a/config.py +++ b/config.py @@ -20,15 +20,11 @@ import os import ConfigParser import sys - -# Get our reference point. preferably $HOME. -homedir = os.getenv("HOME") -if homedir is None: - homedir = os.path.dirname(sys.argv[0]) +from util import homedir, confdir class _Configuration(object): def __init__(self, optioncreator): - self.filename = os.path.join(os.path.join(homedir, ".4grab"), "config.cfg") + self.filename = os.path.join(confdir, "config.cfg") self.configparser = ConfigParser.RawConfigParser() self.optioncreator = optioncreator diff --git a/download.py b/download.py index 7508a50..68315bc 100644 --- a/download.py +++ b/download.py @@ -22,6 +22,7 @@ import os import htmlparser import config import sys +import backend def get_savedir(): conf = config.Configuration() @@ -30,12 +31,10 @@ def get_savedir(): os.makedirs(savedir) return savedir def check_archive(fullpath): - conf = config.Configuration() - archive = conf.get_archive_location() filename = os.path.basename(fullpath) - archfile = os.path.join(archive, filename) - #sys.stderr.write("%s %d\n" % (archfile, os.path.exists(archfile))) - return os.path.exists(archfile) + be = backend.Backend() + return be.check(filename) + def write(message): sys.stdout.write(message) sys.stdout.flush() diff --git a/util.py b/util.py new file mode 100644 index 0000000..9e8214e --- /dev/null +++ b/util.py @@ -0,0 +1,7 @@ +import os +import sys + +homedir = os.getenv("HOME") +if homedir is None: + homedir = os.path.dirname(sys.argv[0]) +confdir = os.path.join(homedir, ".4grab")