예제 #1
0
    def __init__(self, session, showExtentionMenuOption):
        Screen.__init__(self, session)

        self.setup_title = _("Softcam setup")
        self.setTitle(self.setup_title)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "cancel": self.cancel,
                "green": self.save,
                "red": self.cancel,
                "blue": self.ppanelShortcut,
            }, -1)

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=session)

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')

        self.ecminfo = GetEcmInfo()
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        self["info"] = ScrollLabel("".join(ecmInfo))
        self.EcmInfoPollTimer = eTimer()
        self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
        self.EcmInfoPollTimer.start(1000)

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()

        self.softcams = ConfigSelection(choices=softcams)
        self.softcams.value = self.softcam.current()

        self.list.append(getConfigListEntry(_("Select Softcam"),
                                            self.softcams))
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        self.list.append(
            getConfigListEntry(_("Restart softcam"),
                               ConfigAction(self.restart, "s")))
        if cardservers:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))

        if showExtentionMenuOption:
            self.list.append(
                getConfigListEntry(_("Show softcam setup in extensions menu"),
                                   config.misc.softcam_setup.extension_menu))

        self["key_red"] = Label(_("Cancel"))
        self["key_green"] = Label(_("OK"))
        self["key_blue"] = Label(_("Info"))
예제 #2
0
    def __init__(self, session, showExtentionMenuOption):
        Screen.__init__(self, session)

        self.setup_title = _("Softcam startup")

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "cancel": self.cancel,
                "red": self.cancel,
                "green": self.save,
            }, -1)

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=session)

        self.initd()

        self.softcam1 = CamControl('softcam')
        self.softcam2 = CamControl('cardserver')

        softcamlistprimary = self.softcam1.getList()
        softcamlistsecondary = self.softcam2.getList()

        self.softcamlistprimary = ConfigSelection(choices=softcamlistprimary)
        self.softcamlistprimary.value = self.softcam1.current()
        self.softcamlistsecondary = ConfigSelection(
            choices=softcamlistsecondary)
        self.softcamlistsecondary.value = self.softcam2.current()

        self.list.append(
            getConfigListEntry(_("Select primary softcam"),
                               self.softcamlistprimary))
        self.list.append(
            getConfigListEntry(_("Select secondary softcam"),
                               self.softcamlistsecondary))
        self.list.append(
            getConfigListEntry(_("Restart primary softcam"),
                               ConfigAction(self.restart, "s")))
        self.list.append(
            getConfigListEntry(_("Restart secondary softcam"),
                               ConfigAction(self.restart, "c")))
        self.list.append(
            getConfigListEntry(_("Restart both"),
                               ConfigAction(self.restart, "sc")))

        if showExtentionMenuOption:
            self.list.append(
                getConfigListEntry(
                    _("Show softcam startup in extensions menu"),
                    config.misc.softcam_startup.extension_menu))

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

        self.onLayoutFinish.append(self.layoutFinished)
예제 #3
0
	def __init__(self, session, showExtentionMenuOption):
		Screen.__init__(self, session)

		self.setup_title = _("Softcam setup")

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "CiSelectionActions"],
			{
				"cancel": self.cancel,
				"green": self.save,
				"red": self.cancel,
				"blue": self.ppanelShortcut,
			},-1)

		self.list = [ ]
		ConfigListScreen.__init__(self, self.list, session = session)

		self.softcam = CamControl('softcam')
		self.cardserver = CamControl('cardserver')

		self.ecminfo = GetEcmInfo()
		(newEcmFound, ecmInfo) = self.ecminfo.getEcm()
		self["info"] = Label()
		self.ecm()
		self.EcmInfoPollTimer = eTimer()
		self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
		self.EcmInfoPollTimer.start(1000)

		softcams = self.softcam.getList()
		cardservers = self.cardserver.getList()

		self.softcams = ConfigSelection(choices = softcams)
		self.softcams.value = self.softcam.current()

		self.list.append(getConfigListEntry(_("Select Softcam"), self.softcams))
		if cardservers:
			self.cardservers = ConfigSelection(choices = cardservers)
			self.cardservers.value = self.cardserver.current()
			self.list.append(getConfigListEntry(_("Select Card Server"), self.cardservers))

		self.list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
		if cardservers: 
			self.list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c"))) 
			self.list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))

		if showExtentionMenuOption:
			self.list.append(getConfigListEntry(_("Show softcam setup in extensions menu"), config.misc.softcam_setup.extension_menu))

		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("OK"))
		self["key_blue"] = Label(_("Info"))

		self.onLayoutFinish.append(self.layoutFinished)
예제 #4
0
    def __init__(self, session):
        Screen.__init__(self, session)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "left": self.keyLeft,
                "right": self.keyRight,
                "cancel": self.cancel,
                "ok": self.ok,
                "green": self.save,
                "red": self.cancel,
                "blue": self.blue,
            }, -1)

        self.list = []

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')

        menuList = ConfigList(self.list)
        menuList.list = self.list
        menuList.l.setList(self.list)
        self["entries"] = menuList

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()

        self.softcams = ConfigSelection(choices=softcams)
        self.softcams.value = self.softcam.current()

        self.list.append(getConfigListEntry(_("Select Softcam"),
                                            self.softcams))
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        self.list.append(
            getConfigListEntry(_("Restart softcam"),
                               ConfigAction(self.restart, "s")))
        if cardservers:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))

        self["key_red"] = Label(_("Cancel"))
        self["key_green"] = Label(_("OK"))
        self["key_blue"] = Label(_("ECM Info's"))
예제 #5
0
 def __init__(self, session):
     Screen.__init__(self, session)
     if config.plugins.autoCamSetup.show_ecm.value:
         self.skin = EcmCamsetupSelection
     else:
         self.skin = NoEcmCamsetupSelection
     self['actions'] = ActionMap(['OkCancelActions',
      'ColorActions',
      'EPGSelectActions',
      'CiSelectionActions'], {'left': self.keyLeft,
      'right': self.keyRight,
      'cancel': self.cancel,
      'ok': self.ok,
      'green': self.save,
      'red': self.cancel,
      'menu': self.keyMenu,
      'info': self.ppanelShortcut}, -1)
     self.setTitle(_('Egami Softcam Setup'))
     self.prev_mtime = 0
     self.prev_mtime1 = 0
     if config.plugins.autoCamSetup.show_ecm.value:
         self['ecm'] = ScrollLabel()
         self['ecm1'] = ScrollLabel()
         self.EcmTimer = eTimer()
         self.EcmTimer1 = eTimer()
         self.EcmTimer.callback.append(self.showEcmInfo)
         self.EcmTimer1.callback.append(self.showEcmInfo1)
         self.EcmTimer.start(50, True)
         self.EcmTimer1.start(50, True)
     self.softcam = CamControl('softcam')
     self.cardserver = CamControl('cardserver')
     self['entries'] = ConfigList([])
     self.initConfig()
     self.createConfig()
     self['key_red'] = Label(_('Cancel'))
     self['key_green'] = Label(_('OK'))
     self['cam'] = Label()
     self['server'] = Label()
     self['info_key'] = Pixmap()
     self['info_key'].hide()
     if InstallPPanel:
         ppanelFileName = '/etc/ppanels/' + self.softcams.value + '.xml'
         if os.path.isfile(ppanelFileName):
             self['info_key'].show()
     self.nameSoftcam()
     self.nameCardserver()
     self.onClose.append(self.__onClose)
예제 #6
0
    def __init__(self, session):
        Screen.__init__(self, session)

        self["actions"] = ActionMap(
            [
                "OkCancelActions", "ColorActions", "EPGSelectActions",
                "CiSelectionActions"
            ], {
                "left": self.keyLeft,
                "right": self.keyRight,
                "cancel": self.cancel,
                "ok": self.ok,
                "green": self.save,
                "red": self.cancel,
                "blue": self.bluekey,
                "menu": self.keyMenu,
            }, -1)

        self.setTitle(_("Softcam Setup"))
        if config.plugins.SoftcamMenu.showEcm.value:
            self["text"] = ScrollLabel()
            self["text1"] = ScrollLabel()
            self.timer = eTimer()
            self.timer.callback.append(self.listServices)
            self.timer.callback.append(self.listServices1)
            self.timer.start(50, True)

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')
        self.blueAction = REFRESH

        self["entries"] = ConfigList([])
        self.initConfig()
        self.createConfig()

        self["key_red"] = Label(_("Cancel"))
        self["key_green"] = Label(_("OK"))
        self["key_blue"] = Label(_("Refresh"))
        self["cam"] = Label()
        self["server"] = Label()

        self.nameSoftcam()
        self.nameCardserver()
        self.onClose.append(self.__onClose)
예제 #7
0
파일: Sc.py 프로젝트: henrylicious/test
	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "CiSelectionActions"],
			{
				"left": self.keyLeft,
				"right": self.keyRight,
				"cancel": self.cancel,
				"ok": self.ok,
				"green": self.save,
				"red": self.cancel,
				"blue": self.blue,
			},-1)

		self.list = [ ]

		self.softcam = CamControl('softcam')
		self.cardserver = CamControl('cardserver')

		menuList = ConfigList(self.list)
		menuList.list = self.list
		menuList.l.setList(self.list)
		self["entries"] = menuList

		softcams = self.softcam.getList()
		cardservers = self.cardserver.getList()

		self.softcams = ConfigSelection(choices = softcams)
		self.softcams.value = self.softcam.current()

		self.list.append(getConfigListEntry(_("Select Softcam"), self.softcams))
		if cardservers:
			self.cardservers = ConfigSelection(choices = cardservers)
			self.cardservers.value = self.cardserver.current()
			self.list.append(getConfigListEntry(_("Select Card Server"), self.cardservers))

		self.list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
		if cardservers:
			self.list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c")))
			self.list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))

		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("OK"))
		self["key_blue"] = Label(_("ECM Info's"))
예제 #8
0
	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "EPGSelectActions", "CiSelectionActions"],
			{
				"left": self.keyLeft,
				"right": self.keyRight,
				"cancel": self.cancel,
				"ok": self.ok,
				"green": self.save,
				"red": self.cancel,
				"blue": self.bluekey,
				"menu": self.keyMenu,
			},-1)
			
		self.setTitle(_("Softcam Setup"))
		if config.plugins.SoftcamMenu.showEcm.value:
			self["text"] = ScrollLabel()
			self["text1"] = ScrollLabel()
			self.timer = eTimer()
			self.timer.callback.append(self.listServices)
			self.timer.callback.append(self.listServices1)
			self.timer.start(50, True)
			
		self.softcam = CamControl('softcam')
		self.cardserver = CamControl('cardserver')
		self.blueAction = REFRESH
		
		self["entries"] = ConfigList([])
		self.initConfig()
		self.createConfig()
		
		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("OK"))
		self["key_blue"] = Label(_("Refresh"))
		self["cam"] = Label()
		self["server"] = Label()
		
		self.nameSoftcam()
		self.nameCardserver()
		self.onClose.append(self.__onClose)
예제 #9
0
	def __init__(self, session, showExtentionMenuOption):
		Screen.__init__(self, session)

		self.setup_title = _("Softcam startup")

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "CiSelectionActions"],
			{
				"cancel": self.cancel,
				"red": self.cancel,
				"green": self.save,
			},-1)

		self.list = [ ]
		ConfigListScreen.__init__(self, self.list, session = session)

		self.initd()

		self.softcam1 = CamControl('softcam')
		self.softcam2 = CamControl('cardserver')

		softcamlistprimary = self.softcam1.getList()
		softcamlistsecondary = self.softcam2.getList()

		self.softcamlistprimary = ConfigSelection(choices = softcamlistprimary)
		self.softcamlistprimary.value = self.softcam1.current()
		self.softcamlistsecondary = ConfigSelection(choices = softcamlistsecondary)
		self.softcamlistsecondary.value = self.softcam2.current()

		self.list.append(getConfigListEntry(_("Select primary softcam"), self.softcamlistprimary))
		self.list.append(getConfigListEntry(_("Select secondary softcam"), self.softcamlistsecondary))
		self.list.append(getConfigListEntry(_("Restart primary softcam"), ConfigAction(self.restart, "s")))
		self.list.append(getConfigListEntry(_("Restart secondary softcam"), ConfigAction(self.restart, "c"))) 
		self.list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))

		if showExtentionMenuOption:
			self.list.append(getConfigListEntry(_("Show softcam startup in extensions menu"), config.misc.softcam_startup.extension_menu))

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

		self.onLayoutFinish.append(self.layoutFinished)
예제 #10
0
class CamsetupSelection(Screen):

    def __init__(self, session):
        Screen.__init__(self, session)
        if config.plugins.autoCamSetup.show_ecm.value:
            self.skin = EcmCamsetupSelection
        else:
            self.skin = NoEcmCamsetupSelection
        self['actions'] = ActionMap(['OkCancelActions',
         'ColorActions',
         'EPGSelectActions',
         'CiSelectionActions'], {'left': self.keyLeft,
         'right': self.keyRight,
         'cancel': self.cancel,
         'ok': self.ok,
         'green': self.save,
         'red': self.cancel,
         'menu': self.keyMenu,
         'info': self.ppanelShortcut}, -1)
        self.setTitle(_('Egami Softcam Setup'))
        self.prev_mtime = 0
        self.prev_mtime1 = 0
        if config.plugins.autoCamSetup.show_ecm.value:
            self['ecm'] = ScrollLabel()
            self['ecm1'] = ScrollLabel()
            self.EcmTimer = eTimer()
            self.EcmTimer1 = eTimer()
            self.EcmTimer.callback.append(self.showEcmInfo)
            self.EcmTimer1.callback.append(self.showEcmInfo1)
            self.EcmTimer.start(50, True)
            self.EcmTimer1.start(50, True)
        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')
        self['entries'] = ConfigList([])
        self.initConfig()
        self.createConfig()
        self['key_red'] = Label(_('Cancel'))
        self['key_green'] = Label(_('OK'))
        self['cam'] = Label()
        self['server'] = Label()
        self['info_key'] = Pixmap()
        self['info_key'].hide()
        if InstallPPanel:
            ppanelFileName = '/etc/ppanels/' + self.softcams.value + '.xml'
            if os.path.isfile(ppanelFileName):
                self['info_key'].show()
        self.nameSoftcam()
        self.nameCardserver()
        self.onClose.append(self.__onClose)

    def __onClose(self):
        config.plugins.autoCamSetup.autocam.enabled.save()
        if config.plugins.autoCamSetup.autocam.enabled.value:
            config.plugins.autoCamSetup.autocam.defcam.value = self.softcams.value
            config.plugins.autoCamSetup.autocam.defcam.save()
        else:
            config.plugins.autoCamSetup.autocam.defcam.cancel()

    def initConfig(self):
        self.softcams = ConfigSelection(choices=self.softcam.getList())
        self.cfg_autocam = getConfigListEntry(_('Switch auto-camd'), config.plugins.autoCamSetup.autocam.enabled)
        self.cfg_autocam_setup = getConfigListEntry(_('Additional Settings Auto-Camd'), ConfigAction(self.AdditionalsetupAutoCam, None))
        self.cfg_aclsetup = getConfigListEntry(_('Setup Auto-Camd List'), ConfigAction(self.setupAutoCamList, None))

    def createConfig(self):
        cardservers = self.cardserver.getList()
        list = []
        if config.plugins.autoCamSetup.restart_choice.value == '1':
            list.append(getConfigListEntry(_('Restart Egami Softcam'), ConfigAction(self.restart, 's')))
            if cardservers:
                list.append(getConfigListEntry(_('Restart Egami Cardserver'), ConfigAction(self.restart, 'c')))
                list.append(getConfigListEntry(_('Restart Both'), ConfigAction(self.restart, 'sc')))
        elif config.plugins.autoCamSetup.restart_choice.value == '2':
            if cardservers:
                list.append(getConfigListEntry(_('Restart Egami Cardserver'), ConfigAction(self.restart, 'c')))
            list.append(getConfigListEntry(_('Restart Egami Softcam'), ConfigAction(self.restart, 's')))
            if cardservers:
                list.append(getConfigListEntry(_('Restart Both'), ConfigAction(self.restart, 'sc')))
        elif config.plugins.autoCamSetup.restart_choice.value == '3':
            if cardservers:
                list.append(getConfigListEntry(_('Restart Both'), ConfigAction(self.restart, 'sc')))
            list.append(getConfigListEntry(_('Restart Egami Softcam'), ConfigAction(self.restart, 's')))
            if cardservers:
                list.append(getConfigListEntry(_('Select Egami Cardserver'), ConfigAction(self.restart, 'c')))
        list.append(self.cfg_autocam)
        if not config.plugins.autoCamSetup.autocam.enabled.value:
            self.softcams.value = self.softcam.current()
            list.append(getConfigListEntry(_('Select Egami Softcam'), self.softcams))
        else:
            self.softcams.value = config.plugins.autoCamSetup.autocam.defcam.value
            list.append(getConfigListEntry(_('Default Egami Camd'), self.softcams))
            list.append(self.cfg_aclsetup)
            list.append(self.cfg_autocam_setup)
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            list.append(getConfigListEntry(_('Select Egami Cardserver'), self.cardservers))
        self['entries'].list = list
        self['entries'].l.setList(list)

    def newConfig(self):
        cur = self['entries'].getCurrent()
        if cur == self.cfg_autocam:
            self.createConfig()
        elif cur == self.cfg_aclsetup:
            self.setupAutoCamList()
        elif cur == self.cfg_autocam_setup:
            self.AdditionalsetupAutoCam()

    def keyLeft(self):
        self['entries'].handleKey(KEY_LEFT)
        self.newConfig()

    def keyRight(self):
        self['entries'].handleKey(KEY_RIGHT)
        self.newConfig()

    def ok(self):
        self['entries'].handleKey(KEY_OK)

    def restart(self, what):
        self.what = what
        if 's' in what:
            if 'c' in what:
                msg = _('Please wait, restarting Egami softcam and cardserver.')
            else:
                msg = _('Please wait, restarting Egami softcam.')
        elif 'c' in what:
            msg = _('Please wait, restarting Egami cardserver.')
        else:
            return
        try:
            self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
        except:
            self.mbox = None

        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        if 'c' in self.what:
            self.cardserver.command('stop')
        if 's' in self.what:
            self.softcam.command('stop')
        self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
        self.session.nav.stopService()
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        del self.activityTimer
        if 'c' in self.what:
            self.cardserver.select(self.cardservers.value)
            self.cardserver.command('start')
        if 's' in self.what:
            self.softcam.select(self.softcams.value)
            self.softcam.command('start')
        if self.mbox:
            self.mbox.close()
        if config.plugins.autoCamSetup.close_on_restart.value:
            self.close()
        else:
            self.nameSoftcam()
            self.nameCardserver()
        self.session.nav.playService(self.oldref)
        del self.oldref

    def restartCardServer(self):
        if hasattr(self, 'cardservers'):
            self.restart('c')

    def restartSoftcam(self):
        self.restart('s')

    def restartCam(self):
        val = config.plugins.autoCamSetup.long_hotkey.value
        if val == 'c' or val == 'sc':
            cardservers = self.cardserver.getList()
            if cardservers:
                self.restart(val)
        elif val == 's':
            self.restart(val)

    def save(self):
        what = ''
        if hasattr(self, 'cardservers') and self.cardservers.value != self.cardserver.current():
            what = 'sc'
        elif self.softcams.value != self.softcam.current():
            what = 's'
        if what:
            self.restart(what)
        else:
            self.close()

    def ppanelShortcut(self):
        if InstallPPanel:
            ppanelFileName = '/etc/ppanels/' + self.softcams.value + '.xml'
            if os.path.isfile(ppanelFileName) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'):
                self.session.open(PPanel, name=self.softcams.value + ' PPanel', node=None, filename=ppanelFileName, deletenode=None)
            else:
                return 0
        else:
            return 0

    def keyMenu(self):
        self.session.openWithCallback(self.createConfig, CamSetupScreen)

    def nameSoftcam(self):
        name = ''
        if fileExists('/etc/init.d/softcam'):
            try:
                f = os.popen('/etc/init.d/softcam info')
                for i in f.readlines():
                    text = _('Current softcam: ')
                    name = text + i

            except:
                pass

        self['cam'].setText(name)

    def nameCardserver(self):
        name = ''
        if fileExists('/etc/init.d/cardserver'):
            try:
                f = os.popen('/etc/init.d/cardserver info')
                for i in f.readlines():
                    text = _('Current cardserver: ')
                    name = text + i

            except:
                pass

        self['server'].setText(name)

    def showEcmInfo(self):
        text = ''
        snow_text = False
        if fileExists('/tmp/ecm.info'):
            try:
                st = os.stat('/tmp/ecm.info')
                if st.st_size > 0 and self.prev_mtime < st.st_mtime:
                    self.prev_mtime = st.st_mtime
                    f = open('/tmp/ecm.info', 'r')
                    for line in f:
                        text += line

                    f.close()
                    snow_text = True
            except:
                snow_text = True

        else:
            self.prev_mtime = 0
            snow_text = True
        if snow_text:
            self['ecm'].setText(text)
        self.EcmTimer.start(1500, True)

    def showEcmInfo1(self):
        text = ''
        snow_text = False
        if fileExists('/tmp/ecm1.info'):
            try:
                st = os.stat('/tmp/ecm1.info')
                if st.st_size > 0 and self.prev_mtime1 < st.st_mtime:
                    self.prev_mtime1 = st.st_mtime
                    f = open('/tmp/ecm1.info', 'r')
                    for line in f:
                        text += line

                    f.close()
                    snow_text = True
            except:
                snow_text = True

        else:
            self.prev_mtime1 = 0
            snow_text = True
        if snow_text:
            self['ecm1'].setText(text)
        self.EcmTimer1.start(1500, True)

    def cancel(self):
        self.close()

    def AdditionalsetupAutoCam(self, *args):
        self.session.open(AdditionalAutoCamSetup, None)

    def setupAutoCamList(self, *args):
        from autocam import AutoCamListSetup
        self.session.open(AutoCamListSetup, self.softcam)
예제 #11
0
class SoftcamStartup(Screen, ConfigListScreen):
	skin = """
	<screen name="SoftcamStartup" position="center,center" size="560,350" >
		<widget name="config" position="5,10" size="550,200"/>
		<ePixmap name="red" position="5,310" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on"/>
		<ePixmap name="green" position="185,310" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on"/>
		<widget name="key_red" position="45,310" zPosition="2" size="140,40" valign="center" halign="left" font="Regular;21" transparent="1"/>
		<widget name="key_green" position="225,310" zPosition="2" size="140,40" valign="center" halign="left" font="Regular;21" transparent="1"/>
	</screen>"""
	def __init__(self, session, showExtentionMenuOption):
		Screen.__init__(self, session)

		self.setup_title = _("Softcam startup")

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "CiSelectionActions"],
			{
				"cancel": self.cancel,
				"red": self.cancel,
				"green": self.save,
			},-1)

		self.list = [ ]
		ConfigListScreen.__init__(self, self.list, session = session)

		self.initd()

		self.softcam1 = CamControl('softcam')
		self.softcam2 = CamControl('cardserver')

		softcamlistprimary = self.softcam1.getList()
		softcamlistsecondary = self.softcam2.getList()

		self.softcamlistprimary = ConfigSelection(choices = softcamlistprimary)
		self.softcamlistprimary.value = self.softcam1.current()
		self.softcamlistsecondary = ConfigSelection(choices = softcamlistsecondary)
		self.softcamlistsecondary.value = self.softcam2.current()

		self.list.append(getConfigListEntry(_("Select primary softcam"), self.softcamlistprimary))
		self.list.append(getConfigListEntry(_("Select secondary softcam"), self.softcamlistsecondary))
		self.list.append(getConfigListEntry(_("Restart primary softcam"), ConfigAction(self.restart, "s")))
		self.list.append(getConfigListEntry(_("Restart secondary softcam"), ConfigAction(self.restart, "c"))) 
		self.list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))

		if showExtentionMenuOption:
			self.list.append(getConfigListEntry(_("Show softcam startup in extensions menu"), config.misc.softcam_startup.extension_menu))

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

		self.onLayoutFinish.append(self.layoutFinished)

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

	def restart(self, what):
		self.what = what
		if "s" in what:
			if "c" in what:
				msg = _("Please wait, restarting primary and secondary softcam.")
			else:
				msg  = _("Please wait, restarting primary softcam.")
		elif "c" in what:
			msg = _("Please wait, restarting secondary softcam.")
		self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStop)
		self.activityTimer.start(100, False)

	def doStop(self):
		self.activityTimer.stop()
		if "c" in self.what:
			self.softcam2.command('stop')
		if "s" in self.what:
			self.softcam1.command('stop')
		self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
		self.session.nav.stopService()
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStart)
		self.activityTimer.start(1000, False)

	def doStart(self):
		self.activityTimer.stop()
		del self.activityTimer 
		if "s" in self.what:
			self.softcam1.select(self.softcamlistprimary.value)
			self.softcam1.command('start')
		if "c" in self.what:
			self.softcam2.select(self.softcamlistsecondary.value)
			self.softcam2.command('start')
		if self.mbox:
			self.mbox.close()
		self.close()
		self.session.nav.playService(self.oldref)
		del self.oldref

	def save(self):
		what = ''
		if (self.softcamlistsecondary.value != self.softcam2.current()) and (self.softcamlistprimary.value != self.softcam1.current()):
			what = 'sc'
		elif (self.softcamlistsecondary.value != self.softcam2.current()):
			what = 'c'
		elif (self.softcamlistprimary.value != self.softcam1.current()):
			what = 's'
		else:
			what = ''
		if what:
			self.restart(what)
		else:
			from Components.PluginComponent import plugins
			plugins.reloadPlugins()
			config.misc.softcam_startup.extension_menu.save()
			self.close()

	def cancel(self):
		self.close()

	def initd(self):
		CSNoneData = '#!/bin/sh\necho "Cardserver is deactivated."\n'
		SCNoneData = '#!/bin/sh\necho "Softcam is deactivated."\n'

		if not fileExists('/etc/init.d/softcam.None'):
			fd = file('/etc/init.d/softcam.None', 'w')
			fd.write(SCNoneData)
			fd.close()
			os.chmod("/etc/init.d/softcam.None", 0755)

		if not fileExists('/etc/init.d/cardserver.None'):
			fd = file('/etc/init.d/cardserver.None', 'w')
			fd.write(CSNoneData)
			fd.close()
			os.chmod("/etc/init.d/cardserver.None", 0755)

		if not fileExists('/etc/init.d/softcam'):
			os.system('ln -s /etc/init.d/softcam.None /etc/init.d/softcam')
		if not fileExists('/etc/init.d/cardserver'):
			os.system('ln -s /etc/init.d/cardserver.None /etc/init.d/cardserver')

		if fileExists ('/etc/rc0.d/K20softcam'):
			os.system('update-rc.d -f softcam remove && update-rc.d -f cardserver remove')
		if not fileExists('/etc/rc0.d/K09softcam'):
			os.system('update-rc.d softcam stop 09 0 1 6 . start  60 2 3 4 5 .')
			os.system('update-rc.d cardserver stop 09 0 1 6 . start  60 2 3 4 5 .')
