当前位置: 首页>>代码示例>>Python>>正文


Python tools.xbmcItem函数代码示例

本文整理汇总了Python中resources.tools.xbmcItem函数的典型用法代码示例。如果您正苦于以下问题:Python xbmcItem函数的具体用法?Python xbmcItem怎么用?Python xbmcItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xbmcItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: index

 def index(self, filter = "/explore/"):
  filterarray = filter.strip('/').split('/')
  filterlevel = len(filterarray)
  if filterlevel == 4 and filterarray[2] == 'az':
   filterlevel += 1
  url = self.urls['base'] + filter
  page = webpage(url, agent='chrome', cookie='nzos_html5=true')
  if page.doc:
   #resources.tools.gethtmlpage("http://www.nzonscreen.com/html5/opt_in", "chrome", 1) # Get a cookie for this session to enable the HTML5 video tag
   div_tag = SoupStrainer('div')
   html_divtag = BeautifulSoup(page.doc, parseOnlyThese = div_tag)
   sections = html_divtag.find(attrs={'id' : 'explore_filter_%s' % str(filterlevel)})
   if not sections:
    sections = html_divtag.find(attrs={'id' : 'explore_listview'})
   if sections:
    links = sections.findAll('a')
    if len(links) > 0:
     for link in links:
      item = tools.xbmcItem(self.channel)
      info = item['videoInfo']
      info["FileName"] = "%s?ch=%s&filter=%s" % (self.base, self.channel, urllib.quote(link["href"]))
      if link.string:
       info["Title"] = link.string.strip()
      else:
       filterarray = link["href"].split('/')
       info["Title"] = filterarray[len(filterarray) - 1].capitalize()
      self.xbmcitems.items.append(item)
     if filterlevel == 1:
      item = tools.xbmcItem(self.channel)
      info = item['videoInfo']
      info["FileName"] = "%s?ch=%s&filter=search" % (self.base, self.channel)
      info["Title"] = "Search"
      self.xbmcitems.items.append(item)
    else:
     nav = html_divtag.find(attrs={'class' : 'nav_pagination'})
     if nav:
      pages = nav.findAll('a')
      if pages:
       for page in pages:
        if page.string:
         lastpage = page.string.strip()
       for i in range(1, int(lastpage)):
        item = tools.xbmcItem(self.channel)
        info = item['videoInfo']
        info["FileName"] = "%s?ch=%s&filter=%s&page=%s" % (self.base, self.channel, urllib.quote(filter), str(i))
        info["Title"] = 'Page %s' % str(i)
        self.xbmcitems.items.append(item)
    return self.xbmcitems.addall()
   else:
    sys.stderr.write("index: No sections")
  else:
   sys.stderr.write("index: No page.doc")
开发者ID:Beirdo,项目名称:plugin.video.nz.ondemand,代码行数:52,代码来源:nzonscreen.py

示例2: index

 def index(self):
  item = tools.xbmcItem(self.channel)
  info = item['videoInfo']
  info["Title"] = "Channels"
  info["FileName"] = "%s?ch=Ziln&folder=channels" % sys.argv[0]
  self.xbmcitems.items.append(item)
  item = tools.xbmcItem(self.channel)
  info = item['videoInfo']
  info["Title"] = "Search"
  info["Thumb"] = "DefaultVideoPlaylists.png"
  info["FileName"] = "%s?ch=Ziln&folder=search" % sys.argv[0]
  self.xbmcitems.items.append(item)
  return self.xbmcitems.addall()
开发者ID:Beirdo,项目名称:plugin.video.nz.ondemand,代码行数:13,代码来源:ziln.py

