Esempio n. 1
0
 def getBoolean(self):
     service = self.source.service
     info = service and service.info()
     if info:
         if self.type == self.HAS_TELETEXT:
             tpid = info.getInfo(iServiceInformation.sTXTPID)
             return tpid != -1
         elif self.type in (self.IS_MULTICHANNEL, self.IS_STEREO):
             # FIXME. But currently iAudioTrackInfo doesn't provide more information.
             audio = service.audioTracks()
             if audio:
                 n = audio.getNumberOfTracks()
                 idx = 0
                 while idx < n:
                     i = audio.getTrackInfo(idx)
                     description = i.getDescription()
                     if description in ("AC3", "AC3+", "DTS", "DTS-HD",
                                        "AC-3"):
                         if self.type == self.IS_MULTICHANNEL:
                             return True
                         elif self.type == self.IS_STEREO:
                             return False
                     idx += 1
                 if self.type == self.IS_MULTICHANNEL:
                     return False
                 elif self.type == self.IS_STEREO:
                     return True
             return False
         elif self.type == self.IS_CRYPTED:
             return info.getInfo(iServiceInformation.sIsCrypted) == 1
         elif self.type == self.SUBSERVICES_AVAILABLE:
             return hasActiveSubservicesForCurrentChannel(service)
         elif self.type == self.HAS_HBBTV:
             return info.getInfoString(iServiceInformation.sHBBTVUrl) != ""
         elif self.type == self.AUDIOTRACKS_AVAILABLE:
             audio = service.audioTracks()
             return bool(audio and audio.getNumberOfTracks() > 1)
         elif self.type == self.SUBTITLES_AVAILABLE:
             subtitle = service and service.subtitle()
             return bool(subtitle and subtitle.getSubtitleList())
         elif self.type == self.EDITMODE:
             return bool(
                 hasattr(self.source, "editmode") and self.source.editmode)
         elif self.type == self.IS_STREAM:
             return service.streamed() is not None
         elif self.isVideoService(info):
             if self.type == self.IS_SDR:
                 return info.getInfo(iServiceInformation.sGamma) == 0
             elif self.type == self.IS_HDR:
                 return info.getInfo(iServiceInformation.sGamma) == 1
             elif self.type == self.IS_HDR10:
                 return info.getInfo(iServiceInformation.sGamma) == 2
             elif self.type == self.IS_HLG:
                 return info.getInfo(iServiceInformation.sGamma) == 3
             elif self.type == self.IS_WIDESCREEN:
                 return info.getInfo(
                     iServiceInformation.sAspect) in WIDESCREEN
             elif self.type == self.IS_NOT_WIDESCREEN:
                 return info.getInfo(
                     iServiceInformation.sAspect) not in WIDESCREEN
             elif self.type == self.IS_VIDEO_MPEG2:
                 return info.getInfo(iServiceInformation.sVideoType) == 0
             elif self.type == self.IS_VIDEO_AVC:
                 return info.getInfo(iServiceInformation.sVideoType) == 1
             elif self.type == self.IS_VIDEO_HEVC:
                 return info.getInfo(iServiceInformation.sVideoType) == 7
             else:
                 videoHeight = info.getInfo(
                     iServiceInformation.sVideoHeight)
                 self.videoHeight = videoHeight if videoHeight > 0 else self.videoHeight
                 if self.videoHeight is not None:
                     if self.type == self.IS_SD:
                         return self.videoHeight and self.videoHeight < 720
                     elif self.type == self.IS_HD:
                         return self.videoHeight >= 720 and self.videoHeight <= 1080
                     elif self.type == self.IS_4K:
                         return self.videoHeight > 2100 and self.videoHeight <= 2160
                     elif self.type == self.IS_1080:
                         return self.videoHeight > 1000 and self.videoHeight <= 1080
                     elif self.type == self.IS_720:
                         return video_height > 700 and video_height <= 720
                     elif self.type == self.IS_576:
                         return video_height > 500 and video_height <= 576
                     elif self.type == self.IS_480:
                         return video_height > 0 and video_height <= 480
                     elif self.type == self.IS_HDHDR:
                         return self.videoHeight > 721 and self.videoHeight <= 1980
                     else:
                         aspect = info.getInfo(iServiceInformation.sAspect)
                         self.aspect = aspect if aspect > -1 else self.aspect
                         if self.type == self.IS_SD_AND_WIDESCREEN:
                             return self.videoHeight and self.aspect and self.videoHeight < 720 and self.aspect in WIDESCREEN
                         if self.type == self.IS_SD_AND_NOT_WIDESCREEN:
                             return self.videoHeight and self.aspect and self.videoHeight < 720 and self.aspect not in WIDESCREEN
     return False
