add copy and move to file actions
This commit is contained in:
1 parent
47ddf31f76
commit
3c2a00b17b
2 files changed
+9
-6
No files matched your search
@@ -113,11 +113,12 @@ config = [{
|
|||||||
'description': 'Replace all the spaces with a character. Example: ".", "-" (without quotes). Leave empty to use spaces.',
|
'description': 'Replace all the spaces with a character. Example: ".", "-" (without quotes). Leave empty to use spaces.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'links',
|
'name': 'file_action',
|
||||||
'default': '0',
|
'label': 'File Action',
|
||||||
|
'default': 'move',
|
||||||
'type': 'dropdown',
|
'type': 'dropdown',
|
||||||
'values': [('Disable', 0), ('Hard link', 'hard'), ('Sym link', 'sym')],
|
'values': [('Move', 'move'), ('Copy', 'copy'), ('Hard link', 'hardlink'), ('Sym link', 'symlink')],
|
||||||
'description': 'Use <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> instead of moving files, ideal for Torrent users.',
|
'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,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -524,10 +524,12 @@ class Renamer(Plugin):
|
|||||||
def moveFile(self, old, dest):
|
def moveFile(self, old, dest):
|
||||||
dest = ss(dest)
|
dest = ss(dest)
|
||||||
try:
|
try:
|
||||||
if self.conf('link') == 'hard':
|
if self.conf('file_action') == 'hardlink':
|
||||||
linktastic.link(old, dest)
|
linktastic.link(old, dest)
|
||||||
elif self.conf('link') == 'sym':
|
elif self.conf('file_action') == 'symlink':
|
||||||
linktastic.symlink(old, dest)
|
linktastic.symlink(old, dest)
|
||||||
|
elif self.conf('file_action') == 'copy':
|
||||||
|
shutil.copy(old, dest)
|
||||||
else:
|
else:
|
||||||
shutil.move(old, dest)
|
shutil.move(old, dest)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user