def seasons(arg):
    import data

    titles, urls, thumbs, bgs = data.parse_seasons(arg)
    if len(titles) == 1:
        plugin.redirect(plugin.url_for(urls[0]))
        return
    view(titles, urls, thumbs=thumbs, bgs=bgs)
Exemple #2
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)
Exemple #3
0
def seasons(arg):
  titles, urls = data.parse_seasons(arg)
  if len(titles) == 1:
    plugin.redirect(plugin.url_for(urls[0]))
    return
  view(titles, urls)