Archive lookup

4grab was saving the archived images to the wrong place, which is now fixed
This commit is contained in:
ryuslash 2010-04-08 15:14:12 +02:00
parent 9fb2b4ff58
commit 2db5555609
3 changed files with 13 additions and 11 deletions

View file

@ -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

View file

@ -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()

7
util.py Normal file
View file

@ -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")