Exemplo n.º 1
0
Arquivo: api.py Projeto: bialagary/mw
 def __init__(self, pt=False):
     self.handle = int(sys.argv[1])
     self.ws_limit = False  #web search limit
     self.defs = defs
     self.window = ui.listwindow('select.xml',
                                 addon_dir,
                                 'Default',
                                 '720p',
                                 ump=self)
     self.iwindow = ui.imagewindow('picture.xml', addon_dir, "Default",
                                   "720p")
     self.urlval_en = True
     self.urlval_tout = 60
     self.urlval_d_size = {
         self.defs.CT_VIDEO: 1000000,
         self.defs.CT_AUDIO: 10000,
         self.defs.CT_IMAGE: 200
     }
     self.urlval_d_tout = 1.5
     self.tm_conc = int(xbmcplugin.getSetting(self.handle, "conc"))
     self.player = None
     self.mirrors = []
     self.terminate = False
     self.tm = task.manager(self.tm_conc)
     self.loaded_uprv = {}
     self.checked_uids = {"video": {}, "audio": {}, "image": {}}
     self.pt = pt
     if xbmcplugin.getSetting(self.handle, "kodiproxy") == "true":
         from ump import proxy
         socket.socket = proxy.socket()
     self.cj = LWPCookieJar(
         os.path.join(addon_dir, 'resources', 'data', "cookie"))
     if os.path.exists(
             os.path.join(addon_dir, 'resources', 'data', "cookie")):
         try:
             self.cj.load()
         except LoadError:
             pass
     self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(
         self.cj))
     self.ua = xbmcplugin.getSetting(self.handle, "useragent")
     self.opener.addheaders = [('User-agent', self.ua)]
     self.dialog = xbmcgui.Dialog()
     query = sys.argv[2][1:]
     result = urlparse.parse_qs(query)
     [self.module] = result.get('module', ["ump"])
     [self.page] = result.get('page', ["root"])
     [args] = result.get('args', ["{}"])
     self.args = json.loads(args)
     for keep in ["info", "art"]:
         [lst] = result.get(keep, ["{}"])
         setattr(self, keep, json.loads(lst))
     [self.content_type] = result.get('content_type', ["index"])
     [self.content_cat] = result.get('content_cat', ["N/A"])
     self.loadable_uprv = providers.find(self.content_type, "url")
Exemplo n.º 2
0
    def __init__(self, pt=False):
        self.settings = {}
        self.log = ""
        self.handle = int(sys.argv[1])
        self.ws_limit = False  # web search limit
        self.defs = defs
        self.window = ui.listwindow("select.xml", addon_dir, "Default", "720p", ump=self)
        self.iwindow = ui.imagewindow("picture.xml", addon_dir, "Default", "720p")
        self.urlval_en = True
        self.urlval_tout = 30
        self.urlval_d_size = {self.defs.CT_VIDEO: 1000000, self.defs.CT_AUDIO: 10000, self.defs.CT_IMAGE: 200}
        self.urlval_d_tout = 1.5
        self.tm_conc = int(float(addon.getSetting("conc")))
        self.player = None
        self.mirrors = []
        self.terminate = False
        self.tm = task.manager(self.tm_conc)
        self.loaded_uprv = {}
        self.checked_uids = {"video": {}, "audio": {}, "image": {}}
        self.pt = pt
        socket.socket = proxy.getsocket()
        policy = cookielib.DefaultCookiePolicy(rfc2965=True, rfc2109_as_netscape=True)
        self.cj = cookielib.LWPCookieJar(os.path.join(addon_dir, "resources", "data", "cookie"))
        self.cj.set_policy(policy)
        if os.path.exists(os.path.join(addon_dir, "resources", "data", "cookie")):
            try:
                self.cj.load()
            except cookielib.LoadError:
                pass
        self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cj))
        if addon.getSetting("overrideua") == "true":
            self.ua = addon.getSetting("useragent")
        else:
            from ump import useragents

            self.ua = choice(useragents.all)
        self.opener.addheaders = [("User-agent", self.ua)]
        self.dialog = xbmcgui.Dialog()
        query = sys.argv[2][1:]
        result = parse_qs(query)
        [self.module] = result.get("module", ["ump"])
        [self.page] = result.get("page", ["root"])
        [args] = result.get("args", ["{}"])
        self.args = json.loads(args)
        for keep in ["info", "art"]:
            [lst] = result.get(keep, ["{}"])
            setattr(self, keep, json.loads(lst))

        [self.content_type] = result.get("content_type", ["index"])
        [self.content_cat] = result.get("content_cat", ["N/A"])
        self.loadable_uprv = providers.find(self.content_type, "url")
