From 3980ccf38e1bdd3bce84929ee5a259ace38e9c2c Mon Sep 17 00:00:00 2001 From: ryuslash Date: Mon, 22 Mar 2010 15:17:55 +0100 Subject: [PATCH] Sorter also sorts by date now --- sorter.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sorter.py b/sorter.py index c52ab9a..dbaadba 100644 --- a/sorter.py +++ b/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: