示例#1
0
def channelVideos(name):
    items = [{
        'label':
        PLUGIN.get_string(30078),
        'icon':
        Images.ICON,
        'thumbnail':
        Images.THUMB,
        'art':
        utils.theArt(),
        'path':
        PLUGIN.url_for(endpoint='channelVideosList',
                       name=name,
                       index=0,
                       past='true')
    }, {
        'label':
        PLUGIN.get_string(30079),
        'icon':
        Images.ICON,
        'thumbnail':
        Images.THUMB,
        'art':
        utils.theArt(),
        'path':
        PLUGIN.url_for(endpoint='channelVideosList',
                       name=name,
                       index=0,
                       past='false')
    }]
    PLUGIN.set_content(utils.getContentType())
    return items
示例#2
0
    def convertToXBMCPlaylist(InputPlaylist, title='', image=''):
        # Create playlist in Kodi, return tuple (playlist, {listitem dict}) or ()
        playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playlist.clear()
        initialItem = None
        for (url, details) in InputPlaylist:
            if url:
                if details != ():
                    (title, image) = details
                playbackItem = xbmcgui.ListItem(label=title, path=url)
                playbackItem.setArt(theArt({'poster': image, 'thumb': image}))
                playbackItem.setProperty('IsPlayable', 'true')
                playlist.add(url, playbackItem)
                if not initialItem and url:
                    initialItem = {
                        'label': title,
                        'thumbnail': image,
                        'path': url,
                        'is_playable': True
                    }

        if playlist and initialItem:
            return playlist, initialItem
        else:
            return ()
示例#3
0
def channelVideos(name):
    items = [{
        'label':
        PLUGIN.get_string(30078),
        'icon':
        Images.ICON,
        'thumbnail':
        Images.THUMB,
        'art':
        utils.theArt(),
        'path':
        PLUGIN.url_for(endpoint='channelVideosList',
                       name=name,
                       index=0,
                       broadcast_type='archive')
    }, {
        'label':
        PLUGIN.get_string(30113),
        'icon':
        Images.ICON,
        'thumbnail':
        Images.THUMB,
        'art':
        utils.theArt(),
        'path':
        PLUGIN.url_for(endpoint='channelVideosList',
                       name=name,
                       index=0,
                       broadcast_type='upload')
    }, {
        'label':
        PLUGIN.get_string(30079),
        'icon':
        Images.ICON,
        'thumbnail':
        Images.THUMB,
        'art':
        utils.theArt(),
        'path':
        PLUGIN.url_for(endpoint='channelVideosList',
                       name=name,
                       index=0,
                       broadcast_type='highlight')
    }]
    PLUGIN.set_content(utils.getContentType())
    return items
示例#4
0
def createFollowingList():
    username = utils.getUserName()
    if not username:
        utils.notification(PLUGIN.get_string(30095))
    else:
        streams = TWITCHTV.getFollowingStreams(username)
        liveStreams = [CONVERTER.convertStreamToListItem(stream) for stream in streams[Keys.LIVE]]
        liveStreams.insert(0, {'path': PLUGIN.url_for(endpoint='createFollowingList'), 'icon': Images.ICON,
                               'thumbnail': Images.THUMB, 'art': utils.theArt(), 'is_playable': False,
                               'label': PLUGIN.get_string(30012)})
        liveStreams.append({'path': PLUGIN.url_for(endpoint='createFollowingList'), 'icon': Images.ICON,
                            'thumbnail': Images.THUMB, 'art': utils.theArt(), 'is_playable': False,
                            'label': PLUGIN.get_string(30013)})
        liveStreams.extend([CONVERTER.convertFollowersToListItem(follower) for follower in streams[Keys.OTHERS]])
        utils.refreshPreviews()
        PLUGIN.set_content(utils.getContentType())
        return liveStreams
示例#5
0
def createFollowingList():
    username = utils.getUserName()
    if not username:
        utils.notification(PLUGIN.get_string(30095))
    else:
        streams = TWITCHTV.getFollowingStreams(username)
        liveStreams = [CONVERTER.convertStreamToListItem(stream) for stream in streams[Keys.LIVE]]
        liveStreams.insert(0, {'path': PLUGIN.url_for(endpoint='createFollowingList'), 'icon': Images.ICON,
                               'thumbnail': Images.THUMB, 'art': utils.theArt(), 'is_playable': False,
                               'label': PLUGIN.get_string(30012)})
        liveStreams.append({'path': PLUGIN.url_for(endpoint='createFollowingList'), 'icon': Images.ICON,
                            'thumbnail': Images.THUMB, 'art': utils.theArt(), 'is_playable': False,
                            'label': PLUGIN.get_string(30013)})
        liveStreams.extend([CONVERTER.convertFollowersToListItem(follower) for follower in streams[Keys.OTHERS]])
        utils.refreshPreviews()
        PLUGIN.set_content(utils.getContentType())
        return liveStreams
示例#6
0
 def convertTeamToListItem(self, team):
     name = team[Keys.NAME]
     background = team.get(Keys.BACKGROUND) if team.get(Keys.BACKGROUND) else Images.FANART
     image = team.get(Keys.LOGO) if team.get(Keys.LOGO) else Images.ICON
     return {'label': name,
             'path': self.plugin.url_for(endpoint='createListOfTeamStreams', team=name),
             'icon': image,
             'thumbnail': image,
             'art': theArt({'fanart': background, 'poster': image, 'thumb': image})}
示例#7
0
 def convertFollowersToListItem(self, follower):
     image = follower.get(Keys.LOGO) if follower.get(Keys.LOGO) else Images.ICON
     videobanner = follower.get(Keys.VIDEO_BANNER)
     if not videobanner:
         videobanner = follower.get(Keys.PROFILE_BANNER) if follower.get(Keys.PROFILE_BANNER) else Images.FANART
     return {'label': follower[Keys.DISPLAY_NAME],
             'path': self.plugin.url_for(endpoint='channelVideos', name=follower[Keys.NAME]),
             'icon': image,
             'thumbnail': image,
             'art': theArt({'fanart': videobanner, 'poster': image, 'thumb': image})}
示例#8
0
 def convertGameToListItem(self, game):
     name = game[Keys.NAME].encode('utf-8')
     if not name:
         name = self.plugin.get_string(30064)
     image = Images.BOXART
     if game.get(Keys.BOX):
         image = game[Keys.BOX].get(Keys.LARGE) if game[Keys.BOX].get(Keys.LARGE) else image
     return {'label': name,
             'path': self.plugin.url_for('createListForGame', gameName=name, index='0'),
             'icon': image,
             'thumbnail': image,
             'art': theArt({'poster': image, 'thumb': image})}
示例#9
0
 def convertStreamToListItem(self, stream):
     channel = stream[Keys.CHANNEL]
     videobanner = channel.get(Keys.PROFILE_BANNER)
     if not videobanner:
         videobanner = channel.get(Keys.VIDEO_BANNER) if channel.get(
             Keys.VIDEO_BANNER) else Images.FANART
     preview = stream.get(Keys.PREVIEW)
     if preview:
         preview = preview.get(Keys.MEDIUM)
     logo = channel.get(Keys.LOGO) if channel.get(
         Keys.LOGO) else Images.VIDEOTHUMB
     image = preview if preview else logo
     title = self.getTitleForStream(stream)
     info = self.getPlotForStream(stream)
     info['mediatype'] = getMediaType()
     return {
         'label':
         title,
         'path':
         self.plugin.url_for(endpoint='playLive',
                             name=channel[Keys.NAME],
                             quality='-2'),
         'context_menu':
         [(self.plugin.get_string(30077),
           'RunPlugin(%s)' % self.plugin.url_for(
               endpoint='playLive', name=channel[Keys.NAME], quality='-1'))
          ],
         'is_playable':
         True,
         'icon':
         image,
         'thumbnail':
         image,
         'info':
         info,
         'art':
         theArt({
             'fanart': videobanner,
             'poster': image,
             'thumb': image
         }),
         'stream_info': {
             'video': {
                 'height': stream.get(Keys.VIDEO_HEIGHT),
                 'duration': 0
             }
         }
     }
