Ejemplo n.º 1
0
def getEpisodes(path):
  index = path.rfind('/')
  response = tools.getResponseUrl('http://ondemand.mtv.it' + path[:index] + '.rss')
  videos = re.compile('<item><title><!\[CDATA\[(.+?)]]></title><link>(.+?)</link><description><!\[CDATA\[(.+?)]]></description><guid>.+?</guid><pubDate>(.+?)</pubDate><enclosure length="0" type="image/jpeg" url="(.+?)"/></item>').findall(response)
  season = path[index:] + '/'
  for name, link, descr, pubDate, img in videos:
    if link.find(season) > -1:
      name = tools.normalizeText(name)
      iResEnd = img.rfind('.')
      iResStart = iResEnd - 3
      if img[iResStart:iResEnd] == '140':
        img = img[:iResStart] + '640' + img[iResEnd:]
      tools.addDir(handle, name, img, '', 'video', { 'title' : name, 'plot' : tools.normalizeText(descr), 'duration' : -1, 'director' : '' }, { 'action' : 'r', 'path' : link })
Ejemplo n.º 2
0

# Entry point.
#startTime = datetime.datetime.now()

handle = int(sys.argv[1])
params = tools.urlParametersToDict(sys.argv[2])
succeeded = True
idPlugin = 'plugin.mtvondemand'

if len(params) == 0: # Programmi.
  response = tools.getResponseUrl('http://ondemand.mtv.it/serie-tv')
  programs = re.compile('<h3 class="showpass"><a href="(.+?)"> <img class="lazy" height="105" width="140" src=".+?" data-original="(.+?)\?width=0&amp;amp;height=0&amp;amp;matte=true&amp;amp;matteColor=black&amp;amp;quality=0\.91" alt=".+?"/><p><strong>(.+?)</strong>(.+?)</p>').findall(response)
  for link, img, name, descr in programs:
    name = tools.normalizeText(name)
    tools.addDir(handle, name, img, '', 'video', { 'title' : name, 'plot' : tools.normalizeText(descr), 'duration' : -1, 'director' : '' }, { 'action' : 's', 'path' : link })
elif params['action'] == 's': # Stagioni.
  response = tools.getResponseUrl('http://ondemand.mtv.it' + params['path'])
  if response.find('<h2>Troppo tardi! <b>&#9787;</b></h2>') == -1:
    seasonsMenu = re.compile('<ul class="nav">(.+?)</ul>').findall(response)
    seasons = re.compile('href="(.+?)">(.+?)</a></li>').findall(seasonsMenu[0])
    if len(seasons) > 1:
      title = tools.normalizeText(re.compile('<h1 itemprop="name">(.+?)</h1>').findall(response)[0])
      for link, season in seasons:
        season = tools.normalizeText(season)
        tools.addDir(handle, season, '', '', 'video', { 'title' : season, 'plot' : season + ' di ' + title, 'duration' : -1, 'director' : '' }, { 'action' : 'p', 'path' : link })
    else:
      getEpisodes(seasons[0][0])
  else:
    succeeded = False
    xbmcgui.Dialog().ok('MTV on demand', tools.getTranslation(idPlugin, 30001))