예제 #12
0
class ScSelection(Screen):
	skin = """
        <screen name="ScSelection" position="center,center" size="560,230" title="Softcam Setup">
                <widget name="entries" position="5,10" size="550,140" />
                <ePixmap name="red" position="0,190" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
                <ePixmap name="green" position="140,190" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
                <widget name="key_red" position="0,190" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                <widget name="key_green" position="140,190" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
        </screen>"""
	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "CiSelectionActions"],
			{
				"left": self.keyLeft,
				"right": self.keyRight,
				"cancel": self.cancel,
				"ok": self.ok,
				"green": self.save,
				"red": self.cancel,
			},-1)

		self.list = [ ]

		self.softcam = CamControl('softcam')
		self.cardserver = CamControl('cardserver')

		menuList = ConfigList(self.list)
		menuList.list = self.list
		menuList.l.setList(self.list)
		self["entries"] = menuList

		softcams = self.softcam.getList()
		cardservers = self.cardserver.getList()

		self.softcams = ConfigSelection(choices = softcams)
		self.softcams.value = self.softcam.current()

		self.list.append(getConfigListEntry(_("Select Softcam"), self.softcams))
		if cardservers:
			self.cardservers = ConfigSelection(choices = cardservers)
			self.cardservers.value = self.cardserver.current()
			self.list.append(getConfigListEntry(_("Select Card Server"), self.cardservers))

		self.list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
		if cardservers: 
			self.list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c"))) 
			self.list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc"))) 

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

	def keyLeft(self):
		self["entries"].handleKey(KEY_LEFT)

	def keyRight(self):
		self["entries"].handleKey(KEY_RIGHT)
		
	def ok(self):
		self["entries"].handleKey(KEY_OK)
	

	def restart(self, what):
		self.what = what
		if "s" in what:
			if "c" in what:
				msg = _("Please wait, restarting softcam and cardserver.")
			else:
				msg  = _("Please wait, restarting softcam.")
                elif "c" in what:
			msg = _("Please wait, restarting cardserver.")
		self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStop)
		self.activityTimer.start(100, False)

	def doStop(self):
		self.activityTimer.stop()
		if "c" in self.what:
			self.cardserver.command('stop')
		if "s" in self.what:
			self.softcam.command('stop')
		self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
		self.session.nav.stopService()
		# Delay a second to give 'em a chance to stop
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStart)
		self.activityTimer.start(1000, False)

	def doStart(self):
		self.activityTimer.stop()
		del self.activityTimer 
		if "c" in self.what:
                        self.cardserver.select(self.cardservers.value)
			self.cardserver.command('start')
		if "s" in self.what:
			self.softcam.select(self.softcams.value)
			self.softcam.command('start')
		self.mbox.close()
		self.close()
		self.session.nav.playService(self.oldref)
		del self.oldref

	def restartCardServer(self):
		if hasattr(self, 'cardservers'):
			self.restart("c")
	
	def restartSoftcam(self):
		self.restart("s")

	def save(self):
		what = ''
		if hasattr(self, 'cardservers') and (self.cardservers.value != self.cardserver.current()):
                        what = 'sc'
		elif self.softcams.value != self.softcam.current():
                        what = 's'
                if what:
                	self.restart(what)
		else:
			self.close()

	def cancel(self):
		self.close()
예제 #13
0
파일: Sc.py 프로젝트: MaxWiesel/enigma2pc-1
class ScSelection(Screen):
    skin = """
        <screen name="ScSelection" position="center,center" size="560,230" title="Softcam Setup">
                <widget name="entries" position="5,10" size="550,140" />
                <ePixmap name="red" position="0,190" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
                <ePixmap name="green" position="140,190" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
                <widget name="key_red" position="0,190" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                <widget name="key_green" position="140,190" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
        </screen>"""

    def __init__(self, session):
        Screen.__init__(self, session)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "left": self.keyLeft,
                "right": self.keyRight,
                "cancel": self.cancel,
                "ok": self.ok,
                "green": self.save,
                "red": self.cancel,
            }, -1)

        self.list = []

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')

        menuList = ConfigList(self.list)
        menuList.list = self.list
        menuList.l.setList(self.list)
        self["entries"] = menuList

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()

        self.softcams = ConfigSelection(choices=softcams)
        self.softcams.value = self.softcam.current()

        self.list.append(getConfigListEntry(_("Select Softcam"),
                                            self.softcams))
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        self.list.append(
            getConfigListEntry(_("Restart softcam"),
                               ConfigAction(self.restart, "s")))
        if cardservers:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))

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

    def keyLeft(self):
        self["entries"].handleKey(KEY_LEFT)

    def keyRight(self):
        self["entries"].handleKey(KEY_RIGHT)

    def ok(self):
        self["entries"].handleKey(KEY_OK)

    def restart(self, what):
        self.what = what
        if "s" in what:
            if "c" in what:
                msg = _("Please wait, restarting softcam and cardserver.")
            else:
                msg = _("Please wait, restarting softcam.")
        elif "c" in what:
            msg = _("Please wait, restarting cardserver.")
        self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        if "c" in self.what:
            self.cardserver.command('stop')
        if "s" in self.what:
            self.softcam.command('stop')
        self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
        self.session.nav.stopService()
        # Delay a second to give 'em a chance to stop
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        del self.activityTimer
        if "c" in self.what:
            self.cardserver.select(self.cardservers.value)
            self.cardserver.command('start')
        if "s" in self.what:
            self.softcam.select(self.softcams.value)
            self.softcam.command('start')
        self.mbox.close()
        self.close()
        self.session.nav.playService(self.oldref)
        del self.oldref

    def restartCardServer(self):
        if hasattr(self, 'cardservers'):
            self.restart("c")

    def restartSoftcam(self):
        self.restart("s")

    def save(self):
        what = ''
        if hasattr(self, 'cardservers') and (self.cardservers.value !=
                                             self.cardserver.current()):
            what = 'sc'
        elif self.softcams.value != self.softcam.current():
            what = 's'
        if what:
            self.restart(what)
        else:
            self.close()

    def cancel(self):
        self.close()
예제 #14
0
파일: Sc.py 프로젝트: henrylicious/test
class ScSelection(Screen):
	skin = """
		<screen name="ScSelection" position="center,center" size="525,400" title="Softcam Cardserver Manager">
			<widget name="entries" position="10,10" size="505,310" enableWrapAround="1" />
			<ePixmap name="red" position="0,350" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
			<ePixmap name="green" position="140,350" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
			<ePixmap name="blue" position="280,350" zPosition="1" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
			<widget name="key_red" position="0,350" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_green" position="140,350" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_blue" position="280,350" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<eLabel font="Regular;18" halign="left" valign="top" position="10,135" size="500,26" text="----------------------------------------------------------------------------------------" zPosition="2" transparent="1" />
			<eLabel font="Regular;18" halign="left" valign="top" position="15,160" size="90,26" text="ECM:" zPosition="2" transparent="1" />
			<widget source="session.CurrentService" render="Label" position="100,160" size="490,56" transparent="1" zPosition="2" font="Regular;18" valign="top" halign="left" noWrap="1">
			<convert type="CryptoInfo">VerboseInfo</convert></widget>
			<eLabel font="Regular;18" halign="left" valign="top" position="15,220" size="90,26" text="Channel:" zPosition="2" transparent="1" />
			<widget source="session.CurrentService" render="Label" position="100,220" size="480,26" transparent="1" zPosition="2" font="Regular;18" valign="top" halign="left">
			<convert type="ServiceName">All</convert></widget>
			<widget source="session.CurrentService" render="Label" position="15,300" size="479,26" transparent="1" zPosition="2" font="Regular;18" valign="top" halign="left" noWrap="1" >
			<convert type="PliExtraInfo">CryptoInfo</convert></widget>
			<eLabel font="Regular;18" halign="left" valign="top" position="15,260" size="90,26" text="RES:" zPosition="2" transparent="1" />
			<widget source="session.CurrentService" render="Label" zPosition="2" position="100,260" size="55,24" halign="left" valign="top" font="Regular;18" transparent="1">
			<convert type="ServiceInfo">VideoWidth</convert></widget>
			<eLabel text="x" zPosition="2" position="150,260" size="35,24" halign="left" valign="top" font="Regular;18" transparent="1" />
			<widget source="session.CurrentService" render="Label" zPosition="2" position="170,260" size="55,24" halign="left" valign="top" font="Regular;18" transparent="1">
			<convert type="ServiceInfo">VideoHeight</convert></widget>
			<eLabel font="Regular;18" halign="left" valign="top" position="10,320" size="500,26" text="----------------------------------------------------------------------------------------" zPosition="2" transparent="1" />
		</screen>"""

	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "CiSelectionActions"],
			{
				"left": self.keyLeft,
				"right": self.keyRight,
				"cancel": self.cancel,
				"ok": self.ok,
				"green": self.save,
				"red": self.cancel,
				"blue": self.blue,
			},-1)

		self.list = [ ]

		self.softcam = CamControl('softcam')
		self.cardserver = CamControl('cardserver')

		menuList = ConfigList(self.list)
		menuList.list = self.list
		menuList.l.setList(self.list)
		self["entries"] = menuList

		softcams = self.softcam.getList()
		cardservers = self.cardserver.getList()

		self.softcams = ConfigSelection(choices = softcams)
		self.softcams.value = self.softcam.current()

		self.list.append(getConfigListEntry(_("Select Softcam"), self.softcams))
		if cardservers:
			self.cardservers = ConfigSelection(choices = cardservers)
			self.cardservers.value = self.cardserver.current()
			self.list.append(getConfigListEntry(_("Select Card Server"), self.cardservers))

		self.list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
		if cardservers:
			self.list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c")))
			self.list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))

		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("OK"))
		self["key_blue"] = Label(_("ECM Info's"))

	def keyLeft(self):
		self["entries"].handleKey(KEY_LEFT)

	def keyRight(self):
		self["entries"].handleKey(KEY_RIGHT)

	def ok(self):
		self["entries"].handleKey(KEY_OK)

	def blue(self):
		if os.path.exists("/tmp/ecm.info") is True:
			self.session.open(Console,_("ECM -> ecm.info"),["cat /tmp/ecm.info"])
			pass
		elif os.path.exists("/tmp/ecm1.info") is True:
			self.session.open(Console,_("ECM -> ecm0.info"),["cat /tmp/ecm0.info"])
			pass
		else:
			msgi = _("Sorry ... no ECM Info found")
			self.session.open(MessageBox, msgi, MessageBox.TYPE_INFO)

	def restart(self, what):
		self.what = what
		if "s" in what:
			if "c" in what:
				msg = _("Please wait, restarting softcam and cardserver.")
			else:
				msg  = _("Please wait, restarting softcam.")
                elif "c" in what:
			msg = _("Please wait, restarting cardserver.")
		self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStop)
		self.activityTimer.start(100, False)

	def doStop(self):
		self.activityTimer.stop()
		if "c" in self.what:
			self.cardserver.command('stop')
		if "s" in self.what:
			self.softcam.command('stop')
		self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
		self.session.nav.stopService()
		# Delay a second to give 'em a chance to stop
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStart)
		self.activityTimer.start(1000, False)

	def doStart(self):
		self.activityTimer.stop()
		del self.activityTimer
		if "c" in self.what:
                        self.cardserver.select(self.cardservers.value)
			self.cardserver.command('start')
		if "s" in self.what:
			self.softcam.select(self.softcams.value)
			self.softcam.command('start')
		self.mbox.close()
		#self.close()
		self.session.nav.playService(self.oldref)
		del self.oldref

	def restartCardServer(self):
		if hasattr(self, 'cardservers'):
			self.restart("c")

	def restartSoftcam(self):
		self.restart("s")

	def save(self):
		what = ''
		if hasattr(self, 'cardservers') and (self.cardservers.value != self.cardserver.current()):
                        what = 'sc'
		elif self.softcams.value != self.softcam.current():
                        what = 's'
                if what:
                	self.restart(what)
		else:
			self.close()

	def cancel(self):
		self.close()
예제 #15
0
class ScNewSelection(Screen):
	if config.plugins.SoftcamMenu.showEcm.value:
		skin = """
			<screen name="ScNewSelection" position="center,center" size="670,520" title="Softcam Setup">
				<widget name="cam" zPosition="2" position="5,5" size="310,21" font="Regular; 17" halign="left" foregroundColor="#00bab329" />
				<widget name="server" zPosition="2" position="320,5" size="328,21" font="Regular; 17" halign="left" foregroundColor="#00bab329" />
				<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/div-h.png" position="0,30" zPosition="2" size="650,2" />
				<widget name="entries" position="5,35" size="630,200" />
				<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/div-h.png" position="0,235" zPosition="2" size="650,2" />
				<widget name="text" position="5,240" size="345,260" zPosition="2"  font="Regular;17" />
				<widget name="text1" position="350,240" size="320,260" zPosition="2"  font="Regular;17" />
				<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/div-h.png" position="0,470" zPosition="2" size="650,2" />
				<ePixmap position="150,510" zPosition="1" size="150,2" pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/red.png" transparent="1" alphatest="on" />
				<ePixmap position="300,510" zPosition="1" size="150,2" pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/green.png" transparent="1" alphatest="on" />
				<ePixmap position="450,510" zPosition="1" size="150,2" pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/blue.png" transparent="1" alphatest="on" />
				<widget name="key_red" position="150,480" zPosition="2" size="150,25" valign="center" halign="center" font="Regular;21" transparent="1" />
				<widget name="key_green" position="300,480" zPosition="2" size="150,25" valign="center" halign="center" font="Regular;21" transparent="1" />
				<widget name="key_blue" position="450,480" zPosition="2" size="150,25" valign="center" halign="center" font="Regular;21" transparent="1" />
				<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup//images/key_menu.png" position="20,480" zPosition="2" size="50,40" alphatest="on" />
			</screen>"""	
	else:
		skin = """
			<screen name="ScNewSelection" position="center,center" size="650,270" title="Softcam Setup">
				<widget name="cam" zPosition="2" position="5,5" size="310,21" font="Regular; 17" halign="left" foregroundColor="#00bab329" />
				<widget name="server" zPosition="2" position="320,5" size="328,21" font="Regular; 17" halign="left" foregroundColor="#00bab329" />
				<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/div-h.png" position="0,30" zPosition="2" size="650,2" />
				<widget name="entries" position="5,35" size="630,180" />
				<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup//images/div-h.png" position="0,215" zPosition="2" size="650,2" />
				<ePixmap position="150,260" zPosition="1" size="150,2" pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/red.png" transparent="1" alphatest="on" />
				<ePixmap position="300,260" zPosition="1" size="150,2" pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/green.png" transparent="1" alphatest="on" />
				<ePixmap position="450,260" zPosition="1" size="150,2" pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/blue.png" transparent="1" alphatest="on" />
				<widget name="key_red" position="150,230" zPosition="2" size="150,25" valign="center" halign="center" font="Regular;21" transparent="1" />
				<widget name="key_green" position="300,230" zPosition="2" size="150,25" valign="center" halign="center" font="Regular;21" transparent="1" />
				<widget name="key_blue" position="450,230" zPosition="2" size="150,25" valign="center" halign="center" font="Regular;21" transparent="1" />
				<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/PLi/SoftcamSetup/images/key_menu.png" position="20,230" zPosition="2" size="50,40" alphatest="on" />
			</screen>"""
			
	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "EPGSelectActions", "CiSelectionActions"],
			{
				"left": self.keyLeft,
				"right": self.keyRight,
				"cancel": self.cancel,
				"ok": self.ok,
				"green": self.save,
				"red": self.cancel,
				"blue": self.bluekey,
				"menu": self.keyMenu,
			},-1)
			
		self.setTitle(_("Softcam Setup"))
		if config.plugins.SoftcamMenu.showEcm.value:
			self["text"] = ScrollLabel()
			self["text1"] = ScrollLabel()
			self.timer = eTimer()
			self.timer.callback.append(self.listServices)
			self.timer.callback.append(self.listServices1)
			self.timer.start(50, True)
			
		self.softcam = CamControl('softcam')
		self.cardserver = CamControl('cardserver')
		self.blueAction = REFRESH
		
		self["entries"] = ConfigList([])
		self.initConfig()
		self.createConfig()
		
		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("OK"))
		self["key_blue"] = Label(_("Refresh"))
		self["cam"] = Label()
		self["server"] = Label()
		
		self.nameSoftcam()
		self.nameCardserver()
		self.onClose.append(self.__onClose)

	def __onClose(self):
		config.plugins.SoftcamSetup.autocam.enabled.save()
		if config.plugins.SoftcamSetup.autocam.enabled.value:
			config.plugins.SoftcamSetup.autocam.defcam.value = self.softcams.value
			config.plugins.SoftcamSetup.autocam.defcam.save()
		else:
			config.plugins.SoftcamSetup.autocam.defcam.cancel()
			config.plugins.SoftcamSetup.autocam.checkrec.value = False
		config.plugins.SoftcamSetup.autocam.checkrec.save()

	def initConfig(self):
		self.softcams = ConfigSelection(choices = self.softcam.getList())
		self.cfg_autocam = getConfigListEntry(_("Enable Auto-Camd"), config.plugins.SoftcamSetup.autocam.enabled)
		self.cfg_checkrec = getConfigListEntry(_("Don't switch auto-camd while recording"), config.plugins.SoftcamSetup.autocam.checkrec)
		self.cfg_switchinfo = getConfigListEntry(_("Show (switch info camname)"), config.plugins.SoftcamSetup.autocam.switchinfo)
		self.cfg_aclsetup = getConfigListEntry(_("Setup Auto-Camd List"), ConfigAction(self.setupAutoCamList, None))

	def createConfig(self):
		cardservers = self.cardserver.getList()
		list = [ ]
		if config.plugins.SoftcamMenu.RestartChoice.value == "1":
			list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
			if cardservers:
				list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c"))) 
				list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))
		elif config.plugins.SoftcamMenu.RestartChoice.value == "2":
			if cardservers:
				list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c")))
			list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
			if cardservers:
				list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))
		elif config.plugins.SoftcamMenu.RestartChoice.value == "3":
			if cardservers:
				list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))
			list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
			if cardservers:
				list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c")))
		list.append(self.cfg_autocam)
		if not config.plugins.SoftcamSetup.autocam.enabled.value:
			self.softcams.value = self.softcam.current()
			list.append(getConfigListEntry(_("Select Softcam"), self.softcams))
		else:
			self.softcams.value = config.plugins.SoftcamSetup.autocam.defcam.value
			list.append(getConfigListEntry(_("Default Camd"), self.softcams))
			list.append(self.cfg_checkrec)
			list.append(self.cfg_switchinfo)
			list.append(self.cfg_aclsetup)
		if cardservers:
			self.cardservers = ConfigSelection(choices = cardservers)
			self.cardservers.value = self.cardserver.current()
			list.append(getConfigListEntry(_("Select Card Server"), self.cardservers))
		self["entries"].list = list
		self["entries"].l.setList(list)

	def newConfig(self):
		cur = self["entries"].getCurrent()
		if cur == self.cfg_autocam:
			self.createConfig()
		elif cur == self.cfg_aclsetup:
			self.setupAutoCamList()

	def keyLeft(self):
		self["entries"].handleKey(KEY_LEFT)
		self.newConfig()

	def keyRight(self):
		self["entries"].handleKey(KEY_RIGHT)
		self.newConfig()
		
	def ok(self):
		self["entries"].handleKey(KEY_OK)
	

	def restart(self, what):
		self.what = what
		if "s" in what:
			if "c" in what:
				msg = _("Please wait, restarting softcam and cardserver.")
			else:
				msg  = _("Please wait, restarting softcam.")
		elif "c" in what:
			msg = _("Please wait, restarting cardserver.")
		self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStop)
		self.activityTimer.start(100, False)

	def doStop(self):
		self.activityTimer.stop()
		if "c" in self.what:
			self.cardserver.command('stop')
		if "s" in self.what:
			self.softcam.command('stop')
		self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
		self.session.nav.stopService()
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStart)
		self.activityTimer.start(1000, False)

	def doStart(self):
		self.activityTimer.stop()
		del self.activityTimer 
		if "c" in self.what:
			self.cardserver.select(self.cardservers.value)
			self.cardserver.command('start')
		if "s" in self.what:
			self.softcam.select(self.softcams.value)
			self.softcam.command('start')
		if self.mbox:
			self.mbox.close()
		if config.plugins.SoftcamMenu.CloseOnRestart.value:
			self.close()
		else:
			self.nameSoftcam()
			self.nameCardserver()
		self.session.nav.playService(self.oldref)
		del self.oldref

	def restartCardServer(self):
		if hasattr(self, 'cardservers'):
			self.restart("c")
	
	def restartSoftcam(self):
		self.restart("s")

	def save(self):
		what = ''
		if hasattr(self, 'cardservers') and (self.cardservers.value != self.cardserver.current()):
			what = 'sc'
		elif self.softcams.value != self.softcam.current():
			what = 's'
		if what:
			self.restart(what)
		else:
			self.close()

	def keyMenu(self):
		self.session.open(ScSetupScreen)
						
	def nameSoftcam(self):
		if fileExists("/etc/init.d/softcam"):
			name = ""
			try:
				f = os.popen("/etc/init.d/softcam info")
				for i in f.readlines():
					text = _("Current softcam: ")
					name = text + i
			except: 
				pass
		else:
			name = ""
		self["cam"].setText(name)
		self.setblueKey(name)
			
	def nameCardserver(self):
		if fileExists("/etc/init.d/cardserver"):
			name = ""
			try:
				f = os.popen("/etc/init.d/cardserver info")
				for i in f.readlines():
					text = _("Current cardserver: ")
					name = text + i
			except: 
				pass
		else:
			name = ""
		self["server"].setText(name)

	def listServices(self):
		list = "\n"
		prev_mtime = None
		if fileExists("/tmp/ecm.info"):
			try:
				st = os.stat("/tmp/ecm.info")
				if st.st_size > 0 and prev_mtime < st.st_mtime:
					prev_mtime = st.st_mtime
					fdd = open("/tmp/ecm.info", "r")
					for line in fdd:
						list += line
					fdd.close()
			except:
				pass
		self["text"].setText(list)
		self.timer.start(2000, True)
		
	def listServices1(self):
		list1 = "\n"
		prev1_mtime = None
		if fileExists("/tmp/ecm1.info"):
			try:
				st1 = os.stat("/tmp/ecm1.info")
				if st1.st_size > 0 and prev1_mtime < st1.st_mtime:
					prev1_mtime = st1.st_mtime
					fd = open("/tmp/ecm1.info", "r")
					for line in fd:
						list1 += line
					fd.close()
			except:
				pass
		self["text1"].setText(list1)
		self.timer.start(2000, True)
			
	def cancel(self):
		self.close()

	def setupAutoCamList(self, *args):
		from autocam import AutoCamListSetup
		self.session.open(AutoCamListSetup, self.softcam)

	def bluekey(self):
		if self.blueAction == CCCAMINFO:
			self.session.openWithCallback(self.CCcamInfoCallback, CCcamInfoMain)
		elif self.blueAction == OSCAMINFO:
			self.session.openWithCallback(self.CCcamInfoCallback, OscamInfoMenu)
		else:
			self.nameSoftcam()
			self.nameCardserver()

	def CCcamInfoCallback(self):
		pass
		
	def setblueKey(self, cam):
		print"[SOFTCAM] setblueKey=%s<" %cam
		if cam == None or cam == '':
			self.blueAction = REFRESH
			self["key_blue"].setText(_("Refresh"))
			return
		pretxt = _("Current softcam: ")
		if cam.upper().startswith(pretxt.upper() + 'CCCAM') and ISCCCAMINFO:
			self.blueAction = CCCAMINFO
			self["key_blue"].setText(_("CCcamInfo"))
		elif cam.upper().startswith(pretxt.upper() + 'OSCAM') and ISOSCAMINFO:
			self.blueAction = OSCAMINFO
			self["key_blue"].setText(_("OscamInfo"))
		else:
			self.blueAction = REFRESH
			self["key_blue"].setText(_("Refresh"))