示例#10
0
 def convertVideoListToListItem(self, video):
     duration = video.get(Keys.LENGTH)
     plot = video.get(Keys.DESCRIPTION)
     date = video.get(Keys.CREATED_AT)[:10] if video.get(
         Keys.CREATED_AT) else ''
     year = video.get(Keys.CREATED_AT)[:4] if video.get(
         Keys.CREATED_AT) else ''
     image = video.get(Keys.PREVIEW) if video.get(
         Keys.PREVIEW) else Images.VIDEOTHUMB
     return {
         'label':
         video[Keys.TITLE],
         'path':
         self.plugin.url_for(endpoint='playVideo',
                             _id=video['_id'],
                             quality='-2'),
         'context_menu':
         [(self.plugin.get_string(30077),
           'RunPlugin(%s)' % self.plugin.url_for(
               endpoint='playVideo', _id=video['_id'], quality='-1'))],
         'is_playable':
         True,
         'icon':
         image,
         'thumbnail':
         image,
         'info': {
             'duration': str(duration),
             'plot': plot,
             'plotoutline': plot,
             'tagline': plot,
             'year': year,
             'date': date,
             'premiered': date,
             'mediatype': getMediaType()
         },
         'art':
         theArt({
             'poster': image,
             'thumb': image
         }),
         'stream_info': {
             'video': {
                 'duration': duration
             }
         }
     }
示例#11
0
 def convertTeamChannelToListItem(self, teamChannel):
     images = teamChannel.get(Keys.IMAGE)
     image = Images.ICON
     if images:
         image = images.get(Keys.SIZE600) if images.get(Keys.SIZE600) else Images.ICON
     channelname = teamChannel[Keys.NAME]
     titleValues = self.extractChannelTitleValues(teamChannel)
     title = self.titleBuilder.formatTitle(titleValues)
     return {'label': title,
             'path': self.plugin.url_for(endpoint='playLive', name=channelname, quality='-2'),
             'context_menu': [(self.plugin.get_string(30077), 'RunPlugin(%s)' %
                               self.plugin.url_for(endpoint='playLive', name=channelname, quality='-1'))],
             'is_playable': True,
             'icon': image,
             'thumbnail': image,
             'art': theArt({'poster': image, 'thumb': image}),
             'stream_info': {'video': {'duration': 0}}}
示例#12
0
 def convertVideoListToListItem(self, video):
     duration = video.get(Keys.LENGTH)
     plot = video.get(Keys.DESCRIPTION)
     date = video.get(Keys.CREATED_AT)[:10] if video.get(Keys.CREATED_AT) else ''
     year = video.get(Keys.CREATED_AT)[:4] if video.get(Keys.CREATED_AT) else ''
     image = video.get(Keys.PREVIEW) if video.get(Keys.PREVIEW) else Images.VIDEOTHUMB
     return {'label': video[Keys.TITLE],
             'path': self.plugin.url_for(endpoint='playVideo', _id=video['_id'], quality='-2'),
             'context_menu': [(self.plugin.get_string(30077), 'RunPlugin(%s)' %
                               self.plugin.url_for(endpoint='playVideo', _id=video['_id'], quality='-1'))],
             'is_playable': True,
             'icon': image,
             'thumbnail': image,
             'info': {'duration': str(duration), 'plot': plot, 'plotoutline': plot, 'tagline': plot,
                      'year': year, 'date': date, 'premiered': date, 'mediatype': getMediaType()},
             'art': theArt({'poster': image, 'thumb': image}),
             'stream_info': {'video': {'duration': duration}}}
示例#13
0
    def convertToXBMCPlaylist(InputPlaylist, title='', image=''):
        # Create playlist in Kodi, return tuple (playlist, {listitem dict}) or ()
        playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playlist.clear()
        initialItem = None
        for (url, details) in InputPlaylist:
            if url:
                if details != ():
                    (title, image) = details
                playbackItem = xbmcgui.ListItem(label=title, path=url)
                playbackItem.setArt(theArt({'poster': image, 'thumb': image}))
                playbackItem.setProperty('IsPlayable', 'true')
                playlist.add(url, playbackItem)
                if not initialItem and url:
                    initialItem = {'label': title, 'thumbnail': image, 'path': url, 'is_playable': True}

        if playlist and initialItem:
            return playlist, initialItem
        else:
            return ()
