antizapret fix by inpos
This commit is contained in:
		
							parent
							
								
									55cb8797e2
								
							
						
					
					
						commit
						a457d26395
					
				
							
								
								
									
										14
									
								
								Core.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Core.py
									
									
									
									
									
								
							@ -276,7 +276,19 @@ class Core:
 | 
			
		||||
        #    self.Downloader.__exit__()
 | 
			
		||||
        #self.Player = AnteoPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params)
 | 
			
		||||
 | 
			
		||||
        xbmcgui.Dialog().ok('Dam Son!','Now send this shit to DiMartino')
 | 
			
		||||
        #xbmcgui.Dialog().ok('Dam Son!','Now send this shit to DiMartino')
 | 
			
		||||
        from resources.proxy import antizapret
 | 
			
		||||
        filename = os.path.join(tempdir(),"antizapret.pac_config")
 | 
			
		||||
        import shelve
 | 
			
		||||
        from contextlib import contextmanager, closing
 | 
			
		||||
        with closing(shelve.open(filename, writeback=True)) as d:
 | 
			
		||||
            import time
 | 
			
		||||
            log(str(d))
 | 
			
		||||
            log(str(time.time()))
 | 
			
		||||
            log(str((time.time() - d["created_at"])))
 | 
			
		||||
            ttl = 24*3600
 | 
			
		||||
            if ttl > 0 and (time.time() - d["created_at"]) > ttl:
 | 
			
		||||
                log('xxx')
 | 
			
		||||
 | 
			
		||||
    def DownloadStatus(self, params={}):
 | 
			
		||||
        db = DownloadDB()
 | 
			
		||||
 | 
			
		||||
@ -33,7 +33,7 @@ import sys
 | 
			
		||||
import xbmcgui
 | 
			
		||||
import xbmc
 | 
			
		||||
import Localization
 | 
			
		||||
from functions import log, debug
 | 
			
		||||
from functions import log, debug, showMessage
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class SearcherABC:
 | 
			
		||||
@ -47,13 +47,6 @@ class SearcherABC:
 | 
			
		||||
 | 
			
		||||
    socket.setdefaulttimeout(10+(10*int(timeout_multi)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    #def __del__(self):
 | 
			
		||||
    #    print '!!!!!!!!!!!!!!!!!! DIED !!! '+self.__class__.__name__
 | 
			
		||||
 | 
			
		||||
    #def __init__(self):
 | 
			
		||||
    #    print '!!!!!!!!!!!!!!!!!! BORN '+self.__class__.__name__
 | 
			
		||||
 | 
			
		||||
    def search(self, keyword):
 | 
			
		||||
        '''
 | 
			
		||||
        Retrieve keyword from the input and return a list of tuples:
 | 
			
		||||
@ -110,19 +103,24 @@ class SearcherABC:
 | 
			
		||||
 | 
			
		||||
    def makeRequest(self, url, data={}, headers={}):
 | 
			
		||||
        self.load_cookie()
 | 
			
		||||
        opener = None
 | 
			
		||||
        if self.proxy == 1:
 | 
			
		||||
            from resources.proxy import antizapret
 | 
			
		||||
            opener = urllib2.build_opener(antizapret.AntizapretProxyHandler(), urllib2.HTTPCookieProcessor(self.cookieJar))
 | 
			
		||||
            config = antizapret.config()
 | 
			
		||||
            self.debug('[antizapret]: '+str(config["domains"]))
 | 
			
		||||
            self.debug('[antizapret]: '+str(config["server"]))
 | 
			
		||||
        elif self.proxy == 2:
 | 
			
		||||
            from resources.proxy import immunicity
 | 
			
		||||
            opener = urllib2.build_opener(immunicity.ImmunicityProxyHandler(), urllib2.HTTPCookieProcessor(self.cookieJar))
 | 
			
		||||
            config = immunicity.config()
 | 
			
		||||
            self.debug('[immunicity]: '+str(config["domains"]))
 | 
			
		||||
            self.debug('[immunicity]: '+str(config["server"]))
 | 
			
		||||
        else:
 | 
			
		||||
            try:
 | 
			
		||||
                from resources.proxy import antizapret
 | 
			
		||||
                opener = urllib2.build_opener(antizapret.AntizapretProxyHandler(), urllib2.HTTPCookieProcessor(self.cookieJar))
 | 
			
		||||
                config = antizapret.config()
 | 
			
		||||
                self.debug('[antizapret]: '+str(config["domains"]))
 | 
			
		||||
                self.debug('[antizapret]: '+str(config["server"]))
 | 
			
		||||
            except:
 | 
			
		||||
                showMessage('AntiZapret', Localization.localize('Error'))
 | 
			
		||||
                self.debug('[antizapret]: OFF!')
 | 
			
		||||
        #elif self.proxy == 2:
 | 
			
		||||
        #    from resources.proxy import immunicity
 | 
			
		||||
        #    opener = urllib2.build_opener(immunicity.ImmunicityProxyHandler(), urllib2.HTTPCookieProcessor(self.cookieJar))
 | 
			
		||||
        #    config = immunicity.config()
 | 
			
		||||
        #    self.debug('[immunicity]: '+str(config["domains"]))
 | 
			
		||||
        #    self.debug('[immunicity]: '+str(config["server"]))
 | 
			
		||||
        if not opener:
 | 
			
		||||
            opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookieJar))
 | 
			
		||||
        opener.addheaders = headers
 | 
			
		||||
        if 0 < len(data):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user