예제 #1
0
def show_list(listing):
	addon_handle = int(sys.argv[1])
	xbmcplugin.setContent(addon_handle, 'movies')
	for item in listing:
		info = item.get_info()
		li = xbmcgui.ListItem(info['title'])
		li.setInfo('video', info)
		li.setArt(item.get_art())

		url_search = make_url(
			{'action': 'add_media',
			 'title': info['title'].encode('utf-8'),
			 'imdb': item.imdb()})

		url_similar = make_url(
			{'action': 'show_similar',
			 'type': item.type,
			 'tmdb': item.tmdb_id()})

		items = [(u'Смотрите также', 'Container.Update("%s")' % url_similar),
				(u'Искать источники', 'RunPlugin("%s")' % (url_search + '&force=true') )]

		li.addContextMenuItems(items)

		xbmcplugin.addDirectoryItem(handle=addon_handle, url=url_search, listitem=li)
	
	updateListing = next_item(listing.total_pages)
	xbmcplugin.endOfDirectory(addon_handle, updateListing=updateListing, cacheToDisc=True)
예제 #2
0
def view_top():
  addDirectoryItem(plugin.handle, plugin.make_url("/live"), ListItem("Direkte"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/recommended"), ListItem("Aktuelt"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/mostrecent"), ListItem("Nytt"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/mostpopularweek"), ListItem("Populært siste uke"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/mostpopularmonth"), ListItem("Populært siste måned"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/browse"), ListItem("Bla"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/search"), ListItem("Søk"), True)
  endOfDirectory(plugin.handle)
예제 #3
0
def view_top():
  addDirectoryItem(plugin.handle, plugin.make_url("/live"), ListItem("Direkte"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/recommended"), ListItem("Aktuelt"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/mostrecent"), ListItem("Siste"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/popular"), ListItem("Populært"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/categories"), ListItem("Kategorier"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/letters"), ListItem("A-Å"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/search"), ListItem("Søk"), True)
  endOfDirectory(plugin.handle)
예제 #4
0
def view(titles, urls, thumbs=repeat(''), bgs=repeat(''), descr=repeat(''), update_listing=False):
  total = len(titles)
  for title, url, descr, thumb, bg in zip(titles, urls, descr, thumbs, bgs):
    descr = descr() if callable(descr) else descr
    thumb = thumb() if callable(thumb) else thumb
    bg = bg() if callable(bg) else bg
    li = ListItem(title, thumbnailImage=thumb)
    playable = plugin.route_for(url) == play
    li.setProperty('isplayable', str(playable))
    li.setProperty('fanart_image', bg)
    if playable:
      li.setInfo('video', {'title':title, 'plot':descr})
      li.addStreamInfo('video', {'codec':'h264', 'width':1280, 'height':720})
      li.addStreamInfo('audio', {'codec':'aac', 'channels':2})
      commands = []
      search_url = plugin.make_url( "/searchfor/%s" % title.encode('utf-8') )
      runner = "XBMC.ActivateWindow(Video," + search_url + ",return)"
      commands.append(( str("Search NRK..."), runner))
      li.addContextMenuItems( commands )
    addDirectoryItem(plugin.handle, plugin.make_url(url), li, not playable, total)
  endOfDirectory(plugin.handle, updateListing=update_listing)
예제 #5
0
def view(titles, urls, thumbs=repeat(''), bgs=repeat(''), descr=repeat(''), update_listing=False):
  total = len(titles)
  for title, url, descr, thumb, bg in zip(titles, urls, descr, thumbs, bgs):
    descr = descr() if callable(descr) else descr
    thumb = thumb() if callable(thumb) else thumb
    bg = bg() if callable(bg) else bg
    li = ListItem(title, thumbnailImage=thumb)
    playable = plugin.route_for(url) == play
    li.setProperty('isplayable', str(playable))
    li.setProperty('fanart_image', bg)
    if playable:
      li.setInfo('video', {'title':title, 'plot':descr})
      li.addStreamInfo('video', {'codec':'h264', 'width':1280, 'height':720})
      li.addStreamInfo('audio', {'codec':'aac', 'channels':2})
    addDirectoryItem(plugin.handle, plugin.make_url(url), li, not playable, total)
  endOfDirectory(plugin.handle, updateListing=update_listing)
예제 #6
0
def next_item(total_pages):
	'''	returns True if current listing is next page
		else return False
	'''
	if not total_pages:
		return False

	from plugin import get_params
	params = get_params()
	if params:
		page = int(params.get('page', 1))
		if page < total_pages:
			params['page'] = page + 1
			url = make_url(params)

			addon_handle = int(sys.argv[1])
			li = xbmcgui.ListItem(u'[Далее]')
			xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
		return page > 1
	else:
		return False
예제 #7
0
def popular():
  addDirectoryItem(plugin.handle, plugin.make_url("/popular/Week"), ListItem("Siste uke"), True)
  addDirectoryItem(plugin.handle, plugin.make_url("/popular/Month"), ListItem("Siste måned"), True)
  endOfDirectory(plugin.handle)
def show_similar():
    import xbmc, xbmcgui

    import vsdbg
    vsdbg._bp()

    imdb_id = xbmc.getInfoLabel('ListItem.IMDBNumber')
    type = 'movie'

    from context import get_path_name
    path, name = get_path_name()

    FileNameAndPath = path.decode('utf-8')
    dbtype = xbmc.getInfoLabel('ListItem.DBTYPE')

    if dbtype == 'episode' or dbtype == 'tvshow':
        type = 'tv'

    if 'Anime' in path and not name:
        import filesystem
        if filesystem.exists('special://home/addons/plugin.video.shikimori.2'):
            import sys
            it = sys.listitem.getVideoInfoTag()

            try:
                import shikicore
                if shikicore.authorize_me():
                    oo = shikicore.animes_search(it.getOriginalTitle())
                    if oo:
                        #wname = xbmc.getInfoLabel('System.CurrentWindow')
                        wid = xbmcgui.getCurrentWindowId()

                        uri = 'plugin://plugin.video.shikimori.2/?action=similar&id={0}'.format(
                            oo[0]['id'])
                        if wid == 10025:
                            xbmc.executebuiltin(b'Container.Update(\"%s\")' %
                                                uri)
                        else:
                            xbmc.executebuiltin('ActivateWindow(10025,"%s")' %
                                                uri)
            except ImportError:
                pass

    if not imdb_id and dbtype == 'episode':
        from nforeader import NFOReader
        nfo_path = FileNameAndPath.replace('.strm', '.nfo')
        debug(nfo_path)
        rd = NFOReader(nfo_path, '')
        tvs_rd = rd.tvs_reader()
        imdb_id = tvs_rd.imdb_id()
        type = 'tv'

    if imdb_id:
        from movieapi import TMDB_API
        res = TMDB_API.tmdb_by_imdb(imdb_id, type)
        debug(res)
        if res and len(res) > 0:
            tmdb_id = res[0].tmdb_id()
            from plugin import make_url

            url = make_url({
                'action': 'show_similar',
                'tmdb': tmdb_id,
                'type': type
            })
            xbmc.executebuiltin('Container.Update("%s")' % url)
            return True

    return False