From: Andreas Monzner Date: Wed, 19 Jul 2006 18:19:48 +0000 (+0000) Subject: add ability to choose "Multiple service support (auto/no/yes)" in Ci Setup X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=0d8132d3512dbf77d817aa8fb6684384155b642e add ability to choose "Multiple service support (auto/no/yes)" in Ci Setup --- diff --git a/data/keymap.xml b/data/keymap.xml index 3839715..bf5e424 100644 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -383,6 +383,11 @@ + + + + + diff --git a/data/skin_default.xml b/data/skin_default.xml index 9bb9e86..041fb5c 100644 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -92,8 +92,8 @@ - - + + diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp index 9c4e0ac..f646262 100644 --- a/lib/dvb_ci/dvbci.cpp +++ b/lib/dvb_ci/dvbci.cpp @@ -6,6 +6,7 @@ #include #include +#include // access to python config #include #include #include @@ -217,6 +218,24 @@ void eDVBCIInterfaces::ciRemoved(eDVBCISlot *slot) } } +static bool canDescrambleMultipleServices(int slotid) +{ + char configStr[255]; + snprintf(configStr, 255, "config.ci%d.canDescrambleMultipleServices", slotid); + std::string str; + ePythonConfigQuery::getConfigValue(configStr, str); + eDebug("str is %s", str.empty()?"empty" : str.c_str()); + if ( str == "auto" ) + { + std::string appname = eDVBCI_UI::getInstance()->getAppName(slotid); + if (appname.find("AlphaCrypt") != std::string::npos) + return true; + } + else if (str == "yes") + return true; + return false; +} + void eDVBCIInterfaces::recheckPMTHandlers() { // eDebug("recheckPMTHAndlers()"); @@ -278,7 +297,6 @@ void eDVBCIInterfaces::recheckPMTHandlers() { if ( tmp->cislot ) { - bool canHandleMultipleServices=false; eServiceReferenceDVB ref2; tmp->pmthandler->getServiceReference(ref2); eDVBChannelID s1, s2; @@ -286,15 +304,8 @@ void eDVBCIInterfaces::recheckPMTHandlers() { ref.getChannelID(s1); ref2.getChannelID(s2); - // FIXME .. build a "ci can handle multiple services" config entry - // Yes / No / Auto - if ( eDVBCI_UI::getInstance()->getAppName(ci_it->getSlotID()) == "AlphaCrypt" ) - { - canHandleMultipleServices = true; - eDebug("Alphacrypt can handle multiple services"); - } } - if (ref == ref2 || (s1 == s2 && canHandleMultipleServices) ) + if (ref == ref2 || (s1 == s2 && canDescrambleMultipleServices(ci_it->getSlotID()))) { it->cislot = tmp->cislot; ++it->cislot->use_count; diff --git a/lib/python/Screens/Ci.py b/lib/python/Screens/Ci.py index b3653d2..b516ec7 100644 --- a/lib/python/Screens/Ci.py +++ b/lib/python/Screens/Ci.py @@ -15,6 +15,13 @@ from enigma import eTimer, eDVBCI_UI, eListboxPythonStringContent, eListboxPytho TYPE_MENU = 0 TYPE_CONFIG = 1 +MAX_NUM_CI = 4 + +def InitCiConfig(): + config.ci = [ ] + for slot in range(MAX_NUM_CI): + config.ci.append(ConfigSubsection()) + config.ci[slot].canDescrambleMultipleServices = configElement("config.ci%d.canDescrambleMultipleServices"%(slot), configSelection, 0, (("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes")))) class CiMmi(Screen): def __init__(self, session, slotid, action): @@ -264,26 +271,42 @@ class CiSelection(Screen): def __init__(self, session): Screen.__init__(self, session) - self["actions"] = ActionMap(["OkCancelActions"], + self["actions"] = ActionMap(["OkCancelActions", "CiSelectionActions"], { + "left": self.keyLeft, + "right": self.keyLeft, "ok": self.okbuttonClick, "cancel": self.cancel - }) + },-1) self.dlg = None self.state = { } self.list = [ ] - for slot in range(4): + for slot in range(MAX_NUM_CI): state = eDVBCI_UI.getInstance().getState(slot) - self.appendEntries(slot, state) # FIXME more than one CI - CiHandler.registerCIMessageHandler(slot, self.ciStateChanged) + if state != -1: + self.appendEntries(slot, state) + CiHandler.registerCIMessageHandler(slot, self.ciStateChanged) - menuList = MenuList(list) + menuList = ConfigList(list) menuList.list = self.list menuList.l.setList(self.list) self["entries"] = menuList + def keyConfigEntry(self, key): + try: + self["entries"].handleKey(key) + self["entries"].getCurrent()[1].save() + except: + pass + + def keyLeft(self): + self.keyConfigEntry(config.key["prevElement"]) + + def keyRight(self): + self.keyConfigEntry(config.key["nextElement"]) + def appendEntries(self, slot, state): self.state[slot] = state self.list.append( (_("Reset"), 0, slot) ) @@ -298,6 +321,8 @@ class CiSelection(Screen): appname = eDVBCI_UI.getInstance().getAppName(slot) self.list.append( (appname, 2, slot) ) + self.list.append(getConfigListEntry(_("Multiple service support"), config.ci[slot].canDescrambleMultipleServices)) + def updateState(self, slot): state = eDVBCI_UI.getInstance().getState(slot) self.state[slot] = state @@ -337,7 +362,7 @@ class CiSelection(Screen): def okbuttonClick(self): cur = self["entries"].getCurrent() - if cur: + if cur and len(cur) > 2: action = cur[1] slot = cur[2] if action == 0: #reset diff --git a/mytest.py b/mytest.py index db720a6..aa63567 100644 --- a/mytest.py +++ b/mytest.py @@ -484,6 +484,9 @@ Components.RFmod.InitRFmod() import Components.NimManager +import Screens.Ci +Screens.Ci.InitCiConfig() + # first, setup a screen try: runScreenTest() diff --git a/po/de.po b/po/de.po index 7ae25b4..dd7ac55 100644 --- a/po/de.po +++ b/po/de.po @@ -783,6 +783,10 @@ msgstr "Filmauswahl" msgid "Multi EPG" msgstr "Multi-EPG" +#: ../lib/python/Screens/Ci.py:324 +msgid "Multiple service support" +msgstr "Kann mehrere Sender entschlüsseln" + #: ../lib/python/Screens/ScanSetup.py:352 msgid "Multisat" msgstr "Multisat" diff --git a/po/enigma2.pot b/po/enigma2.pot index 5dd5a15..652e73d 100644 --- a/po/enigma2.pot +++ b/po/enigma2.pot @@ -756,6 +756,10 @@ msgstr "" msgid "Multi EPG" msgstr "" +#: ../lib/python/Screens/Ci.py:324 +msgid "Multiple service support" +msgstr "" + #: ../lib/python/Screens/ScanSetup.py:352 msgid "Multisat" msgstr ""