Merge branch 'links' of git://github.com/jkaberg/CouchPotatoServer into jkaberg-links

This commit is contained in:
Ruud
2013-04-05 18:00:17 +02:00
6 changed files with 126 additions and 1 deletions
@@ -112,6 +112,15 @@ config = [{
'label': 'Separator',
'description': 'Replace all the spaces with a character. Example: ".", "-" (without quotes). Leave empty to use spaces.',
},
{
'name': 'file_action',
'label': 'File Action',
'default': 'move',
'type': 'dropdown',
'values': [('Move', 'move'), ('Copy', 'copy'), ('Hard link', 'hardlink'), ('Sym link', 'symlink')],
'description': 'Define which kind of file operation you want to use. Before you start using <a href="http://en.wikipedia.org/wiki/Hard_link">hard links</a> or <a href="http://en.wikipedia.org/wiki/Sym_link">sym links</a>, read about thire possible drawbacks.',
'advanced': True,
},
{
'advanced': True,
'name': 'ntfs_permission',
+9 -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,14 @@ class Renamer(Plugin):
def moveFile(self, old, dest):
dest = ss(dest)
try:
shutil.move(old, dest)
if self.conf('file_action') == 'hardlink':
linktastic.link(old, dest)
elif self.conf('file_action') == 'symlink':
linktastic.symlink(old, dest)
elif self.conf('file_action') == 'copy':
shutil.copy(old, dest)
else:
shutil.move(old, dest)
try:
os.chmod(dest, Env.getPermission('file'))