Exemplo n.º 3
0
Arquivo: api.py Projeto: msports/mw
	def __init__(self,pt=False):
		self.handle = int(sys.argv[1])
		self.ws_limit=False #web search limit
		self.defs=defs
		self.window = ui.listwindow('select.xml', addon_dir, 'Default', '720p',ump=self)
		self.iwindow = ui.imagewindow('picture.xml', addon_dir,"Default","720p")
		self.urlval_en=True
		self.urlval_tout=60
		self.urlval_d_size={self.defs.CT_VIDEO:1000000,self.defs.CT_AUDIO:10000,self.defs.CT_IMAGE:200}
		self.urlval_d_tout=1.5
		self.tm_conc=int(xbmcplugin.getSetting(self.handle,"conc"))
		self.player=None
		self.mirrors=[]
		self.terminate=False
		self.tm=task.manager(self.tm_conc)
		self.loaded_uprv={}
		self.checked_uids={"video":{},"audio":{},"image":{}}
		self.pt=pt
		if xbmcplugin.getSetting(self.handle,"kodiproxy")=="true":
			from ump import proxy
			socket.socket = proxy.socket()
		self.cj=LWPCookieJar(os.path.join( addon_dir, 'resources', 'data', "cookie"))
		if os.path.exists(os.path.join( addon_dir, 'resources', 'data', "cookie")):
			try:
				self.cj.load()
			except LoadError:
				pass
		self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cj))
		self.ua=xbmcplugin.getSetting(self.handle,"useragent")
		self.opener.addheaders = [('User-agent', self.ua)]
		self.dialog=xbmcgui.Dialog()
		query=sys.argv[2][1:]
		result=urlparse.parse_qs(query)
		[self.module]= result.get('module', ["ump"])
		[self.page]= result.get('page', ["root"])
		[args]= result.get('args', ["{}"])
		self.args=json.loads(args)
		for keep in ["info","art"]:
			[lst]=result.get(keep, ["{}"])
			setattr(self,keep,json.loads(lst))
		[self.content_type]= result.get('content_type', ["index"])
		[self.content_cat]= result.get('content_cat', ["N/A"])
		self.loadable_uprv=providers.find(self.content_type,"url")
Exemplo n.º 4
0
	def __init__(self,pt=False):
		if not os.path.exists(defs.addon_ddir):
			os.makedirs(defs.addon_ddir)
		self.pub=[]
		self.index_items=[]
		self.backwards=teamkodi.backwards()
		self.settings={}
		self.buffermode=buffering.get()
		self.log=""
		self.handle = int(sys.argv[1])
		self.ws_limit=False #web search limit
		self.defs=defs
		if self.backwards.abortRequested():sys.exit()
		self.window = ui.listwindow('select.xml', defs.addon_dir,'Default', '720p',ump=self)
		self.iwindow = ui.imagewindow('picture.xml', defs.addon_dir,"Default","720p")
		self.urlval_en=True
		self.urlval_tout=30
		self.urlval_d_size={self.defs.CT_VIDEO:1000000,self.defs.CT_AUDIO:10000,self.defs.CT_IMAGE:200}
		self.urlval_d_tout=1.5
		try:self.tm_conc=int(float(addon.getSetting("conc")))
		except:self.tm_conc=10
		self.player=None
		self.cfagents=prefs.get("cfagents")
		self.cflocks={}
		self.mirrors=[]
		self.terminate=False
		self.loaded_uprv={}
		self.checked_uids={"video":{},"audio":{},"image":{}}
		self.pt=pt
		socket.socket = proxy.getsocket()
		policy=cookielib.DefaultCookiePolicy(rfc2965=True, rfc2109_as_netscape=True, strict_rfc2965_unverifiable=False)
		self.cj=cookielib.LWPCookieJar(os.path.join(defs.addon_ddir, "cookie"))
		self.cj.set_policy(policy)
		self.dialog=xbmcgui.Dialog()
		if os.path.exists(defs.addon_cookfile):
			try:
				self.cj.load()
			except cookielib.LoadError:
				pass
			except IOError:
				pass
		if addon.getSetting("verifyssl").lower()=="false":
			self.opener = urllib2.build_opener(http.HTTPErrorProcessor,urllib2.HTTPCookieProcessor(self.cj),http.HTTPSHandler)
		else:
			self.opener = urllib2.build_opener(http.HTTPErrorProcessor,urllib2.HTTPCookieProcessor(self.cj))	
		if addon.getSetting("overrideua")=="true":
			self.ua=addon.getSetting("useragent")
		else:
			from ump import useragents
			self.ua=choice(useragents.all)
		self.opener.addheaders = [('User-agent', self.ua)]
		self.tunnel=webtunnel.tunnel(self.opener)
		query=sys.argv[2][1:]
		result=parse_qs(query)
		[self.module]= result.get('module', ["ump"])
		[self.page]= result.get('page', ["root"])
		[args]= result.get('args', ["e30="])
		try:
			self.args=json.loads(args.decode("base64"))
		except:
			try:
				self.args=json.loads(args) # old url formatting
			except:
				self._wronguri()
		for keep in ["info","art","pub"]:
			if keep in ["pub"]:default="W10="
			else: default= "e30="
			[lst]=result.get(keep, [default])
			try:
				setattr(self,keep,json.loads(lst.decode("base64")))
			except:
				try:
					setattr(self,keep,json.loads(lst))
				except:
					self._wronguri()
		[self.content_type]= result.get('content_type', ["ump"])
		self.loadable_uprv=providers.find(self.content_type,"url")
		self.stats=stats.stats()
		self.throttle=throttle.throttle(self.defs.addon_tdir)

		if prefs.get("play","flag"):
			self.refreshing=True
			prefs.set("play","flag",False)
		else:
			self.refreshing=False
		self.dialogpg=teamkodi.backwards.DialogProgressBG()
		self.dialogpg.create("UMP")
		self.tm=task.manager(self.dialogpg,self.tm_conc)
		self.stat=clicky.clicky(self)
		if not self.page=="urlselect":
			self.stat.query()
		self.identifier=identifier.identifier()
		self.container_mediatype=defs.MT_NONE
		self.dialogpg.update(100,"UMP %s:%s:%s"%(self.content_type,self.module,self.page))