Esempio n. 2
0
    def getBoolean(self):
        service = self.source.service
        info = service and service.info()
        if not info:
            return False

        video_height = None
        video_width = None
        video_aspect = None
        video_height = self._getVideoHeight(info)
        video_width = self._getVideoWidth(info)

        if path.exists("/proc/stb/vmpeg/0/aspect"):
            f = open("/proc/stb/vmpeg/0/aspect", "r")
            try:
                video_aspect = int(f.read())
            except:
                pass
            f.close()

        if not video_height:
            video_height = int(info.getInfo(iServiceInformation.sVideoHeight))
        if not video_aspect:
            video_aspect = info.getInfo(iServiceInformation.sAspect)
        if self.type == self.HAS_TELETEXT:
            tpid = info.getInfo(iServiceInformation.sTXTPID)
            return tpid != -1
        elif self.type in (self.IS_MULTICHANNEL, self.AUDIO_STEREO):
            # FIXME. but currently iAudioTrackInfo doesn't provide more information.
            audio = service.audioTracks()
            if audio:
                n = audio.getNumberOfTracks()
                idx = 0
                while idx < n:
                    i = audio.getTrackInfo(idx)
                    description = i.getDescription()
                    if description and description.split()[0] in (
                            "AC3", "AC-3", "AC3+", "DTS"
                    ):  # some audio description has 'audio' as additional value (e.g. 'AC-3 audio')
                        if self.type == self.IS_MULTICHANNEL:
                            return True
                        elif self.type == self.AUDIO_STEREO:
                            return False
                    idx += 1
                if self.type == self.IS_MULTICHANNEL:
                    return False
                elif self.type == self.AUDIO_STEREO:
                    return True
            return False
        elif self.type == self.IS_CRYPTED:
            return info.getInfo(iServiceInformation.sIsCrypted) == 1
        elif self.type == self.IS_WIDESCREEN:
            return video_aspect in WIDESCREEN
        elif self.type == self.IS_NOT_WIDESCREEN:
            return video_aspect not in WIDESCREEN
        elif self.type == self.SUBSERVICES_AVAILABLE:
            return hasActiveSubservicesForCurrentChannel(':'.join(
                info.getInfoString(
                    iServiceInformation.sServiceref).split(':')[:11]))
        elif self.type == self.HAS_HBBTV:
            return info.getInfoString(iServiceInformation.sHBBTVUrl) != ""
        elif self.type == self.AUDIOTRACKS_AVAILABLE:
            audio = service.audioTracks()
            return bool(audio) and audio.getNumberOfTracks() > 1
        elif self.type == self.SUBTITLES_AVAILABLE:
            subtitle = service and service.subtitle()
            subtitlelist = subtitle and subtitle.getSubtitleList()
            if subtitlelist:
                return len(subtitlelist) > 0
            return False
        elif self.type == self.EDITMODE:
            return hasattr(self.source,
                           "editmode") and not not self.source.editmode
        elif self.type == self.IS_STREAM:
            return service.streamed() is not None
        elif self.type == self.IS_SD:
            return video_height < 720
        elif self.type == self.IS_HD:
            if info.getInfo(iServiceInformation.sGamma) > 0:
                return False
            else:
                return video_width >= 721 and video_width < 1980
        elif self.type == self.IS_1080:
            return video_height > 1000 and video_height <= 1080
        elif self.type == self.IS_720:
            return video_height > 700 and video_height <= 720
        elif self.type == self.IS_576:
            return video_height > 500 and video_height <= 576
        elif self.type == self.IS_480:
            return video_height > 0 and video_height <= 480
        elif self.type == self.IS_4K:
            if info.getInfo(iServiceInformation.sGamma) > 0:
                return False
            else:
                return video_width > 2160 and video_width <= 3840
        elif self.PROGRESSIVE:
            return bool(self._getProgressive(info))
        elif self.type == self.IS_SDR:
            return info.getInfo(iServiceInformation.sGamma) == 0
        elif self.type == self.IS_HDR:
            return info.getInfo(iServiceInformation.sGamma) == 1
        elif self.type == self.IS_HDR10:
            return info.getInfo(iServiceInformation.sGamma) == 2
        elif self.type == self.IS_HLG:
            return info.getInfo(iServiceInformation.sGamma) == 3
        return False
Esempio n. 3
0
	def getBoolean(self):
		service = self.source.service
		info = service and service.info()
		if not info:
			return False
		video_height = None
		video_aspect = None
		video_height = self._getVideoHeight(info)
		video_aspect = info.getInfo(iServiceInformation.sAspect)
		if self.type == self.HAS_TELETEXT:
			tpid = info.getInfo(iServiceInformation.sTXTPID)
			return tpid != -1
		elif self.type in (self.IS_MULTICHANNEL, self.AUDIO_STEREO):
			# FIXME. but currently iAudioTrackInfo doesn't provide more information.
			audio = service.audioTracks()
			if audio:
				n = audio.getNumberOfTracks()
				idx = 0
				while idx < n:
					i = audio.getTrackInfo(idx)
					description = i.getDescription()
					if description in ("AC3", "AC-3", "DTS"):
						if self.type == self.IS_MULTICHANNEL:
							return True
						elif self.type == self.AUDIO_STEREO:
							return False
					idx += 1
				if self.type == self.IS_MULTICHANNEL:
					return False
				elif self.type == self.AUDIO_STEREO:
					return True
			return False
		elif self.type == self.IS_CRYPTED:
			return info.getInfo(iServiceInformation.sIsCrypted) == 1
		elif self.type == self.IS_WIDESCREEN:
			return video_aspect in WIDESCREEN
		elif self.type == self.IS_NOT_WIDESCREEN:
			return video_aspect not in WIDESCREEN
		elif self.type == self.SUBSERVICES_AVAILABLE:
			return hasActiveSubservicesForCurrentChannel(':'.join(info.getInfoString(iServiceInformation.sServiceref).split(':')[:11]))
		elif self.type == self.HAS_HBBTV:
			return info.getInfoString(iServiceInformation.sHBBTVUrl) != ""
		elif self.type == self.AUDIOTRACKS_AVAILABLE:
			audio = service.audioTracks()
			return bool(audio) and audio.getNumberOfTracks() > 1
		elif self.type == self.SUBTITLES_AVAILABLE:
			subtitle = service and service.subtitle()
			subtitlelist = subtitle and subtitle.getSubtitleList()
			if subtitlelist:
				return len(subtitlelist) > 0
			return False
		elif self.type == self.EDITMODE:
			return hasattr(self.source, "editmode") and not not self.source.editmode
		elif self.type == self.IS_STREAM:
			return service.streamed() is not None
		elif self.type == self.IS_SD:
			return video_height < 720
		elif self.type == self.IS_HD:
			return video_height >= 720 and video_height < 2160
		elif self.type == self.IS_1080:
			return video_height > 1000 and video_height <= 1080
		elif self.type == self.IS_720:
			return video_height > 700 and video_height <= 720
		elif self.type == self.IS_576:
			return video_height > 500 and video_height <= 576
		elif self.type == self.IS_480:
			return video_height > 0 and video_height <= 480
		elif self.type == self.IS_4K:
			return video_height >= 2100
		elif self.PROGRESSIVE:
			return bool(self._getProgressive(info))
		return False
