initial link support

This commit is contained in:
Joel Kåberg
2013-04-05 13:48:09 +02:00
parent 72cc3576d3
commit 57ae06e139
6 changed files with 129 additions and 1 deletions
@@ -112,6 +112,20 @@ config = [{
'label': 'Separator',
'description': 'Replace all the spaces with a character. Example: ".", "-" (without quotes). Leave empty to use spaces.',
},
{
'name': 'hardlink',
'type': 'bool',
'description': 'Use <a href="http://en.wikipedia.org/wiki/Hard_link">hard links</a> instead of moving files, ideal for Torrent users. NOTE: From location and to location needs to be on the same drive/partition.',
'default': False,
'advanced': True,
},
{
'name': 'symlink',
'type': 'bool',
'description': 'Use <a href="http://en.wikipedia.org/wiki/Sym_link">sym links</a> instead of moving files.',
'default': False,
'advanced': True,
},
{
'advanced': True,
'name': 'ntfs_permission',
+7 -1
View File
@@ -10,6 +10,7 @@ from couchpotato.core.plugins.base import Plugin
from couchpotato.core.settings.model import Library, File, Profile, Release, \
ReleaseInfo
from couchpotato.environment import Env
import linktastic.linktastic as linktastic
import errno
import os
import re
@@ -523,7 +524,12 @@ class Renamer(Plugin):
def moveFile(self, old, dest):
dest = ss(dest)
try:
shutil.move(old, dest)
if self.conf('hardlink') and not self.conf('symlink'):
linktastic.link(old, dest)
elif self.conf('symlink') and not self.conf('hardlink'):
linktastic.symlink(old, dest)
else:
shutil.move(old, dest)
try:
os.chmod(dest, Env.getPermission('file'))