Advertisement
Guest User

fptvfix

a guest
Oct 29th, 2011
1,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 40.16 KB | None | 0 0
  1. import urllib,urllib2,re,sys,xbmcplugin,xbmcgui
  2. import cookielib,os,string,cookielib,StringIO
  3. import os,time,base64,logging
  4. import xbmcaddon
  5.  
  6. fpt=xbmcaddon.Addon(id='plugin.video.fpt')
  7. pluginhandle = int(sys.argv[1])
  8.  
  9. def login():
  10.     urlogin = 'http://www.fastpasstv.eu/register'
  11.     cookiejar = cookielib.LWPCookieJar()
  12.     cookiejar = urllib2.HTTPCookieProcessor(cookiejar)
  13.     opener = urllib2.build_opener(cookiejar)
  14.     urllib2.install_opener(opener)
  15.     values = {'login': uname,'password': pwd}
  16.     user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  17.     headers = { 'User-Agent' : user_agent }
  18.     data = urllib.urlencode(values)
  19.     req = urllib2.Request(urlogin, data, headers)
  20.     response = urllib2.urlopen(req)
  21.  
  22. def geturl(url):
  23.         req = urllib2.Request(url)
  24.         req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
  25.         response = urllib2.urlopen(req)
  26.         link=response.read()
  27.         return link
  28.  
  29. def redirect(url):
  30.         req = urllib2.Request(url)
  31.         req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
  32.         response = urllib2.urlopen(req)
  33.         gurl=response.geturl()
  34.         return gurl
  35.  
  36. def xbmcpath(path,filename):
  37.      translatedpath = os.path.join(xbmc.translatePath( path ), ''+filename+'')
  38.      return translatedpath
  39.  
  40. def openfile(filename):
  41.      fh = open(filename, 'r')
  42.      contents=fh.read()
  43.      fh.close()
  44.      return contents
  45.  
  46. def save(filename,contents):  
  47.      fh = open(filename, 'w')
  48.      fh.write(contents)  
  49.      fh.close()
  50.  
  51. fptpath = 'special://temp/'
  52. translatedfptpath = xbmcpath(fptpath,'')
  53. referer = xbmcpath(fptpath,'ref.txt')
  54.  
  55. def CATS():
  56.         addDir('Most Popular TV Shows Today','http://www.fastpasstv.ms/',14,'')
  57.         addDir('Most Popular Movies Today','http://www.fastpasstv.ms/',5,'')
  58.         addDir('Latest Added TV Shows','http://www.fastpasstv.ms/tv/',4,'')
  59.         addDir('Latest Added Movies','http://www.fastpasstv.ms/movies',20,'')
  60.         addDir('Latest Added Documentaries','http://www.fastpasstv.ms/documentaries',22,'')
  61.         addDir('All TV Shows','http://www.fastpasstv.ms/tv',2,'')
  62.     addDir('All Movies','http://www.fastpasstv.ms/movies',1,'')
  63.     addDir('All Documentaries','http://www.fastpasstv.ms/documentaries',1,'')
  64.     addDir('Search','http://www.fastpasstv.ms/',9,'')
  65.  
  66. def NEWEP(url,name):
  67.         link= geturl(url)
  68.         tvs=re.compile('<li><a href="/tv/(.+?)">(.+?)</a></li>').findall(link)
  69.     for url2,name in tvs:
  70.         addDir(name,'http://www.fastpasstv.ms/tv/'+url2,18,'')
  71.  
  72. def MOVALL(url,name):
  73.         link= geturl(url)
  74.         mvs=re.compile('<li.+?><a href="(.+?)">(.+?)<span class="epnum">.+?</span></a></li>').findall(link)
  75.     for url,name in mvs:
  76.         addDir(name.replace('<font class="newvid">New Episodes!</font>','(NEW EPISODE)').replace('<font class="newvid">New!</font>','(NEW)'),'http://www.fastpasstv.ms'+url,18,'')
  77.  
  78. def MOVLAT(url,name):
  79.         link= geturl(url)
  80.     all = re.compile('<b>Latest additions</b>.+?<ul class="pagination">', re.DOTALL).findall(link)
  81.         mv = re.compile('<a href="(.+?)">(.+?)</a>').findall(all[0])
  82.     for url,name in mv:
  83.         addDir(name.replace('&amp;','&'),'http://www.fastpasstv.ms'+url,18,'')
  84.  
  85. def DOCLAT(url,name):
  86.         link= geturl(url)
  87.     all = re.compile('<b>Latest additions</b>.+?<ul class="pagination">', re.DOTALL).findall(link)
  88.         doc = re.compile('<a href="(.+?)">(.+?)</a>').findall(all[0])
  89.     for url,name in doc:
  90.         addDir(name.replace('&amp;','&'),'http://www.fastpasstv.ms'+url,18,'')
  91.  
  92. def X2(url,name):
  93.         link= geturl(url)
  94.         list=re.compile('<li><a href="(.+?)">(.+?)<span class="epnum">.+?</span></a></li>').findall(link)
  95.     for url,name in list:
  96.         addDir(name.replace('<font class="newvid">New Episodes!</font>','(NEW EPISODE)'),'http://www.fastpasstv.ms'+url,21,'')
  97.  
  98. def Y1(url,name):
  99.         link= geturl(url)
  100.     all = re.compile('<b>Latest additions</b>:.+?<ul class="pagination">', re.DOTALL).findall(link)
  101.         tvs=re.compile('<a href="(.+?)">(.+?)</a>').findall(all[0])
  102.     for url,name in tvs:
  103.         addDir(name.replace('&amp;','&'),'http://www.fastpasstv.ms'+url,18,'')
  104.  
  105. def Y2(url,name):
  106.         link= geturl(url)
  107.         mvs=re.compile('<li><a href="/movies/(.+?)">(.+?)</a></li>').findall(link)
  108.     for url2,name in mvs:
  109.         addDir(name,'http://www.fastpasstv.ms/movies/'+url2,18,'')
  110.  
  111. def Y3(url,name):
  112.         link= geturl(url)
  113.         tvs=re.compile('<li class="episode"><a href="/tv/(.+?)">(.+?)</a></li>').findall(link)
  114.     for url2,name in tvs:
  115.         addDir(name,'http://www.fastpasstv.ms/tv/'+url2,18,'')
  116.  
  117. def Y3MOV(url,name):
  118.     i=0
  119.         req = urllib2.Request(url)
  120.         req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:10.0a1) Gecko/20111029 Firefox/10.0a1')
  121.         response2 = urllib2.urlopen(req)
  122.         ref=response2.geturl()
  123.     save(referer,ref)
  124.         link=response2.read()
  125.     nova=re.compile('<b>Nova.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  126.     mega=re.compile('<b>Megavideo</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  127.         woot=re.compile('<b>Wootly</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  128.         fv2=re.compile('<b>VidX.+?FLV.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  129.         dv=re.compile('<b>VidX.+?DivX.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">Watch This Video!').findall(link)
  130.         dv1=re.compile('<b>VidX.+?DivX.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">1</a>&nbsp;<a href=".+?"').findall(link)
  131.         dv2=re.compile('<b>VidX.+?DivX.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href=".+?" target="_blank">1</a>&nbsp;<a href="(.+?)"').findall(link)
  132.         vidbx=re.compile('<b>VidBux.+?DivX.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">Watch This Video!').findall(link)
  133.         vidbx1=re.compile('<b>VidBux.+?DivX.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">1</a>&nbsp;<a href=".+?"').findall(link)
  134.         vidbx2=re.compile('<b>VidBux.+?DivX.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href=".+?" target="_blank">1</a>&nbsp;<a href="(.+?)"').findall(link)
  135.         wise=re.compile('<b>Wise.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  136.         putloc=re.compile('<b>Putlock.+?</b></td>\n<td class="siteparts" style="width:165px;"><a class="link" href="(.+?)"').findall(link)
  137.         apex=re.compile('<b>apexvid.com</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  138.     for url in apex:
  139.         i=i+1
  140.         addDir('Apexvid (flv) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),24,'')
  141.     for url in nova:
  142.         i=i+1
  143.         addDir('Novamov (flv) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),12,'')
  144.     for url in woot:
  145.         i=i+1
  146.         addDir('Wootly (mp4) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),7,'')
  147.     for url in dv1:
  148.         i=i+1
  149.         addDir('DivxDen (avi) Pt 1 #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),8,'')
  150.     for url in dv2:
  151.         i=i+1
  152.         addDir('DivxDen (avi) Pt 2 #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),8,'')
  153.     for url in dv:
  154.         i=i+1
  155.         addDir('DivxDen (avi) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),8,'')
  156.     for url in vidbx:
  157.         i=i+1
  158.         addDir('VidBux (avi) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),10,'')
  159.     for url in vidbx1:
  160.         i=i+1
  161.         addDir('VidBux (avi) Pt 1 #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),10,'')
  162.     for url in vidbx2:
  163.         i=i+1
  164.         addDir('VidBux (avi) Pt 2 #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),10,'')
  165.     for url in putloc:
  166.         i=i+1
  167.         addDir('PutLocker (avi) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),23,'')
  168.     for url in wise:
  169.         i=i+1
  170.         addDir('Wisevid (flv) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),19,'')
  171.     for url in mega:
  172.         i=i+1
  173.         addDir('Megavideo (flv) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),15,'')
  174.  
  175. def Y3TV(url,name):
  176.     i=0
  177.         req = urllib2.Request(url)
  178.         req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
  179.         response2 = urllib2.urlopen(req)
  180.         ref=response2.geturl()
  181.     save(referer,ref)
  182.         link=response2.read()
  183.     mega=re.compile('<b>Megavid.+?</b></td>\n.+?<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  184.         woot=re.compile('<b>Wootly</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  185.         dv=re.compile('<b>Vidxden.+?DivX.+?</b></td>\n.+?<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">Watch This Video!').findall(link)
  186.     dvflash=re.compile('<b>Vidxden.+?Flash.+?</b></td>\n.+?<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">Watch This Video!').findall(link)
  187.         vidbx=re.compile('<b>VidBux.+?DivX.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">Watch This Video!').findall(link)
  188.         vidbx2=re.compile('<b>VidBux.+?FLV.+?</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">Watch This Video!').findall(link)
  189.  
  190.         wise=re.compile('<b>WiseVid</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  191.         putloc=re.compile('<b>putlocker.com</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  192.         apex=re.compile('<b>apexvid.com</b></td>\n<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  193.  
  194.     divxavi=re.compile('<b>Divxden.+?DivX.+?</b></td>\n.+?<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">Watch This Video!').findall(link)
  195.     divxflash=re.compile('<b>Divxden.+?Flash.+?</b></td>\n.+?<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)" target="_blank">Watch This Video!').findall(link)
  196.  
  197.         new2=re.compile('<b>Put.+?</b></td>\n.+?<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  198.         new3=re.compile('<b>Vidbu.+?</b></td>\n.+?<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  199.     new4=re.compile('<b>Novamo.+?</b></td>\n.+?<td class="siteparts" style="width:.+?px;"><a class="link" href="(.+?)"').findall(link)
  200.     for url in apex:
  201.         i=i+1
  202.         addDir('Apexvid (flv) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),24,'')
  203.  
  204.     for url in dv:
  205.         i=i+1
  206.         addDir('Vidxden (avi) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),8,'')
  207.     for url in dvflash:
  208.         i=i+1
  209.         addDir('Vidxden (flv) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),27,'')
  210.     for url in mega:
  211.         i=i+1
  212.         addDir('Megavideo (flv) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),15,'')
  213.     for url in woot:
  214.         i=i+1
  215.         addDir('Wootly (mp4) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),7,'')
  216.     for url in putloc:
  217.         i=i+1
  218.         addDir('PutLocker (avi) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),23,'')
  219.     for url in vidbx:
  220.         i=i+1
  221.         addDir('VidBux (avi) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),10,'')
  222.     for url in vidbx2:
  223.         i=i+1
  224.         addDir('VidBux (flv) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),25,'')
  225.     for url in divxavi:
  226.         i=i+1
  227.         addDir('Divxden (avi) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),8,'')
  228.     for url in divxflash:
  229.         i=i+1
  230.         addDir('Divxden (flv) #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),27,'')
  231.     for url in new2:
  232.         i=i+1
  233.         addDir('Putlocker #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),23,'')
  234.     for url in new3:
  235.         i=i+1
  236.         addDir('Vidbux #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),10,'')
  237.     for url in new4:
  238.         i=i+1
  239.         addDir('Novamov #'+str(i),'http://www.fastpasstv.ms'+url.replace('/watch','/redirect'),12,'')
  240.  
  241. def PUTLOC(url,name):
  242.         #login()
  243.         link1 = geturl(url)
  244.         link2 = redirect(url)
  245.         try:
  246.                 hash=re.compile('type="hidden" value="(.+?)" name="hash"').findall(link1)[0]
  247.         except:
  248.                 dialog = xbmcgui.Dialog()
  249.                 ok = dialog.ok("FastPassTv",'The file has been removed due to copyright.')
  250.                 return
  251.  
  252.         values = {'hash': hash, 'confirm':'Continue as Free User'}
  253.         user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  254.         headers = { 'User-Agent' : user_agent}
  255.     cookiejar = cookielib.LWPCookieJar()
  256.     cookiejar = urllib2.HTTPCookieProcessor(cookiejar)
  257.     opener = urllib2.build_opener(cookiejar)
  258.     urllib2.install_opener(opener)
  259.         data = urllib.urlencode(values)
  260.         req = urllib2.Request(link2, data, headers)
  261.         response = urllib2.urlopen(req)
  262.         link = response.read()
  263.         code = re.compile("stream=(.+?)'").findall(link)
  264.         req = urllib2.Request('http://www.putlocker.com/get_file.php?stream='+code[0])
  265.         req.add_header('User-Agent', user_agent)
  266.         response = urllib2.urlopen(req)
  267.         link=response.read()
  268.         finalurl = re.compile('<media:content url="(.+?)"').findall(link)[0]
  269.         Play(finalurl)
  270.  
  271. def WOOT(url,name):
  272.     #login()   
  273.     link1 = geturl(url)
  274.     link2 = redirect(url)
  275.     try:
  276.         fcodenm=re.compile('name="fname" value="(.+?)"').findall(link1)[0]
  277.     except:
  278.         dialog = xbmcgui.Dialog()
  279.         ok = dialog.ok("FastPassTv",'The file has been removed due to copyright.')
  280.         return
  281.  
  282.     fcodeid=re.compile('name="id" value="(.+?)"').findall(link1)[0]
  283.     refer=openfile(referer)
  284.  
  285.     values = {'op': 'download1','usr_login': ' ','id': fcodeid, 'fname': fcodenm,'referer' : refer, 'method_free':'Continue to Video'}
  286.     user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  287.     headers = { 'User-Agent' : user_agent }
  288.     cookiejar = cookielib.LWPCookieJar()
  289.     cookiejar = urllib2.HTTPCookieProcessor(cookiejar)
  290.     opener = urllib2.build_opener(cookiejar)
  291.     urllib2.install_opener(opener)
  292.     data = urllib.urlencode(values)
  293.     req = urllib2.Request(link2, data, headers)
  294.     response = urllib2.urlopen(req)
  295.     link = response.read()
  296.  
  297.     if 'mp4' in fcodenm:
  298.         file=re.compile("mp4(.+?)182|file").findall(link)[0]
  299.         cleanup=file.replace('|',' ').replace('||',' ')
  300.         hashlong = cleanup[-57:].replace(' ','')   
  301.         hashshort =  re.compile("ltas(.+?)flvplayer").findall(link)[0]
  302.         if hashshort == '||' :
  303.             hashshort = 's1'
  304.             finalurl = 'http://'+hashshort.replace('|','')+'.wootly.com:182/d/'+hashlong+'/'+ 'video.mp4'
  305.         Play(finalurl)
  306.         return
  307.     else:
  308.         file=re.compile("Stage6(.+?)182|file").findall(link)[0]
  309.         cleanup=file.replace('|',' ').replace('||',' ')
  310.         hashlong = cleanup[-57:].replace(' ','')   
  311.         hashshort =  re.compile("wootly(.+?)divx").findall(link)[0]
  312.         if hashshort == '||' :
  313.             hashshort = 's1'
  314.             finalurl = 'http://'+hashshort.replace('|','')+'.wootly.com:182/d/'+hashlong+'/'+ 'video.avi'
  315.         Play(finalurl)
  316.  
  317. def WOOTAVI(url,name):
  318.     #login()   
  319.     link1 = geturl(url)
  320.     link2 = redirect(url)
  321.     try:
  322.         fcodenm=re.compile('name="fname" value="(.+?)"').findall(link1)[0]
  323.     except:
  324.         dialog = xbmcgui.Dialog()
  325.         ok = dialog.ok("FastPassTv",'The file has been removed due to copyright.')
  326.         return
  327.  
  328.     fcodeid=re.compile('name="id" value="(.+?)"').findall(link1)[0]
  329.     refer=openfile(referer)
  330.  
  331.     values = {'op': 'download1','usr_login': ' ','id': fcodeid, 'fname': fcodenm,'referer' : refer, 'method_free':'Continue to Video'}
  332.     user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  333.     headers = { 'User-Agent' : user_agent }
  334.     cookiejar = cookielib.LWPCookieJar()
  335.     cookiejar = urllib2.HTTPCookieProcessor(cookiejar)
  336.     opener = urllib2.build_opener(cookiejar)
  337.     urllib2.install_opener(opener)
  338.     data = urllib.urlencode(values)
  339.     req = urllib2.Request(link2, data, headers)
  340.     response = urllib2.urlopen(req)
  341.     link = response.read()
  342.  
  343.     file=re.compile("Stage6(.+?)182|file").findall(link)[0]
  344.     cleanup=file.replace('|',' ').replace('||',' ')
  345.     hashlong = cleanup[-57:].replace(' ','')   
  346.     hashshort =  re.compile("wootly(.+?)divx").findall(link)[0]
  347.     if hashshort == '||' :
  348.         hashshort = 's1'
  349.         finalurl = 'http://'+hashshort.replace('|','')+'.wootly.com:182/d/'+hashlong+'/'+ 'video.mp4'
  350.     Play(finalurl)
  351.  
  352. def APEX(url,name):
  353.     #login()   
  354.     link1 = geturl(url)
  355.     link2 = redirect(url)
  356.     try:
  357.         fcodenm=re.compile('name="fname" value="(.+?)"').findall(link1)[0]
  358.     except:
  359.         dialog = xbmcgui.Dialog()
  360.         ok = dialog.ok("FastPassTv",'The file has been removed due to copyright.')
  361.         return
  362.  
  363.     fcodeid=re.compile('name="id" value="(.+?)"').findall(link1)[0]
  364.     refer=openfile(referer)
  365.  
  366.     values = {'op': 'download1','usr_login': ' ','id': fcodeid, 'fname': fcodenm,'referer' : refer, 'method_free':'Continue to Video'}
  367.     user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  368.     headers = { 'User-Agent' : user_agent }
  369.     cookiejar = cookielib.LWPCookieJar()
  370.     cookiejar = urllib2.HTTPCookieProcessor(cookiejar)
  371.     opener = urllib2.build_opener(cookiejar)
  372.     urllib2.install_opener(opener)
  373.  
  374.     data = urllib.urlencode(values)
  375.     req = urllib2.Request(link2, data, headers)
  376.     response = urllib2.urlopen(req)
  377.     link = response.read()
  378.  
  379.     file=re.compile("mp4(.+?)182.+?file").findall(link)[0]
  380.     cleanup=file.replace('|',' ').replace('||',' ')
  381.     hashlong = cleanup[-57:].replace(' ','')   
  382.     hashshort =  re.compile("video(.+?)flvplayer").findall(link)[0]
  383.     if hashshort == '||' :
  384.         hashshort = 's1'
  385.         finalurl = 'http://'+hashshort.replace('|','')+'.apexvid.com:182/d/'+hashlong+'/'+ 'video.mp4'
  386.     Play(finalurl)
  387.  
  388. def VIDSDIVX(url,name):
  389.     #login()
  390.     link1 = geturl(url)
  391.     link2 = redirect(url)
  392.     try:
  393.         fcodenm=re.compile('name="fname" type="hidden" value="(.+?)"').findall(link1)[0]
  394.     except:
  395.         dialog = xbmcgui.Dialog()
  396.         ok = dialog.ok("FastPassTv",'The file has been removed due to copyright.')
  397.         return
  398.  
  399.     fcodeid=re.compile('name="id" type="hidden" value="(.+?)"').findall(link1)[0]
  400.     refer=openfile(referer)
  401.  
  402.     values = {'op': 'download1','usr_login': ' ','id': fcodeid, 'fname': fcodenm,'referer' : refer, 'method_free':'Continue to Video'}
  403.     user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  404.     headers = { 'User-Agent' : user_agent }
  405.     cookiejar = cookielib.LWPCookieJar()
  406.     cookiejar = urllib2.HTTPCookieProcessor(cookiejar)
  407.     opener = urllib2.build_opener(cookiejar)
  408.     urllib2.install_opener(opener)
  409.  
  410.     data = urllib.urlencode(values)
  411.     req = urllib2.Request(link2, data, headers)
  412.     response = urllib2.urlopen(req)
  413.     link = response.read()
  414.  
  415.     file = re.compile("Stage6(.+?)364|divxden").findall(link)[0]
  416.     print file
  417.     cleanup = file.replace('|',' ').replace('||',' ')
  418.     hashlong = cleanup[-46:].replace(' ','')
  419.     hashshort =  re.compile('divxden(.+?)src').findall(link)[0]
  420.     finalurl = 'http://'+hashshort.replace('the','').replace('you','').replace(' ','').replace('|','')+'.divxden.com:364/d/'+hashlong+'/'+ fcodenm
  421.     Play(finalurl)
  422.  
  423. def VIDXFLV(url,name):
  424.     #login()
  425.     link1 = geturl(url)
  426.     link2 = redirect(url)
  427.     try:
  428.         fcodenm=re.compile('name="fname" type="hidden" value="(.+?)"').findall(link1)[0]
  429.     except:
  430.         dialog = xbmcgui.Dialog()
  431.         ok = dialog.ok("FastPassTv",'The file has been removed due to copyright.')
  432.         return
  433.  
  434.     fcodeid=re.compile('name="id" type="hidden" value="(.+?)"').findall(link1)[0]
  435.     refer=openfile(referer)
  436.  
  437.     values = {'op': 'download1','usr_login': ' ','id': fcodeid, 'fname': fcodenm,'referer' : refer, 'method_free':'Continue to Video'}
  438.     user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  439.     headers = { 'User-Agent' : user_agent }
  440.     cookiejar = cookielib.LWPCookieJar()
  441.     cookiejar = urllib2.HTTPCookieProcessor(cookiejar)
  442.     opener = urllib2.build_opener(cookiejar)
  443.     urllib2.install_opener(opener)
  444.  
  445.     data = urllib.urlencode(values)
  446.     req = urllib2.Request(link2, data, headers)
  447.     response = urllib2.urlopen(req)
  448.     link = response.read()
  449.  
  450.     file = re.compile("image(.+?)364|divxden").findall(link)[0]
  451.     print file
  452.     cleanup = file.replace('|',' ').replace('||',' ')
  453.     hashlong = cleanup[-46:].replace(' ','')
  454.     hashshort =  re.compile('divxden(.+?)file').findall(link)[0]
  455.     finalurl = 'http://'+hashshort.replace('the','').replace('you','').replace(' ','').replace('|','')+'.divxden.com:364/d/'+hashlong+'/'+ fcodenm
  456.     Play(finalurl)
  457.  
  458. def VIDBUX(url,name):
  459.     #login()
  460.     link1 = geturl(url)
  461.     link2 = redirect(url)
  462.     try:
  463.         fcodenm=re.compile('name="fname" type="hidden" value="(.+?)"').findall(link1)[0]
  464.     except:
  465.         dialog = xbmcgui.Dialog()
  466.         ok = dialog.ok("FastPassTv",'The file has been removed due to copyright.')
  467.         return
  468.  
  469.     fcodeid=re.compile('name="id" type="hidden" value="(.+?)"').findall(link1)[0]
  470.     refer=openfile(referer)
  471.  
  472.     values = {'op': 'download1','usr_login': ' ','id': fcodeid, 'fname': fcodenm,'referer' : refer, 'method_free':'Continue to Video'}
  473.     user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  474.     headers = { 'User-Agent' : user_agent }
  475.  
  476.     data = urllib.urlencode(values)
  477.     req = urllib2.Request(link2, data, headers)
  478.     response = urllib2.urlopen(req)
  479.     link = response.read()
  480.  
  481.     file=re.compile("vidbux(.+?)182|file").findall(link)[0]
  482.     cleanup=file.replace('|',' ').replace('||',' ')
  483.     hashlong = cleanup[-41:].replace(' ','')
  484.     hashshort =  re.compile('</div><!-- <img src="http://(.+?).vidbux.com').findall(link)[0]
  485.     finalurl = 'http://'+hashshort+'.vidbux.com:182/d/'+hashlong+'/'+ fcodenm + '?start=0'
  486.     Play(finalurl)
  487.  
  488. def VIDBUX2(url,name):
  489.     #login()
  490.     link1 = geturl(url)
  491.     link2 = redirect(url)
  492.     try:
  493.         fcodenm=re.compile('name="fname" type="hidden" value="(.+?)"').findall(link1)[0]
  494.     except:
  495.         dialog = xbmcgui.Dialog()
  496.         ok = dialog.ok("FastPassTv",'The file has been removed due to copyright.')
  497.         return
  498.  
  499.     fcodeid=re.compile('name="id" type="hidden" value="(.+?)"').findall(link1)[0]
  500.     refer=openfile(referer)
  501.  
  502.     values = {'op': 'download1','usr_login': ' ','id': fcodeid, 'fname': fcodenm,'referer' : refer, 'method_free':'Continue to Video'}
  503.     user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  504.     headers = { 'User-Agent' : user_agent }
  505.     cookiejar = cookielib.LWPCookieJar()
  506.     cookiejar = urllib2.HTTPCookieProcessor(cookiejar)
  507.     opener = urllib2.build_opener(cookiejar)
  508.     urllib2.install_opener(opener)
  509.  
  510.     data = urllib.urlencode(values)
  511.     req = urllib2.Request(link2, data, headers)
  512.     response = urllib2.urlopen(req)
  513.     link = response.read()
  514.  
  515.     file=re.compile("'(.+?)182").findall(link)[0]
  516.     cleanup=file.replace('|',' ').replace('||',' ')
  517.     hashlong = cleanup[-41:].replace(' ','')
  518.     hashshort =  re.compile("182(.+?)file").findall(link)[0]
  519.     finalurl = 'http://'+hashshort.replace('|','')+'.vidbux.com:182/d'+hashlong+'/'+ fcodenm
  520.     Play(finalurl)
  521.  
  522. def Nova(url,name):
  523.         link= geturl(url)
  524.     file =re.compile('flashvars.file="(.+?)"').findall(link)[0]
  525.     filekey =re.compile('flashvars.filekey="(.+?)"').findall(link)[0]
  526.         req = urllib2.Request('http://www.novamov.com/api/player.api.php?key='+ filekey + '&user=undefined&codes=1&file='+ file +'&pass=undefined')
  527.         req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
  528.         response = urllib2.urlopen(req)
  529.         link=response.read()
  530.     finalurl =re.compile('url=http://(.+?)&title=.+?').findall(link)[0]
  531.     Play('http://'+finalurl)
  532.  
  533. def Mega(url,name):
  534.     gurl = redirect(url)
  535.     code = gurl[-8:]
  536.         try:
  537.                 req = urllib2.Request("http://www.megavideo.com/xml/videolink.php?v="+code)
  538.                 req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14')
  539.                 req.add_header('Referer', 'http://www.megavideo.com/')
  540.                 lemon = urllib2.urlopen(req);response=lemon.read();lemon.close()
  541.                 errort = re.compile(' errortext="(.+?)"').findall(response)
  542.                 if len(errort) > 0: addLink(errort[0],'http://novid.com','')
  543.                 else:
  544.                         s = re.compile(' s="(.+?)"').findall(response)
  545.                         k1 = re.compile(' k1="(.+?)"').findall(response)
  546.                         k2 = re.compile(' k2="(.+?)"').findall(response)
  547.                         un = re.compile(' un="(.+?)"').findall(response)
  548.                         finalurl = "http://www" + s[0] + ".megavideo.com/files/" + __calculateFileHash(un[0], k1[0], k2[0]) + "/"
  549.             Play(finalurl)
  550.         except: pass
  551.  
  552. def __calcDecriptionMix(hash, keyMix):
  553.   """Mixes the decription keys into the hash and returns the updated hash
  554.  @param hash: the hash to merge the keys into
  555.  @param keyMix: the array of keys to mix"""
  556.   for i in range(128):
  557.     hash[i] = str(int(hash[i]) ^ int(keyMix[i + 256]) & 1)
  558.   return "".join(hash)
  559.  
  560. def __toHexDecriptionString(binaryChunks):
  561.   """Converts an array of binary strings into a string of the corresponding hex chunks merged
  562.  This method will first loop through the binary strings converting each one into it's correspondent
  563.  hexadecimal string and then merge the resulting array into a string
  564.  @param binaryChunks: an array of binary strings
  565.  @return: a string of the corresponding hexadecimal strings, merged"""
  566.   hexChunks = []
  567.   for binChunk in binaryChunks:
  568.     hexChunks.append("%x" % int(binChunk, 2))    
  569.   return "".join(hexChunks)
  570.  
  571. def __doDecriptionChunks(binaryMergedString):
  572.   """Break a string of 0's and 1's in pieces of 4 chars
  573.  @param binaryMergedString: a string of 0's and 1's to break in 4-part pieces
  574.  @return: an array of 4 character parts of the original string"""
  575.   binaryChunks = []
  576.   for index in range(0, len(binaryMergedString), 4):
  577.     binaryChunk = binaryMergedString[index:index + 4]
  578.     binaryChunks.append(binaryChunk)
  579.   return binaryChunks
  580.  
  581. def __doDecriptionSwaps(hash, keys):
  582.   """Swap the first 256 indices from keys on the hash with the last 128 elements from the hash
  583.  @param hash: the hash to do swaps on
  584.  @param keys: the generated keys to use as indices for the swaps
  585.  @return: hash after swaps"""
  586.   for index in range(256, 0, -1):
  587.     key = keys[index]
  588.     swapTarget = index % 128
  589.     oldHashKey = hash[key]
  590.     hash[key] = hash[swapTarget]
  591.     hash[swapTarget] = oldHashKey
  592.   return hash
  593.  
  594. def __computeIndices(key1, key2):
  595.   """Generate an array of 384 indices with values 0-127
  596.  @param key1: first seed to generate indices from
  597.  @param key2: second seed to generate indices from
  598.  @return: an array of 384 indices with values between 0 and 127"""
  599.   indices = []
  600.   for i in range(384):
  601.     key1 = (int(key1) * 11 + 77213) % 81371
  602.     key2 = (int(key2) * 17 + 92717) % 192811
  603.     indices.append((int(key1) + int(key2)) % 128)
  604.   return indices
  605.  
  606. def __explodeBin(str1):
  607.   # explode each char in str1 into it;s binary representation
  608.   # and collect the result into __reg1
  609.   __reg1 = []
  610.   __reg3 = 0
  611.   while (__reg3 < len(str1)):
  612.     __reg0 = str1[__reg3]
  613.     holder = __reg0
  614.     if (holder == "0"):
  615.       __reg1.append("0000")
  616.     else:
  617.       if (__reg0 == "1"):
  618.         __reg1.append("0001")
  619.       else:
  620.         if (__reg0 == "2"):
  621.           __reg1.append("0010")
  622.         else:
  623.           if (__reg0 == "3"):
  624.             __reg1.append("0011")
  625.           else:
  626.             if (__reg0 == "4"):
  627.               __reg1.append("0100")
  628.             else:
  629.               if (__reg0 == "5"):
  630.                 __reg1.append("0101")
  631.               else:
  632.                 if (__reg0 == "6"):
  633.                   __reg1.append("0110")
  634.                 else:
  635.                   if (__reg0 == "7"):
  636.                     __reg1.append("0111")
  637.                   else:
  638.                     if (__reg0 == "8"):
  639.                       __reg1.append("1000")
  640.                     else:
  641.                       if (__reg0 == "9"):
  642.                         __reg1.append("1001")
  643.                       else:
  644.                         if (__reg0 == "a"):
  645.                           __reg1.append("1010")
  646.                         else:
  647.                           if (__reg0 == "b"):
  648.                             __reg1.append("1011")
  649.                           else:
  650.                             if (__reg0 == "c"):
  651.                               __reg1.append("1100")
  652.                             else:
  653.                               if (__reg0 == "d"):
  654.                                 __reg1.append("1101")
  655.                               else:
  656.                                 if (__reg0 == "e"):
  657.                                   __reg1.append("1110")
  658.                                 else:
  659.                                   if (__reg0 == "f"):
  660.                                     __reg1.append("1111")
  661.  
  662.     __reg3 = __reg3 + 1
  663.   return list("".join(__reg1))
  664.  
  665. def __calculateFileHash(str1, key1, key2):
  666.   # explode hex to bin strings, collapse to a string and return char array
  667.   hash = __explodeBin(str1)
  668.   # based on the keys, generate an array of 384 (256 + 128) values
  669.   decriptIndices = __computeIndices(key1, key2)
  670.   # from 256 to 0, swap hash[decriptIndices[x]] with hash[__reg3 % 128]
  671.   hash = __doDecriptionSwaps(hash, decriptIndices)
  672.   # replace the first 128 chars in hash with the formula:
  673.   #  hash[x] = hash[x] * decriptIndices[x+256] & 1
  674.   hash = __calcDecriptionMix(hash, decriptIndices)
  675.   # split __reg12 in chunks of 4 chars
  676.   chunks = __doDecriptionChunks(hash)  
  677.   # convert each binary chunk to a hex string for the final hash
  678.   return __toHexDecriptionString(chunks)
  679.  
  680. def SEARCH():
  681.         keyb = xbmc.Keyboard('', 'Search FASTPASSTV')
  682.         keyb.doModal()
  683.         if (keyb.isConfirmed()):
  684.                 search = keyb.getText()
  685.                 encode=urllib.quote(search)
  686.         values = {'input': encode,'submit': 'Search'}
  687.         user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
  688.         headers = { 'User-Agent' : user_agent }
  689.         data = urllib.urlencode(values)
  690.                 req = urllib2.Request('http://www.fastpasstv.ms/search/',data,headers)
  691.             req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
  692.                 response = urllib2.urlopen(req).read()
  693.             tvs=re.compile('<li><a href="/tv/(.+?)">(.+?)<span class="epnum">.+?</span></a></li>').findall(response)
  694.             docs=re.compile('li><a href="/documentaries/(.+?)">(.+?)<span class="epnum"').findall(response)
  695.             ctn=re.compile('<li><a href="/cartoons/(.+?)">(.+?)<span class="epnum">.+?</span></a>').findall(response)
  696.             mvs=re.compile('<li><a href="/movies/(.+?)">(.+?)<span class="epnum">.+?</span></a>').findall(response)
  697.         for url,name in tvs:
  698.             addDir(name.replace('<font class="newvid">New Episodes!</font>','(NEW EPISODE)'),'http://www.fastpasstv.ms/tv/'+url,21,'')
  699.         for url,name in ctn:
  700.             addDir(name.replace('<font class="newvid">New Episodes!</font>','(NEW EPISODE)'),'http://www.fastpasstv.ms/cartoons/'+url,18,'')
  701.         for url,name in mvs:
  702.             addDir(name,'http://www.fastpasstv.ms/movies/'+url,18,'')
  703.         for url,name in docs:
  704.             addDir(name,'http://www.fastpasstv.ms/documentaries/'+url,18,'')
  705.  
  706. def WISE(url,name):
  707.     login()
  708.     link1 = geturl(url)
  709.     link2 = redirect(url)
  710.     try:
  711.             rawcode=re.compile("javascript:location.href='(.+?)'").findall(link1)[1]
  712.             code=rawcode.replace('http://www.wisevid.com/play?v=','')
  713.             ref=response.geturl()
  714.             values = {'name': 'no','value': 'Yes, let me watch'}
  715.             user_agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.11 Safari/532.9'
  716.             headers = { 'User-Agent' : user_agent, 'Referer': ref}
  717.             data = urllib.urlencode(values)
  718.             req = urllib2.Request(rawcode, data, headers)
  719.             response = urllib2.urlopen(req)
  720.             link = response.read()
  721.             match=re.compile("getF(\(.+?)'").findall(link)[0]
  722.             clean= match.replace("('","")
  723.             finalurl=base64.decodestring(clean)
  724.             Play(finalurl)
  725.     except: pass
  726.  
  727.     try:
  728.             acode=re.compile('<input type="hidden" name="a" value="(.+?)" />').findall(link1)[0]
  729.             vcode=re.compile('<input type="hidden" name="v" value="(.+?)" />').findall(link1)[0]
  730.             url2='http://www.wisevid.com/play?v='+vcode
  731.             values = {'a': acode,'v': vcode, 'no1' : 'Yes, let me watch'}
  732.             user_agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.11 Safari/532.9'
  733.             headers = { 'User-Agent' : user_agent, 'Referer': 'http://www.wisevid.com/gate-way?v='+vcode}
  734.             data = urllib.urlencode(values)
  735.             req = urllib2.Request(url2, data, headers)
  736.             response = urllib2.urlopen(req)
  737.             link = response.read()
  738.             match=re.compile("getF(\(.+?)'").findall(link)[0]
  739.             clean= match.replace("('","")
  740.             finalurl=base64.decodestring(clean)
  741.             Play(finalurl)
  742.     except: pass
  743.  
  744. def get_params():
  745.         param=[]
  746.         paramstring=sys.argv[2]
  747.         if len(paramstring)>=2:
  748.                 params=sys.argv[2]
  749.                 cleanedparams=params.replace('?','')
  750.                 if (params[len(params)-1]=='/'):
  751.                         params=params[0:len(params)-2]
  752.                 pairsofparams=cleanedparams.split('&')
  753.                 param={}
  754.                 for i in range(len(pairsofparams)):
  755.                         splitparams={}
  756.                         splitparams=pairsofparams[i].split('=')
  757.                         if (len(splitparams))==2:
  758.                                 param[splitparams[0]]=splitparams[1]
  759.         return param
  760.  
  761. def addDir(name,url,mode,thumbnail,plot=''):
  762.         u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
  763.         ok=True
  764.         liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=thumbnail)
  765.         liz.setInfo( type="Video", infoLabels={ "Title": name,
  766.                                                 "plot": plot} )
  767.         ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
  768.         return ok
  769.  
  770. class StopDownloading(Exception):
  771.         def __init__(self, value):
  772.             self.value = value
  773.         def __str__(self):
  774.             return repr(self.value)
  775.  
  776. def Download(url, dest):
  777.         dp = xbmcgui.DialogProgress()
  778.         dp.create('Downloading', '', name)
  779.         start_time = time.time()
  780.         try:
  781.             urllib.urlretrieve(url, dest, lambda nb, bs, fs: _pbhook(nb, bs, fs, dp, start_time))
  782.         except:
  783.             #delete partially downloaded file
  784.             while os.path.exists(dest):
  785.                 try:
  786.                     print 'hello'
  787.                     break
  788.                 except:
  789.                      pass
  790.             #only handle StopDownloading (from cancel), ContentTooShort (from urlretrieve), and OS (from the race condition); let other exceptions bubble
  791.             if sys.exc_info()[0] in (urllib.ContentTooShortError, StopDownloading, OSError):
  792.                 return 'false'
  793.             else:
  794.                 raise
  795.         return 'downloaded'
  796.          
  797. def _pbhook(numblocks, blocksize, filesize, dp, start_time):
  798.         try:
  799.             percent = min(numblocks * blocksize * 100 / filesize, 100)
  800.             currently_downloaded = float(numblocks) * blocksize / (1024 * 1024)
  801.             kbps_speed = numblocks * blocksize / (time.time() - start_time)
  802.             if kbps_speed > 0:
  803.                 eta = (filesize - numblocks * blocksize) / kbps_speed
  804.             else:
  805.                 eta = 0
  806.             kbps_speed = kbps_speed / 1024
  807.             total = float(filesize) / (1024 * 1024)
  808.             # print (
  809.                 # percent,
  810.                 # numblocks,
  811.                 # blocksize,
  812.                 # filesize,
  813.                 # currently_downloaded,
  814.                 # kbps_speed,
  815.                 # eta,
  816.                 # )
  817.             mbs = '%.02f MB of %.02f MB' % (currently_downloaded, total)
  818.             e = 'Speed: %.02f Kb/s ' % kbps_speed
  819.             e += 'ETA: %02d:%02d' % divmod(eta, 60)
  820.             dp.update(percent, mbs, e)
  821.             #print percent, mbs, e
  822.         except:
  823.             percent = 100
  824.             dp.update(percent)
  825.         if dp.iscanceled():
  826.             dp.close()
  827.             raise StopDownloading('Stopped Downloading')
  828.  
  829. def Play(finalurl):
  830.         if (fpt.getSetting('download') == '0'):
  831.                     dia = xbmcgui.Dialog()
  832.                     ret = dia.select('Streaming Options', ['Play','Download'])
  833.                     if (ret == 0):
  834.                 addLink('Play',finalurl,'','','')
  835.                 item = xbmcgui.ListItem(name)
  836.                     ok=xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(finalurl, item)
  837.                     elif (ret == 1):
  838.                             path = xbmc.translatePath(os.path.join(fpt.getSetting('download_path'), name))
  839.                             Download(finalurl,path+name+'.flv')
  840.                     else:
  841.                             return
  842.     elif (fpt.getSetting('download') == '1'):
  843.         addLink('Play',finalurl,'','','')
  844.         item = xbmcgui.ListItem(name)
  845.             ok=xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(finalurl, item)
  846.         elif (fpt.getSetting('download') == '2'):
  847.                 path = xbmc.translatePath(os.path.join(fpt.getSetting('download_path'), name))
  848.                 Download(finalurl,path+name+'.flv')
  849.         else:
  850.             return
  851.  
  852. def addLink(name,url,iconimage,plot,date):
  853.         ok=True
  854.         liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
  855.         liz.setInfo( type="Video", infoLabels={ "Title": name } )
  856.     liz.setProperty("IsPlayable","true");
  857.         ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz,isFolder=False)
  858.         return ok
  859.  
  860. def check_settings():
  861.         uname = fpt.getSetting('uname')
  862.         pwd   = fpt.getSetting('pwd')
  863.         #if (not uname or uname == '') or (not pwd or pwd == ''):
  864.         #       d = xbmcgui.Dialog()
  865.         #       d.ok('Welcome to fastpasstv.com', 'To start using this plugin first go to the fastpasstv.com.','and register an (free) account.')
  866.         #       fpt.openSettings(sys.argv[ 0 ])
  867.                        
  868. params=get_params()
  869. url=None
  870. name=None
  871. mode=None
  872.  
  873. check_settings()
  874. uname = fpt.getSetting('uname')
  875. pwd   = fpt.getSetting('pwd')
  876.  
  877. try:
  878.         url=urllib.unquote_plus(params["url"])
  879. except:
  880.         pass
  881. try:
  882.         name=urllib.unquote_plus(params["name"])
  883. except:
  884.         pass
  885. try:
  886.         mode=int(params["mode"])
  887. except:
  888.         pass
  889. print "Mode: "+str(mode)
  890. print "URL: "+str(url)
  891. print "Name: "+str(name)
  892.  
  893. if mode==None or url==None or len(url)<1:
  894.         print "categories"
  895.         CATS()
  896. elif mode==1:
  897.         print "PAGE"
  898.         MOVALL(url,name)
  899. elif mode==2:
  900.         print "PAGE"
  901.         X2(url,name)
  902. elif mode==3:
  903.         print "PAGE"
  904.         X3(url,name)
  905. elif mode==4:
  906.         print "PAGE"
  907.         Y1(url,name)
  908. elif mode==5:
  909.         print "PAGE"
  910.         Y2(url,name)
  911. elif mode==6:
  912.         print "PAGE"
  913.         Y3MOV(url,name)
  914. elif mode==7:
  915.         print "PAGE"
  916.         WOOT(url,name)
  917. elif mode==8:
  918.         print "PAGE"
  919.         VIDSDIVX(url,name)
  920. elif mode==27:
  921.         print "PAGE"
  922.         VIDXFLV(url,name)
  923. elif mode==9:
  924.         print "SEARCH  :"+url
  925.         SEARCH()
  926. elif mode==10:
  927.         print "PAGE"
  928.         VIDBUX(url,name)
  929. elif mode==11:
  930.         print "PAGE"
  931.         ICE(url,name)
  932. elif mode==12:
  933.         print "PAGE"
  934.         Nova(url,name)
  935. elif mode==14:
  936.         print "PAGE"
  937.         NEWEP(url,name)
  938. elif mode==15:
  939.         print "PAGE"
  940.         Mega(url,name)
  941. elif mode==18:
  942.         print "PAGE"
  943.         Y3TV(url,name)
  944. elif mode==19:
  945.         print "PAGE"
  946.         WISE(url,name)
  947. elif mode==20:
  948.         print "PAGE"
  949.         MOVLAT(url,name)
  950. elif mode==21:
  951.         print "PAGE"
  952.         Y3(url,name)
  953. elif mode==22:
  954.         print "PAGE"
  955.         DOCLAT(url,name)
  956. elif mode==23:
  957.         print "PAGE"
  958.         PUTLOC(url,name)
  959. elif mode==24:
  960.         print "PAGE"
  961.         APEX(url,name)
  962. elif mode==25:
  963.         print "PAGE"
  964.         VIDBUX2(url,name)
  965. elif mode==26:
  966.         print "PAGE"
  967.         WOOTAVI(url,name)
  968.  
  969. xbmcplugin.endOfDirectory(int(sys.argv[1]))
  970.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement