예제 #1
0
def getEpisodes(id, url):
 link = tools.gethtmlpage(url, "ps3")
 if link:
  node = tools.getxmldocument(link)
  if node:
   for ep in node.getElementsByTagName('Episode'):
    addEpisode(ep)
   for ep in node.getElementsByTagName('Extra'):
    addEpisode(ep)
예제 #2
0
def SHOW_EPISODES(id):
 getEpisodes(id, "%s/content/%s/ps3_xml_skin.xml" % (BASE_URL, id))
 link = tools.gethtmlpage("%s/content/%s_extras_group/ps3_xml_skin.xml" % (BASE_URL, id[:-15]), "ps3")
 if link:
  node = tools.getxmldocument(link)
  if node:
   info = tools.defaultinfo(1)
   info["FileName"] = "%s?ch=TVNZ&type=shows&id=%s_extras_group" % (sys.argv[0], id[:-15])
   info["Title"] = "Extras"
   tools.addlistitem(int(sys.argv[1]), info, FANART_URL, 1)
 return
예제 #3
0
def SHOW_DISTRIBUTORS(id):
 link = tools.gethtmlpage("%s/content/%s/ps3_xml_skin.xml" % (BASE_URL, id), "ps3")
 if link:
  node = tools.getxmldocument(link)
  if node:
   print node.toxml().encode('latin1')
   urls = list()
   for distributor in node.getElementsByTagName('Distributor'):
    url,liz = getShow(distributor)
    if not urls.count(url):
     xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=url, listitem=liz, isFolder=True )
     urls.append(url)
예제 #4
0
def getAdvert(chapter):
 advert = chapter.getElementsByTagName('ref')
 if len(advert):
  # fetch the link - it'll return a .asf file
  link = tools.gethtmlpage(advert[0].attributes['src'].value, "ps3")
  if link:
   node = tools.getxmldocument(link)
   if node:
    # grab out the URL to the actual flash ad
    for flv in node.getElementsByTagName('FLV'):
     if flv.firstChild and len(flv.firstChild.wholeText):
      return(flv.firstChild.wholeText)
예제 #5
0
def RESOLVE(id, info):
 link = tools.gethtmlpage("%s/content/%s/ta_ent_smil_skin.smil?platform=PS3" % (BASE_URL, id), "ps3")
 if link:
  node = tools.getxmldocument(link)
  if node:
   urls=list()
   for chapter in node.getElementsByTagName('seq'):
    # grab out the advert link
    if addon.getSetting('TVNZ_showads') == 'true':
     ad = getAdvert(chapter)
     if len(ad) > 0:
      urls.append(ad)
    maxbitrate = 0
    minbitrate = 9999999999
    for video in chapter.getElementsByTagName('video'):
     bitrate = int(video.attributes["systemBitrate"].value)
     if bitrate > maxbitrate:
      maxbitrate = bitrate
     if bitrate < minbitrate:
      minbitrate = bitrate
    requiredbitrate = 700000 #Medium = 700000
    if addon.getSetting('TVNZ_quality') == "High": #High = 1500000
     requiredbitrate = maxbitrate
    elif addon.getSetting('TVNZ_quality') == "Low": #Low = 300000
     requiredbitrate = minbitrate
    for video in chapter.getElementsByTagName('video'):
     bitrate = int(video.attributes["systemBitrate"].value)
     if bitrate == requiredbitrate:
      url = video.attributes["src"].value
      if url[:7] == 'http://':
       # easy case - we have an http URL
       urls.append(url)
       sys.stderr.write("HTTP URL: " + url)
      elif url[:5] == 'rtmp:':
       # rtmp case
       rtmp_url = "rtmpe://fms-streaming.tvnz.co.nz/tvnz.co.nz"
       playpath = " playpath=" + url[5:]
       flashversion = " flashVer=MAC%2010,0,32,18"
       swfverify = " swfurl=http://tvnz.co.nz/stylesheets/tvnz/entertainment/flash/ondemand/player.swf swfvfy=true"
       conn = " conn=S:-720"
       urls.append(rtmp_url + playpath + flashversion + swfverify + conn)
       sys.stderr.write("RTMP URL: " + rtmp_url + playpath + flashversion + swfverify + conn)
   if len(urls) == 0:
    sys.stderr.write("No playback URLs found!")
    return
  
   if len(urls) == 1:
    uri = urls[0]
   elif len(urls) > 1:
    uri = tools.constructStackURL(urls)
   tools.addlistitem(int(sys.argv[1]), info, FANART_URL, 0, 1, uri)
예제 #6
0
def INDEX():
 link = tools.gethtmlpage("%s/content/ps3_navigation/ps3_xml_skin.xml" % (BASE_URL), "ps3")
 if link:
  count = 0
  node = tools.getxmldocument(link)
  if node:
   for stat in node.getElementsByTagName('MenuItem'):
    type = stat.attributes["type"].value
    if type in ('shows', 'alphabetical'): #, 'distributor'
     m = re.search('/([0-9]+)/',stat.attributes["href"].value)
     if m:
      info = tools.defaultinfo(1)
      info["Title"] = stat.attributes["title"].value
      info["Count"] = count
      count += 1
      info["FileName"] = "%s?ch=TVNZ&type=%s&id=%s" % (sys.argv[0], type, m.group(1))
      tools.addlistitem(int(sys.argv[1]), info, FANART_URL, 1)
예제 #7
0
def SHOW_LIST(id):
 link = tools.gethtmlpage("%s/content/%s/ps3_xml_skin.xml" % (BASE_URL, id), "ps3")
 node = tools.getxmldocument(link)
 if node:
  urls = list()
  count = 0
  infoitems = {}
  for show in node.getElementsByTagName('Show'):
   se = re.search('/content/(.*)_(episodes|extras)_group/ps3_xml_skin.xml', show.attributes["href"].value)
   if se:
    if se.group(2) == "episodes":
     #videos = int(show.attributes["videos"].value)
     #channel = show.attributes["channel"].value
     info = tools.defaultinfo(1)
     info["FileName"] = "%s?ch=TVNZ&type=singleshow&id=%s_episodes_group" % (sys.argv[0], se.group(1))
     info["Title"] = show.attributes["title"].value
     info["Count"] = count
     count += 1
     infoitems[info["Title"]] = info
  tools.addlistitems(int(sys.argv[1]), infoitems, FANART_URL, 1)