def get_media_path(self): if self.get_show(): if self.media_format == 'normal': return ImageCache().banner_path(self.indexer_id) if self.media_format == 'thumb': return ImageCache().banner_thumb_path(self.indexer_id) return ''
def get_media_path(self): media_file = None if self.get_show(): if self.media_format == 'normal': media_file = ImageCache().banner_path(self.indexer_id) if self.media_format == 'thumb': media_file = ImageCache().banner_thumb_path(self.indexer_id) if not all([media_file, os.path.exists(media_file)]): media_file = os.path.join(self.get_media_root(), 'images', self.get_default_media_name()) return media_file
def get_media_path(self): media_file = None if self.get_show(): media_file = ImageCache().fanart_path(self.indexer_id) if not all([media_file, os.path.exists(media_file)]): media_file = os.path.join(self.get_media_root(), 'images', self.get_default_media_name()) return media_file
def _notify(self, title, body, send_icon='', quiet=False, access_token='', chatid='', ep_obj=None, **kwargs): result = None use_icon = bool(self._choose(send_icon, sickbeard.TELEGRAM_SEND_IMAGE)) quiet = bool(self._choose(quiet, sickbeard.TELEGRAM_QUIET)) access_token = self._choose(access_token, sickbeard.TELEGRAM_ACCESS_TOKEN) cid = self._choose(chatid, sickbeard.TELEGRAM_CHATID) try: msg = self._body_only(('' if not title else u'<b>%s</b>' % title), body) msg = msg.replace(u'<b>%s</b>: ' % title, u'<b>%s:</b>\r\n' % ('SickGear ' + title, title)[use_icon]) # HTML spaces ( ) and tabs ( ) aren't supported # See https://core.telegram.org/bots/api#html-style msg = re.sub('(?i) ?', ' ', msg) # Tabs become 3 spaces msg = re.sub('(?i) ?', ' ', msg) if use_icon: image_path = ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', 'slick', 'images', 'banner_thumb.jpg') if not self._testing: show_obj = ep_obj.show_obj banner_path = ImageCache().banner_thumb_path(show_obj.tvid, show_obj.prodid) if ek.ek(os.path.isfile, banner_path): image_path = banner_path with open(image_path, 'rb') as f: response = self.post('sendPhoto', access_token, cid, quiet, dict(files={'photo': ('image.png', f)}, post_data=dict(caption=msg))) else: response = self.post('sendMessage', access_token, cid, quiet, dict(post_data=dict(text=msg))) result = response and response.get('ok') or False except (BaseException, Exception) as e: if 'No chat_id' in ex(e): result = 'a chat id is not set, and a msg has not been sent to the bot to auto detect one.' if True is not result: self._log_error('Failed to send message, %s' % result) return dict(chatid=cid, result=self._choose(('Successful test notice sent.', 'Error sending notification, %s' % result)[True is not result], result))
def get_media_path(self): if self.get_show(): return ImageCache().fanart_path(self.indexer_id) return ''