Sorter also sorts by date now
This commit is contained in:
parent
4b70374e9d
commit
3980ccf38e
1 changed files with 13 additions and 0 deletions
13
sorter.py
13
sorter.py
|
@ -21,6 +21,7 @@ import config
|
|||
import Image
|
||||
import shutil
|
||||
import os
|
||||
import datetime
|
||||
|
||||
def dummy_option_creator(value1, value2): pass
|
||||
config._optioncreator = dummy_option_creator
|
||||
|
@ -67,8 +68,20 @@ class Sorter:
|
|||
download_base = self.conf.get_download_location()
|
||||
source = os.path.join(download_base,
|
||||
os.path.basename(filename))
|
||||
|
||||
today = datetime.date.today()
|
||||
dest = os.path.join(destpath,
|
||||
"%d-%d-%d" % (today.year, today.month, today.day))
|
||||
if not os.path.exists(dest):
|
||||
os.makedirs(dest)
|
||||
|
||||
dest = os.path.join(dest,
|
||||
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:
|
||||
shutil.copy(source, dest)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue