mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 08:16:06 -07:00
Upload from Imgur to Telegram directly
This commit is contained in:
parent
1d9d16b69b
commit
d23c4ef319
1 changed files with 4 additions and 9 deletions
|
@ -3081,20 +3081,15 @@ class TELEGRAM(Notifier):
|
||||||
text = body.encode('utf-8')
|
text = body.encode('utf-8')
|
||||||
|
|
||||||
if self.config['incl_poster'] and kwargs.get('parameters'):
|
if self.config['incl_poster'] and kwargs.get('parameters'):
|
||||||
poster_data = {'chat_id': self.config['chat_id'],
|
|
||||||
'disable_notification': True}
|
|
||||||
|
|
||||||
parameters = kwargs['parameters']
|
parameters = kwargs['parameters']
|
||||||
poster_url = parameters.get('poster_url','')
|
poster_url = parameters.get('poster_url','')
|
||||||
|
|
||||||
if poster_url:
|
if poster_url:
|
||||||
poster_request = requests.get(poster_url)
|
poster_data = {'photo': poster_url,
|
||||||
poster_content = poster_request.content
|
'chat_id': self.config['chat_id'],
|
||||||
|
'disable_notification': True}
|
||||||
|
|
||||||
files = {'photo': (poster_url, poster_content)}
|
r = requests.post('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']), json=poster_data)
|
||||||
|
|
||||||
r = requests.post('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']),
|
|
||||||
data=poster_data, files=files)
|
|
||||||
|
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
logger.info(u"PlexPy Notifiers :: {name} poster sent.".format(name=self.NAME))
|
logger.info(u"PlexPy Notifiers :: {name} poster sent.".format(name=self.NAME))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue