From f5e42d839e8d86954d02b0f5015ce55e6fd70cea Mon Sep 17 00:00:00 2001 From: Noam Meltzer Date: Fri, 15 Apr 2016 23:40:40 +0300 Subject: [PATCH] add IMBD url to telegram notifications --- couchpotato/core/notifications/telegrambot.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/notifications/telegrambot.py b/couchpotato/core/notifications/telegrambot.py index a65e2d6..3b59f2c 100644 --- a/couchpotato/core/notifications/telegrambot.py +++ b/couchpotato/core/notifications/telegrambot.py @@ -1,4 +1,4 @@ -from couchpotato.core.helpers.variable import splitString +from couchpotato.core.helpers.variable import getIdentifier from couchpotato.core.logger import CPLog from couchpotato.core.notifications.base import Notification import requests @@ -19,8 +19,15 @@ class TelegramBot(Notification): token = self.conf('bot_token') usr_id = self.conf('receiver_user_id') + # Add IMDB url to message: + if data: + imdb_id = getIdentifier(data) + if imdb_id: + url = 'http://www.imdb.com/title/{0}/'.format(imdb_id) + message = '{0}\n{1}'.format(message, url) + # Cosntruct message - payload = {'chat_id': usr_id, 'text': message} + payload = {'chat_id': usr_id, 'text': message, 'parse_mode': 'Markdown'} # Send message user Telegram's Bot API response = requests.post(self.TELEGRAM_API % (token, "sendMessage"), data=payload)