示例3: index

 def index(self):
  item = tools.xbmcItem()
  info = item.info
  info["Title"] = config.__language__(30053)
  info["Count"] = 1
  info["FileName"] = "%s?ch=Ziln&folder=channels" % sys.argv[0]
  self.xbmcitems.items.append(item)
  item = tools.xbmcItem()
  info = item.info
  info["Title"] = config.__language__(30065)
  info["Count"] = 2
  info["Thumb"] = "DefaultVideoPlaylists.png"
  info["FileName"] = "%s?ch=Ziln&folder=search" % sys.argv[0]
  self.xbmcitems.items.append(item)
  self.xbmcitems.addall()
开发者ID:Jonherries,项目名称:plugin.video.nz.ondemand,代码行数:15,代码来源:ziln.py

示例4: channelindex

 def channelindex(self, channel): #Create second level folder for the hierarchy view, only showing items for the selected top level folder
  for category in self.urls['categories']:
   item = tools.xbmcItem(channel, self.channel)
   item['videoInfo']["Title"] = category
   item['videoInfo']["FileName"] = "%s?ch=TV3&channel=%s&cat=%s" % (self.base, channel, category.replace(" ", ""))
   self.xbmcitems.items.append(item)
  item = tools.xbmcItem(channel, self.channel)
  item['videoInfo']["Title"] = 'Shows'
  item['videoInfo']["FileName"] = "%s?ch=TV3&channel=%s&cat=%s" % (self.base, channel, "shows")
  self.xbmcitems.items.append(item)
  item = tools.xbmcItem(channel, self.channel)
  item['videoInfo']["Title"] = "Search"
  item['videoInfo']["FileName"] = "%s?ch=TV3&channel=%s&cat=%s" % (self.base, channel, "search")
  self.xbmcitems.items.append(item)
  return self.xbmcitems.addall()
开发者ID:Beirdo,项目名称:plugin.video.nz.ondemand,代码行数:15,代码来源:tv3.py

示例5: channelindex

 def channelindex(self, channel): #Create second level folder for the hierarchy view, only showing items for the selected top level folder
  for category in self.urls['categories']:
   item = tools.xbmcItem()
   item.info["Title"] = category
   item.info["FileName"] = "%s?ch=TV3&channel=%s&cat=%s" % (self.base, channel, category.replace(" ", ""))
   self.xbmcitems.items.append(item)
  item = tools.xbmcItem()
  item.info["Title"] = language(30055)
  item.info["FileName"] = "%s?ch=TV3&channel=%s&cat=%s" % (self.base, channel, "shows")
  self.xbmcitems.items.append(item)
  item = tools.xbmcItem()
  item.info["Title"] = language(30065)
  item.info["FileName"] = "%s?ch=TV3&channel=%s&cat=%s" % (self.base, channel, "search")
  self.xbmcitems.items.append(item)
  self.xbmcitems.addall()
开发者ID:Jonherries,项目名称:plugin.video.nz.ondemand,代码行数:15,代码来源:tv3.py