예제 #16
0
class SoftcamStartup(Screen, ConfigListScreen):
    skin = """
	<screen name="SoftcamStartup" position="center,center" size="560,350" >
		<widget name="config" position="5,10" size="550,200"/>
		<ePixmap name="red" position="5,310" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on"/>
		<ePixmap name="green" position="185,310" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on"/>
		<widget name="key_red" position="45,310" zPosition="2" size="140,40" valign="center" halign="left" font="Regular;21" transparent="1"/>
		<widget name="key_green" position="225,310" zPosition="2" size="140,40" valign="center" halign="left" font="Regular;21" transparent="1"/>
	</screen>"""

    def __init__(self, session, showExtentionMenuOption):
        Screen.__init__(self, session)

        self.setup_title = _("Softcam startup")

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "cancel": self.cancel,
                "red": self.cancel,
                "green": self.save,
            }, -1)

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=session)

        self.initd()

        self.softcam1 = CamControl('softcam')
        self.softcam2 = CamControl('cardserver')

        softcamlistprimary = self.softcam1.getList()
        softcamlistsecondary = self.softcam2.getList()

        self.softcamlistprimary = ConfigSelection(choices=softcamlistprimary)
        self.softcamlistprimary.value = self.softcam1.current()
        self.softcamlistsecondary = ConfigSelection(
            choices=softcamlistsecondary)
        self.softcamlistsecondary.value = self.softcam2.current()

        self.list.append(
            getConfigListEntry(_("Select primary softcam"),
                               self.softcamlistprimary))
        self.list.append(
            getConfigListEntry(_("Select secondary softcam"),
                               self.softcamlistsecondary))
        self.list.append(
            getConfigListEntry(_("Restart primary softcam"),
                               ConfigAction(self.restart, "s")))
        self.list.append(
            getConfigListEntry(_("Restart secondary softcam"),
                               ConfigAction(self.restart, "c")))
        self.list.append(
            getConfigListEntry(_("Restart both"),
                               ConfigAction(self.restart, "sc")))

        if showExtentionMenuOption:
            self.list.append(
                getConfigListEntry(
                    _("Show softcam startup in extensions menu"),
                    config.misc.softcam_startup.extension_menu))

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

        self.onLayoutFinish.append(self.layoutFinished)

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

    def restart(self, what):
        self.what = what
        if "s" in what:
            if "c" in what:
                msg = _(
                    "Please wait, restarting primary and secondary softcam.")
            else:
                msg = _("Please wait, restarting primary softcam.")
        elif "c" in what:
            msg = _("Please wait, restarting secondary softcam.")
        self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        if "c" in self.what:
            self.softcam2.command('stop')
        if "s" in self.what:
            self.softcam1.command('stop')
        self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
        self.session.nav.stopService()
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        del self.activityTimer
        if "s" in self.what:
            self.softcam1.select(self.softcamlistprimary.value)
            self.softcam1.command('start')
        if "c" in self.what:
            self.softcam2.select(self.softcamlistsecondary.value)
            self.softcam2.command('start')
        if self.mbox:
            self.mbox.close()
        self.close()
        self.session.nav.playService(self.oldref)
        del self.oldref

    def save(self):
        what = ''
        if (self.softcamlistsecondary.value != self.softcam2.current()) and (
                self.softcamlistprimary.value != self.softcam1.current()):
            what = 'sc'
        elif (self.softcamlistsecondary.value != self.softcam2.current()):
            what = 'c'
        elif (self.softcamlistprimary.value != self.softcam1.current()):
            what = 's'
        else:
            what = ''
        if what:
            self.restart(what)
        else:
            from Components.PluginComponent import plugins
            plugins.reloadPlugins()
            config.misc.softcam_startup.extension_menu.save()
            self.close()

    def cancel(self):
        self.close()

    def initd(self):
        CSNoneData = '#!/bin/sh\necho "Cardserver is deactivated."\n'
        SCNoneData = '#!/bin/sh\necho "Softcam is deactivated."\n'

        if not fileExists('/etc/init.d/softcam.None'):
            fd = file('/etc/init.d/softcam.None', 'w')
            fd.write(SCNoneData)
            fd.close()
            os.chmod("/etc/init.d/softcam.None", 0755)

        if not fileExists('/etc/init.d/cardserver.None'):
            fd = file('/etc/init.d/cardserver.None', 'w')
            fd.write(CSNoneData)
            fd.close()
            os.chmod("/etc/init.d/cardserver.None", 0755)

        if not fileExists('/etc/init.d/softcam'):
            os.system('ln -s /etc/init.d/softcam.None /etc/init.d/softcam')
        if not fileExists('/etc/init.d/cardserver'):
            os.system(
                'ln -s /etc/init.d/cardserver.None /etc/init.d/cardserver')

        if fileExists('/etc/rc0.d/K20softcam'):
            os.system(
                'update-rc.d -f softcam remove && update-rc.d -f cardserver remove'
            )
        if not fileExists('/etc/rc0.d/K09softcam'):
            os.system(
                'update-rc.d softcam stop 09 0 1 6 . start  60 2 3 4 5 .')
            os.system(
                'update-rc.d cardserver stop 09 0 1 6 . start  60 2 3 4 5 .')
예제 #17
0
class SoftcamSetup(Screen, ConfigListScreen):
	skin = """
	<screen name="SoftcamSetup" position="center,center" size="560,450" >
		<widget name="config" position="5,10" size="550,90" />
		<widget name="info" position="5,100" size="550,300" font="Fixed;18" />
		<ePixmap name="red" position="0,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
		<ePixmap name="green" position="140,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
		<ePixmap name="blue" position="420,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
		<widget name="key_red" position="0,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget name="key_green" position="140,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget name="key_blue" position="420,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
	</screen>"""
	def __init__(self, session, showExtentionMenuOption):
		Screen.__init__(self, session)

		self.setup_title = _("Softcam setup")
		self.setTitle(self.setup_title)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "CiSelectionActions"],
			{
				"cancel": self.cancel,
				"green": self.save,
				"red": self.cancel,
				"blue": self.ppanelShortcut,
			},-1)

		self.list = [ ]
		ConfigListScreen.__init__(self, self.list, session = session)

		self.softcam = CamControl('softcam')
		self.cardserver = CamControl('cardserver')

		self.ecminfo = GetEcmInfo()
		(newEcmFound, ecmInfo) = self.ecminfo.getEcm()
		self["info"] = ScrollLabel("".join(ecmInfo))
		self.EcmInfoPollTimer = eTimer()
		self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
		self.EcmInfoPollTimer.start(1000)

		softcams = self.softcam.getList()
		cardservers = self.cardserver.getList()

		self.softcams = ConfigSelection(choices = softcams)
		self.softcams.value = self.softcam.current()

		self.list.append(getConfigListEntry(_("Select Softcam"), self.softcams))
		if cardservers:
			self.cardservers = ConfigSelection(choices = cardservers)
			self.cardservers.value = self.cardserver.current()
			self.list.append(getConfigListEntry(_("Select Card Server"), self.cardservers))

		self.list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
		if cardservers: 
			self.list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c"))) 
			self.list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))

		if showExtentionMenuOption:
			self.list.append(getConfigListEntry(_("Show softcam setup in extensions menu"), config.misc.softcam_setup.extension_menu))

		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("OK"))
		self["key_blue"] = Label(_("Info"))

	def setEcmInfo(self):
		(newEcmFound, ecmInfo) = self.ecminfo.getEcm()
		if newEcmFound:
			self["info"].setText("".join(ecmInfo))

	def ppanelShortcut(self):
		if "oscam" in self.softcams.value.lower() and os.path.isfile('/usr/lib/enigma2/python/Plugins/Extensions/OscamStatus/plugin.py'):
			from Plugins.Extensions.OscamStatus.plugin import OscamStatus
			self.session.open(OscamStatus)
		ppanelFileName = '/etc/ppanels/' + self.softcams.value + '.xml'
		if os.path.isfile(ppanelFileName) and os.path.isfile('/usr/lib/enigma2/python/Plugins/Extensions/PPanel/plugin.py'):
			from Plugins.Extensions.PPanel.ppanel import PPanel
			self.session.open(PPanel, name = self.softcams.value + ' PPanel', node = None, filename = ppanelFileName, deletenode = None)
		else:
			return 0

	def restart(self, what):
		self.what = what
		if "s" in what:
			if "c" in what:
				msg = _("Please wait, restarting softcam and cardserver.")
			else:
				msg  = _("Please wait, restarting softcam.")
		elif "c" in what:
			msg = _("Please wait, restarting cardserver.")
		self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStop)
		self.activityTimer.start(100, False)

	def doStop(self):
		self.activityTimer.stop()
		if "c" in self.what:
			self.cardserver.command('stop')
		if "s" in self.what:
			self.softcam.command('stop')
		self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
		self.session.nav.stopService()
		# Delay a second to give 'em a chance to stop
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStart)
		self.activityTimer.start(1000, False)

	def doStart(self):
		self.activityTimer.stop()
		del self.activityTimer 
		if "c" in self.what:
			self.cardserver.select(self.cardservers.value)
			self.cardserver.command('start')
		if "s" in self.what:
			self.softcam.select(self.softcams.value)
			self.softcam.command('start')
		if self.mbox:
			self.mbox.close()
		self.close()
		self.session.nav.playService(self.oldref)
		del self.oldref

	def restartCardServer(self):
		if hasattr(self, 'cardservers'):
			self.restart("c")
	
	def restartSoftcam(self):
		self.restart("s")

	def save(self):
		what = ''
		if hasattr(self, 'cardservers') and (self.cardservers.value != self.cardserver.current()):
			what = 'sc'
		elif self.softcams.value != self.softcam.current():
			what = 's'
		if what:
			self.restart(what)
		else:
			from Components.PluginComponent import plugins
			plugins.reloadPlugins()
			config.misc.softcam_setup.extension_menu.save()
			self.close()

	def cancel(self):
		self.close()
