←  [EN] Third-Party Development

Forums

»

Detect current working channel on the system

's foto Mouneer 11 jun 2016

Hi All,

 

I wonder if it is applicable to get information about the current working channel on the system. Also, can I add an event handler when channel is changed?

Citeren

's foto mx3L 12 jun 2016

1. You can get EventInfo of current event from session globals, at least that's how I do it.

event = self.session.screen["Event_Now"].getEvent()

You can look how it's used for example in enigma2 sources in EventView.py

 

2. Yes, you can create ServiceEventTracker, register it to your screen and map event like evStart to trigger your function when new event starts:

        self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
        {
            iPlayableService.evStart: self.__serviceChanged,
        })

For more examples just look in enigma2 sources for ServiceEventTracker.

Citeren

's foto Mouneer 12 jun 2016

Thanks mx3L. Regarding (1),

event = self.session.screen["Event_Now"].getEvent()

this always gives me None. I investigated about this and tried many things with no luck. Any Idea?

Citeren

's foto Lost in Space 12 jun 2016

What a great community of OpenSource developers you are here, helping out each other ...

 

He asked about infos on he channel so you probably need to know first which one is running.

import NavigationInstance
cur_ref = NavigationInstance.instance.getCurrentlyPlayingServiceReference()
if cur_ref is not None:                           
   cur_serv=cur_ref.toString()
   print cur_serv

                        
 


Veranderd door gutemine, 12 juni 2016 - 21:19
Citeren

's foto WanWizard 12 jun 2016

Behave yourself, there is no need to be sarcastic.

 

mx3L might as well have missed the first part of the question. There is no indication whatsoever that he did that on purpose.

 

Without that comment perhaps people would mistakenly have believed you were part of that great community too. On the plus side, good to see you're not falling out of your usual role...

Citeren

's foto Mouneer 12 jun 2016

Great support guys. Thank you all. I succeeded now to get the current playing channel. I need now to get more info about it. I managed to get its number using 

cur_ref.getChannelNum()

I also need to get its name, frequency , and other descriptive info.

 

 I tried 

cur_ref.getName()

and 

cur_ref.getData()

but unfortunately both return empty string. What am I missing? I appreciate your help very much :)


Veranderd door Mouneer, 12 juni 2016 - 23:37
Citeren

's foto mx3L 13 jun 2016

You're right guys I somehow misinterpreted the question, thanks for correction.

Citeren

's foto Rob van der Does 13 jun 2016

On the plus side, good to see you're not falling out of your usual role...

LOL, she's always easy to recognize :)

Citeren

's foto Mouneer 13 jun 2016

Honestly, it's a great honor for me to have you all at my first post at OpenPLI forum. Pleased to meet you, guys.  :) 
 

Back to my question:
 

I want to get all info about the currently playing service. getName() returns empty string and getData() needs arguments. And originally I don't know whether these methods give my info like channel name, satalite, frequency, Polarization, FEC, Symbol Rate and finally how long has the channel been watched at the time of my inquery - or not. I don't know from where to start. I indeed need all your help, guys. 

Waiting your valuable replies. :)


Veranderd door Mouneer, 13 juni 2016 - 09:45
Citeren

's foto Mouneer 14 jun 2016

Any tips/hints guys?

Citeren

's foto mx3L 14 jun 2016

I don't have direct answer to your question since I don't have experience with this, but I would try to look for keywords in source files of enigma2, then look in most probable source files how it's used.

marko@ openpli-enigma2 $grep -Irsl getData lib/
lib/python/Screens/NetworkSetup.py
lib/python/Screens/ChannelSelection.py
lib/python/enigma.py
lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py
lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py
lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py
lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
lib/python/Plugins/Extensions/MediaPlayer/plugin.py
lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py
lib/python/Plugins/Extensions/PicturePlayer/ui.py
lib/python/Components/HdmiCec.py
lib/python/enigma_python.cpp
lib/gdi/picload.h
lib/gdi/picload.cpp
lib/service/servicedvbstream.cpp
lib/service/servicedvbrecord.cpp
lib/service/iservice.h
lib/service/servicets.cpp
lib/service/servicemp3.cpp
lib/service/servicewebts.cpp
lib/service/servicedvb.cpp
lib/network/xmlrpc.h
lib/network/xmlrpc.cpp
lib/driver/hdmi_cec.h
lib/driver/hdmi_cec.cpp
lib/dvb/frontend.cpp
lib/dvb/pmt.h
lib/dvb/frontend.h
lib/dvb/idvb.h
lib/dvb/dvb.cpp
lib/dvb/fbc.cpp
lib/dvb/pmt.cpp
lib/dvb/sec.cpp

So I guess how to use getData on channel could be in ChannelSelection.py?

 

For polarization keyword:

marko@ openpli-enigma2 $grep -Iirsl polarization lib/
lib/python/Screens/Dish.py
lib/python/Screens/ScanSetup.py
lib/python/Screens/ServiceInfo.py
lib/python/Tools/Transponder.py
lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py
lib/python/Plugins/SystemPlugins/Satfinder/plugin.py
lib/python/Components/Converter/TransponderInfo.py
lib/python/Components/Converter/PliExtraInfo.py
lib/python/Components/NimManager.py
lib/python/python_helpers.cpp
lib/dvb/frontend.cpp
lib/dvb/idvb.h
lib/dvb/fastscan.h
lib/dvb/fastscan.cpp
lib/dvb/frontendparms.h
lib/dvb/db.cpp
lib/dvb/frontendparms.cpp

So Transporder.py or ServiceInfo.py for polarization, etc...

Citeren

's foto Mouneer 14 jun 2016

great tip bro. I will try it. Thank you :)

Citeren