only link for torrents not nzbs
This commit is contained in:
1 parent
cb0b6614c6
commit
185a530b59
3 files changed
+17
-7
No files matched your search
@@ -39,6 +39,13 @@ class Downloader(Provider):
|
|||||||
addEvent('download.enabled_types', self.getEnabledDownloadType)
|
addEvent('download.enabled_types', self.getEnabledDownloadType)
|
||||||
addEvent('download.status', self._getAllDownloadStatus)
|
addEvent('download.status', self._getAllDownloadStatus)
|
||||||
addEvent('download.remove_failed', self._removeFailed)
|
addEvent('download.remove_failed', self._removeFailed)
|
||||||
|
addEvent('download.downloader_type', self.getDownloaderType)
|
||||||
|
|
||||||
|
def getDownloaderType(self, downloader):
|
||||||
|
if self.getName() == downloader:
|
||||||
|
return self.type
|
||||||
|
|
||||||
|
return []
|
||||||
|
|
||||||
def getEnabledDownloadType(self):
|
def getEnabledDownloadType(self):
|
||||||
for download_type in self.type:
|
for download_type in self.type:
|
||||||
|
|||||||
@@ -114,11 +114,11 @@ config = [{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'file_action',
|
'name': 'file_action',
|
||||||
'label': 'File Action',
|
'label': 'Torrent File Action',
|
||||||
'default': 'move',
|
'default': 'move',
|
||||||
'type': 'dropdown',
|
'type': 'dropdown',
|
||||||
'values': [('Move', 'move'), ('Copy', 'copy'), ('Hard link', 'hardlink'), ('Sym link', 'symlink'), ('Move & Sym link', 'move_symlink')],
|
'values': [('Move', 'move'), ('Copy', 'copy'), ('Hard link', 'hardlink'), ('Sym link', 'symlink'), ('Move & Sym link', 'move_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>, PLEASE read about their possible drawbacks.',
|
'description': 'Define which kind of file operation you want to use for torrents. 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>, PLEASE read about their possible drawbacks.',
|
||||||
'advanced': True,
|
'advanced': True,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class Renamer(Plugin):
|
|||||||
|
|
||||||
db = get_session()
|
db = get_session()
|
||||||
|
|
||||||
# Get the release with the downloader ID that was downloded by the downloader
|
# Get the release with the downloader ID that was downloaded by the downloader
|
||||||
download_info = None
|
download_info = None
|
||||||
if download_id and downloader:
|
if download_id and downloader:
|
||||||
rls = None
|
rls = None
|
||||||
@@ -137,6 +137,7 @@ class Renamer(Plugin):
|
|||||||
download_info = {
|
download_info = {
|
||||||
'imdb_id': rls.movie.library.identifier,
|
'imdb_id': rls.movie.library.identifier,
|
||||||
'quality': rls.quality.identifier,
|
'quality': rls.quality.identifier,
|
||||||
|
'is_torrent': any(downloader_type in fireEvent('download.downloader_type', downloader = downloader) for downloader_type in ['torrent', 'torrent_magnet'])
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
log.error('Download ID %s from downloader %s not found in releases', (download_id, downloader))
|
log.error('Download ID %s from downloader %s not found in releases', (download_id, downloader))
|
||||||
@@ -446,13 +447,13 @@ class Renamer(Plugin):
|
|||||||
self.makeDir(os.path.dirname(dst))
|
self.makeDir(os.path.dirname(dst))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.moveFile(src, dst)
|
self.moveFile(src, dst, forcemove = not (download_info and download_info.get('is_torrent')))
|
||||||
group['renamed_files'].append(dst)
|
group['renamed_files'].append(dst)
|
||||||
except:
|
except:
|
||||||
log.error('Failed moving the file "%s" : %s', (os.path.basename(src), traceback.format_exc()))
|
log.error('Failed moving the file "%s" : %s', (os.path.basename(src), traceback.format_exc()))
|
||||||
self.tagDir(group, 'failed_rename')
|
self.tagDir(group, 'failed_rename')
|
||||||
|
|
||||||
if self.conf('file_action') != 'move':
|
if self.conf('file_action') != 'move' and download_info and download_info.get('is_torrent'):
|
||||||
self.tagDir(group, 'renamed already')
|
self.tagDir(group, 'renamed already')
|
||||||
|
|
||||||
# Remove matching releases
|
# Remove matching releases
|
||||||
@@ -518,10 +519,12 @@ Remove it if you want it to be renamed (again, or at least let it try again)
|
|||||||
self.createFile(ignore_file, text)
|
self.createFile(ignore_file, text)
|
||||||
|
|
||||||
|
|
||||||
def moveFile(self, old, dest):
|
def moveFile(self, old, dest, forcemove = False):
|
||||||
dest = ss(dest)
|
dest = ss(dest)
|
||||||
try:
|
try:
|
||||||
if self.conf('file_action') == 'hardlink':
|
if forcemove:
|
||||||
|
shutil.move(old, dest)
|
||||||
|
elif self.conf('file_action') == 'hardlink':
|
||||||
link(old, dest)
|
link(old, dest)
|
||||||
elif self.conf('file_action') == 'symlink':
|
elif self.conf('file_action') == 'symlink':
|
||||||
symlink(old, dest)
|
symlink(old, dest)
|
||||||
|
|||||||
Reference in new issue
Block a user