Error with archive
The archive function in sorter.py didn't archive to .arch, now it does
This commit is contained in:
parent
d58d029202
commit
dfaa24b1b6
2 changed files with 4 additions and 7 deletions
|
@ -34,6 +34,7 @@ def check_archive(fullpath):
|
||||||
archive = conf.get_archive_location()
|
archive = conf.get_archive_location()
|
||||||
filename = os.path.basename(fullpath)
|
filename = os.path.basename(fullpath)
|
||||||
archfile = os.path.join(archive, filename)
|
archfile = os.path.join(archive, filename)
|
||||||
|
#sys.stderr.write("%s %d\n" % (archfile, os.path.exists(archfile)))
|
||||||
return os.path.exists(archfile)
|
return os.path.exists(archfile)
|
||||||
def write(message):
|
def write(message):
|
||||||
sys.stdout.write(message)
|
sys.stdout.write(message)
|
||||||
|
|
10
sorter.py
10
sorter.py
|
@ -60,7 +60,7 @@ class Sorter:
|
||||||
self.copy(filename, folderpath)
|
self.copy(filename, folderpath)
|
||||||
break
|
break
|
||||||
|
|
||||||
self.archive(filename)
|
self.archive(filename)
|
||||||
self.remove(filename)
|
self.remove(filename)
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
@ -77,10 +77,6 @@ class Sorter:
|
||||||
|
|
||||||
dest = os.path.join(dest,
|
dest = os.path.join(dest,
|
||||||
os.path.basename(filename))
|
os.path.basename(filename))
|
||||||
|
|
||||||
#today = datetime.date.today()
|
|
||||||
#dest = os.path.join(dest,
|
|
||||||
# "%d-%d-%d" % (today.year, today.month, today.day))
|
|
||||||
|
|
||||||
if source != dest:
|
if source != dest:
|
||||||
shutil.copy(source, dest)
|
shutil.copy(source, dest)
|
||||||
|
@ -88,12 +84,12 @@ class Sorter:
|
||||||
print "\nHow can this even happen?! Copying", source, "to", dest
|
print "\nHow can this even happen?! Copying", source, "to", dest
|
||||||
|
|
||||||
def archive(self, filename):
|
def archive(self, filename):
|
||||||
download_base = self.conf.get_download_location()
|
|
||||||
location = self.conf.get_archive_location()
|
location = self.conf.get_archive_location()
|
||||||
if not os.path.exists(location):
|
if not os.path.exists(location):
|
||||||
os.makedirs(location)
|
os.makedirs(location)
|
||||||
|
|
||||||
dest = os.path.join(location, filename)
|
dest = os.path.join(location, os.path.basename(filename))
|
||||||
|
#print dest
|
||||||
f = open(dest, "w")
|
f = open(dest, "w")
|
||||||
file.close(f)
|
file.close(f)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue