summaryrefslogtreecommitdiffstats
path: root/sorter.py
diff options
context:
space:
mode:
authorGravatar ryuslash2010-04-19 09:16:04 +0200
committerGravatar ryuslash2010-04-19 09:16:04 +0200
commitaf529bcd4e214c13b7810eeba4d425c4a1129b58 (patch)
tree3d17d70dd9e67e9173a97267002bfdb364aacfd8 /sorter.py
parent2db5555609b4ab157ea836f9611c6faa80508cf3 (diff)
download4grab-af529bcd4e214c13b7810eeba4d425c4a1129b58.tar.gz
4grab-af529bcd4e214c13b7810eeba4d425c4a1129b58.zip
Not checking and kirbybase
Using kirbybase to store downloaded images A nasty bug that always returned the wrong result when checking whether an image had already been downloaded has been fixed
Diffstat (limited to 'sorter.py')
-rw-r--r--sorter.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/sorter.py b/sorter.py
index 4022b55..5cb35e9 100644
--- a/sorter.py
+++ b/sorter.py
@@ -22,6 +22,7 @@ import Image
import shutil
import os
import datetime
+import backend
def dummy_option_creator(value1, value2): pass
config._optioncreator = dummy_option_creator
@@ -36,7 +37,7 @@ class Sorter:
download_base = self.conf.get_download_location()
retval = True
- if self.check_filename(filename):
+ if not self.check_filename(filename):
image = None
try:
image = Image.open(os.path.join(download_base,
@@ -59,10 +60,9 @@ class Sorter:
self.copy(filename, folderpath)
break
-
self.archive(filename)
- self.remove(filename)
- return retval
+ self.remove(filename)
+ return retval
def copy(self, filename, destpath):
download_base = self.conf.get_download_location()
@@ -84,20 +84,12 @@ class Sorter:
print "\nHow can this even happen?! Copying", source, "to", dest
def archive(self, filename):
- location = self.conf.get_archive_location()
- if not os.path.exists(location):
- os.makedirs(location)
-
- dest = os.path.join(location, os.path.basename(filename))
- #print dest
- f = open(dest, "w")
- file.close(f)
-
+ be = backend.Backend()
+ be.add(os.path.basename(filename))
def archive_check(self, filename):
- archive_path = self.conf.get_archive_location()
- fullname = os.path.join(archive_path, filename)
- return os.path.exists(fullname)
+ be = backend.Backend()
+ return be.check(os.path.basename(filename))
def check_filename(self, filename):
ext = os.path.splitext(filename)[1]