diff --git a/couchpotato/core/downloaders/rtorrent/__init__.py b/couchpotato/core/downloaders/rtorrent/__init__.py index efc2234b..b04e6898 100755 --- a/couchpotato/core/downloaders/rtorrent/__init__.py +++ b/couchpotato/core/downloaders/rtorrent/__init__.py @@ -35,6 +35,11 @@ config = [{ 'name': 'label', 'description': 'Label to apply on added torrents.', }, + { + 'name': 'directory', + 'type': 'directory', + 'description': 'Directory where rtorrent should download the files too.', + }, { 'name': 'remove_complete', 'label': 'Remove torrent', @@ -43,6 +48,14 @@ config = [{ 'type': 'bool', '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', 'label': 'Remove files', diff --git a/couchpotato/core/downloaders/rtorrent/main.py b/couchpotato/core/downloaders/rtorrent/main.py index 161c671a..c7cf03b9 100755 --- a/couchpotato/core/downloaders/rtorrent/main.py +++ b/couchpotato/core/downloaders/rtorrent/main.py @@ -7,7 +7,7 @@ from datetime import timedelta from hashlib import sha1 from rtorrent import RTorrent from rtorrent.err import MethodError -import shutil +import shutil, os log = CPLog(__name__) @@ -91,6 +91,7 @@ class rTorrent(Downloader): if self.conf('label'): torrent_params['label'] = self.conf('label') + if not filedata and data.get('protocol') == 'torrent': log.error('Failed sending torrent, no data') return False @@ -120,6 +121,11 @@ class rTorrent(Downloader): if 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') and not self.conf('append_label'): + torrent.set_directory(self.conf('directory')) + # Set Ratio Group torrent.set_visible(group_name)