From 90f342bd17bcb9cf6b2fad8e64018d1480c57e15 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 12 Oct 2011 15:20:49 +0200 Subject: [PATCH] Twitter mention in notification --- couchpotato/core/notifications/twitter/__init__.py | 4 ++++ couchpotato/core/notifications/twitter/main.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/couchpotato/core/notifications/twitter/__init__.py b/couchpotato/core/notifications/twitter/__init__.py index 6bdd5348..00569e62 100644 --- a/couchpotato/core/notifications/twitter/__init__.py +++ b/couchpotato/core/notifications/twitter/__init__.py @@ -27,6 +27,10 @@ config = [{ 'name': 'access_token_secret', 'advanced': True, }, + { + 'name': 'mention', + 'description': 'Add a mention to this user to the tweet.', + }, ], } ], diff --git a/couchpotato/core/notifications/twitter/main.py b/couchpotato/core/notifications/twitter/main.py index f3891956..dae428e9 100644 --- a/couchpotato/core/notifications/twitter/main.py +++ b/couchpotato/core/notifications/twitter/main.py @@ -36,6 +36,10 @@ class Twitter(Notification): api = Api(self.consumer_key, self.consumer_secret, self.conf('access_token_key'), self.conf('access_token_secret')) + mention = self.conf('mention') + if mention: + message = '%s @%s' % (message, mention.lstrip('@')) + try: api.PostUpdate('[%s] %s' % (self.default_title, message)) except Exception, e: