Пример #1
0
def controller(handle, base_url, node, arg):
  if node == 'live':
    view_live(handle, base_url)
  
  elif node == 'recommended':
    titles, args, imgs = data.parse_recommended()
    view_dir(handle, base_url, repeat('play'), args, titles, imgs, imgs)
  
  elif node == 'mostrecent':
    titles, args, thumbs = data.parse_most_recent()
    view_dir(handle, base_url, repeat('play'), args, titles, thumbs)
  
  elif node == 'letters':
    common = ['0-9'] + map(chr, range(97, 123))
    titles = common + [ u'æ', u'ø', u'å' ]
    titles = [ e.upper() for e in titles ]
    args = common + [ 'ae', 'oe', 'aa' ]
    view_dir(handle, base_url, repeat('letter'), args, titles)
  
  elif node == 'letter':
    titles, args = data.parse_by_letter(arg)
    nodes = ( 'seasons' if arg.startswith('/serie') else 'play' for arg in args )
    view_dir(handle, base_url, nodes, args, titles)
  
  elif node == 'seasons':
    titles, args = data.parse_seasons(arg)
    nodes = repeat('episodes')
    if len(titles) == 1:
      titles, args = data.parse_episodes(args[0])
      nodes = repeat('play')
    view_dir(handle, base_url, nodes, args, titles)
  
  elif node == 'episodes':
    titles, args = data.parse_episodes(arg)
    view_dir(handle, base_url, repeat('play'), args, titles)
  
  elif node == 'play':
    info = data.parse_media_url(arg, BITRATE)
    li = ListItem(label=info['title'],path=info['url'])
    li.setIconImage(info['icon'])
    li.setThumbnailImage(info['thumbnail'])
    li.setInfo('video',info['info'])
    player = xbmc.Player();
    xbmcplugin.setResolvedUrl(handle, True, li)
    if ENABLE_SUBS and info.has_key('subtitle'):
      subtitle = subs.getSubtitles(info['subtitle'])
      # Waiting for stream to start
      start_time = time.time()
      while not player.isPlaying() and time.time() - start_time < 10:
          time.sleep(1.)
    
      player.setSubtitles(subtitle)
        
  
  else:
    view_top(handle, base_url)
Пример #2
0
def play(video_id, series_id=""):
  url = data.parse_media_url(video_id, BITRATE)
  xbmcplugin.setResolvedUrl(plugin.handle, True, ListItem(path=url))
  player = xbmc.Player()
  subtitle = subs.get_subtitles(video_id)
  #Wait for stream to start
  start_time = time.time()
  while not player.isPlaying() and time.time() - start_time < 10:
    time.sleep(1.)
    player.setSubtitles(subtitle)
    if not SHOW_SUBS:
      player.showSubtitles(False)
Пример #3
0
def play(video_id):
	url = data.parse_media_url(video_id)
	xbmcplugin.setResolvedUrl(plugin.handle, True, xbmcgui.ListItem(path=url))