Esempio n. 4
0
	def getBoolean(self):
		service = self.source.service
		info = service and service.info()
		if not info:
			return False
		video_height = None
		video_width = None
		video_aspect = None
		video_height = self._getVideoHeight(info)
		video_width = self._getVideoWidth(info)

		if path.exists("/proc/stb/vmpeg/0/aspect"):
			f = open("/proc/stb/vmpeg/0/aspect", "r")
			try:
				video_aspect = int(f.read())
			except:
				pass
			f.close()

		if not video_aspect:
			video_aspect = info.getInfo(iServiceInformation.sAspect)

		if self.type == self.HAS_TELETEXT:
			tpid = info.getInfo(iServiceInformation.sTXTPID)
			return tpid != -1
		elif self.type in (self.IS_MULTICHANNEL, self.IS_STEREO):
			# FIXME. but currently iAudioTrackInfo doesn't provide more information.
			audio = service.audioTracks()
			if audio:
				n = audio.getNumberOfTracks()
				idx = 0
				while idx < n:
					i = audio.getTrackInfo(idx)
					description = i.getDescription()
					if description in ("AC3", "AC-3", "AC-3 (ATSC A/52)", "A_AC3", "A_AC-3", "A_AC-3 (ATSC A/52)", "A-AC-3 audio", "E-AC-3 audio", "A_EAC3", "DTS"):
						if self.type == self.IS_MULTICHANNEL:
							return True
						elif self.type == self.IS_STEREO:
							return False
					idx += 1
				if self.type == self.IS_MULTICHANNEL:
					return False
				elif self.type == self.IS_STEREO:
					return True
			return False
		elif self.type == self.IS_CRYPTED:
			return info.getInfo(iServiceInformation.sIsCrypted) == 1
		elif self.type == self.SUBSERVICES_AVAILABLE:
			return hasActiveSubservicesForCurrentChannel(':'.join(info.getInfoString(iServiceInformation.sServiceref).split(':')[:11]))
		elif self.type == self.HAS_HBBTV:
			return info.getInfoString(iServiceInformation.sHBBTVUrl) != ""
		elif self.type == self.AUDIOTRACKS_AVAILABLE:
			audio = service.audioTracks()
			return bool(audio) and audio.getNumberOfTracks() > 1
		elif self.type == self.SUBTITLES_AVAILABLE:
			subtitle = service and service.subtitle()
			subtitlelist = subtitle and subtitle.getSubtitleList()
			if subtitlelist:
				return len(subtitlelist) > 0
			return False
		elif self.type == self.EDITMODE:
			return hasattr(self.source, "editmode") and not not self.source.editmode
		elif self.type == self.IS_STREAM:
			return service.streamed() is not None
		elif self.isVideoService(info):
			if self.type == self.IS_WIDESCREEN:
				return video_aspect in WIDESCREEN
			elif self.type == self.IS_NOT_WIDESCREEN:
				return video_aspect not in WIDESCREEN
			elif self.type == self.IS_HD:
				return video_width > 1025 and video_width <= 1920 and video_height >= 481 and video_height < 1440 or video_width >= 960 and video_height == 720
			elif self.type == self.IS_SD:
				return video_width > 1 and video_width <= 1024 and video_height > 1 and video_height <= 578
			elif self.type == self.IS_SD_AND_WIDESCREEN:
				return video_height < 578 and video_aspect in WIDESCREEN
			elif self.type == self.IS_SD_AND_NOT_WIDESCREEN:
				return video_height < 578 and video_aspect not in WIDESCREEN
			elif self.type == self.IS_1080:
				return video_width >= 1367 and video_width <= 1920 and video_height >= 768 and video_height <= 1440
			elif self.type == self.IS_720:
				return video_width >= 1025 and video_width <= 1366 and video_height >= 481 and video_height <= 768 or video_width >= 960 and video_height == 720
			elif self.type == self.IS_576:
				return video_width > 1 and video_width <= 1024 and video_height > 481 and video_height <= 578
			elif self.type == self.IS_480:
 				return video_width > 1 and video_width <= 1024 and video_height > 1 and video_height <= 480
			elif self.type == self.IS_4K:
				return video_height >= 1460
			elif self.type == self.PROGRESSIVE:
				return bool(self._getProgressive(info))
			elif self.type == self.IS_SDR:
				return info.getInfo(iServiceInformation.sGamma) == 0
			elif self.type == self.IS_HDR:
				return info.getInfo(iServiceInformation.sGamma) == 1
			elif self.type == self.IS_HDR10:
				return info.getInfo(iServiceInformation.sGamma) == 2
			elif self.type == self.IS_HLG:
				return info.getInfo(iServiceInformation.sGamma) == 3
			elif self.type == self.IS_VIDEO_MPEG2:
				return info.getInfo(iServiceInformation.sVideoType) == 0
			elif self.type == self.IS_VIDEO_AVC:
				return info.getInfo(iServiceInformation.sVideoType) == 1
			elif self.type == self.IS_VIDEO_HEVC:
				return info.getInfo(iServiceInformation.sVideoType) == 7
		return False
