diff --git a/couchpotato/core/plugins/renamer.py b/couchpotato/core/plugins/renamer.py index a2d993e..7784053 100755 --- a/couchpotato/core/plugins/renamer.py +++ b/couchpotato/core/plugins/renamer.py @@ -10,7 +10,7 @@ from couchpotato.api import addApiView from couchpotato.core.event import addEvent, fireEvent, fireEventAsync from couchpotato.core.helpers.encoding import toUnicode, ss, sp from couchpotato.core.helpers.variable import getExt, mergeDicts, getTitle, \ - getImdb, link, symlink, tryInt, splitString, fnEscape, isSubFolder, getIdentifier + getImdb, link, symlink, tryInt, splitString, fnEscape, isSubFolder, getIdentifier, randomString from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin from couchpotato.environment import Env @@ -586,6 +586,10 @@ class Renamer(Plugin): if rename_files[src]: dst = rename_files[src] + if dst in group['renamed_files']: + log.error('File "%s" already exists, adding random string at the end to prevent data loss', dst) + dst = '%s.random-%s' % (dst, randomString()) + # Create dir self.makeDir(os.path.dirname(dst))