示例#14
0
 def convertStreamToListItem(self, stream):
     channel = stream[Keys.CHANNEL]
     videobanner = channel.get(Keys.PROFILE_BANNER)
     if not videobanner:
         videobanner = channel.get(Keys.VIDEO_BANNER) if channel.get(Keys.VIDEO_BANNER) else Images.FANART
     preview = stream.get(Keys.PREVIEW)
     if preview:
         preview = preview.get(Keys.MEDIUM)
     logo = channel.get(Keys.LOGO) if channel.get(Keys.LOGO) else Images.VIDEOTHUMB
     image = preview if preview else logo
     title = self.getTitleForStream(stream)
     info = self.getPlotForStream(stream)
     return {'label': title,
             'path': self.plugin.url_for(endpoint='playLive', name=channel[Keys.NAME], quality='-2'),
             'context_menu': [(self.plugin.get_string(30077), 'RunPlugin(%s)' %
                               self.plugin.url_for(endpoint='playLive', name=channel[Keys.NAME], quality='-1'))],
             'is_playable': True,
             'icon': image,
             'thumbnail': image,
             'info': info,
             'art': theArt({'fanart': videobanner, 'poster': image, 'thumb': image}),
             'stream_info': {'video': {'height': stream.get(Keys.VIDEO_HEIGHT), 'duration': 0}}}
示例#15
0
def channelVideos(name):
    items = [{'label': PLUGIN.get_string(30078), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, past='true')},
             {'label': PLUGIN.get_string(30079), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, past='false')}]
    PLUGIN.set_content(utils.getContentType())
    return items
示例#16
0
def createMainListing():
    context_menu = []
    context_menu.extend(utils.contextClearPreviews())
    items = [
        {'label': PLUGIN.get_string(30005),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfFeaturedStreams')
         },
        {'label': PLUGIN.get_string(30001),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfGames', index='0')
         },
        {'label': PLUGIN.get_string(30008),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfChannels', index='0')
         },
        {'label': PLUGIN.get_string(30002),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createFollowingList')
         },
        {'label': PLUGIN.get_string(30066),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createFollowingGameList')
         },
        {'label': PLUGIN.get_string(30006),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfTeams', index='0')
         },
        {'label': PLUGIN.get_string(30098),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListForSelectedVideo')
         },
        {'label': PLUGIN.get_string(30003),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='search')
         },
        {'label': PLUGIN.get_string(30004),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='showSettings')
         }
    ]
    PLUGIN.set_content(utils.getContentType())
    return items
示例#17
0
def channelVideos(name):
    items = [{'label': PLUGIN.get_string(30078), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, broadcast_type='archive')},
             {'label': PLUGIN.get_string(30113), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, broadcast_type='upload')},
             {'label': PLUGIN.get_string(30079), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, broadcast_type='highlight')}]
    PLUGIN.set_content(utils.getContentType())
    return items
示例#18
0
def createMainListing():
    context_menu = []
    context_menu.extend(utils.contextClearPreviews())
    items = [
        {'label': PLUGIN.get_string(30005),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfFeaturedStreams')
         },
        {'label': PLUGIN.get_string(30001),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfGames', index='0')
         },
        {'label': PLUGIN.get_string(30008),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfChannels', index='0')
         },
        {'label': PLUGIN.get_string(30002),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createFollowingList')
         },
        {'label': PLUGIN.get_string(30066),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createFollowingGameList')
         },
        {'label': PLUGIN.get_string(30006),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfTeams', index='0')
         },
        {'label': PLUGIN.get_string(30098),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListForSelectedVideo')
         },
        {'label': PLUGIN.get_string(30003),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='search')
         },
        {'label': PLUGIN.get_string(30004),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='showSettings')
         }
    ]
    PLUGIN.set_content(utils.getContentType())
    return items