Ejemplo n.º 1
0
	def __init__(self, load = None, disable = None, cache_results=False):
		self.threadpool_size = 5
		self.cache_results = cache_results
		self._load_list = load
		self._disable_list = disable
		self.enabled_scrapers = 0
		self.active_scrapers = []
		self.supported_scrapers = []
		self._active_scrapers = []
		self._load_scrapers()
		self._enable_scrapers()
		self.search_results = []
		expired = True
		cache_file = vfs.join(DATA_PATH, 'debrid_hosts.cache')
		if vfs.exists(cache_file):
			timestamp = int(time.time())
			m_time = vfs.get_stat(cache_file).st_mtime()
			if (timestamp - m_time) < 86400: expired = False
		
		if expired:
			hosts = {}
			response = Net().http_GET('http://real-debrid.com/api/hosters.php').content
			hosts['rd'] = [x.strip('"') for x in response.split(',')]
			
			response = Net().http_GET('http://alldebrid.com/api.php?action=get_host').content
			hosts['ad'] = [x.strip('"') for x in response.split(',\n')]
			
			response = Net().http_GET('http://premium.rpnet.biz/hoster2.json').content
			hosts['rp'] = json.loads(response)['supported']
			ADDON.save_data(cache_file, hosts)
Ejemplo n.º 2
0
	def __init__(self, load = None, disable = None, cache_results=False):
		self.threadpool_size = 5
		self.cache_results = cache_results
		self._load_list = load
		self._disable_list = disable
		self.enabled_scrapers = 0
		self.active_scrapers = []
		self.supported_scrapers = []
		self._active_scrapers = []
		self._load_scrapers()
		self._enable_scrapers()
		self.search_results = []
		self.show_scraper_progress = ADDON.get_setting('enable_scraper_progress') == 'true'
		
		expired = True
		self.filters = False
		if ADDON.get_setting('enable_result_filters') == 'true':
			cache_file = vfs.join(DATA_PATH, 'filters.cache')
			if vfs.exists(cache_file):
				self.filters = ADDON.load_data(cache_file)
		cache_file = vfs.join(DATA_PATH, 'debrid_hosts.cache')
		if vfs.exists(cache_file):
			timestamp = int(time.time())
			m_time = vfs.get_stat(cache_file).st_mtime()
			if (timestamp - m_time) < 86400: expired = False
		
		if expired:
			hosts = {"pm": [], "rd": [], "ad": [], "rp": []}
			net = Net()
			try:
				customer_id = xbmcaddon.Addon('script.module.urlresolver').getSetting('PremiumizeMeResolver_username')
				pin = xbmcaddon.Addon('script.module.urlresolver').getSetting('PremiumizeMeResolver_password')
				query = {"method": "hosterlist", "params[login]": customer_id, "params[pass]": pin}
				api_url = "http://api.premiumize.me/pm-api/v1.php?" + urllib.urlencode(query)
				response = net.http_GET(api_url).content
				data = json.loads(response)
				if 'result' in data:
					hosts['pm'] = data['result']['hosterlist']
			except: pass

			try:
				response = Net().http_GET('http://real-debrid.com/api/hosters.php').content
				hosts['rd'] = [x.strip('"') for x in response.split(',')]
			except: pass
			
			try:
				response = Net().http_GET('http://alldebrid.com/api.php?action=get_host').content
				hosts['ad'] = [x.strip('"') for x in response.split(',\n')]
			except: pass
				
			try:
				response = Net().http_GET('http://premium.rpnet.biz/hoster2.json').content
				hosts['rp'] = json.loads(response)['supported']
			except: pass

			ADDON.save_data(cache_file, hosts)
Ejemplo n.º 3
0
    def __init__(self,
                 load=None,
                 disable=None,
                 cache_results=False,
                 is_stream=False):
        self.threadpool_size = 5
        self.cache_results = cache_results
        self._load_list = load
        self._disable_list = disable
        self.enabled_scrapers = 0
        self.active_scrapers = []
        self.supported_scrapers = []
        self._active_scrapers = []
        self._load_scrapers()
        self._enable_scrapers()
        self.search_results = []
        if is_stream:
            self.show_scraper_progress = False
        else:
            self.show_scraper_progress = ADDON.get_setting(
                'enable_scraper_progress') == 'true'
        self.skip_second_search = True
        expired = True
        self.filters = False
        self.cache_queue = Queue()
        if ADDON.get_setting('enable_result_filters') == 'true':
            cache_file = vfs.join(DATA_PATH, 'filters.cache')
            if vfs.exists(cache_file):
                self.filters = ADDON.load_data(cache_file)
        cache_file = vfs.join(DATA_PATH, 'debrid_hosts.cache')

        if vfs.exists(cache_file):
            timestamp = int(time.time())
            m_time = vfs.get_stat(cache_file).st_mtime()
            if (timestamp - m_time) < 86400: expired = False

        if expired:
            hosts = {"pm": [], "rd": [], "ad": [], "rp": []}
            net = Net()
            try:
                customer_id = xbmcaddon.Addon(
                    'script.module.urlresolver').getSetting(
                        'PremiumizeMeResolver_username')
                pin = xbmcaddon.Addon('script.module.urlresolver').getSetting(
                    'PremiumizeMeResolver_password')
                query = {
                    "method": "hosterlist",
                    "params[login]": customer_id,
                    "params[pass]": pin
                }
                api_url = "http://api.premiumize.me/pm-api/v1.php?" + urllib.urlencode(
                    query)
                response = net.http_GET(api_url).content
                data = json.loads(response)
                if 'result' in data:
                    hosts['pm'] = data['result']['hosterlist']
            except:
                pass

            try:
                response = Net().http_GET(
                    'http://real-debrid.com/api/hosters.php').content
                hosts['rd'] = [x.strip('"') for x in response.split(',')]
            except:
                pass

            try:
                response = Net().http_GET(
                    'http://alldebrid.com/api.php?action=get_host').content
                hosts['ad'] = [x.strip('"') for x in response.split(',\n')]
            except:
                pass

            try:
                response = Net().http_GET(
                    'http://premium.rpnet.biz/hoster2.json').content
                hosts['rp'] = json.loads(response)['supported']
            except:
                pass

            ADDON.save_data(cache_file, hosts)