Esempio n. 5
0
 def getBoolean(self):
     service = self.source.service
     info = service and service.info()
     if not info:
         return False
     video_height = None
     video_aspect = None
     video_height = self._getVideoHeight(info)
     video_aspect = info.getInfo(iServiceInformation.sAspect)
     if self.type == self.HAS_TELETEXT:
         tpid = info.getInfo(iServiceInformation.sTXTPID)
         return tpid != -1
     elif self.type in (self.IS_MULTICHANNEL, self.AUDIO_STEREO):
         # FIXME. but currently iAudioTrackInfo doesn't provide more information.
         audio = service.audioTracks()
         if audio:
             n = audio.getNumberOfTracks()
             idx = 0
             while idx < n:
                 i = audio.getTrackInfo(idx)
                 description = i.getDescription()
                 if description in ("AC3", "AC-3", "DTS"):
                     if self.type == self.IS_MULTICHANNEL:
                         return True
                     elif self.type == self.AUDIO_STEREO:
                         return False
                 idx += 1
             if self.type == self.IS_MULTICHANNEL:
                 return False
             elif self.type == self.AUDIO_STEREO:
                 return True
         return False
     elif self.type == self.IS_CRYPTED:
         return info.getInfo(iServiceInformation.sIsCrypted) == 1
     elif self.type == self.IS_WIDESCREEN:
         return video_aspect in WIDESCREEN
     elif self.type == self.IS_NOT_WIDESCREEN:
         return video_aspect not in WIDESCREEN
     elif self.type == self.SUBSERVICES_AVAILABLE:
         return hasActiveSubservicesForCurrentChannel(':'.join(
             info.getInfoString(
                 iServiceInformation.sServiceref).split(':')[:11]))
     elif self.type == self.HAS_HBBTV:
         return info.getInfoString(iServiceInformation.sHBBTVUrl) != ""
     elif self.type == self.AUDIOTRACKS_AVAILABLE:
         audio = service.audioTracks()
         return bool(audio) and audio.getNumberOfTracks() > 1
     elif self.type == self.SUBTITLES_AVAILABLE:
         subtitle = service and service.subtitle()
         subtitlelist = subtitle and subtitle.getSubtitleList()
         if subtitlelist:
             return len(subtitlelist) > 0
         return False
     elif self.type == self.EDITMODE:
         return hasattr(self.source,
                        "editmode") and not not self.source.editmode
     elif self.type == self.IS_STREAM:
         return service.streamed() is not None
     elif self.type == self.IS_SD:
         return video_height < 720
     elif self.type == self.IS_HD:
         return video_height >= 720 and video_height < 2160
     elif self.type == self.IS_1080:
         return video_height > 1000 and video_height <= 1080
     elif self.type == self.IS_720:
         return video_height > 700 and video_height <= 720
     elif self.type == self.IS_576:
         return video_height > 500 and video_height <= 576
     elif self.type == self.IS_480:
         return video_height > 0 and video_height <= 480
     elif self.type == self.IS_4K:
         return video_height >= 1200
     elif self.PROGRESSIVE:
         return bool(self._getProgressive(info))
     return False
