From 28019b0a096bdc36e2cef259cf4925c7b84de9e0 Mon Sep 17 00:00:00 2001 From: Mathew Paret Date: Mon, 10 Nov 2014 18:39:58 +0530 Subject: [PATCH 1/3] Transmission status 16 is for "Stopped". So we need to detect a download as completed even if it is stopped but percent done is 100 --- couchpotato/core/downloaders/transmission.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/couchpotato/core/downloaders/transmission.py b/couchpotato/core/downloaders/transmission.py index d6112a91..400e00ce 100644 --- a/couchpotato/core/downloaders/transmission.py +++ b/couchpotato/core/downloaders/transmission.py @@ -119,6 +119,8 @@ class Transmission(DownloaderBase): status = 'failed' elif torrent['status'] == 0 and torrent['percentDone'] == 1: status = 'completed' + elif torrent['status'] == 16 and torrent['percentDone'] == 1: + status = 'completed' elif torrent['status'] in [5, 6]: status = 'seeding' From 87338760ad2f8773330b1934946bbd23e35274ac Mon Sep 17 00:00:00 2001 From: Mathew Paret Date: Mon, 10 Nov 2014 18:47:37 +0530 Subject: [PATCH 2/3] Feature #3967 - Added IMDB link to download complete tweet --- .../core/notifications/twitter/main.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/couchpotato/core/notifications/twitter/main.py b/couchpotato/core/notifications/twitter/main.py index 0d02191e..fd7d2844 100644 --- a/couchpotato/core/notifications/twitter/main.py +++ b/couchpotato/core/notifications/twitter/main.py @@ -34,11 +34,13 @@ class Twitter(Notification): def notify(self, message = '', data = None, listener = None): if not data: data = {} - + log.debug('Data in notification is %s', data['identifier']) api = Api(self.consumer_key, self.consumer_secret, self.conf('access_token_key'), self.conf('access_token_secret')) direct_message = self.conf('direct_message') direct_message_users = self.conf('screen_name') + + message = '%s%s' % (message,' - http://www.imdb.com/title/' + data['identifier'] if data['identifier'] else '') mention = self.conf('mention') mention_tag = None @@ -59,11 +61,20 @@ class Twitter(Notification): update_message = '[%s] %s' % (self.default_title, message) if len(update_message) > 140: if mention_tag: - api.PostUpdate(update_message[:135 - len(mention_tag)] + ('%s 1/2 ' % mention_tag)) - api.PostUpdate(update_message[135 - len(mention_tag):] + ('%s 2/2 ' % mention_tag)) + if update_message.find(" - http://www.imdb.com/title/") < 141 and update_message.find(" - http://www.imdb.com/title/") > 0: + api.PostUpdate(update_message[:update_message.find(" - http://www.imdb.com/title/") - len(mention_tag)] + ('%s 1/2 ' % mention_tag)) + api.PostUpdate(update_message[update_message.find(" - http://www.imdb.com/title/") - len(mention_tag):] + ('%s 2/2 ' % mention_tag)) + else: + api.PostUpdate(update_message[:135 - len(mention_tag)] + ('%s 1/2 ' % mention_tag)) + api.PostUpdate(update_message[135 - len(mention_tag):] + ('%s 2/2 ' % mention_tag)) else: - api.PostUpdate(update_message[:135] + ' 1/2') - api.PostUpdate(update_message[135:] + ' 2/2') + if update_message.find(" - http://www.imdb.com/title/") < 141 and update_message.find(" - http://www.imdb.com/title/") > 0: + api.PostUpdate(update_message[:update_message.find(" - http://www.imdb.com/title/")] + ' 1/2') + api.PostUpdate(update_message[update_message.find(" - http://www.imdb.com/title/"):] + ' 2/2') + else: + api.PostUpdate(update_message[:135] + ' 1/2') + api.PostUpdate(update_message[135:] + ' 2/2') + else: api.PostUpdate(update_message) except Exception as e: From 52478a00db0bbaf986d7a49a2a0d77fe367bd23c Mon Sep 17 00:00:00 2001 From: Mathew Paret Date: Thu, 27 Nov 2014 18:13:41 +0530 Subject: [PATCH 3/3] Revert "Feature #3967 - Added IMDB link to download complete tweet" This reverts commit 87338760ad2f8773330b1934946bbd23e35274ac. --- .../core/notifications/twitter/main.py | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/couchpotato/core/notifications/twitter/main.py b/couchpotato/core/notifications/twitter/main.py index fd7d2844..0d02191e 100644 --- a/couchpotato/core/notifications/twitter/main.py +++ b/couchpotato/core/notifications/twitter/main.py @@ -34,13 +34,11 @@ class Twitter(Notification): def notify(self, message = '', data = None, listener = None): if not data: data = {} - log.debug('Data in notification is %s', data['identifier']) + api = Api(self.consumer_key, self.consumer_secret, self.conf('access_token_key'), self.conf('access_token_secret')) direct_message = self.conf('direct_message') direct_message_users = self.conf('screen_name') - - message = '%s%s' % (message,' - http://www.imdb.com/title/' + data['identifier'] if data['identifier'] else '') mention = self.conf('mention') mention_tag = None @@ -61,20 +59,11 @@ class Twitter(Notification): update_message = '[%s] %s' % (self.default_title, message) if len(update_message) > 140: if mention_tag: - if update_message.find(" - http://www.imdb.com/title/") < 141 and update_message.find(" - http://www.imdb.com/title/") > 0: - api.PostUpdate(update_message[:update_message.find(" - http://www.imdb.com/title/") - len(mention_tag)] + ('%s 1/2 ' % mention_tag)) - api.PostUpdate(update_message[update_message.find(" - http://www.imdb.com/title/") - len(mention_tag):] + ('%s 2/2 ' % mention_tag)) - else: - api.PostUpdate(update_message[:135 - len(mention_tag)] + ('%s 1/2 ' % mention_tag)) - api.PostUpdate(update_message[135 - len(mention_tag):] + ('%s 2/2 ' % mention_tag)) + api.PostUpdate(update_message[:135 - len(mention_tag)] + ('%s 1/2 ' % mention_tag)) + api.PostUpdate(update_message[135 - len(mention_tag):] + ('%s 2/2 ' % mention_tag)) else: - if update_message.find(" - http://www.imdb.com/title/") < 141 and update_message.find(" - http://www.imdb.com/title/") > 0: - api.PostUpdate(update_message[:update_message.find(" - http://www.imdb.com/title/")] + ' 1/2') - api.PostUpdate(update_message[update_message.find(" - http://www.imdb.com/title/"):] + ' 2/2') - else: - api.PostUpdate(update_message[:135] + ' 1/2') - api.PostUpdate(update_message[135:] + ' 2/2') - + api.PostUpdate(update_message[:135] + ' 1/2') + api.PostUpdate(update_message[135:] + ' 2/2') else: api.PostUpdate(update_message) except Exception as e: