From a2c87e1b7d4af76ac33ebde1424c7ecbe8584f35 Mon Sep 17 00:00:00 2001 From: Dean Gardiner Date: Sat, 8 Feb 2014 03:22:59 +1300 Subject: [PATCH 1/2] Fixed bug where changes to rtorrent settings wouldn't take effect until a restart --- couchpotato/core/downloaders/rtorrent/main.py | 9 +++++++++ couchpotato/core/settings/__init__.py | 1 + 2 files changed, 10 insertions(+) diff --git a/couchpotato/core/downloaders/rtorrent/main.py b/couchpotato/core/downloaders/rtorrent/main.py index cfd1dce0..4fdecc89 100755 --- a/couchpotato/core/downloaders/rtorrent/main.py +++ b/couchpotato/core/downloaders/rtorrent/main.py @@ -24,6 +24,7 @@ class rTorrent(Downloader): super(rTorrent, self).__init__() addEvent('app.load', self.migrate) + addEvent('setting.save.rtorrent.*.after', self.settingsChanged) def migrate(self): @@ -37,6 +38,14 @@ class rTorrent(Downloader): self.deleteConf('url') + def settingsChanged(self): + # Reset active connection if settings have changed + if self.rt: + log.debug('Settings have changed, closing active connection') + + self.rt = None + return True + def connect(self): # Already connected? if self.rt is not None: diff --git a/couchpotato/core/settings/__init__.py b/couchpotato/core/settings/__init__.py index 3b575176..0e65c778 100644 --- a/couchpotato/core/settings/__init__.py +++ b/couchpotato/core/settings/__init__.py @@ -200,6 +200,7 @@ class Settings(object): # After save (for re-interval etc) fireEvent('setting.save.%s.%s.after' % (section, option), single = True) + fireEvent('setting.save.%s.*.after' % section, single = True) return { 'success': True, From 3380e20e3aad6903172c07e989f64252f6160593 Mon Sep 17 00:00:00 2001 From: Dean Gardiner Date: Sat, 8 Feb 2014 03:25:11 +1300 Subject: [PATCH 2/2] Cleaned up naming of functions in rtorrent downloader --- couchpotato/core/downloaders/rtorrent/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/downloaders/rtorrent/main.py b/couchpotato/core/downloaders/rtorrent/main.py index 4fdecc89..1fbae354 100755 --- a/couchpotato/core/downloaders/rtorrent/main.py +++ b/couchpotato/core/downloaders/rtorrent/main.py @@ -64,7 +64,7 @@ class rTorrent(Downloader): return self.rt - def _update_provider_group(self, name, data): + def updateProviderGroup(self, name, data): if data.get('seed_time'): log.info('seeding time ignored, not supported') @@ -113,7 +113,7 @@ class rTorrent(Downloader): return False group_name = 'cp_' + data.get('provider').lower() - if not self._update_provider_group(group_name, data): + if not self.updateProviderGroup(group_name, data): return False torrent_params = {}