示例6: programmes

 def programmes(self, type, urlext):
  if type == "channel":
   folder = 1
   url = self.urls['base']
  elif type == "video":
   folder = 0
   url = "%s/assets/php/slider.php?channel=%s" % (self.urls['base'], urlext)
  elif type == "search":
   folder = 0
   url = "%s/search?search_keyword=%s" % (self.urls['base'], urlext.replace(" ", "+"))
  page = webpage(url)
  if page.doc:
   if type == "channel" or type == "search":
    div_tag = SoupStrainer('div')
    html_divtag = BeautifulSoup(page.doc, parseOnlyThese = div_tag)
    programmes = html_divtag.findAll(attrs={'class' : 'programmes'})
   elif type == "video":
    div_tag = SoupStrainer('body')
    html_divtag = BeautifulSoup(page.doc, parseOnlyThese = div_tag)
    programmes = html_divtag.findAll(attrs={'class' : 'slider slider-small'})
   if type == "search":
    type = "video"
   if len(programmes) > 0:
    for program in programmes:
     list = program.find('ul')
     if list:
      listitems = list.findAll('li')
      count = len(listitems)
      if count > 0:
       for listitem in listitems:
        link = listitem.find('a', attrs={'href' : re.compile("^/%s/" % type)})
        if link.img:
         if re.search("assets/images/%ss/" % type, link.img["src"]):
          #item = tools.xbmcItem()
          item = tools.xbmcItem()
          if listitem.p.string:
           item.info["Title"] = listitem.p.string.strip()
          else:
           item.info["Title"] = link.img["alt"]
          item.info["Thumb"] = "%s/%s" % (self.urls['base'], link.img["src"])
          index = re.search("assets/images/%ss/([0-9]*?)-mini.jpg" % type, link.img["src"]).group(1)
          item.info["FileName"] = "%s?ch=%s&%s=%s" % (self.base, self.channel, type, urllib.quote(index))
          if type == "video":
           if self.prefetch:
            item.info["FileName"] = self._geturl(index)
           else:
            item.playable = True
          self.xbmcitems.items.append(item)
          if self.prefetch:
           self.xbmcitems.add(count)
       if self.prefetch:
        self.xbmcitems.sort()
       else:
        self.xbmcitems.addall()
     else:
      sys.stderr.write("Search returned no results")
   else:
    sys.stderr.write("Couldn't find any programs")
  else:
   sys.stderr.write("Couldn't get page")
开发者ID:Jonherries,项目名称:plugin.video.nz.ondemand,代码行数:60,代码来源:ziln.py

示例7: search

 def search(self, query):
  import urllib
  qid = urllib.quote_plus(query)
  qs = "&requiredfields=type:programme.site:tv&partialfields=programme-title:%s&fq=programme-title:%s&fq=type:programme&fq=site:tv&num=999" % (qid, qid)
  url = "%s/%s/%s?q=%s%s" % (self.urls['base'], self.urls['search'], self.urls['searchpage'], qid, qs)
  page = webpage(url)
  soup = BeautifulSoup(page.doc)
  if soup:
   for show in soup.findAll('ul', attrs={'class' : 'showDetailsMain'}):
    channel = show.find('li', attrs={'class' : "channel"}).contents[0].strip()
    item = tools.xbmcItem(channel, self.channel)
    info = item['videoInfo']
    urlIn = show.a['href']
    if not urlIn.startswith('http://'):
     urlIn = self.urls['base'] + urlIn
    info['urlIn'] = urlIn
    m = re.match(r'^.*?-(\d+)', urlIn)
    if not m:
     continue
    id = m.group(1)
    info["Title"] = show.a.contents[0].strip()
    info["Date"] = show.find('li', attrs={'class' : 'date'}).contents[0].strip()
    info["TVShowTitle"] = info["Title"]
    info["Plot"] = show.find('li', attrs={'class' : 'details'}).contents[0].strip()
    info["FileName"] = "%s?ch=%s&id=%s&type=shows" % (self.base, self.channel, id)
    self.xbmcitems.items.append(item)
  return self.xbmcitems.addall()
开发者ID:Beirdo,项目名称:plugin.video.nz.ondemand,代码行数:27,代码来源:tvnz.py

示例8: play

 def play(self, id, channel, encodedinfo):
  item = tools.xbmcItem()
  item.infodecode(encodedinfo)
  item.fanart = self.xbmcitems.fanart
  item.urls = self._geturls(id, channel)
  if item.urls:
   self.xbmcitems.resolve(item, self.channel)
开发者ID:j0ton,项目名称:plugin.video.nz.ondemand,代码行数:7,代码来源:tv3.py

