Jump to content


Photo

Stream Information on Converters

stream converter serviceinfo

  • Please log in to reply
2 replies to this topic

#1 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 19 November 2013 - 18:44

Hello,


Here is a patch that enables IsStream boolean flag on ServiceInfo Converter.

We can use it eg to enable/disable some parts of the skin when watching streams.
--- a/lib/python/Components/Converter/ServiceInfo.py
+++ b/lib/python/Components/Converter/ServiceInfo.py
@@ -26,6 +26,7 @@ class ServiceInfo(Converter, object):
 	AUDIOTRACKS_AVAILABLE = 18
 	SUBTITLES_AVAILABLE = 19
 	EDITMODE = 20
+	IS_STREAM = 21
 
 	def __init__(self, type):
 		Converter.__init__(self, type)
@@ -51,6 +52,7 @@ class ServiceInfo(Converter, object):
 				"AudioTracksAvailable": (self.AUDIOTRACKS_AVAILABLE, (iPlayableService.evUpdatedInfo,)),
 				"SubtitlesAvailable": (self.SUBTITLES_AVAILABLE, (iPlayableService.evUpdatedInfo,)),
 				"Editmode": (self.EDITMODE, (iPlayableService.evUpdatedInfo,)),
+				"IsStream": (self.IS_STREAM, (iPlayableService.evUpdatedInfo,)),
 			}[type]
 
 	def getServiceInfoString(self, info, what, convert = lambda x: "%d" % x):
@@ -104,6 +106,8 @@ class ServiceInfo(Converter, object):
 			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
 		return False
 
 	boolean = property(getBoolean)

Attached Files


Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Stream Information on Converters #2 littlesat

  • PLi® Core member
  • 57,467 posts

+708
Excellent

Posted 19 November 2013 - 18:59

Do we really need the is not None?

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Stream Information on Converters #3 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 19 November 2013 - 19:05

Do we really need the is not None?

I think i was gettting an error if returning service.streamed() (something like is proxy of swing ...)

But the following worked:
if service.streamed():
    return True
return False
I prefer is Not None in order to do it in oneliner.

Edited by athoik, 19 November 2013 - 19:06.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916



Also tagged with one or more of these keywords: stream, converter, serviceinfo

2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users