Exemple #1
0
	def _on_new_id(self,parts,name):
		##validate media providers url first before adding
		for part in parts:
			self._validatepart(part)
		for part in parts:
			if part["urls"]=={}:
				#if even 1 part is missing drop the mirror!!
				self.add_log("mirror ignored, has missing parts: %s"%str(parts))
				return False
		#if payer is not yet ready init it.
		if self.player is None:
			self.player=ui.xplayer(ump=self)

		#get the highest quality info from each part and mirror
		q=0
		ss=0
		prefix_q=""
		prefix_s=""
		for part in parts:
			for mirror in part["urls"].itervalues():
				if not mirror["meta"] == {}:
					t=mirror["meta"]["type"]
					w=mirror["meta"]["width"]
					h=mirror["meta"]["height"]
					s=mirror["meta"]["size"]
					if not (w is None or h is None) and w*h>=q:
						prefix_q="[R:%s]"%humanres(w,h)
						q=w*h
					if not s is None and s>0 and s>ss:
						prefix_s="[F:%s]"%humanint(s)
						ss=s
		mname=prefix_q+prefix_s+name
		
		autoplay=False
		if self.content_type==self.defs.CT_VIDEO and xbmcplugin.getSetting(self.handle,"auto_en_video")=="true":
			if xbmcplugin.getSetting(self.handle,"video_val_method")=="Check if Alive & Quality":
				if unicode(prefix_q[3:-2]).isnumeric() and int(prefix_q[3:-2])>=int(xbmcplugin.getSetting(self.handle,"min_vid_res")):
					autoplay=True
			if xbmcplugin.getSetting(self.handle,"video_val_method")=="Check if Alive Only" or xbmcplugin.getSetting(self.handle,"video_val_method")=="Check if Alive & Quality" and autoplay:
				tags=re.findall("\[(.*?)\]",name)
				required=xbmcplugin.getSetting(self.handle,"require_tag").split(",")
				filtered=xbmcplugin.getSetting(self.handle,"dont_require_tag").split(",")
				autoplay=True
				for tag in tags:
					if not tag=="" and tag.lower().replace(" ","") in [x.lower().replace(" ","") for x in filtered]:
						autoplay=False
						break
				
				for require in required:
					if not require=="" and not require.lower().replace(" ","") in [x.lower().replace(" ","") for x in tags]:
						autoplay=False
						break
				
		if self.content_type==self.defs.CT_AUDIO and xbmcplugin.getSetting(self.handle,"auto_en_audio")=="true" and xbmcplugin.getSetting(self.handle,"audio_val_method")=="Check if Alive Only":
			autoplay=True

		if self.content_type==self.defs.CT_IMAGE and xbmcplugin.getSetting(self.handle,"auto_en_image")=="true" and xbmcplugin.getSetting(self.handle,"audio_val_method")=="Check if Alive & Quality":
			autoplay=True

		item=xbmcgui.ListItem()
		item.setLabel(mname)
		item.setLabel2(self.info["title"])
		item.setProperty("parts",json.dumps(parts))
		upname=parts[0].get("url_provider_name",None)
		if not upname is None:
			item.setIconImage("https://raw.githubusercontent.com/huseyinbiyik/dataserver/master/ump/images/"+parts[0]["url_provider_name"]+".png")
		#if there is no more mirrors and media does not require a provider directly play it.
		if autoplay:
			try:
				state=self.player.create_list(item)
				if state:
					self.shut(True,3)
				return None
			except Exception,e:
				self.notify_error(e)