Esempio n. 6
0
	def getBoolean(self):
		service = self.source.service
		info = service and service.info()
		if not info:
			return False

		video_height = None
		video_width = None
		video_aspect = None
		if path.exists("/proc/stb/vmpeg/0/yres"):
			f = open("/proc/stb/vmpeg/0/yres", "r")
			try:
				video_height = int(f.read(),16)
			except:
				pass
			f.close()

		if path.exists("/proc/stb/vmpeg/0/xres"):
			f = open("/proc/stb/vmpeg/0/xres", "r")
			try:
				video_width = int(f.read(),16)
			except:
				pass
			f.close()

		if path.exists("/proc/stb/vmpeg/0/aspect"):
			f = open("/proc/stb/vmpeg/0/aspect", "r")
			try:
				video_aspect = int(f.read())
			except:
				pass
			f.close()

		if not video_height:
			video_height = int(info.getInfo(iServiceInformation.sVideoHeight))
		if not video_aspect:
			video_aspect = info.getInfo(iServiceInformation.sAspect)

		if self.type == self.HAS_TELETEXT:
			tpid = info.getInfo(iServiceInformation.sTXTPID)
			return tpid != -1
		elif self.type in (self.IS_MULTICHANNEL, self.AUDIO_STEREO):
			# FIXME. but currently iAudioTrackInfo doesn't provide more information.
			audio = service.audioTracks()
			if audio:
				n = audio.getNumberOfTracks()
				idx = 0
				while idx < n:
					i = audio.getTrackInfo(idx)
					description = i.getDescription()
					#if description in ("AC3", "AC-3", "AC3+", "DTS"):
					if description and description.split()[0] in ("AC3", "AC-3", "AC3+", "DTS"): # some audio description has 'audio' as additional value (e.g. 'AC-3 audio')
						if self.type == self.IS_MULTICHANNEL:
							return True
						elif self.type == self.AUDIO_STEREO:
							return False
					idx += 1
				if self.type == self.IS_MULTICHANNEL:
					return False
				elif self.type == self.AUDIO_STEREO:
					return True
			return False
		elif self.type == self.IS_CRYPTED:
			return info.getInfo(iServiceInformation.sIsCrypted) == 1
		elif self.type == self.IS_WIDESCREEN:
			return video_aspect in WIDESCREEN
		elif self.type == self.IS_NOT_WIDESCREEN:
			return video_aspect not in WIDESCREEN
		elif self.type == self.SUBSERVICES_AVAILABLE:
			return hasActiveSubservicesForCurrentChannel(':'.join(info.getInfoString(iServiceInformation.sServiceref).split(':')[:11]))
		elif self.type == self.HAS_HBBTV:
			return info.getInfoString(iServiceInformation.sHBBTVUrl) != ""
		elif self.type == self.AUDIOTRACKS_AVAILABLE:
			audio = service.audioTracks()
			return audio and audio.getNumberOfTracks() > 1
		elif self.type == self.SUBTITLES_AVAILABLE:
			subtitle = service and service.subtitle()
			subtitlelist = subtitle and subtitle.getSubtitleList()
			if subtitlelist:
				return len(subtitlelist) > 0
			return False
		elif self.type == self.EDITMODE:
			return hasattr(self.source, "editmode") and not not self.source.editmode
		elif self.type == self.IS_STREAM:
			return service.streamed() is not None
		elif self.type == self.IS_SD:
			return video_height < 720
		elif self.type == self.IS_HD:
			if info.getInfo(iServiceInformation.sGamma) > 0:
				return False
			else:
				return video_width >= 721 and video_width < 1980
		elif self.type == self.IS_1080:
			return video_height > 1000 and video_height <= 1080
		elif self.type == self.IS_720:
			return video_height > 700 and video_height <= 720
		elif self.type == self.IS_576:
			return video_height > 500 and video_height <= 576
		elif self.type == self.IS_480:
			return video_height > 0 and video_height <= 480
		elif self.type == self.IS_4K: 
			if info.getInfo(iServiceInformation.sGamma) > 0:
				return False
			else:
				return video_width > 2160 and video_width <= 3840
		elif self.type == self.IS_IPSTREAM:
			return service.streamed() is not None
		elif self.type == self.IS_SDR:
			return video_width > 2160 and video_width <= 3840 and info.getInfo(iServiceInformation.sGamma) == 0
		elif self.type == self.IS_HDR:
			return video_width > 2160 and video_width <= 3840 and info.getInfo(iServiceInformation.sGamma) == 1
		elif self.type == self.IS_HDR10:
			return video_width > 2160 and video_width <= 3840 and info.getInfo(iServiceInformation.sGamma) == 2
		elif self.type == self.IS_HLG:
			return video_width > 2160 and video_width <= 3840 and info.getInfo(iServiceInformation.sGamma) == 3
		elif self.type == self.IS_HDHDR:
			return video_width >= 721 and video_width < 1980 and info.getInfo(iServiceInformation.sGamma) > 0
		return False
