コード例 #1
0
def episode_makeitem(episodename, episodelink):
    '''
    Will return a ListItem for the given link to an episode and it's full linked name.
    Name will be sent to format show to attempt to parse out a date or season from the title.
    Infolabels are populated with any details that can be parsed from the title as well.
    Should be used anytime an item needs to be created that is an item for one specific episode of a show.
    Latest 350, Saved Show, Category (Show listing of all episodes for that series) would all use this.
    '''
    infolbl = {}
    spath = plugin.url_for(episode, name=episodename, url=episodelink)
    img = "DefaultVideoFolder.png"
    seasonstr = ''
    try:
        eptitle, epdate, epnum = formatshow(episodename)
        eplbl = formatlabel(eptitle, epdate, epnum)
        plotstr = "{0} ({1}): {2} {3}".format(epdate, epnum, eptitle, episodelink)
        infolbl = {'Date': epdate, 'Title': eptitle, 'Plot': plotstr}
        if len(epnum) > 0:
            showS, showE = findepseason(epnum)
            dictshow = {'Episode': showE, 'Season': showS}
            infolbl.update(dictshow)
            snum = int(showS)
            epnum = int(showE)
            if snum > 0 and epnum > 0:
                epdate = "S{0}e{1}".format(snum, epnum)
        item = {'label': eplbl, 'label2': epdate, 'icon': img, 'thumbnail': img, 'path': spath}
        item.setdefault(item.keys()[0])
        li = ListItem.from_dict(**item)
        li.set_info(type='video', info_labels=infolbl)
        li.add_context_menu_items([('Search [B]{0}[/B]'.format(eptitle), 'RunPlugin({0})'.format(plugin.url_for(query, searchquery=eptitle)),)])
    except:
        li = ListItem(label=episodename, label2=episodelink, icon=img, thumbnail=img, path=spath)
    return li
コード例 #2
0
ファイル: test_listitem.py プロジェクト: beenje/xbmcswift2
 def test_label(self):
     item = ListItem('foo')
     self.assertEqual(item.label, 'foo')
     item.label = 'bar'
     self.assertEqual(item.label, 'bar')
     item.set_label('baz')
     self.assertEqual(item.get_label(), 'baz')
コード例 #3
0
ファイル: test_listitem.py プロジェクト: beenje/xbmcswift2
 def test_select(self):
     with patch.object(xbmcgui.ListItem, 'select') as mock_select:
         item = ListItem()
         item.selected = True
         mock_select.assert_called_with(True)
         item.select(False)
         mock_select.assert_called_with(False)
コード例 #4
0
ファイル: test_listitem.py プロジェクト: Opvolger/xbmcswift2
 def test_stream_info(self):
     with patch.object(xbmcgui.ListItem, 'addStreamInfo') as mock_stream_info:
         item = ListItem()
         item.add_stream_info('video', {'duration': 185})
         mock_stream_info.assert_called_with('video', {'duration': 185})
         item.add_stream_info('audio', {'languange': 'en'})
         mock_stream_info.assert_called_with('audio', {'languange': 'en'})
コード例 #5
0
ファイル: test_listitem.py プロジェクト: beenje/xbmcswift2
 def test_label2(self):
     item = ListItem('foo')
     self.assertIsNone(item.label2)
     item.label2 = 'bar'
     self.assertEqual(item.label2, 'bar')
     item.set_label2('baz')
     self.assertEqual(item.get_label2(), 'baz')
コード例 #6
0
ファイル: path.py プロジェクト: brmnh/xbmc-addons-chinese
def video_detail(seasonId):
    detail = Meiju.video_detail(seasonId)
    season_data = detail["data"]["season"]
    title = season_data["title"]
    SEASON_CACHE[seasonId] = detail["data"]  # store season detail
    history = HISTORY.get("list", None)
    playing_episode = "0"
    if history is not None:
        for l in history:
            if l["seasonId"] == seasonId:
                playing_episode = l["index"]
    for episode in season_data["playUrlList"]:
        label = title + str(episode["episode"])
        if episode["episode"] == playing_episode:
            label = "[B]" + colorize(label, "green") + "[/B]"
        item = ListItem(**{
            'label': label,
            'path': plugin.url_for("play_season", seasonId=seasonId, index=episode["episode"], Esid=episode["episodeSid"]),
        })
        item.set_info("video", {"plot": season_data["brief"],
                                "TVShowTitle": title,
                                "episode": int(episode["episode"]),
                                "season": 0})
        item._listitem.setArt({"poster": season_data["cover"]})
        item.set_is_playable(True)
        yield item
    plugin.set_content('episodes')
コード例 #7
0
 def test_select(self):
     with patch.object(xbmcgui.ListItem, 'select') as mock_select:
         item = ListItem()
         item.selected = True
         mock_select.assert_called_with(True)
         item.select(False)
         mock_select.assert_called_with(False)
コード例 #8
0
ファイル: javbus.py プロジェクト: gobeexx/115-for-kodi
def javstarlist(qbbb='qb', page=1):
    filter = '/actresses'
    pagestr = ''
    if int(page) > 1:
        pagestr = '/' + str(page)
    url = '%s%s%s' % (javbusurl[qbbb], filter, pagestr)
    try:
        rsp = _http(url)
        releech = 'avatar-box.*?href="%s/star/(?P<starid>.*?)">.*?src="(?P<starimg>.*?)".*?<span>(?P<starname>.*?)</span>' % (
            javbusurl[qbbb])
        # if qbbb=='om':
        # releech=r'star-frame2.*?href="%s/star/(?P<starid>.*?)".*?src="(?P<starimg>.*?)".*?title="(?P<starname>.*?)"'%(javbusurl[qbbb])
        leech = re.compile(releech, re.S)
        menus = []
        for match in leech.finditer(rsp):
            context_menu_items = []
            context_menu_items.append((
                '搜索' + colorize_label(match.group('starname').encode('UTF-8'),
                                      color='00FF00'),
                'RunPlugin(' +
                plugin.url_for('searchinit',
                               stypes='pan,bt',
                               sstr=match.group('starname').encode('UTF-8'),
                               modify='1',
                               otherargs='{}') + ')',
            ))

            listitem = ListItem(
                label='优优:%s' % (match.group('starname')),
                thumbnail=match.group('starimg'),
                path=plugin.url_for('javlist',
                                    qbbb=qbbb,
                                    filtertype='star',
                                    filterkey=match.group('starid'),
                                    page=1),
            )

            if len(context_menu_items) > 0 and listitem != None:
                listitem.add_context_menu_items(context_menu_items, False)
                menus.append(listitem)
        strnextpage = str(int(page) + 1)
        strnextpage = '/' + strnextpage + '">' + strnextpage + '</a>'
        if rsp.find(strnextpage) >= 0:
            menus.append({
                'label':
                '下一页',
                'path':
                plugin.url_for('javstarlist', qbbb=qbbb, page=int(page) + 1),
                'thumbnail':
                xbmc.translatePath(os.path.join(
                    IMAGES_PATH, 'nextpage.png')).decode('utf-8')
            })
        setthumbnail['set'] = True
        return menus
    except:
        plugin.notify('女优列表获取失败')
        return
コード例 #9
0
ファイル: addon.py プロジェクト: giogris/tvs
def tvitem(adapter, channel):
    titleandtime = channel.nowstarttimeandtitle()

    item = ListItem(label=channel.name,
                    label2=titleandtime,
                    icon=channel.getimagefile(config.tvconfig.channelsdir),
                    thumbnail=channel.getimagefile(config.tvconfig.channelsdir),
                    path=plugin.url_for(str('play_channel'), adapter=adapter, channelid=str(channel.channelid)))

    item.set_is_playable(True)
    item.set_info('video',
                  {
                      'title': channel.name[:15],
                      'tvshowtitle': titleandtime,
                      'duration': channel.v_nowduration,
                      'plot': channel.v_nowdescription,
                      'plotoutline': channel.v_nowdescription,
                      'tagline': channel.nowstarttimeandtitle(),
                      'playcount': 0,
                      #'cast': channel.v_nowactors,
                      'fanart': channel.v_nowfanart,
                      'extrafanart': channel.v_nowposter,
                      'originaltitle': channel.v_nowtitle,
                      'year': channel.v_nowyear,
                      'album': titleandtime,  # I used album 'cause I haven't found another field to display label2
                      'genre': channel.v_nowgenre
                  })
    item.add_context_menu_items(create_context_menu(channel.name, adapter, channel.channelid), replace_items=True)
    item.add_stream_info('video',
                         {'duration': try_parse_int(channel.v_nowduration) * 60, 'plot': channel.v_nowdescription})
    return item
コード例 #10
0
def play(url):
    resolved = ''
    stream_url = ''
    item = None
    try:
        import urlresolver
        resolved = urlresolver.HostedMediaFile(url).resolve()
        if not resolved or resolved == False or len(resolved) < 1:
            resolved = urlresolver.resolve(url)
            if resolved is None or len(resolved) < 1:
                resolved = urlresolver.resolve(urllib.unquote(url))
        if len(resolved) > 1:
            plugin.notify(msg="PLAY {0}".format(resolved.partition('.')[-1]), title="URLRESOLVER", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        resolved = ''
        plugin.notify(msg="FAILED {0}".format(url.partition('.')[-1]), title="URLRESOLVER", delay=1000)
    try:
        import YDStreamExtractor
        info = YDStreamExtractor.getVideoInfo(url, resolve_redirects=True)
        resolved = info.streamURL()
        for s in info.streams():
            try:
                stream_url = s['xbmc_url'].encode('utf-8', 'ignore')
                xbmc.log(msg="**YOUTUBE-DL Stream found: {0}".format(stream_url))
            except:
                pass
        if len(stream_url) > 1:
            resolved = stream_url
        if len(resolved) > 1:
            plugin.notify(msg="Playing: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)
            plugin.set_resolved_url(resolved)
            item = ListItem.from_dict(path=resolved)
            item.add_stream_info('video', stream_values={})
            item.set_is_playable(True)
            return item
    except:
        plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000)

    if len(resolved) > 1:
        plugin.set_resolved_url(resolved)
        item = ListItem.from_dict(path=resolved)
        return item
    else:
        plugin.set_resolved_url(url) #url)
        #plugurl = 'plugin://plugin.video.live.streamspro/?url={0}'.format(urllib.quote_plus(url))
        #item = ListItem.from_dict(path=plugurl)
        #item.add_stream_info('video', stream_values={})
        #item.set_is_playable(True)
        #plugin.notify(msg="RESOLVE FAIL: {0}".format(url.split('.', 1)[-1]),title="Trying {0}".format(item.path.split('.', 1)[-1]), delay=2000)
        return None
コード例 #11
0
def play(artist, track):
    data = getTrack(artist, track)
    print data
    item = ListItem()
    item.set_label('%s - %s' % (artist, track))
    item.set_path(data['url'])
    item.set_played(True)
    xbmcplugin.setResolvedUrl(plugin.handle, True, item.as_xbmc_listitem())
コード例 #12
0
ファイル: test_listitem.py プロジェクト: Opvolger/xbmcswift2
    def test_from_dict_props(self):
        dct = {
            'properties': {'StartOffset': '256.4'},
        }
        item = ListItem.from_dict(**dct)
        self.assertEqual(item.get_property('StartOffset'), '256.4')

        dct = {
            'properties': [('StartOffset', '256.4')],
        }
        item = ListItem.from_dict(**dct)
        self.assertEqual(item.get_property('StartOffset'), '256.4')
コード例 #13
0
    def test_from_dict_props(self):
        dct = {
            'properties': {
                'StartOffset': '256.4'
            },
        }
        item = ListItem.from_dict(**dct)
        self.assertEqual(item.get_property('StartOffset'), '256.4')

        dct = {
            'properties': [('StartOffset', '256.4')],
        }
        item = ListItem.from_dict(**dct)
        self.assertEqual(item.get_property('StartOffset'), '256.4')
コード例 #14
0
ファイル: addon.py プロジェクト: Backmute/seppius-xbmc-repo
def play(artist, track):
    data = getTrack(artist, track)
    print data
    item = ListItem()
    item.set_label('%s - %s' % (artist, track))
    item.set_path(data['url'])
    item.set_played(True)
    xbmcplugin.setResolvedUrl(plugin.handle, True, item.as_xbmc_listitem())
コード例 #15
0
def javmagnet(qbbb='qb',gid='0',uc='0'):
    menus=[]
    baseurl=javbusurl['base']
    if qbbb=='om':
        baseurl=javbusurl['om']
#try:
    rspmagnet=_http('%s/ajax/uncledatoolsbyajax.php?gid=%s&uc=%s&floor=1'%(baseurl,gid,uc),referer=baseurl)
    #xbmc.log(rspmagnet)
    leechmagnet = re.compile('onmouseover.*?href="(?P<magnet>magnet.*?)">\s*(?P<title>.*?)\s*</a>.*?href.*?">\s*(?P<filesize>.*?)\s*</a>.*?href.*?">\s*(?P<createdate>.*?)\s*</a>',  re.S)
    #if qbbb=='om':
    #	leechmagnet = re.compile(r'onmouseover.*?\x29">\s*(?P<title>.*?)\s*</td>.*?">\s*(?P<filesize>.*?)\s*</td>.*?">\s*(?P<createdate>.*?)\s*</td>.*?href="(?P<magnet>magnet.*?)">',  re.S)
    for match in leechmagnet.finditer(rspmagnet):
        
        magnet=match.group('magnet')
        title=match.group('title')
        title = re.sub("<a\x20.*?>", "|", title)
        filesize=match.group('filesize')
        createdate=match.group('createdate')
        

        filemsg ='大小:'+filesize+'  创建时间:'+createdate
        
        listitem=ListItem(label=comm.colorize_label(title, 'bt'), 
            label2=filesize, icon=None,
            thumbnail=xbmc.translatePath( os.path.join( IMAGES_PATH, 'magnet.jpg') ), 
            path=plugin.url_for('execmagnet',
            url=six.ensure_binary(magnet),title=six.ensure_binary(title),msg=six.ensure_binary(filemsg)))
        
        menus.append(listitem)
    return menus
#except:
    plugin.notify('自带磁力获取失败')
    return
コード例 #16
0
ファイル: path.py プロジェクト: 2php/xbmc-addons-chinese
def get_album(albumId):
    c_list = Meiju.get_album(albumId)
    for one in c_list["data"]["results"]:
        item = ListItem(**{
            'label': one.get("title"),
            'path': plugin.url_for("detail", seasonId=one.get("id")),
            'icon': one["cover"],
            'thumbnail': one["cover"],
        })
        item.set_info("video", {"plot": one.get("brief", ""),
                                "rating ": float(one["score"]),
                                "genre": one["cat"],
                                "season": one["seasonNo"]})
        item.set_is_playable(False)
        yield item
    plugin.set_content('TVShows')
コード例 #17
0
ファイル: test_listitem.py プロジェクト: beenje/xbmcswift2
 def test_from_dict(self):
     dct = {
         'label': 'foo',
         'label2': 'bar',
         'icon': 'icon',
         'thumbnail': 'thumbnail',
         'path': 'plugin://my.plugin.id/',
         'selected': True,
         'info': {'title': 'My title'},
         'info_type': 'pictures',
         'properties': [('StartOffset', '256.4')],
         'context_menu': [('label', 'action')],
         'is_playable': True}
     with patch.object(ListItem, 'set_info', spec=True) as mock_set_info:
         item = ListItem.from_dict(**dct)
     self.assertEqual(item.label, 'foo')
     self.assertEqual(item.label2, 'bar')
     self.assertEqual(item.icon, 'icon')
     self.assertEqual(item.thumbnail, 'thumbnail')
     self.assertEqual(item.path, 'plugin://my.plugin.id/')
     self.assertEqual(item.selected, True)
     mock_set_info.assert_called_with('pictures', {'title': 'My title'})
     self.assertEqual(item.get_property('StartOffset'), '256.4')
     self.assertEqual(item.get_context_menu_items(), [('label', 'action')]) 
     self.assertEqual(item.get_property('isPlayable'), 'true')
     self.assertEqual(item.is_folder, False)
コード例 #18
0
ファイル: app.py プロジェクト: beenje/xbmcswift2
def interactive(plugin):
    '''A run mode for the CLI that runs the plugin in a loop based on user
    input.
    '''
    items = [item for item in once(plugin) if not item.get_played()]
    parent_stack = []  # Keep track of parents so we can have a '..' option

    selected_item = get_user_choice(items)
    while selected_item is not None:
        if parent_stack and selected_item == parent_stack[-1]:
            # User selected the parent item, remove from list
            parent_stack.pop()
        else:
            # User selected non parent item, add current url to parent stack
            parent_stack.append(ListItem.from_dict(label='..',
                                                   path=plugin.request.url))
        patch_plugin(plugin, selected_item.get_path())

        # If we have parent items, include the top of the stack in the list
        # item display
        parent_item = None
        if parent_stack:
            parent_item = parent_stack[-1]
        items = [item for item in once(plugin, parent_item=parent_item)
                 if not item.get_played()]
        selected_item = get_user_choice(items)
コード例 #19
0
    def play(self, videoId):
        api = NetworkTenVideo()
        media = api.get_media_for_video(videoId)
        self.log.debug("Found media renditions for video: %s", repr(media.items))
        if len(media.items):
            # Blindly go for the highest bitrate for now.
            # Later versions could include a customisable setting of which stream to use
            media_sorted = sorted(media.items, key=lambda m: m.encodingRate, reverse=True)
            media = media_sorted[0]
            path = media.defaultURL
            self.log.info("Using rendition: %s with url: %s" % (media, path))
        else:
            # Fallback to API FLVFullLength (e.g. for live streams)
            media = api.get_fallback_media_for_video(videoId)
            path = media.remoteUrl
            self.log.info("Using fallback rendition: %s with url: %s" % (media, path))

        if path.startswith("rtmp"):
            path = path.replace("&mp4:", " playpath=mp4:")
            path += " swfVfy=true swfUrl=%s pageUrl=%s" % (SWF_URL, PAGE_URL)

        # Set the resolved url, and include media stream info
        item = ListItem.from_dict(path=path)
        item.add_stream_info(
            "video", {"codec": media.videoCodec, "width": media.frameWidth, "height": media.frameHeight}
        )
        self.plugin.set_resolved_url(path)
コード例 #20
0
  def play(self, videoId):
    api = NetworkTenVideo()
    media = api.get_media_for_video(videoId)
    self.log.debug('Found media renditions for video: %s', repr(media))
    if len(media):
        # Blindly go for the highest bitrate for now.
        # Later versions could include a customisable setting of which stream to use
        media_sorted = sorted(media, key=lambda m: m.encodingRate, reverse=True)
        media = media_sorted[0]
        path = media.url
        self.log.info('Using rendition: %s with url: %s' % (media, path))
    else:
        # Fallback to API FLVFullLength (e.g. for live streams)
        media = api.get_fallback_media_for_video(videoId)
        if media.remoteUrl:
          path = media.remoteUrl
          self.log.info('Using fallback rendition: %s with url: %s' % (media, path))
        else:
          # attempt to deal with DRM'd content by falling back to mobile HLS stream
          path = "http://c.brightcove.com/services/mobile/streaming/index/master.m3u8?videoId=%s" % videoId
          self.log.info('Using fallback rendition unavailable - falling back to mobile HLS stream: %s' % path)

    if path.startswith('rtmp'):
      path = path.replace('&mp4:', ' playpath=mp4:')
      path += ' swfVfy=true swfUrl=%s pageUrl=%s' % (SWF_URL, PAGE_URL)

    # Set the resolved url, and include media stream info
    item = ListItem.from_dict(path=path)
    item.add_stream_info('video', {'codec': media.videoCodec, 'width': media.frameWidth, 'height': media.frameHeight})
    self.plugin.set_resolved_url(path)
コード例 #21
0
def index():
    json_query = get_movie_list()
    if not json_query:
        return
    for item in json_query['data']['videos']:
        movie_id = item['MovieID']
        year = "20" + movie_id[4:6]
        image = IMAGE_API + year + "/" + movie_id + "/popu.jpg"
        listitem = ListItem.from_dict(
            **{
                'label': item['Title'],
                'path': PLAY_API + movie_id + "/hls/index.m3u8",
                'icon': image,
                'info': {
                    "Title": item['Title'],
                    "OriginalTitle": item['Title'],
                    "Year": int(year),
                    "Country": "Japan",
                    "Plot": item['Desc'],
                    "Rating": str(item['AvgRating'] * 2.0),
                    "MPAA": "R",
                    "Cast": item['ActressesJa'],
                    "CastAndRole": item['ActressesEn'],
                    "Duration": item['Duration'],
                    "premiered": year + "-" + movie_id[:2] + "-" +
                    movie_id[2:4],
                    "mediatype": "movie"
                },
                'is_playable': True,
            })
        yield listitem
コード例 #22
0
ファイル: oldaddon.py プロジェクト: moedje/kodi-repo-gaymods
def episode(name='', url=''):
    waserror = False
    linklist = []
    if len(url) == '':
        waserror = True
    else:
        html = DL(url)
        litems = []
        linklist = findvidlinks(html)
        itemparent = None
    if len(linklist) > 0:
        for name, link in linklist:
            itempath = plugin.url_for(play, url=link)
            item = dict(label=name, label2=link, icon='DefaultFolder.png', thumbnail='DefaultFolder.png', path=itempath)
            item.setdefault(item.keys()[0])
            litems.append(item)
        vitems = sortSourceItems(litems)
        litems = []
        for li in vitems:
            item = ListItem.from_dict(**li)
            item.set_is_playable(True)
            item.set_info(type='video', info_labels={'Title': item.label, 'Plot': item.label2})
            item.add_stream_info(stream_type='video', stream_values={})
            litems.append(item)
    else:
        waserror = True
    if waserror:
        plugin.notify(title="ERROR No links: {0}".format(name), msg=url)
        return []
    return litems
コード例 #23
0
 def test_from_dict(self):
     dct = {
         'label': 'foo',
         'label2': 'bar',
         'icon': 'icon',
         'thumbnail': 'thumbnail',
         'path': 'plugin://my.plugin.id/',
         'selected': True,
         'info': {
             'title': 'My title'
         },
         'info_type': 'pictures',
         'properties': [('StartOffset', '256.4')],
         'context_menu': [('label', 'action')],
         'is_playable': True
     }
     with patch.object(ListItem, 'set_info', spec=True) as mock_set_info:
         item = ListItem.from_dict(**dct)
     self.assertEqual(item.label, 'foo')
     self.assertEqual(item.label2, 'bar')
     self.assertEqual(item.icon, 'icon')
     self.assertEqual(item.thumbnail, 'thumbnail')
     self.assertEqual(item.path, 'plugin://my.plugin.id/')
     self.assertEqual(item.selected, True)
     mock_set_info.assert_called_with('pictures', {'title': 'My title'})
     self.assertEqual(item.get_property('StartOffset'), '256.4')
     self.assertEqual(item.get_context_menu_items(), [('label', 'action')])
     self.assertEqual(item.get_property('isPlayable'), 'true')
     self.assertEqual(item.is_folder, False)
コード例 #24
0
ファイル: app.py プロジェクト: beenje/xbmcswift2
def interactive(plugin):
    '''A run mode for the CLI that runs the plugin in a loop based on user
    input.
    '''
    items = [item for item in once(plugin) if not item.get_played()]
    parent_stack = []  # Keep track of parents so we can have a '..' option

    selected_item = get_user_choice(items)
    while selected_item is not None:
        if parent_stack and selected_item == parent_stack[-1]:
            # User selected the parent item, remove from list
            parent_stack.pop()
        else:
            # User selected non parent item, add current url to parent stack
            parent_stack.append(
                ListItem.from_dict(label='..', path=plugin.request.url))
        patch_plugin(plugin, selected_item.get_path())

        # If we have parent items, include the top of the stack in the list
        # item display
        parent_item = None
        if parent_stack:
            parent_item = parent_stack[-1]
        items = [
            item for item in once(plugin, parent_item=parent_item)
            if not item.get_played()
        ]
        selected_item = get_user_choice(items)
コード例 #25
0
    def play(self, videoId):
        api = NetworkTenVideo()
        media = api.get_media_for_video(videoId)
        self.log.debug('Found media renditions for video: %s',
                       repr(media.items))
        if len(media.items):
            # Blindly go for the highest bitrate for now.
            # Later versions could include a customisable setting of which stream to use
            media_sorted = sorted(media.items,
                                  key=lambda m: m.encodingRate,
                                  reverse=True)
            media = media_sorted[0]
            path = media.defaultURL
            self.log.info('Using rendition: %s with url: %s' % (media, path))
        else:
            # Fallback to API FLVFullLength (e.g. for live streams)
            media = api.get_fallback_media_for_video(videoId)
            path = media.remoteUrl
            self.log.info('Using fallback rendition: %s with url: %s' %
                          (media, path))

        if path.startswith('rtmp'):
            path = path.replace('&mp4:', ' playpath=mp4:')
            path += ' swfVfy=true swfUrl=%s pageUrl=%s' % (SWF_URL, PAGE_URL)

        # Set the resolved url, and include media stream info
        item = ListItem.from_dict(path=path)
        item.add_stream_info(
            'video', {
                'codec': media.videoCodec,
                'width': media.frameWidth,
                'height': media.frameHeight
            })
        self.plugin.set_resolved_url(path)
コード例 #26
0
    def test_context_menu(self):
        menu_items = [('label1', 'foo'), ('label2', 'bar')]
        item = ListItem()
        item.add_context_menu_items(menu_items)
        self.assertEqual(item.get_context_menu_items(), menu_items)

        extra_menu_item = ('label3', 'baz')
        menu_items.append(extra_menu_item)
        item.add_context_menu_items([extra_menu_item])
        self.assertEqual(item.get_context_menu_items(), menu_items)
コード例 #27
0
def get_track_item(track, album = None, band = None):
    if not album:
        if track.get('album_id',None):
            album = bc.album_info(track['album_id'])
        else:album = {}

    if not band:
        band = bc.band_info(track['band_id'])

    art = track.get('large_art_url', album.get('large_art_url',None))
    release_date = track.get('release_date', album.get('release_date',None))
    artist = track.get('artist', album.get('artist', band['name']))
    if track.get('number',None):
        label = u"{0} - {1}".format(track['number'], track['title'])
    else: label = track['title']
    li = ListItem(
        label = label,
        icon=art,
        thumbnail=art,
        path=plugin.url_for('play_track', track_id = track['track_id']),
    )
    li.set_property('mimetype','audio/mpeg')
    li.set_is_playable(True)
    infos = {
        'title':track['title'],
        'tracknumber':track.get('number',None),
        'duration':track['duration'],
        'lyrics':track.get('lyrics',''),
        'album':album.get('title',None),
        'artist':artist,
        'year':year_from_timestamp(release_date)
    }
    li.set_info('Music', infos)
    return li
コード例 #28
0
def processPlaylists(playlists):
    items = []
    for playlist in playlists:
        item = ListItem()
        title = playlist['name']
        if plugin.get_setting('Show owner') == 'true':
            title += ' @' + playlist['user']['login']
        item.set_label(title)
        item.set_thumbnail(playlist['images']['large'])
        item.set_path(
            plugin.url_for('playlist',
                           playlist_id=str(playlist['playlistId'])))
        item.set_info('music', {
            'Album': playlist['name'],
            'TrackNumber': playlist['itemsCount']
        })
        items.append(item)
    return items
コード例 #29
0
def playurl():
    url = ''
    url = plugin.keyboard(default='', heading='Video Page URL')
    if url != '' and len(url) > 0:
        item = ListItem.from_dict(path=plugin.url_for(endpoint=play, url=url))
        item.set_is_playable(True)
        item.set_info(type='video', info_labels={'Title': url, 'Plot': url})
        item.add_stream_info(stream_type='video', stream_values={})
        return play(url)
コード例 #30
0
    def test_selected(self):
        item = ListItem()
        self.assertEqual(item.selected, False)
        self.assertEqual(item.is_selected(), False)

        item.selected = True
        self.assertEqual(item.selected, True)
        self.assertEqual(item.is_selected(), True)

        item.select(False)
        self.assertEqual(item.selected, False)
        self.assertEqual(item.is_selected(), False)
コード例 #31
0
ファイル: addon.py プロジェクト: Backmute/seppius-xbmc-repo
def processPlaylists(playlists):
    items = []
    for playlist in playlists:
        item = ListItem()
        title = playlist['name']
        if plugin.get_setting('Show owner') == 'true':
            title += ' @' + playlist['user']['login']
        item.set_label(title)
        item.set_thumbnail(playlist['images']['large'])
        item.set_path(plugin.url_for('playlist', playlist_id = str(playlist['playlistId'])))
        item.set_info('music', {
            'Album': playlist['name'],
            'TrackNumber': playlist['itemsCount']
        })
        items.append(item)
    return items
コード例 #32
0
ファイル: oldaddon.py プロジェクト: moedje/kodi-repo-gaymods
def playfirst(url=''):
    idx = 0
    if len(url) < 1:
        return None
    thispath = plugin.url_for(endpoint=play, url=url)
    selItem = None
    outtxt = "Not Found"
    try:
        for fitem in plugin.added_items:
            if fitem.selected == True or fitem.path.find(thispath) != -1:
                try:
                    plugin.set_resolved_url(fitem)
                    fitem.is_playable(True)
                    fitem.played(True)
                except:
                    pass
                selItem = fitem
                plugin.notify(msg=selItem.label, title="Found item")
                break
    except:
        selItem = None
    if selItem is not None:
        try:
            selItem.set_is_playable(True)
            selItem.set_played(was_played=True)
            outtxt = selItem.label + " " + selItem.label2
        except:
            outtxt = str(repr(selItem))
    plugin.notify(msg=outtxt, title=str(idx))
    html = DL(url)
    prefhost = ''
    sourceslist = []
    stext = plugin.get_setting('topSources')
    if len(stext) < 1:
        prefhost = 'thevideo'
    else:
        sourceslist = stext.split(',')
        prefhost = sourceslist[0]
    litems = []
    linklist = findvidlinks(html, findhost=prefhost)
    if len(linklist) > 0:
        name, link = linklist[0]
        itempath = plugin.url_for(play, url=link)
        sitem = dict(label=name, label2=link, icon='DefaultFolder.png', thumbnail='DefaultFolder.png', path=itempath)
        sitem.setdefault(sitem.keys()[0])
        item = ListItem.from_dict(**sitem)
        item.set_is_playable(True)
        item.set_info(type='video', info_labels={'Title': item.label, 'Plot': item.label2})
        item.add_stream_info(stream_type='video', stream_values={})
        plugin.notify(msg=link, title=name)
        # plugin.add_items([item])
        item.set_played(was_played=True)
        # plugin.add_items([plugin.set_resolved_url(link)])#.as_tuple())])
        plugin.play_video(item)
        return [plugin.set_resolved_url(item)]
コード例 #33
0
ファイル: default.py プロジェクト: peiit/kodi_plugins
def play(seasonId='', index='', Esid=''):
    season_data = SEASON_CACHE.get(seasonId).get('season')
    title = season_data['title']
    episode_sid = Esid
    play_url, _ = Meiju.get_by_sid(episode_sid, plugin.get_setting('quality'))
    if play_url is not None:
        play_url = play_url.split('|')
        stackurl = 'stack://' + ' , '.join(play_url)
        add_history(seasonId, index, Esid, title)
        li = ListItem(title + index,
                      path=stackurl,
                      thumbnail=season_data.get('cover'))
        li.set_info('video', {
            'title': title + index,
            'plot': season_data.get('brief', '')
        })

        plugin.set_resolved_url(li)
    else:
        plugin.set_resolved_url(False)
コード例 #34
0
def play(seasonId="", index="", Esid=""):
    season_data = SEASON_CACHE.get(seasonId)
    title = season_data["seasonDetail"]["title"]
    episode_sid = Esid
    rs = RRMJResolver()
    play_url, _ = rs.get_play(seasonId, episode_sid,
                              plugin.get_setting("quality"))
    if play_url is not None:
        add_history(seasonId, index, Esid, title)
        li = ListItem(title + index, path=play_url)
        plugin.set_resolved_url(li)
コード例 #35
0
def get_album_item(album, band = None):
    if (not band) and (not album.get('artist',None)):
        band = bc.band_info(album['band_id'])

    year = year_from_timestamp(int(album['release_date']))
    artist = album.get('artist', band['name'])

    li = ListItem(
        label = u"{1} - {0}".format(album['title'], year),
        icon=album['large_art_url'],
        thumbnail=album['large_art_url'],
        path=plugin.url_for('show_album', album_id = album['album_id'])
    )
    infos = {
        'year':year,
        'album':album['title'],
        'artist':artist
    }
    li.set_info('Music', infos)
    return li
コード例 #36
0
ファイル: test_listitem.py プロジェクト: beenje/xbmcswift2
    def test_context_menu(self):
        menu_items = [('label1', 'foo'), ('label2', 'bar')]
        item = ListItem()
        item.add_context_menu_items(menu_items)
        self.assertEqual(item.get_context_menu_items(), menu_items)

        extra_menu_item = ('label3', 'baz')
        menu_items.append(extra_menu_item)
        item.add_context_menu_items([extra_menu_item])
        self.assertEqual(item.get_context_menu_items(), menu_items)
コード例 #37
0
def makecatitem(name, link, removelink=False):
    item = {}
    ctxitem = {}
    itempath = plugin.url_for(category, name=name, url=link)
    item = {'label': name, 'label2': link, 'icon': 'DefaultFolder.png', 'thumbnail': 'DefaultFolder.png', 'path': itempath}
    item.setdefault(item.keys()[0])
    litem = ListItem.from_dict(**item)
    #if removelink:
    #    litem.add_context_menu_items([('Remove Saved Show', 'RunPlugin("{0}")'.format(plugin.url_for(removeshow, name=name, link=itempath)),)])
    #else:
    litem.add_context_menu_items([('Save Show', 'RunPlugin("{0}")'.format(plugin.url_for(saveshow, name=name, link=link)),)])
    return litem
コード例 #38
0
 def test_label2(self):
     item = ListItem('foo')
     self.assertIsNone(item.label2)
     item.label2 = 'bar'
     self.assertEqual(item.label2, 'bar')
     item.set_label2('baz')
     self.assertEqual(item.get_label2(), 'baz')
コード例 #39
0
 def test_label(self):
     item = ListItem('foo')
     self.assertEqual(item.label, 'foo')
     item.label = 'bar'
     self.assertEqual(item.label, 'bar')
     item.set_label('baz')
     self.assertEqual(item.get_label(), 'baz')
コード例 #40
0
def video_detail(seasonId):
    detail = Meiju.video_detail(seasonId)
    title = detail["data"]["seasonDetail"]["title"]
    SEASON_CACHE[seasonId] = detail["data"]  # store season detail
    history = HISTORY.get("list", None)
    playing_episode = "0"
    if history is not None:
        for l in history:
            if l["seasonId"] == seasonId:
                playing_episode = l["index"]
    for episode in detail["data"]["seasonDetail"]["episode_brief"]:
        label = title + episode["episode"]
        if episode["episode"] == playing_episode:
            label = "[B]" + colorize(label, "green") + "[/B]"
        item = ListItem(
            **{
                'label':
                label,
                'path':
                plugin.url_for("play_season",
                               seasonId=seasonId,
                               index=episode["episode"],
                               Esid=episode["sid"]),
            })
        item.set_info(
            "video", {
                "plot": episode["text"],
                "TVShowTitle": episode["text"],
                "episode": int(episode["episode"]),
                "season": 0
            })
        item.set_is_playable(True)
        yield item
    plugin.set_content('episodes')
コード例 #41
0
def btsearch(enginestr, sstr, sorttype):
    if not sstr or sstr == '0':
        return
    max = int(plugin.get_setting('btmaxresult'))
    max = (max + 1) * 20
    items = []
    if enginestr != 'all' and sorttype == '-1':
        engineinfo = nova2.getengineinfo(enginestr)
        supportsort = engineinfo['support_sort']
        if len(supportsort) > 0:
            sortkeys = {
                'relevance': '相关度',
                'addtime': '创建时间',
                'size': '文件大小',
                'files': '文件数量',
                'popular': '热度',
            }
            dialog = xbmcgui.Dialog()
            sortselectlist = []
            for s in supportsort:
                sortselectlist.append(sortkeys[s])
            sorttype = dialog.select(engineinfo['name'] + '选择排序类型',
                                     sortselectlist)
            if sorttype == -1:
                return None
            sorttype = supportsort[int(sorttype)]
            #plugin.notify(sorttype)
    result = nova2.search(enginestr, sstr, sorttype, maxresult=max)
    msg = '共找到%d条磁力链' % (len(result))
    plugin.notify(msg)

    for res_dict in result:
        title = '[COLOR FF00FFFF]' + res_dict[
            'size'] + '[/COLOR]' + '[COLOR FFCCFFCC]' + res_dict[
                'date'][:10] + '[/COLOR]' + res_dict['name'].encode('UTF-8')
        filemsg = '大小:' + res_dict['size'].encode(
            'UTF-8') + '  创建时间:' + res_dict['date'].encode('UTF-8')
        listitem = ListItem(label=comm.colorize_label(title, 'bt'),
                            label2=res_dict['size'],
                            icon=None,
                            thumbnail=None,
                            path=plugin.url_for(
                                'execmagnet',
                                url=res_dict['link'].encode('UTF-8'),
                                title=title,
                                msg=filemsg))
        #listitem.set_info('picture', {'size': anySizeToBytes(res_dict['size'])})
        context_menu_items = []
        if (list == 'other'):
            titletype = title
        items.append(listitem)
    return items
コード例 #42
0
def watch(sid, season, episode, title, vid):
    if vid == 'None':  # Otherwise request was sent from choose_quality and url already exist
        vid, cookie = sdarot.get_final_video_and_cookie(sid, season, episode)

    if vid:
        item = ListItem(**{
            'label': u'פרק {0}'.format(episode),
            'path': vid,
            'thumbnail': POSTER_PREFIX + sid + '.jpg'
        })

        item.as_xbmc_listitem().setContentLookup(False)
        item.set_property('mimetype', 'video/mp4')
        item.set_property('type', 'movie')
        item.set_info('Video', {
                'Title': title,
                'Genre': u'פרק {0}, עונה {1}'.format(episode, season)
            })

        plugin.set_resolved_url(item)
    else:
        plugin.notify(msg='הייתה בעיה, נסו שוב', title='שגיאה', image=ICON)
コード例 #43
0
    def test_icon(self):
        item = ListItem()
        self.assertIsNone(item.icon)

        item.icon = 'bar'
        self.assertEqual(item.icon, 'bar')
        self.assertEqual(item.get_icon(), 'bar')

        item.set_icon('baz')
        self.assertEqual(item.icon, 'baz')
        self.assertEqual(item.get_icon(), 'baz')
コード例 #44
0
    def test_path(self):
        item = ListItem()
        self.assertIsNone(item.path)

        item.path = 'bar'
        self.assertEqual(item.path, 'bar')
        self.assertEqual(item.get_path(), 'bar')

        item.set_path('baz')
        self.assertEqual(item.path, 'baz')
        self.assertEqual(item.get_path(), 'baz')
コード例 #45
0
    def test_thumbnail(self):
        item = ListItem()
        self.assertIsNone(item.thumbnail)

        item.thumbnail = 'bar'
        self.assertEqual(item.thumbnail, 'bar')
        self.assertEqual(item.get_thumbnail(), 'bar')

        item.set_thumbnail('baz')
        self.assertEqual(item.thumbnail, 'baz')
        self.assertEqual(item.get_thumbnail(), 'baz')
コード例 #46
0
 def test_stream_info(self):
     with patch.object(xbmcgui.ListItem,
                       'addStreamInfo') as mock_stream_info:
         item = ListItem()
         item.add_stream_info('video', {'duration': 185})
         mock_stream_info.assert_called_with('video', {'duration': 185})
         item.add_stream_info('audio', {'languange': 'en'})
         mock_stream_info.assert_called_with('audio', {'languange': 'en'})
コード例 #47
0
ファイル: test_listitem.py プロジェクト: beenje/xbmcswift2
    def test_selected(self):
        item = ListItem()
        self.assertEqual(item.selected, False)
        self.assertEqual(item.is_selected(), False)

        item.selected = True
        self.assertEqual(item.selected, True)
        self.assertEqual(item.is_selected(), True)

        item.select(False)
        self.assertEqual(item.selected, False)
        self.assertEqual(item.is_selected(), False)
コード例 #48
0
    def _listitemify(self, item):
        '''Creates an xbmcswift2.ListItem if the provided value for item is a
        dict. If item is already a valid xbmcswift2.ListItem, the item is
        returned unmodified.
        '''
        info_type = self.info_type if hasattr(self, 'info_type') else 'video'

        # Create ListItems for anything that is not already an instance of
        # ListItem
        if not hasattr(item, 'as_tuple'):
            if 'info_type' not in item.keys():
                item['info_type'] = info_type
            item = ListItem.from_dict(**item)
        return item
コード例 #49
0
ファイル: addon.py プロジェクト: artmatsak/xbmc-rockpeaks
def playlist_play_all(playlist_id):
    data = api.request('playlist.getInfo', {
        'id': playlist_id,
        'video_sources': _get_supported_sources(),
        'video_status': 1
    })
    items = [_make_video_item(video) for video in data['playlist']['videos']['video']]
    playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    playlist.clear()
    for item in items:
        listitem = ListItem.from_dict(**item)
        playlist.add(item['path'], listitem.as_xbmc_listitem())
    player = xbmc.Player()
    player.playPlaylist(playlist)
コード例 #50
0
def play(link, title):
    if link[0] == '/':
        link = HOST + link
    page = get_html(link)
    playurl = re.compile('a href="(http.+?)\"').findall(page)[0]

    if ('le.com' in playurl) or ('letv.com' in playurl):
        videourl = video_from_letv(playurl, m3u8=__m3u8__)
        plugin.set_resolved_url(__m3u8__)
        return

    elif 'sohu.com' in playurl:
        videourl = video_from_sohu
    elif 'qq.com' in playurl:
        videourl = video_from_qq
    elif 'iqiyi.com' in playurl:
        split = urlparse.urlsplit(playurl)
        playurl = '{scheme}://{netloc}{path}/'.format(scheme=split[0],
                                                      netloc=split[1],
                                                      path=split[2])
        videourl = video_from_iqiyi
    elif 'fun.tv' in playurl:
        videourl = video_from_funshion
    elif 'youku.com' in playurl:
        videourl = video_from_youku
    elif 'mgtv.com' in playurl:
        videourl = video_from_mgtv
    else:
        xbmcgui.Dialog().ok(plugin.addon.getAddonInfo('name'), '地址不能解析')
        return

    urls = videourl(playurl)
    stackurl = 'stack://' + ' , '.join(urls)
    li = ListItem(title, path=stackurl)
    li.set_info('video', {'title': title})
    plugin.set_resolved_url(li)
コード例 #51
0
def episode_makeitem(episodename, episodelink, dateadded=None):
    '''
    Will return a ListItem for the given link to an episode and it's full linked name.
    Name will be sent to format show to attempt to parse out a date or season from the title.
    Infolabels are populated with any details that can be parsed from the title as well.
    Should be used anytime an item needs to be created that is an item for one specific episode of a show.
    Latest 350, Saved Show, Category (Show listing of all episodes for that series) would all use this.
    '''
    infolbl = {}
    spath = plugin.url_for(episode, name=episodename, url=episodelink)
    img = "DefaultVideoFolder.png"
    seasonstr = ''
    try:
        eptitle, epdate, epnum = formatshow(episodename)
        eplbl = formatlabel(eptitle, epdate, epnum)
        plotstr = "{0} ({1}): {2} {3}".format(epdate, epnum, eptitle, episodelink)
        infolbl = {'EpisodeName': epdate, 'Title': eptitle, 'Plot': plotstr}
        if len(epnum) > 0:
            showS, showE = findepseason(epnum)
            snum = int(showS)
            epnum = int(showE)
            infolbl.update({'Episode': showE, 'Season': showS})
            if snum > 0 and epnum > 0:
                epdate = "S{0}e{1}".format(snum, epnum)
                infolbl.update({'PlotOutline': epdate})
        if dateadded is not None:
            dateout = dateadded.replace(' ', '-').trim()
            eplbl += " [I][B][LIGHT]{0}[/LIGHT][/B][/I]".format(dateout)
            infolbl.update({"Date": dateout})
        item = {'label': eplbl, 'label2': epdate, 'icon': img, 'thumbnail': img, 'path': spath}
        item.setdefault(item.keys()[0])
        li = ListItem.from_dict(**item)
        li.set_info(type='video', info_labels=infolbl)
    except:
        li = ListItem(label=episodename, label2=episodelink, icon=img, thumbnail=img, path=spath)
    return li
コード例 #52
0
ファイル: test_listitem.py プロジェクト: beenje/xbmcswift2
    def test_icon(self):
        item = ListItem()
        self.assertIsNone(item.icon)

        item.icon = 'bar'
        self.assertEqual(item.icon, 'bar')
        self.assertEqual(item.get_icon(), 'bar')

        item.set_icon('baz')
        self.assertEqual(item.icon, 'baz')
        self.assertEqual(item.get_icon(), 'baz')
コード例 #53
0
ファイル: test_listitem.py プロジェクト: beenje/xbmcswift2
    def test_thumbnail(self):
        item = ListItem()
        self.assertIsNone(item.thumbnail)

        item.thumbnail = 'bar'
        self.assertEqual(item.thumbnail, 'bar')
        self.assertEqual(item.get_thumbnail(), 'bar')

        item.set_thumbnail('baz')
        self.assertEqual(item.thumbnail, 'baz')
        self.assertEqual(item.get_thumbnail(), 'baz')
コード例 #54
0
ファイル: test_listitem.py プロジェクト: beenje/xbmcswift2
    def test_path(self):
        item = ListItem()
        self.assertIsNone(item.path)

        item.path = 'bar'
        self.assertEqual(item.path, 'bar')
        self.assertEqual(item.get_path(), 'bar')

        item.set_path('baz')
        self.assertEqual(item.path, 'baz')
        self.assertEqual(item.get_path(), 'baz')
コード例 #55
0
ファイル: oldaddon.py プロジェクト: moedje/kodi-repo-gaymods
def resolveurl():
    url = plugin.keyboard(default='', heading='Video Page URL')
    if url is not None:
        name = url
        if len(url) > 0:
            item = ListItem(label=name, label2=url, icon='DefaultVideo.png', thumbnail='DefaultVideo.png',
                            path=plugin.url_for(endpoint=play, url=url))
            item.set_is_playable(True)
            item.set_info(type='video', info_labels={'Title': url, 'Plot': url})
            item.add_stream_info(stream_type='video', stream_values={})
            playable = play(url)
            plugin.notify(msg=playable.path, title="Playing..")
            plugin.play_video(playable)
    # plugin.redirect(plugin.url_for(index))
    plugin.clear_added_items()
    plugin.end_of_directory()
コード例 #56
0
ファイル: oldaddon.py プロジェクト: moedje/kodi-repo-gaymods
def episode_makeitem(episodename, episodelink, dateadded=None):
    '''
    Will return a ListItem for the given link to an episode and it's full linked name.
    Name will be sent to format show to attempt to parse out a date or season from the title.
    Infolabels are populated with any details that can be parsed from the title as well.
    Should be used anytime an item needs to be created that is an item for one specific episode of a show.
    Latest 350, Saved Show, Category (Show listing of all episodes for that series) would all use this.
    '''
    infolbl = {}
    spath = plugin.url_for(episode, name=episodename, url=episodelink)
    img = "DefaultVideoFolder.png"
    seasonstr = ''
    try:
        eptitle, epdate, epnum = formatshow(episodename)
        eplbl = formatlabel(eptitle, epdate, epnum)
        plotstr = "{0} ({1}): {2} {3}".format(epdate, epnum, eptitle, episodelink)
        infolbl = {'EpisodeName': epdate, 'Title': eptitle, 'Plot': plotstr}
        if len(epnum) > 0:
            showS, showE = findepseason(epnum)
            snum = int(showS)
            epnum = int(showE)
            infolbl.update({'Episode': showE, 'Season': showS})
            if snum > 0 and epnum > 0:
                epdate = "S{0}e{1}".format(snum, epnum)
                infolbl.update({'PlotOutline': epdate})
        if dateadded is not None:
            dateout = str(dateadded.replace(' ', '-')).strip()
            infolbl.update({"Date": dateout})
        item = {'label': eplbl, 'label2': epdate, 'icon': img, 'thumbnail': img, 'path': spath}
        item.setdefault(item.keys()[0])
        li = ListItem.from_dict(**item)
        li.set_is_playable(is_playable=True)
        li.is_folder = True
        li.set_info(type='video', info_labels=infolbl)
        li.add_context_menu_items(
            [('Autoplay', 'RunPlugin("{0}")'.format(plugin.url_for(endpoint=playfirst, url=episodelink)),)])
    except:
        li = ListItem(label=episodename, label2=episodelink, icon=img, thumbnail=img, path=spath)
    return li
コード例 #57
0
ファイル: old_addon.py プロジェクト: moedje/kodi-repo-gaymods
def loadsaved():
    sitems = []
    litems = []
    items = []
    savedpath = ''
    try:
        savedpath = path.join(__datadir__, "saved.json")
        if path.exists(savedpath):
            fpin = file(savedpath)
            rawjson = fpin.read()
            sitems = json.loads(rawjson)
            fpin.close()
        else:
            return []
        for item in sitems:
            li = ListItem.from_dict(**item)
            li.add_context_menu_items(
                [('Remove Saved Show', 'RunPlugin("{0}")'.format(plugin.url_for(removeshow, name=li.label, link=li.path)),)])
            litems.append(li)
    except:
        pass
    return litems