示例#1
0
文件: api.py 项目: 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")
示例#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")
示例#3
0
文件: api.py 项目: 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")
示例#4
0
	from ump import api
	from ump import postrun
	from ump import providers
	from ump import ui
	#bookmark.resolve()
	ump=api.ump()
	prerun.run(ump)
	from ump import cloud
	ump.add_log("HANDLE       : %s"%str(ump.handle))
	ump.add_log("MODULE       : %s"%str(ump.module))
	ump.add_log("PAGE         : %s"%str(ump.page))
	#ump.add_log("ARGS         : " + str(ump.args))
	ump.add_log("CONTENT_TYPE : %s"%str(ump.content_type))
	#print "INFO         : " + str(ump.info)
	#print "ART          : " + str(ump.art)
	indexers=providers.find(ump.content_type,"index")
	url_providers=providers.find(ump.content_type,"url")
	link_providers=providers.find(ump.content_type,"link")
	if ump.module == "ump":
		if ump.page == "root":
			for provider in indexers:
				provider_type,provider_cat,provider_name=provider
				if ump.content_type == "ump":content_type=provider_type
				else: content_type = ump.content_type
				img=arturi+provider_name+".png"
				ump.index_item(provider_name.title(),module=provider_name,icon=img,thumb=img,content_type=content_type)
			ump._do_container()
	elif ump.page== "urlselect":
		if not addon.getSetting("tn_chk_url_en").lower()=="false":
			from ump import webtunnel
			webtunnel.check_health(ump,True)
示例#5
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))