Esempio n. 7
0
    def getBoolean(self):
        service = self.source.service
        info = service and service.info()
        if not info:
            return False
        video_height = None
        video_width = None
        video_aspect = None
        video_height = self._getVideoHeight(info)
        video_width = self._getVideoWidth(info)
        if path.exists('/proc/stb/vmpeg/0/aspect'):
            f = open('/proc/stb/vmpeg/0/aspect', 'r')
            try:
                video_aspect = int(f.read())
            except:
                pass

            f.close()
        if not video_height:
            video_height = int(info.getInfo(iServiceInformation.sVideoHeight))
        if not video_aspect:
            video_aspect = info.getInfo(iServiceInformation.sAspect)
        if self.type == self.HAS_TELETEXT:
            tpid = info.getInfo(iServiceInformation.sTXTPID)
            return tpid != -1
        if self.type in (self.IS_MULTICHANNEL, self.AUDIO_STEREO):
            audio = service.audioTracks()
            if audio:
                n = audio.getNumberOfTracks()
                idx = 0
                while idx < n:
                    i = audio.getTrackInfo(idx)
                    description = i.getDescription()
                    if description in ('AC3', 'AC-3', 'AC3+', 'DTS', 'DTS-HD'):
                        if self.type == self.IS_MULTICHANNEL:
                            return True
                        if self.type == self.AUDIO_STEREO:
                            return False
                    idx += 1

                if self.type == self.IS_MULTICHANNEL:
                    return False
                if self.type == self.AUDIO_STEREO:
                    return True
            return False
        if self.type == self.IS_CRYPTED:
            return info.getInfo(iServiceInformation.sIsCrypted) == 1
        if self.type == self.IS_WIDESCREEN:
            return video_aspect in WIDESCREEN
        if self.type == self.IS_NOT_WIDESCREEN:
            return video_aspect not in WIDESCREEN
        if self.type == self.SUBSERVICES_AVAILABLE:
            return hasActiveSubservicesForCurrentChannel(':'.join(
                info.getInfoString(
                    iServiceInformation.sServiceref).split(':')[:11]))
        if self.type == self.HAS_HBBTV:
            return info.getInfoString(iServiceInformation.sHBBTVUrl) != ''
        if self.type == self.AUDIOTRACKS_AVAILABLE:
            audio = service.audioTracks()
            return bool(audio) and audio.getNumberOfTracks() > 1
        if self.type == self.SUBTITLES_AVAILABLE:
            subtitle = service and service.subtitle()
            subtitlelist = subtitle and subtitle.getSubtitleList()
            if subtitlelist:
                return len(subtitlelist) > 0
            return False
        if self.type == self.EDITMODE:
            return hasattr(self.source,
                           'editmode') and not not self.source.editmode
        if self.type == self.IS_STREAM:
            return service.streamed() is not None
        if self.type == self.IS_SD:
            return video_height < 720
        if self.type == self.IS_HD:
            if info.getInfo(iServiceInformation.sGamma) > 0:
                return False
            else:
                return video_width >= 721 and video_width < 1980
        else:
            if self.type == self.IS_1080:
                return video_height > 1000 and video_height <= 1080
            if self.type == self.IS_720:
                return video_height > 700 and video_height <= 720
            if self.type == self.IS_576:
                return video_height > 500 and video_height <= 576
            if self.type == self.IS_480:
                return video_height > 0 and video_height <= 480
            if self.type == self.IS_4K:
                if info.getInfo(iServiceInformation.sGamma) > 0:
                    return False
                else:
                    return video_width > 2160 and video_width <= 3840
            else:
                if self.type == self.IS_IPSTREAM:
                    return service.streamed() is not None
                if self.type == self.IS_SDR:
                    return video_width > 2160 and video_width <= 3840 and info.getInfo(
                        iServiceInformation.sGamma) == 0
                if self.type == self.IS_HDR:
                    return video_width > 2160 and video_width <= 3840 and info.getInfo(
                        iServiceInformation.sGamma) == 1
                if self.type == self.IS_HDR10:
                    return video_width > 2160 and video_width <= 3840 and info.getInfo(
                        iServiceInformation.sGamma) == 2
                if self.type == self.IS_HLG:
                    return video_width > 2160 and video_width <= 3840 and info.getInfo(
                        iServiceInformation.sGamma) == 3
                if self.type == self.IS_HDHDR:
                    return video_width >= 721 and video_width < 1980 and info.getInfo(
                        iServiceInformation.sGamma) > 0
                if self.PROGRESSIVE:
                    return bool(self._getProgressive(info))
        return False