Exemple #2
0
	def _on_new_id(self,lpname,parts,name,wait,missing):
		##validate media providers url first before adding
		self._validateparts(parts,wait)
		ignores=[]
		for k in range(len(parts)):
			if parts[k]["urls"]=={}:
				#if even 1 part is missing drop the mirror!!
				if missing=="drop":
					self.add_log("mirror dropped, has missing parts: %s"%str(parts))
					return False
				elif missing=="ignore":
					self.add_log("part %s,%s ignored"%(parts[k]["url_provider_name"],parts[k]["url_provider_hash"]))
					ignores.append(k)
		
		for ignore in sorted(ignores,reverse=True):
			parts.pop(ignore)
		
		if not len(parts):
			return None

		#if payer is not yet ready init it.
		if self.player is None:
			self.player=ui.xplayer(ump=self)

		max_k,max_w,max_h,max_s=self.max_meta(parts)
		prefix_q=prefix_s=""

		if max_w*max_h>0:
			prefix_q="[R:%s]"%humanres(max_w,max_h)

		if max_s>0: 
			prefix_s="[F:%s]"%humanint(max_s)
		mname=prefix_q+prefix_s+name
		autoplay=False
		if self.content_type==self.defs.CT_VIDEO and addon.getSetting("auto_en_video")=="true":
			if addon.getSetting("video_val_method") in ["Check if Alive & Quality","Check if Alive + Quality"]:
				if unicode(prefix_q[3:-2]).isnumeric() and int(prefix_q[3:-2])>=int(float(addon.getSetting("min_vid_res"))):
					autoplay=True
			if addon.getSetting("video_val_method")=="Check if Alive Only" or addon.getSetting("video_val_method") in ["Check if Alive & Quality","Check if Alive + Quality"] and autoplay:
				tags=re.findall("\[(.*?)\]",name)
				required=addon.getSetting("require_tag").split(",")
				filtered=addon.getSetting("dont_require_tag").split(",")
				autoplay=True
				for tag in tags:
					if not tag=="" and tag.lower().replace(" ","") in [x.lower().replace(" ","") for x in filtered]:
						autoplay=False
						break
				
				for require in required:
					if not require=="" and not require.lower().replace(" ","") in [x.lower().replace(" ","") for x in tags]:
						autoplay=False
						break
				
		if self.content_type==self.defs.CT_AUDIO and addon.getSetting("auto_en_audio")=="true" and addon.getSetting("audio_val_method")=="Check if Alive Only":
			autoplay=True

		if self.content_type==self.defs.CT_IMAGE and addon.getSetting("auto_en_image")=="true" and addon.getSetting("audio_val_method") in ["Check if Alive & Quality","Check if Alive + Quality"]:
			autoplay=True

		item=xbmcgui.ListItem()
		item.setLabel(mname)
		item.setLabel2(self.info["title"])
		item.setProperty("parts",json.dumps(parts))
		item.setProperty("lpname",lpname)
		upname=parts[0].get("url_provider_name",None)
		art={}
		if not upname is None:
			art["icon"]=defs.arturi+parts[0]["url_provider_name"]+".png"
			item.setIconImage(defs.arturi+parts[0]["url_provider_name"]+".png")
		if not lpname is None:
			#art["thumb"]=defs.arturi+lpname+".png"
			item.setProperty("lpimg",defs.arturi+lpname+".png")
		self.backwards.setArt(item,art)
		#if there is no more mirrors and media does not require a provider directly play it.
		if autoplay:
			try:
				state=self.player.create_list(item,True)
				if state:
					self.shut(True,3)
				return None
			except Exception,e:
				self.notify_error(e)
Exemple #3
0
    def _on_new_id(self, parts, name):
        ##validate media providers url first before adding
        for part in parts:
            self._validatepart(part)
        for part in parts:
            if part["urls"] == {}:
                # if even 1 part is missing drop the mirror!!
                self.add_log("mirror ignored, has missing parts: %s" % str(parts))
                return False
                # if payer is not yet ready init it.
        if self.player is None:
            self.player = ui.xplayer(ump=self)

        max_w, max_h, max_s = self.max_meta(parts)
        prefix_q = prefix_s = ""

        if max_w * max_h > 0:
            prefix_q = "[R:%s]" % humanres(max_w, max_h)

        if max_s > 0:
            prefix_s = "[F:%s]" % humanint(max_s)
        mname = prefix_q + prefix_s + name

        autoplay = False
        if self.content_type == self.defs.CT_VIDEO and addon.getSetting("auto_en_video") == "true":
            if addon.getSetting("video_val_method") == "Check if Alive & Quality":
                if unicode(prefix_q[3:-2]).isnumeric() and int(prefix_q[3:-2]) >= int(
                    float(addon.getSetting("min_vid_res"))
                ):
                    autoplay = True
            if (
                addon.getSetting("video_val_method") == "Check if Alive Only"
                or addon.getSetting("video_val_method") == "Check if Alive & Quality"
                and autoplay
            ):
                tags = re.findall("\[(.*?)\]", name)
                required = addon.getSetting("require_tag").split(",")
                filtered = addon.getSetting("dont_require_tag").split(",")
                autoplay = True
                for tag in tags:
                    if not tag == "" and tag.lower().replace(" ", "") in [x.lower().replace(" ", "") for x in filtered]:
                        autoplay = False
                        break

                for require in required:
                    if not require == "" and not require.lower().replace(" ", "") in [
                        x.lower().replace(" ", "") for x in tags
                    ]:
                        autoplay = False
                        break

        if (
            self.content_type == self.defs.CT_AUDIO
            and addon.getSetting("auto_en_audio") == "true"
            and addon.getSetting("audio_val_method") == "Check if Alive Only"
        ):
            autoplay = True

        if (
            self.content_type == self.defs.CT_IMAGE
            and addon.getSetting("auto_en_image") == "true"
            and addon.getSetting("audio_val_method") == "Check if Alive & Quality"
        ):
            autoplay = True

        item = xbmcgui.ListItem()
        item.setLabel(mname)
        item.setLabel2(self.info["title"])
        item.setProperty("parts", json.dumps(parts))
        upname = parts[0].get("url_provider_name", None)
        if not upname is None:
            item.setIconImage("http://boogie.us.to/dataserver/ump/images/" + parts[0]["url_provider_name"] + ".png")
            # if there is no more mirrors and media does not require a provider directly play it.
        if autoplay:
            try:
                state = self.player.create_list(item)
                if state:
                    self.shut(True, 3)
                return None
            except Exception, e:
                self.notify_error(e)
Exemple #4
0
    def _on_new_id(self, parts, name):
        ##validate media providers url first before adding
        for part in parts:
            self._validatepart(part)
        for part in parts:
            if part["urls"] == {}:
                #if even 1 part is missing drop the mirror!!
                self.add_log("mirror ignored, has missing parts: %s" %
                             str(parts))
                return False
        #if payer is not yet ready init it.
        if self.player is None:
            self.player = ui.xplayer(ump=self)

        #get the highest quality info from each part and mirror
        q = 0
        ss = 0
        prefix_q = ""
        prefix_s = ""
        for part in parts:
            for mirror in part["urls"].itervalues():
                if not mirror["meta"] == {}:
                    t = mirror["meta"]["type"]
                    w = mirror["meta"]["width"]
                    h = mirror["meta"]["height"]
                    s = mirror["meta"]["size"]
                    if not (w is None or h is None) and w * h >= q:
                        prefix_q = "[R:%s]" % humanres(w, h)
                        q = w * h
                    if not s is None and s > 0 and s > ss:
                        prefix_s = "[F:%s]" % humanint(s)
                        ss = s
        mname = prefix_q + prefix_s + name

        autoplay = False
        if self.content_type == self.defs.CT_VIDEO and xbmcplugin.getSetting(
                self.handle, "auto_en_video") == "true":
            if xbmcplugin.getSetting(
                    self.handle,
                    "video_val_method") == "Check if Alive & Quality":
                if unicode(prefix_q[3:-2]).isnumeric() and int(
                        prefix_q[3:-2]) >= int(
                            xbmcplugin.getSetting(self.handle, "min_vid_res")):
                    autoplay = True
            if xbmcplugin.getSetting(
                    self.handle, "video_val_method"
            ) == "Check if Alive Only" or xbmcplugin.getSetting(
                    self.handle, "video_val_method"
            ) == "Check if Alive & Quality" and autoplay:
                tags = re.findall("\[(.*?)\]", name)
                required = xbmcplugin.getSetting(self.handle,
                                                 "require_tag").split(",")
                filtered = xbmcplugin.getSetting(self.handle,
                                                 "dont_require_tag").split(",")
                autoplay = True
                for tag in tags:
                    if not tag == "" and tag.lower().replace(" ", "") in [
                            x.lower().replace(" ", "") for x in filtered
                    ]:
                        autoplay = False
                        break

                for require in required:
                    if not require == "" and not require.lower().replace(
                            " ",
                            "") in [x.lower().replace(" ", "") for x in tags]:
                        autoplay = False
                        break

        if self.content_type == self.defs.CT_AUDIO and xbmcplugin.getSetting(
                self.handle,
                "auto_en_audio") == "true" and xbmcplugin.getSetting(
                    self.handle, "audio_val_method") == "Check if Alive Only":
            autoplay = True

        if self.content_type == self.defs.CT_IMAGE and xbmcplugin.getSetting(
                self.handle,
                "auto_en_image") == "true" and xbmcplugin.getSetting(
                    self.handle,
                    "audio_val_method") == "Check if Alive & Quality":
            autoplay = True

        item = xbmcgui.ListItem()
        item.setLabel(mname)
        item.setLabel2(self.info["title"])
        item.setProperty("parts", json.dumps(parts))
        upname = parts[0].get("url_provider_name", None)
        if not upname is None:
            item.setIconImage(
                "https://raw.githubusercontent.com/huseyinbiyik/dataserver/master/ump/images/"
                + parts[0]["url_provider_name"] + ".png")
        #if there is no more mirrors and media does not require a provider directly play it.
        if autoplay:
            try:
                state = self.player.create_list(item)
                if state:
                    self.shut(True, 3)
                return None
            except Exception, e:
                self.notify_error(e)