示例9: index

 def index(self, type = 'showall', id = ""):
  page = webpage('/'.join([self.urls['base'], self.urls['media'], type, id]))
  if page.doc:
   div_tag = SoupStrainer('div')
   html_divtag = BeautifulSoup(page.doc, parseOnlyThese = div_tag)
   programmes = html_divtag.findAll(attrs={'class' : 'col gu1 video'})
   if len(programmes) > 0:
    for program in programmes:
     item = tools.xbmcItem()
     link = re.search("/media/([a-z]+)/([0-9]+)", program.p.a['href'])
     if link:
      item.info["Title"] = program.p.span.string
      item.info["Thumb"] = "%s%s" % (self.urls['base'], program.p.a.img['src'])
      if link.group(1) == "view":
       item.info["Title"] += ' ' + program.p.span.next.next.next.next.next.string.strip()[6:].strip()
       if self.prefetch:
        item.info["FileName"] = self._geturl(link.group(2))
       else:
        item.playable = True
        item.info["FileName"] = "%s?ch=%s&view=%s&info=%s" % (self.base, self.channel, link.group(2), item.infoencode())
      else:
       item.info["FileName"] = "%s?ch=%s&type=%s&id=%s" % (self.base, self.channel, link.group(1), link.group(2))
      self.xbmcitems.items.append(item)
    return self.xbmcitems.addall()
   else:
    sys.stderr.write("index: no programmes")
  else:
   sys.stderr.write("index: no page.doc")
开发者ID:Beirdo,项目名称:plugin.video.nz.ondemand,代码行数:28,代码来源:choicetv.py

示例10: index

 def index(self, fake = True):
  for folder in self.channels.keys():
   item = tools.xbmcItem(folder, self.channel)
   item['videoInfo']["Title"] = folder
   item['videoInfo']["FileName"] = "%s?ch=TV3&channel=%s" % (self.base, folder)
   self.xbmcitems.items.append(item)
  return self.xbmcitems.addall()
开发者ID:Beirdo,项目名称:plugin.video.nz.ondemand,代码行数:7,代码来源:tv3.py

示例11: play

 def play(self, id, channel, encodedinfo):
  item = tools.xbmcItem(channel, self.channel)
  item.infodecode(encodedinfo)
  item['fanart'] = self.xbmcitems.fanart
  item['urls'] = self._geturls(id, channel)
  if item['urls']:
   return self.xbmcitems.resolve(item, self.channel)
开发者ID:Beirdo,项目名称:plugin.video.nz.ondemand,代码行数:7,代码来源:tv3.py

示例12: folderindex

 def folderindex(self, folder): #Create second level folder for the hierarchy view, only showing items for the selected top level folder
  infopages = list()
  infopages.append(("63", config.__language__(30052), "tv3", config.__language__(30056))) # Latest
  infopages.append(("61", config.__language__(30052), "tv3", config.__language__(30057))) # Most Watched
  infopages.append(("64", config.__language__(30052), "tv3", config.__language__(30058))) # Expiring soon
  #infopages.append(("70", config.__language__(30052), "atoz", "A - Z")) # Now empty
  infopages.append(("71", config.__language__(30053), "tv3", "TV3"))
  infopages.append(("72", config.__language__(30053), "four", "FOUR"))
  infopages.append(("65", config.__language__(30054), "tv3", config.__language__(30059))) # Comedy
  infopages.append(("66", config.__language__(30054), "tv3", config.__language__(30060))) # Drama
  infopages.append(("67", config.__language__(30054), "tv3", config.__language__(30061))) # News/Current affairs
  infopages.append(("68", config.__language__(30054), "tv3", config.__language__(30062))) # Reality
  infopages.append(("82", config.__language__(30054), "tv3", config.__language__(30063))) # Sports
  infopages.append(("80", config.__language__(30052), "tv3", config.__language__(30064))) # All
  #infopages.append(("74", "RSS", "tv3", "RSS Feeds"))
  #infopages.append(("81", "Categories", "tv3", "FOUR Highlights"))
  #infopages.append(("73", "Categories", "tv3", "All (Small)"))
  for page in infopages:
   if page[1] == folder:
    item = tools.xbmcItem()
    item.info["Title"] = page[3]
    item.info["FileName"] = "%s?ch=TV3&cat=%s&catid=%s" % (self.base, page[2], page[0])
    self.xbmcitems.items.append(item)
  if folder == "Shows":
   self.shows("tv3")
  elif folder == "Search":
   self.search()
  self.xbmcitems.addall()