Esempio n. 8
0
 def getBoolean(self):
     service = self.source.service
     info = service and service.info()
     if info:
         if self.type == self.HAS_TELETEXT:
             tpid = info.getInfo(iServiceInformation.sTXTPID)
             return tpid != -1
         elif self.type in (self.IS_MULTICHANNEL, self.IS_STEREO):
             # FIXME. but currently iAudioTrackInfo doesn't provide more information.
             audio = service.audioTracks()
             if audio:
                 n = audio.getNumberOfTracks()
                 idx = 0
                 while idx < n:
                     i = audio.getTrackInfo(idx)
                     description = i.getDescription()
                     if description in ("AC3", "AC3+", "DTS", "DTS-HD",
                                        "AC-3"):
                         if self.type == self.IS_MULTICHANNEL:
                             return True
                         elif self.type == self.IS_STEREO:
                             return False
                     idx += 1
                 if self.type == self.IS_MULTICHANNEL:
                     return False
                 elif self.type == self.IS_STEREO:
                     return True
             return False
         elif self.type == self.IS_CRYPTED:
             return info.getInfo(iServiceInformation.sIsCrypted) == 1
         elif self.type == self.SUBSERVICES_AVAILABLE:
             return hasActiveSubservicesForCurrentChannel(':'.join(
                 info.getInfoString(
                     iServiceInformation.sServiceref).split(':')[:11]))
         elif self.type == self.HAS_HBBTV:
             return info.getInfoString(iServiceInformation.sHBBTVUrl) != ""
         elif self.type == self.AUDIOTRACKS_AVAILABLE:
             audio = service.audioTracks()
             return bool(audio) and audio.getNumberOfTracks() > 1
         elif self.type == self.SUBTITLES_AVAILABLE:
             subtitle = service and service.subtitle()
             subtitlelist = subtitle and subtitle.getSubtitleList()
             if subtitlelist:
                 return len(subtitlelist) > 0
             return False
         elif self.type == self.EDITMODE:
             return hasattr(self.source,
                            "editmode") and not not self.source.editmode
         elif self.type == self.IS_STREAM:
             return service.streamed() is not None
         elif self.isVideoService(info):
             if self.type == self.IS_SD:
                 return info.getInfo(
                     iServiceInformation.sVideoHeight) > 0 and info.getInfo(
                         iServiceInformation.sVideoHeight) < 720
             elif self.type == self.IS_HD:
                 return info.getInfo(
                     iServiceInformation.sVideoHeight
                 ) >= 720 and info.getInfo(
                     iServiceInformation.sVideoHeight) < 2100
             elif self.type == self.IS_SD_AND_WIDESCREEN:
                 return info.getInfo(
                     iServiceInformation.sVideoHeight) > 0 and info.getInfo(
                         iServiceInformation.sVideoHeight
                     ) < 720 and info.getInfo(
                         iServiceInformation.sAspect) in WIDESCREEN
             elif self.type == self.IS_SD_AND_NOT_WIDESCREEN:
                 return info.getInfo(
                     iServiceInformation.sVideoHeight) > 0 and info.getInfo(
                         iServiceInformation.sVideoHeight
                     ) < 720 and info.getInfo(
                         iServiceInformation.sAspect) not in WIDESCREEN
             elif self.type == self.IS_4K:
                 return info.getInfo(
                     iServiceInformation.sVideoHeight) >= 2100
             elif self.type == self.IS_1080:
                 return info.getInfo(
                     iServiceInformation.sVideoHeight
                 ) > 1000 and info.getInfo(
                     iServiceInformation.sVideoHeight) <= 1080
             elif self.type == self.IS_720:
                 return info.getInfo(
                     iServiceInformation.sVideoHeight) == 720
             elif self.type == self.IS_SDR:
                 return info.getInfo(iServiceInformation.sGamma) == 0
             elif self.type == self.IS_HDR:
                 return info.getInfo(iServiceInformation.sGamma) == 1
             elif self.type == self.IS_HDR10:
                 return info.getInfo(iServiceInformation.sGamma) == 2
             elif self.type == self.IS_HLG:
                 return info.getInfo(iServiceInformation.sGamma) == 3
             elif self.type == self.IS_WIDESCREEN:
                 return info.getInfo(
                     iServiceInformation.sAspect) in WIDESCREEN
             elif self.type == self.IS_NOT_WIDESCREEN:
                 return info.getInfo(
                     iServiceInformation.sAspect) not in WIDESCREEN
     return False