예제 #18
0
class SoftcamSetup(Screen, ConfigListScreen):
    skin = """
	<screen name="SoftcamSetup" position="center,center" size="560,450" >
		<widget name="config" position="5,10" size="550,90" />
		<widget name="info" position="5,100" size="550,300" font="Fixed;18" />
		<ePixmap name="red" position="0,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
		<ePixmap name="green" position="140,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
		<ePixmap name="blue" position="420,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
		<widget name="key_red" position="0,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget name="key_green" position="140,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget name="key_blue" position="420,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
	</screen>"""

    def __init__(self, session, showExtentionMenuOption):
        Screen.__init__(self, session)

        self.setup_title = _("Softcam setup")

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "cancel": self.cancel,
                "green": self.save,
                "red": self.cancel,
                "blue": self.ppanelShortcut,
            }, -1)

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=session)

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')

        self.ecminfo = GetEcmInfo()
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        self["info"] = ScrollLabel("".join(ecmInfo))
        self.EcmInfoPollTimer = eTimer()
        self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
        self.EcmInfoPollTimer.start(1000)

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()

        self.softcams = ConfigSelection(choices=softcams)
        self.softcams.value = self.softcam.current()

        self.list.append(getConfigListEntry(_("Select Softcam"),
                                            self.softcams))
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        self.list.append(
            getConfigListEntry(_("Restart softcam"),
                               ConfigAction(self.restart, "s")))
        if cardservers:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))

        if showExtentionMenuOption:
            self.list.append(
                getConfigListEntry(_("Show softcam setup in extensions menu"),
                                   config.misc.softcam_setup.extension_menu))

        self["key_red"] = Label(_("Cancel"))
        self["key_green"] = Label(_("OK"))
        self["key_blue"] = Label(_("Info"))

        self.onLayoutFinish.append(self.layoutFinished)

    def setEcmInfo(self):
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        if newEcmFound:
            self["info"].setText("".join(ecmInfo))

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

    def ppanelShortcut(self):
        if "oscam" in self.softcams.value.lower() and os.path.isfile(
                '/usr/lib/enigma2/python/Plugins/Extensions/OscamStatus/plugin.py'
        ):
            from Plugins.Extensions.OscamStatus.plugin import OscamStatus
            self.session.open(OscamStatus)
        ppanelFileName = '/etc/ppanels/' + self.softcams.value + '.xml'
        if os.path.isfile(ppanelFileName) and os.path.isfile(
                '/usr/lib/enigma2/python/Plugins/Extensions/PPanel/plugin.py'):
            from Plugins.Extensions.PPanel.ppanel import PPanel
            self.session.open(PPanel,
                              name=self.softcams.value + ' PPanel',
                              node=None,
                              filename=ppanelFileName,
                              deletenode=None)
        else:
            return 0

    def restart(self, what):
        self.what = what
        if "s" in what:
            if "c" in what:
                msg = _("Please wait, restarting softcam and cardserver.")
            else:
                msg = _("Please wait, restarting softcam.")
        elif "c" in what:
            msg = _("Please wait, restarting cardserver.")
        self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        if "c" in self.what:
            self.cardserver.command('stop')
        if "s" in self.what:
            self.softcam.command('stop')
        self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
        self.session.nav.stopService()
        # Delay a second to give 'em a chance to stop
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        del self.activityTimer
        if "c" in self.what:
            self.cardserver.select(self.cardservers.value)
            self.cardserver.command('start')
        if "s" in self.what:
            self.softcam.select(self.softcams.value)
            self.softcam.command('start')
        if self.mbox:
            self.mbox.close()
        self.close()
        self.session.nav.playService(self.oldref)
        del self.oldref

    def restartCardServer(self):
        if hasattr(self, 'cardservers'):
            self.restart("c")

    def restartSoftcam(self):
        self.restart("s")

    def save(self):
        what = ''
        if hasattr(self, 'cardservers') and (self.cardservers.value !=
                                             self.cardserver.current()):
            what = 'sc'
        elif self.softcams.value != self.softcam.current():
            what = 's'
        if what:
            self.restart(what)
        else:
            from Components.PluginComponent import plugins
            plugins.reloadPlugins()
            config.misc.softcam_setup.extension_menu.save()
            self.close()

    def cancel(self):
        self.close()
예제 #19
0
class ScSelection(Screen):
    skin = """
		<screen name="ScSelection" position="center,center" size="525,400" title="Softcam Cardserver Manager">
			<widget name="entries" position="10,10" size="505,310" enableWrapAround="1" />
			<ePixmap name="red" position="0,350" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
			<ePixmap name="green" position="140,350" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
			<ePixmap name="blue" position="280,350" zPosition="1" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
			<widget name="key_red" position="0,350" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_green" position="140,350" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_blue" position="280,350" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<eLabel font="Regular;18" halign="left" valign="top" position="10,135" size="500,26" text="----------------------------------------------------------------------------------------" zPosition="2" transparent="1" />
			<eLabel font="Regular;18" halign="left" valign="top" position="15,160" size="90,26" text="ECM:" zPosition="2" transparent="1" />
			<widget source="session.CurrentService" render="Label" position="100,160" size="490,56" transparent="1" zPosition="2" font="Regular;18" valign="top" halign="left" noWrap="1">
			<convert type="CryptoInfo">VerboseInfo</convert></widget>
			<eLabel font="Regular;18" halign="left" valign="top" position="15,220" size="90,26" text="Channel:" zPosition="2" transparent="1" />
			<widget source="session.CurrentService" render="Label" position="100,220" size="480,26" transparent="1" zPosition="2" font="Regular;18" valign="top" halign="left">
			<convert type="ServiceName">All</convert></widget>
			<widget source="session.CurrentService" render="Label" position="15,300" size="479,26" transparent="1" zPosition="2" font="Regular;18" valign="top" halign="left" noWrap="1" >
			<convert type="PliExtraInfo">CryptoInfo</convert></widget>
			<eLabel font="Regular;18" halign="left" valign="top" position="15,260" size="90,26" text="RES:" zPosition="2" transparent="1" />
			<widget source="session.CurrentService" render="Label" zPosition="2" position="100,260" size="55,24" halign="left" valign="top" font="Regular;18" transparent="1">
			<convert type="ServiceInfo">VideoWidth</convert></widget>
			<eLabel text="x" zPosition="2" position="150,260" size="35,24" halign="left" valign="top" font="Regular;18" transparent="1" />
			<widget source="session.CurrentService" render="Label" zPosition="2" position="170,260" size="55,24" halign="left" valign="top" font="Regular;18" transparent="1">
			<convert type="ServiceInfo">VideoHeight</convert></widget>
			<eLabel font="Regular;18" halign="left" valign="top" position="10,320" size="500,26" text="----------------------------------------------------------------------------------------" zPosition="2" transparent="1" />
		</screen>"""

    def __init__(self, session):
        Screen.__init__(self, session)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "left": self.keyLeft,
                "right": self.keyRight,
                "cancel": self.cancel,
                "ok": self.ok,
                "green": self.save,
                "red": self.cancel,
                "blue": self.blue,
            }, -1)

        self.list = []

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')

        menuList = ConfigList(self.list)
        menuList.list = self.list
        menuList.l.setList(self.list)
        self["entries"] = menuList

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()

        self.softcams = ConfigSelection(choices=softcams)
        self.softcams.value = self.softcam.current()

        self.list.append(getConfigListEntry(_("Select Softcam"),
                                            self.softcams))
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        self.list.append(
            getConfigListEntry(_("Restart softcam"),
                               ConfigAction(self.restart, "s")))
        if cardservers:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))

        self["key_red"] = Label(_("Cancel"))
        self["key_green"] = Label(_("OK"))
        self["key_blue"] = Label(_("ECM Info's"))

    def keyLeft(self):
        self["entries"].handleKey(KEY_LEFT)

    def keyRight(self):
        self["entries"].handleKey(KEY_RIGHT)

    def ok(self):
        self["entries"].handleKey(KEY_OK)

    def blue(self):
        if os.path.exists("/tmp/ecm.info") is True:
            self.session.open(Console, _("ECM -> ecm.info"),
                              ["cat /tmp/ecm.info"])
            pass
        elif os.path.exists("/tmp/ecm1.info") is True:
            self.session.open(Console, _("ECM -> ecm0.info"),
                              ["cat /tmp/ecm0.info"])
            pass
        else:
            msgi = _("Sorry ... no ECM Info found")
            self.session.open(MessageBox, msgi, MessageBox.TYPE_INFO)

    def restart(self, what):
        self.what = what
        if "s" in what:
            if "c" in what:
                msg = _("Please wait, restarting softcam and cardserver.")
            else:
                msg = _("Please wait, restarting softcam.")
        elif "c" in what:
            msg = _("Please wait, restarting cardserver.")
        self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        if "c" in self.what:
            self.cardserver.command('stop')
        if "s" in self.what:
            self.softcam.command('stop')
        self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
        self.session.nav.stopService()
        # Delay a second to give 'em a chance to stop
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        del self.activityTimer
        if "c" in self.what:
            self.cardserver.select(self.cardservers.value)
            self.cardserver.command('start')
        if "s" in self.what:
            self.softcam.select(self.softcams.value)
            self.softcam.command('start')
        self.mbox.close()
        #self.close()
        self.session.nav.playService(self.oldref)
        del self.oldref

    def restartCardServer(self):
        if hasattr(self, 'cardservers'):
            self.restart("c")

    def restartSoftcam(self):
        self.restart("s")

    def save(self):
        what = ''
        if hasattr(self, 'cardservers') and (self.cardservers.value !=
                                             self.cardserver.current()):
            what = 'sc'
        elif self.softcams.value != self.softcam.current():
            what = 's'
        if what:
            self.restart(what)
        else:
            self.close()

    def cancel(self):
        self.close()