开发者ID:YimSopheak,项目名称:knalynn,代码行数:28,代码来源:tv3.py

示例13: showsindex

 def showsindex(provider): #Create a second level list of TV Shows from a TV3 webpage
  #doc = resources.tools.gethtmlpage("%s/Shows/tabid/64/Default.aspx" % ("http://www.tv3.co.nz")) #Get our HTML page with a list of video categories
  #doc = resources.tools.gethtmlpage("%s/Shows.aspx" % ("http://www.tv3.co.nz")) #Get our HTML page with a list of video categories
  page = webpage("%s/Shows.aspx" % ("http://www.tv3.co.nz"))
  if page.doc:
   html_divtag = BeautifulSoup(page.doc)
   linksdiv = html_divtag.find('div', attrs = {"id": "pw_8171"})
   if linksdiv:
    links = linksdiv.findAll('a')
    if len(links) > 0:
     count = 0
     for link in links:
      item = tools.xbmcItem()
      item.info["Title"] = link.string.strip()
      catid = link['href']
      if item.info["Title"] == "60 Minutes": #The URL on the next line has more videos
       item.info["FileName"] = "%s?ch=TV3&cat=%s&title=%s&catid=%s" % (self.base, "shows", urllib.quote(item.info["Title"]), urllib.quote(catid)) #"http://ondemand.tv3.co.nz/Default.aspx?TabId=80&cat=22"
      else:
       item.info["FileName"] = "%s?ch=TV3&cat=%s&title=%s&catid=%s" % (self.base, "shows", urllib.quote(item.info["Title"]), urllib.quote(catid))
      self.xbmcitems.items.append(item)
     self.xbmcitems.addall()
    else:
     sys.stderr.write("showsindex: Couldn't find any videos in list")
   else:
    sys.stderr.write("showsindex: Couldn't find video list")
  else:
   sys.stderr.write("showsindex: Couldn't get index webpage")
开发者ID:YimSopheak,项目名称:knalynn,代码行数:27,代码来源:tv3.py

示例14: show

 def show(self, id, search = False):
  if search:
   import urllib
   url = "%s/%s/%s?q=%s" % (self.urls['base'], self.urls['search'], self.urls['page'], urllib.quote_plus(id))
  else:
   url = self.url(id)
  page = webpage(url)
  xml = self._xml(page.doc)
  if xml:
   for show in xml.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) # Number of Extras
	  #episodes = int(show.attributes["episodes"].value) # Number of Episodes
      #channel = show.attributes["channel"].value
      item = tools.xbmcItem()
      info = item.info
      info["FileName"] = "%s?ch=%s&type=singleshow&id=%s%s" % (self.base, self.channel, se.group(1), self.urls['episodes'])
      info["Title"] = show.attributes["title"].value
      info["TVShowTitle"] = info["Title"]
      #epinfo = self.firstepisode(se.group(1))
      #if epinfo:
      # info = dict(epinfo.items() + info.items())
      self.xbmcitems.items.append(item)
  #self.xbmcitems.type = "tvshows"
  self.xbmcitems.addall()
开发者ID:j0ton,项目名称:plugin.video.nz.ondemand,代码行数:27,代码来源:tvnz.py

示例15: play

 def play(self, index, channelNum):
  channel = channelMap.get(int(channelNum), "Ziln")
  item = tools.xbmcItem(channel, self.channel)
  item['playable'] = True
  item['videoInfo'].update(self._getMetadata(index))
  item['urls'] = item['videoInfo'].pop('urls')
  return self.xbmcitems.resolve(item, self.channel)
开发者ID:Beirdo,项目名称:plugin.video.nz.ondemand,代码行数:7,代码来源:ziln.py


注:本文中的resources.tools.xbmcItem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。