Skip to content

Commit

Permalink
Fix for samenamed files
Browse files Browse the repository at this point in the history
  • Loading branch information
usta committed Apr 19, 2015
1 parent 5f20e88 commit 07bc0a2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
@@ -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

Expand Down
20 changes: 16 additions & 4 deletions radmyarchive/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__version__ = "1.1.5"
__version__ = "1.2.0"


from fileinput import close
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 07bc0a2

Please sign in to comment.