summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ryuslash2010-04-08 15:14:12 +0200
committerGravatar ryuslash2010-04-08 15:14:12 +0200
commit2db5555609b4ab157ea836f9611c6faa80508cf3 (patch)
treef62e16e906feede66f3e6981bfa31ec031bed766
parent9fb2b4ff58681dde805f9ac2c8be3b59ad8e9a50 (diff)
download4grab-2db5555609b4ab157ea836f9611c6faa80508cf3.tar.gz
4grab-2db5555609b4ab157ea836f9611c6faa80508cf3.zip
Archive lookup
4grab was saving the archived images to the wrong place, which is now fixed
-rw-r--r--config.py8
-rw-r--r--download.py9
-rw-r--r--util.py7
3 files changed, 13 insertions, 11 deletions
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")