diff --git a/ChangeLog.rst b/ChangeLog.rst index 1d1ba60..cbd1982 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -1,5 +1,9 @@ Change Log ========== +1.2.0 2015-04-19 + * Fix for same-named but different photos + * (Need to implement Md5 check for checking if it is samefile or not ) + 1.1.5 2015-04-19 * Fix for uppercase extensions diff --git a/radmyarchive/__init__.py b/radmyarchive/__init__.py index b305dfa..4bb99a2 100644 --- a/radmyarchive/__init__.py +++ b/radmyarchive/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -__version__ = "1.1.5" +__version__ = "1.2.0" from fileinput import close @@ -30,12 +30,24 @@ def __init__(self, filepath, destination=".//NewImageArchive", move=False): self._parseDate() self._createDestinationDirs() + self._prepareDestinationFilePath() + + self._fileOperation() + + def _prepareDestinationFilePath(self): + count = 1 + self._calculateDestinationFilePath() + while os.path.exists(self._destinationFilePath): + # TODO : Need to implement md5 checking in here + count += 1 + self._calculateDestinationFilePath("_(" + str(count) + ")") + + + def _calculateDestinationFilePath(self, suffix=""): self._destinationFilePath = os.path.join(self._destinationBasePath, self._imgYear, self._imgMonth, - self._imgDay, "") + self._imgFullDate + self._fileExt - - self._fileOperation() + self._imgDay, "") + self._imgFullDate + suffix + self._fileExt def _fileOperation(self): if os.path.exists(self._destinationFilePath):