def __init__(self, session): self.session = session Screen.__init__(self, session) print( "[AutomaticVolumeAdjustment] Starting AutomaticVolumeAdjustment..." ) self.__event_tracker = ServiceEventTracker( screen=self, eventmap={ iPlayableService.evUpdatedInfo: self.__evUpdatedInfo, iPlayableService.evStart: self.__evStart, iPlayableService.evEnd: self.__evEnd }) self.newService = False # switching flag self.pluginStarted = False # is plugin started? self.lastAdjustedValue = 0 # remember delta from last automatic volume up/down self.currentVolume = 0 # only set when AC3 or DTS is available self.enabled = False # AutomaticVolumeAdjustment enabled in setup? self.serviceList = {} # values from config configVA = AutomaticVolumeAdjustmentConfig() # get config values assert not AutomaticVolumeAdjustment.instance, "only one AutomaticVolumeAdjustment instance is allowed!" AutomaticVolumeAdjustment.instance = self # set instance self.volumeControlInstance = None # VolumeControlInstance self.currentAC3DTS = False # current service = AC3||DTS? self.initializeConfigValues(configVA, False) self.volctrl = eDVBVolumecontrol.getInstance()
def __init__(self, session): Screen.__init__(self, session) self.title = _("Automatic Volume Adjustment - Config") self["actions"] = ActionMap(["SetupActions", "ColorActions"], { "green": self.keySave, "red": self.keyCancel, "blue": self.blue, "cancel": self.keyCancel, }, -2) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_blue"] = StaticText() self.configVA = AutomaticVolumeAdjustmentConfig() self.automaticVolumeAdjustmentInstance = AutomaticVolumeAdjustment.instance self.list = [] ConfigListScreen.__init__(self, self.list, session = session) self.createSetup("config")
def __init__(self, session): Screen.__init__(self, session) self.title = _("Automatic Volume Adjustment - Config") self["actions"] = ActionMap( ["SetupActions", "ColorActions"], {"green": self.keySave, "red": self.keyCancel, "blue": self.blue, "cancel": self.keyCancel}, -2, ) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_blue"] = StaticText() self.configVA = AutomaticVolumeAdjustmentConfig() self.automaticVolumeAdjustmentInstance = AutomaticVolumeAdjustment.instance self.list = [] ConfigListScreen.__init__(self, self.list, session=session) self.createSetup("config")
class AutomaticVolumeAdjustmentConfigScreen(ConfigListScreen, Screen): skin = """ <screen name="AutomaticVolumeAdjustmentConfigScreen" position="center,center" size="550,400"> <widget name="config" position="20,10" size="520,330" scrollbarMode="showOnDemand" /> <ePixmap position="0,350" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" /> <ePixmap position="140,350" zPosition="4" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" /> <ePixmap position="280,350" zPosition="4" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" /> <ePixmap position="420,350" zPosition="4" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" /> <widget source="key_red" render="Label" position="0,350" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" /> <widget source="key_green" render="Label" position="140,350" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" /> <widget render="Label" source="key_blue" position="420,350" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" /> </screen>""" def __init__(self, session): Screen.__init__(self, session) self.title = _("Automatic Volume Adjustment - Config") self["actions"] = ActionMap(["SetupActions", "ColorActions"], { "green": self.keySave, "red": self.keyCancel, "blue": self.blue, "cancel": self.keyCancel, }, -2) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_blue"] = StaticText() self.configVA = AutomaticVolumeAdjustmentConfig() self.automaticVolumeAdjustmentInstance = AutomaticVolumeAdjustment.instance self.list = [] ConfigListScreen.__init__(self, self.list, session = session) self.createSetup("config") def createSetup(self, widget): self.list = [] self.config_enable = getConfigListEntry(_("Enable"), self.configVA.config.enable) self.list.append(self.config_enable) if self.configVA.config.enable.value: self.config_modus = getConfigListEntry(_("Modus"), self.configVA.config.modus) self.list.append(self.config_modus) if self.configVA.config.modus.value == "0": self.list.append(getConfigListEntry(_("Default volume adjustment value for AC3/DTS"), self.configVA.config.adustvalue)) self.list.append(getConfigListEntry(_("Max. volume for mpeg audio"), self.configVA.config.mpeg_max_volume)) self["key_blue"].text = _("Services") else: self["key_blue"].text = "" self.list.append(getConfigListEntry(_("Show volumebar when volume-value was changed"), self.configVA.config.show_volumebar)) else: self.config_modus = None self[widget].list = self.list self[widget].l.setList(self.list) def newConfig(self): if self["config"].getCurrent() in (self.config_enable, self.config_modus): self.createSetup("config") def keyLeft(self): ConfigListScreen.keyLeft(self) self.newConfig() def keyRight(self): ConfigListScreen.keyRight(self) self.newConfig() def blue(self): if self.configVA.config.modus.value == "0": self.session.open(AutomaticVolumeAdjustmentEntriesListConfigScreen, self.configVA) def keySave(self): for x in self["config"].list: x[1].save() self.configVA.save() if self.automaticVolumeAdjustmentInstance is not None: self.automaticVolumeAdjustmentInstance.initializeConfigValues(self.configVA, True) # submit config values self.close() def keyCancel(self): ConfigListScreen.cancelConfirm(self, True)
class AutomaticVolumeAdjustmentConfigScreen(ConfigListScreen, Screen): skin = """ <screen name="AutomaticVolumeAdjustmentConfigScreen" position="center,center" size="550,400"> <widget name="config" position="20,10" size="520,330" scrollbarMode="showOnDemand" /> <ePixmap position="0,350" zPosition="4" size="140,40" pixmap="buttons/red.png" transparent="1" alphatest="on" /> <ePixmap position="140,350" zPosition="4" size="140,40" pixmap="buttons/green.png" transparent="1" alphatest="on" /> <ePixmap position="280,350" zPosition="4" size="140,40" pixmap="buttons/yellow.png" transparent="1" alphatest="on" /> <ePixmap position="420,350" zPosition="4" size="140,40" pixmap="buttons/blue.png" transparent="1" alphatest="on" /> <widget source="key_red" render="Label" position="0,350" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" /> <widget source="key_green" render="Label" position="140,350" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" /> <widget render="Label" source="key_blue" position="420,350" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" /> </screen>""" def __init__(self, session): Screen.__init__(self, session) self.title = _("Automatic Volume Adjustment - Config") self["actions"] = ActionMap(["SetupActions", "ColorActions"], { "green": self.keySave, "red": self.keyCancel, "blue": self.blue, "cancel": self.keyCancel, }, -2) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_blue"] = StaticText() self.configVA = AutomaticVolumeAdjustmentConfig() self.automaticVolumeAdjustmentInstance = AutomaticVolumeAdjustment.instance self.list = [] ConfigListScreen.__init__(self, self.list, session = session) self.createSetup("config") def createSetup(self, widget): self.list = [] self.config_enable = getConfigListEntry(_("Enable"), self.configVA.config.enable) self.list.append(self.config_enable) if self.configVA.config.enable.value: self.config_modus = getConfigListEntry(_("Modus"), self.configVA.config.modus) self.list.append(self.config_modus) if self.configVA.config.modus.value == "0": self.list.append(getConfigListEntry(_("Default volume adjustment value for AC3/DTS"), self.configVA.config.adustvalue)) self.list.append(getConfigListEntry(_("Max. volume for mpeg audio"), self.configVA.config.mpeg_max_volume)) self["key_blue"].text = _("Services") else: self["key_blue"].text = "" self.list.append(getConfigListEntry(_("Show volumebar when volume-value was changed"), self.configVA.config.show_volumebar)) else: self.config_modus = None self[widget].list = self.list self[widget].l.setList(self.list) def newConfig(self): if self["config"].getCurrent() in (self.config_enable, self.config_modus): self.createSetup("config") def keyLeft(self): ConfigListScreen.keyLeft(self) self.newConfig() def keyRight(self): ConfigListScreen.keyRight(self) self.newConfig() def blue(self): if self.configVA.config.modus.value == "0": self.session.open(AutomaticVolumeAdjustmentEntriesListConfigScreen, self.configVA) def keySave(self): for x in self["config"].list: x[1].save() self.configVA.save() if self.automaticVolumeAdjustmentInstance is not None: self.automaticVolumeAdjustmentInstance.initializeConfigValues(self.configVA, True) # submit config values self.close() def keyCancel(self): ConfigListScreen.cancelConfirm(self, True)