From cbd23c4f65dcf4ee67454f67ac52d0c3651e6cb0 Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 7 May 2012 22:37:54 +0200 Subject: [PATCH 1/4] Merge pull request #228 from sirchia/twitterDirectMessage Added support for direct messages in twitter notifications --- couchpotato/core/notifications/twitter/__init__.py | 7 +++++++ couchpotato/core/notifications/twitter/main.py | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/notifications/twitter/__init__.py b/couchpotato/core/notifications/twitter/__init__.py index 266a287..5910b0a 100644 --- a/couchpotato/core/notifications/twitter/__init__.py +++ b/couchpotato/core/notifications/twitter/__init__.py @@ -38,6 +38,13 @@ config = [{ 'advanced': True, 'description': 'Also send message when movie is snatched.', }, + { + 'name': 'direct_message', + 'default': 0, + 'type': 'bool', + 'advanced': True, + 'description': 'Use direct messages for the notifications (Also applies to the mentioned users).', + }, ], } ], diff --git a/couchpotato/core/notifications/twitter/main.py b/couchpotato/core/notifications/twitter/main.py index b956dd0..d800369 100644 --- a/couchpotato/core/notifications/twitter/main.py +++ b/couchpotato/core/notifications/twitter/main.py @@ -36,12 +36,24 @@ class Twitter(Notification): 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') + mention = self.conf('mention') if mention: - message = '%s @%s' % (message, mention.lstrip('@')) + if direct_message: + direct_message_users = '%s %s' % (direct_message_users, mention) + direct_message_users = direct_message_users.replace('@',' ') + direct_message_users = direct_message_users.replace(',',' ') + else: + message = '%s @%s' % (message, mention.lstrip('@')) try: - api.PostUpdate('[%s] %s' % (self.default_title, message)) + if direct_message: + for user in direct_message_users.split(): + api.PostDirectMessage(user, '[%s] %s' % (self.default_title, message)) + else: + api.PostUpdate('[%s] %s' % (self.default_title, message)) except Exception, e: log.error('Error sending tweet: %s' % e) return False From 9911f97b97f1a05314e79ec553dd3dc44adcd080 Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 7 May 2012 23:58:31 +0200 Subject: [PATCH 2/4] Desktop updater --- couchpotato/core/_base/updater/main.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/_base/updater/main.py b/couchpotato/core/_base/updater/main.py index 674936b..a5fd73f 100644 --- a/couchpotato/core/_base/updater/main.py +++ b/couchpotato/core/_base/updater/main.py @@ -21,7 +21,9 @@ class Updater(Plugin): def __init__(self): - if os.path.isdir(os.path.join(Env.get('app_dir'), '.git')): + if Env.get('desktop'): + self.updater = DesktopUpdater() + elif os.path.isdir(os.path.join(Env.get('app_dir'), '.git')): self.updater = GitUpdater(self.conf('git_command', default = 'git')) else: self.updater = SourceUpdater() @@ -334,3 +336,32 @@ class SourceUpdater(BaseUpdater): log.error('Failed getting latest request from github: %s' % traceback.format_exc()) return {} + + +class DesktopUpdater(Plugin): + + version = None + update_failed = False + update_version = None + last_check = 0 + + def __init__(self): + self.desktop = Env.get('desktop') + + def doUpdate(self): + pass + + def info(self): + return { + 'last_check': self.last_check, + 'update_version': self.update_version, + 'version': self.getVersion(), + 'branch': 'desktop_build', + } + + def check(self): + pass + + def getVersion(self): + return {} + From d8f8f7b3390c36a902e13caf1a218b06210831a8 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 9 May 2012 22:07:37 +0200 Subject: [PATCH 3/4] Don't error, but info log --- couchpotato/core/plugins/renamer/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index ac6b88b..ece1e76 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -45,7 +45,7 @@ class Renamer(Plugin): return if self.renaming_started is True: - log.error('Renamer is disabled to avoid infinite looping of the same error.') + log.info('Renamer is disabled to avoid infinite looping of the same error.') return # Check to see if the "to" folder is inside the "from" folder. From b2be9ef7c481727c54803c56f0ebde1844baf324 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 9 May 2012 22:19:10 +0200 Subject: [PATCH 4/4] Remove debug lines. fixes #233 --- couchpotato/core/plugins/renamer/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index ece1e76..c60d6cc 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -322,8 +322,6 @@ class Renamer(Plugin): elif not remove_leftovers: # Don't remove anything remove_files = [] - continue - # Rename all files marked group['renamed_files'] = [] for src in rename_files: