Advertisement
Guest User

plugin.video.rtl2.now.1.7 Patch

a guest
Mar 30th, 2012
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.87 KB | None | 0 0
  1. --- a/default.py    2012-02-16 10:13:54.000000000 +0100
  2. +++ b/default.py    2012-03-30 20:08:40.000000000 +0200
  3. @@ -2,12 +2,14 @@
  4.  import xbmcgui
  5.  import sys
  6.  import urllib, urllib2
  7. +import time
  8.  import re
  9.  from htmlentitydefs import name2codepoint as n2cp
  10.  
  11.  thisPlugin = int(sys.argv[1])
  12.  
  13.  urlHost = "http://rtl2now.rtl2.de"
  14. +ajaxUrl = "/xajaxuri.php"
  15.  # -----regexContent-------
  16.  # [0] is url (/foo.php)
  17.  # [1] is name (foo is bar)
  18. @@ -21,9 +23,12 @@
  19.  # the free-content will be filtered in code (paytype)
  20.  
  21.  regexContent = '<div class="seriennavi_free" style=""><a href="(.*?)".*?>FREE.*?</div>.*?<div style="" class="seriennavi_link">.*?">(.*?)</a>.*?</div>'
  22. -regexSeries = '<div class="line (even|odd)"><div onclick="link\(\'(.*?)\'\); return false;".*?<a href=".*?" title=".*?">(.*?)</a>.*?class="time">(.*?)</div>.*?class="minibutton">(.*?)</a></div></div>'
  23. +regexSeries = '<div class="line (even|odd)"><div onclick="link\(\'(.*?)\'\); return false;".*?<a href=".*?" title=".*?">(.*?)</a>.*?class="time">(.*?</div>.*?)</div>.*?class="minibutton">(.*?)</a></div></div>'
  24.  regexVideoData = "data:'(.*?)'"
  25.  regexXML = '<filename><!\[CDATA\[(.*?)\]\]></filename>'
  26. +regexTextOnly = '<\s*\/?\s*\s*.*?>'
  27. +regexTabVars = '<select\s*?onchange.*?xajax_show_top_and_movies.*?\'(.*?)\'.*?\'(.*?)\'.*?\'(.*?)\'.*?\'(.*?)\'.*?\'(.*?)\'.*?>(.*?)</select>'
  28. +regexTabEntry = '<option.*?value=\'(\d)\'.*?>'
  29.  # ------------------------
  30.  
  31.  def showContent():
  32. @@ -41,18 +46,30 @@
  33.     global thisPlugin
  34.  
  35.     content = getUrl(urlS)
  36. +
  37. +   vars = re.compile(regexTabVars,re.DOTALL).search(content)
  38. +  
  39. +   if vars:
  40. +       tabVars = "&xajaxargs[]="+vars.group(1)+"&xajaxargs[]="+vars.group(2)+"&xajaxargs[]="+vars.group(3)+"&xajaxargs[]="+vars.group(4)+"&xajaxargs[]="+vars.group(5)+"&xajax=show_top_and_movies&xajaxr="+str(time.time()).replace('.','')
  41. +       tabentries = re.compile(regexTabEntry,re.DOTALL).findall(vars.group(6))
  42. +       content = ""
  43. +      
  44. +       for te in tabentries:
  45. +           ajcon = postUrl(urlHost+ajaxUrl,"xajaxargs[]="+te+tabVars);
  46. +           content += ajcon;
  47. +
  48.     match = re.compile(regexSeries,re.DOTALL).findall(content)
  49.     print match
  50.     for m in match:
  51.         print m
  52.         if "kostenlos" in m[4]:
  53.         ##xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=m[3]+" "+decode_htmlentities(m[2]), isFolder=False)
  54. -           addDirectoryItem(decode_htmlentities(m[2])+" - "+m[3], {"urlV": m[1]})
  55. +           addDirectoryItem(decode_htmlentities(m[2])+" - "+remHTML(m[3]), {"urlV": m[1], "vidN": m[2]})
  56.         ##print m[2]  
  57.     print "--- showSeries ok"  
  58.     xbmcplugin.endOfDirectory(thisPlugin)
  59.  
  60. -def showVideo(urlV):
  61. +def showVideo(urlV, vidN):
  62.     print "--- showVideo"
  63.     global thisPlugin
  64.     print "--- "+urlV
  65. @@ -81,7 +98,7 @@
  66.  
  67.     swfUrl = "http://rtl2now.rtl2.de/includes/vodplayer.swf"
  68.     pageUrl = "http://rtl2now.rtl2.de/p"
  69. -   item = xbmcgui.ListItem("SuperRTL")
  70. +   item = xbmcgui.ListItem(vidN)
  71.  
  72.     fullData=videoUrl+' swfVfy=1 playpath='+playpath+' app=rtl2now/_definst_ pageUrl='+pageUrl+'/ tcUrl='+videoUrl+' swfUrl='+swfUrl
  73.     print fullData
  74. @@ -90,6 +107,17 @@
  75.  
  76.  # ------ helper ------
  77.  
  78. +def remHTML(text):
  79. +   result = re.compile(regexTextOnly,re.DOTALL).sub('',text)
  80. +   return result
  81. +
  82. +def postUrl(url, values):
  83. +    req = urllib2.Request(url)
  84. +    response = urllib2.urlopen(req, values)
  85. +    link=response.read()
  86. +    response.close()
  87. +    return link
  88. +
  89.  def getUrl(url):
  90.      req = urllib2.Request(url)
  91.      response = urllib2.urlopen(req)
  92. @@ -138,6 +166,7 @@
  93.  params = parameters_string_to_dict(sys.argv[2])
  94.  urlSeries = str(params.get("urlS", ""))
  95.  urlVideo = str(params.get("urlV", ""))
  96. +vidName = str(params.get("vidN", ""))
  97.  
  98.  if not sys.argv[2]:
  99.     # new start
  100. @@ -150,6 +179,6 @@
  101.     if urlVideo:
  102.         newUrl = urlHost + decode_htmlentities(urllib.unquote(urlVideo))
  103.         print newUrl
  104. -       ok = showVideo(newUrl)
  105. +       ok = showVideo(newUrl, decode_htmlentities(urllib.unquote_plus(vidName)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement