diff options
author | ryuslash | 2010-04-19 09:16:59 +0200 |
---|---|---|
committer | ryuslash | 2010-04-19 09:16:59 +0200 |
commit | b5aac6235789c0561026edd38875c786480e4a61 (patch) | |
tree | 3d17d70dd9e67e9173a97267002bfdb364aacfd8 /sorter.py | |
parent | dfaa24b1b680cae0b24dad6761b0970eab0ba2c9 (diff) | |
parent | af529bcd4e214c13b7810eeba4d425c4a1129b58 (diff) | |
download | 4grab-b5aac6235789c0561026edd38875c786480e4a61.tar.gz 4grab-b5aac6235789c0561026edd38875c786480e4a61.zip |
Merge branch 'kirbybase' into develop
Diffstat (limited to 'sorter.py')
-rw-r--r-- | sorter.py | 24 |
1 files changed, 8 insertions, 16 deletions
@@ -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] |