Register

Welcome to the RDI-Board Community.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


Donate Now Goal amount for this month: 100 EUR, Received: 100 EUR (100%)
Donate to support this site...

Results 1 to 4 of 4
  1. #1
    Senior Member Expert
    Join Date
    Aug 2005
    Posts
    3,261
    Posts Thanks / Likes

    Default CCPrioMaker enigma2-plugin - un plugin util.





  2. #2
    Silver Member Expert
    Join Date
    Sep 2005
    Location
    acasa
    Posts
    2,318
    Posts Thanks / Likes

    Default [email protected]

    E super ok acest plugin.Unde sant mai multe care alegem,cel selectat cu albastru banuiesc.Si inca ceva,mai are rost cccam prio sau vine sters,din moment ce alegem prio din acest plugin?

  3. #3
    Târnacopist Expert
    Join Date
    Dec 2005
    Location
    /home/satwien/
    Posts
    6,001
    Posts Thanks / Likes

    Default

    Foarte elegant scris codul in Python

    [PHP]# -*- coding: utf-8 -*-
    from Plugins.Plugin import PluginDescriptor
    from Components.ServiceEventTracker import ServiceEventTracker
    from Screens.Screen import Screen
    from Screens.MessageBox import MessageBox
    from Screens.ChoiceBox import ChoiceBox
    from enigma import iPlayableService, iServiceInformation, eTimer
    from ServiceReference import ServiceReference
    from Components.ConfigList import ConfigList, ConfigListScreen
    from os import path as os_path, rename
    from Components.config import config, ConfigSubsection, ConfigEnableDisable, KEY_LEFT, KEY_RIGHT, KEY_0, getConfigListEntry
    from Components.ActionMap import ActionMap
    from Components.Sources.StaticText import StaticText

    config.plugins.ccprio = ConfigSubsection()
    config.plugins.ccprio.autostart = ConfigEnableDisable(default=True)
    config.plugins.ccprio.onecaid = ConfigEnableDisable(default=False)
    config.plugins.ccprio.allcaid = ConfigEnableDisable(default=True)
    config.plugins.ccprio.askcaid = ConfigEnableDisable(default=True)
    config.plugins.ccprio.debug = ConfigEnableDisable(default=True)

    PRIOLIST_P = []
    ECMINFOPATH = "/tmp/ecm.info"
    PRIOPATH = "/etc/CCcam.prio"
    PRIOPATHBAK = "/etc/CCcam.prio.bak"
    PRIOLIST_D = []
    PRIOLIST_D.append("# Make with CCPrioMaker")
    #PRIOLIST_D.append("I: 09C4")
    PRIOLIST_D.append("P: 0D05:000000")
    PRIOLIST_D.append("P: 1702:000000")
    PRIOLIST_D.append("P: 1722:000000")
    PRIOLIST_D.append("P: 1833:000000")


    def cleanup_r(val):
    i = val.find('#')
    if i != -1:
    val = val[:i].strip()
    k = val.find(',')
    if k != -1:
    val = val[:k].strip()
    return val

    def readprio():
    if os_path.exists(PRIOPATH):
    file = open(PRIOPATH, "r")
    for line in file.readlines():
    if line.startswith("#"):
    continue
    line = line.upper()
    if line.startswith("P:"):
    val = cleanup_r(line.strip())
    sp = val.split(':')
    if len(sp) > 3:
    PRIOLIST_P.append("%s%s" % (sp[2].strip(), sp[3].strip()))
    file.close()
    else:
    file = open(PRIOPATH, 'w')
    for p in PRIOLIST_D:
    file.write(p + "\n")
    file.close()

    def cleanup(val):
    while val.find('\t') != -1:
    val = val.replace('\t',' ')
    while val.find(' ') != -1:
    val = val.replace(' ','')
    return val.strip()

    def readecminfo():
    caid = ""
    provid = ""
    print "[CCPrioMaker] search", ECMINFOPATH
    if os_path.exists(ECMINFOPATH):
    file = open(ECMINFOPATH, "r")
    for line in file.readlines():
    if line.startswith("caid:"):
    caid = line.split(":")
    if len(caid) == 2:
    caid = "%04X" % int(caid[1], 16)
    elif line.startswith("provid:"):
    provid = line.split(":")
    if len(provid) == 2:
    provid = "%06X" % int(provid[1], 16)
    elif caid != "" and provid != "":
    break
    file.close()
    return caid, provid

    class CCPrioMaker(Screen):
    def __init__(self, session):
    Screen.__init__(self, session)
    self.session = session
    self.ssid = None
    self.valssid = ""
    self.Provider = None
    self.ServiceName = None
    self.caidlist = None
    self.ecmTimer = eTimer()
    self.ecmTimer.timeout.get().append(self.parseEcmIn fo)
    self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
    { iPlayableService.evUpdatedEventInfo: self.__evUpdatedEventInfo,
    iPlayableService.evStopped: self.__evStopped})
    readprio()

    def __evStopped(self):
    self.ecmTimer.stop()

    def __evUpdatedEventInfo(self):
    self.ssid = None
    self.Provider = None
    self.ServiceName = None
    self.caidlist = None
    self.valssid = ""
    self.ecmTimer.stop()
    service = self.session.nav.getCurrentService()
    if service:
    info = service and service.info()
    if info:
    if info.getInfo(iServiceInformation.sIsCrypted):
    ssid = info.getInfo(iServiceInformation.sSID)
    if ssid:
    self.ssid = "%04X" % (ssid)
    self.Provider = info.getInfoString(iServiceInformation.sProvider)
    self.ServiceName = info.getName().replace('\xc2\x86', '').replace('\xc2\x87', '')
    self.caidlist = info.getInfoObject(iServiceInformation.sCAIDs) or None
    if self.caidlist:
    frontend = 0
    frontend = service.frontendInfo()
    if frontend:
    frontend = frontend.getAll(False).get("tuner_number")
    global ECMINFOPATH
    ECMINFOPATH = "/tmp/ecm%s.info" % (frontend)
    if config.plugins.ccprio.onecaid.value == False and len(self.caidlist) == 1:
    self.ecmTimer.stop()
    else:
    self.parseEcmInfo()
    else:
    self.ecmTimer.stop()


    def parseEcmInfo(self, caidlist=0):
    self.caid = readecminfo()
    if self.caid and len(self.caid) == 2 and len(self.caid[0])>0 and len(self.caid[1])>0 and self.caid[0] != "0000":
    caid = self.caid[0]
    provid = self.caid[1]
    self.valssid = "%s%s" % (provid, self.ssid)
    if os_path.exists(PRIOPATH) == False:
    global PRIOLIST_P
    PRIOLIST_P = []
    if self.valssid not in PRIOLIST_P:
    menu = []
    tmplist = []
    providval = "000000"
    for x in self.caidlist:
    m = "%04X" % (x)
    if m == caid:
    providval = provid
    menu.append(("Caid:" + str(m) + "\tProvid:" + providval, str(m)))
    tmplist.append(str(m))
    if caid not in tmplist:
    menu.append(("Caid:" + str(caid) + "\tProvid:" + providval, str(caid)))
    tmplist.append(str(caid))
    self.caidlist = tmplist
    if config.plugins.ccprio.askcaid.value == True:
    selection=tmplist.index(str(caid))
    mess = _("Provider") + " :" + self.Provider + " " + _("Service") + " :" + self.ServiceName
    if config.plugins.ccprio.allcaid.value == False:
    menu = [ ]
    menu.append(("Caid:" + str(caid) + "\tProvid:" + provid, str(caid)))
    selection=0
    mess += "\n All Caid:"
    for x in tmplist:
    mess += "%s " % (x)

    self.session.openWithCallback(self.parseEcmInfo_ba ck, ChoiceBox, title=mess, list=menu, selection=selection)
    else:
    self.parseEcmInfo_back((str(caid), str(caid)))
    else:
    self.ecmTimer.stop()
    else:
    self.ecmTimer.start(3000, True)

    def parseEcmInfo_back(self, caidval=0):
    if caidval:
    caid = caidval[1]
    provid = self.caid[1]
    if caid != "" and len(caid) == 4 and caid != "0000" and self.valssid != "":
    val = "P: %s:%s:%s" % (caid, provid, self.ssid)
    self.session.open(MessageBox, "%s\n\n%s\n%s\n\nPrio entry\n%s" % (_("Add"), _("Provider") + ": " + self.Provider, _("Service") + ": " + self.ServiceName, val), MessageBox.TYPE_INFO, 3)
    PRIOLIST_P.append(self.valssid)
    if os_path.exists(PRIOPATH):
    file = open(PRIOPATH, 'a+')
    else:
    file = open(PRIOPATH, 'w')
    for p in PRIOLIST_D:
    file.write(p + "\n")
    if config.plugins.ccprio.debug.value == True:
    file.write("# %s %s Caids:%s\n" % (_("Provider") + ":" + self.Provider, _("Service") + ":" + self.ServiceName, self.caidlist))
    file.write("%s\n" % (val))
    file.close()


    class Ccprio_Setup(Screen, ConfigListScreen):
    def __init__(self, session):
    Screen.__init__(self, session)
    self.skinName = ["Setup" ]
    self.setup_title = _("Settings")
    self.onChangedEntry = [ ]

    self["actions"] = ActionMap(["SetupActions"],
    {
    "cancel": self.keyCancel,
    "save": self.keySave,
    "ok": self.keySave,
    }, -2)

    self["key_red"] = StaticText(_("Cancel"))
    self["key_green"] = StaticText(_("OK"))

    list = []
    list.append(getConfigListEntry(_("CCPrioMaker autostart"), config.plugins.ccprio.autostart))
    list.append(getConfigListEntry(_("Ask for the selection caid"), config.plugins.ccprio.askcaid))
    list.append(getConfigListEntry(_("Ask all caid"), config.plugins.ccprio.allcaid))
    list.append(getConfigListEntry(_("Editing one caid"), config.plugins.ccprio.onecaid))
    list.append(getConfigListEntry(_("Write-Debug"), config.plugins.ccprio.debug))
    ConfigListScreen.__init__(self, list, session = session, on_change = self.changedEntry)
    self.onLayoutFinish.append(self.layoutFinished)

    def layoutFinished(self):
    self.setTitle(self.setup_title)

    def keyLeft(self):
    ConfigListScreen.keyLeft(self)

    def keyRight(self):
    ConfigListScreen.keyRight(self)

    def changedEntry(self):
    for x in self.onChangedEntry:
    x()

    def getCurrentEntry(self):
    return self["config"].getCurrent()[0]

    def getCurrentValue(self):
    return str(self["config"].getCurrent()[1].getText())

    def createSummary(self):
    from Screens.Setup import SetupSummary
    return SetupSummary

    def main(session, **kwargs):
    session.open(Ccprio_Setup)

    CCPrioMaker_session = None

    def autostart(reason, **kwargs):
    if config.plugins.ccprio.autostart.value == True:
    global CCPrioMaker_session
    CCPrioMaker_session = CCPrioMaker(kwargs["session"])

    def Plugins(**kwargs):
    return [PluginDescriptor(where=PluginDescriptor.WHERE_SESS IONSTART,fnc=autostart),
    PluginDescriptor(name=_("CCPrioMaker"), description=_("CCPrioMaker autostart"), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)]
    [/PHP]

  4. #4
    Member Mentor
    RDI - Board Default Avatar

    Join Date
    Dec 2007
    Location
    Targu Jiu
    Posts
    532
    Posts Thanks / Likes

    Default

    L-am testat. Imi pare o porcariutza! L-am sters.
    CCcam prio...il lasi acolo pentru ca asta....tot acolo scrie fisierele prio!

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Back to Top