def state_attributes(self): """ Returns the state attributes. """ if self.youtube_id is None: return state_attr = { ATTR_MEDIA_CONTENT_ID: self.youtube_id, ATTR_MEDIA_TITLE: self.media_title, ATTR_MEDIA_DURATION: 100, ATTR_MEDIA_VOLUME: self.volume, ATTR_ENTITY_PICTURE: YOUTUBE_COVER_URL_FORMAT.format(self.youtube_id) } if self.is_playing: state_attr[ATTR_MEDIA_STATE] = MEDIA_STATE_PLAYING else: state_attr[ATTR_MEDIA_STATE] = MEDIA_STATE_STOPPED return state_attr
def media_image_url(self): """ Image url of current playing media. """ return YOUTUBE_COVER_URL_FORMAT.format(self.youtube_id)