示例#1
0
    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
示例#2
0
    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
示例#3
0
 def media_image_url(self):
     """ Image url of current playing media. """
     return YOUTUBE_COVER_URL_FORMAT.format(self.youtube_id)
示例#4
0
 def media_image_url(self):
     """ Image url of current playing media. """
     return YOUTUBE_COVER_URL_FORMAT.format(self.youtube_id)