Example #1
0
def add_item_atoz(soup, provider, count): #Scrape items from an AtoZ-style HTML page
 baseurl = base_url(provider)
 info = tools.defaultinfo()
 info["Studio"] = provider
 if soup.find('h5'):
  link = soup.h5.find("a", attrs={"href": re.compile(baseurl)})
  if link:
   infoitems = {}
   href = re.match("%s/(.*?)/%s/([0-9]+)/%s/([0-9]+)/%s/([0-9]+)/" % (baseurl, tv3_urls["VIDEO1"], tv3_urls["VIDEO2"], tv3_urls["VIDEO3"]), link['href'])
   if href:
    if link.string:
     title = link.string.strip()
     if title <> "":
      info["TVShowTitle"] = title
      image = soup.find("img", attrs={"src": re.compile(tv3_urls["IMG_RE2"]), "title": True})
      if image:
       info.update(tools.imageinfo(image))
      info.update(seasonepisode(soup.contents[4]))
      info["Title"] = tools.itemtitle(info["TVShowTitle"], info["PlotOutline"])
      plot = soup.find("span", attrs={"class": "lite"})
      if plot.string:
       cleanedplot = plot.string.strip()
       if cleanedplot:
        info["Plot"] = tools.unescape(cleanedplot)
      info["Count"] = count
      info["FileName"] = "%s?ch=TV3&id=%s&info=%s" % (sys.argv[0], "%s,%s,%s,%s" % (href.group(1), href.group(2), href.group(3), href.group(4)), urllib.quote(str(info)))
      infoitems[info["Title"]] = info
      #tools.addlistitem(int(sys.argv[1]), info, tv3_urls["Fanart"], 0)
   tools.addlistitems(infoitems, tv3_urls["Fanart"], 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)