Merge branch 'refs/heads/jkaberg-develop' into develop

This commit is contained in:
Ruud committed 2013-09-30 20:11:51 +02:00
commit 13a0c4607d
2 files changed
+20 -1

No files matched your search

@@ -35,6 +35,11 @@ config = [{
'name': 'label', 'name': 'label',
'description': 'Label to apply on added torrents.', 'description': 'Label to apply on added torrents.',
}, },
{
'name': 'directory',
'type': 'directory',
'description': 'Directory where rtorrent should download the files too.',
},
{ {
'name': 'remove_complete', 'name': 'remove_complete',
'label': 'Remove torrent', 'label': 'Remove torrent',
@@ -43,6 +48,14 @@ config = [{
'type': 'bool', 'type': 'bool',
'description': 'Remove the torrent after it finishes seeding.', 'description': 'Remove the torrent after it finishes seeding.',
}, },
{
'name': 'append_label',
'label': 'Append Label',
'default': False,
'advanced': True,
'type': 'bool',
'description': 'Append label to download location. Requires you to set the download location above.',
},
{ {
'name': 'delete_files', 'name': 'delete_files',
'label': 'Remove files', 'label': 'Remove files',
@@ -7,7 +7,7 @@ from datetime import timedelta
from hashlib import sha1 from hashlib import sha1
from rtorrent import RTorrent from rtorrent import RTorrent
from rtorrent.err import MethodError from rtorrent.err import MethodError
import shutil import shutil, os
log = CPLog(__name__) log = CPLog(__name__)
@@ -91,6 +91,7 @@ class rTorrent(Downloader):
if self.conf('label'): if self.conf('label'):
torrent_params['label'] = self.conf('label') torrent_params['label'] = self.conf('label')
if not filedata and data.get('protocol') == 'torrent': if not filedata and data.get('protocol') == 'torrent':
log.error('Failed sending torrent, no data') log.error('Failed sending torrent, no data')
return False return False
@@ -120,6 +121,11 @@ class rTorrent(Downloader):
if self.conf('label'): if self.conf('label'):
torrent.set_custom(1, self.conf('label')) torrent.set_custom(1, self.conf('label'))
if self.conf('directory') and self.conf('append_label'):
torrent.set_directory(os.path.join(self.conf('directory'), self.conf('label')))
elif self.conf('directory'):
torrent.set_directory(self.conf('directory'))
# Set Ratio Group # Set Ratio Group
torrent.set_visible(group_name) torrent.set_visible(group_name)