def loadConfigFile(self): print("[AutomaticVolumeAdjustmentConfig] Loading config file...") self.config = Config() if not os_path.exists(self.CONFIG_FILE): try: fd = os_open(self.CONFIG_FILE, os_O_RDWR | os_O_CREAT) os_close(fd) except Exception as e: print("Error: ", e) try: self.config.loadFromFile(self.CONFIG_FILE) except Exception as e: print("Error: ", e) self.config.entriescount = ConfigInteger(0) self.config.Entries = ConfigSubList() self.config.enable = ConfigYesNo(default=False) self.config.modus = ConfigSelection(choices=[ ("0", _("Automatic volume adjust")), ("1", _("Remember service volume value")) ], default="0") self.config.adustvalue = ConfigSelectionNumber(-50, 50, 5, default=25) self.config.mpeg_max_volume = ConfigSelectionNumber(10, 100, 5, default=100) self.config.show_volumebar = ConfigYesNo(default=False) self.initConfig()
def loadFavoriteConfig(self): self.favoriteConfig = Config() if os.path.exists(self.FAVORITE_FILE): self.favoriteConfig.loadFromFile(self.FAVORITE_FILE) else: self.favoriteConfig.loadFromFile(self.FAVORITE_FILE_DEFAULT) self.favoriteConfig.entriescount = ConfigInteger(0) self.favoriteConfig.Entries = ConfigSubList() self.initFavouriteConfig()
def loadConfigFile(self): print "[AutomaticVolumeAdjustmentConfig] Loading config file..." self.config = Config() if not os_path.exists(self.CONFIG_FILE): try: fd = os_open(self.CONFIG_FILE, os_O_RDWR | os_O_CREAT) os_close(fd) except Exception, e: print "Error: ", e
def setupConfig(self): #Streamserver base config self.config = Config() self.config.streamserver = ConfigSubsection() self.config.streamserver.source = ConfigSelection(StreamServerControl.INPUT_MODES, default=str(eStreamServer.INPUT_MODE_LIVE)) self.config.streamserver.audioBitrate = ConfigInteger(96, StreamServerControl.AUDIO_BITRATE_LIMITS) self.config.streamserver.videoBitrate = ConfigInteger(1500, StreamServerControl.VIDEO_BITRATE_LIMITS) self.config.streamserver.autoBitrate = ConfigOnOff(default=False) self.config.streamserver.resolution = ConfigSelection(list(StreamServerControl.RESOLUTIONS.keys()), default=StreamServerControl.RES_KEY_PAL) self.config.streamserver.framerate = ConfigSelection(StreamServerControl.FRAME_RATES, default=StreamServerControl.FRAME_RATE_23_976) # extended encoder settings self.config.streamserver.gopLength = ConfigInteger(default=eStreamServer.GOP_LENGTH_AUTO, limits=[eStreamServer.GOP_LENGTH_MIN, eStreamServer.GOP_LENGTH_MAX]) self.config.streamserver.gopOnSceneChange = ConfigOnOff(default=False) self.config.streamserver.openGop = ConfigOnOff(default=False) self.config.streamserver.bFrames = ConfigInteger(default=eStreamServer.BFRAMES_DEFAULT, limits=[eStreamServer.BFRAMES_MIN, eStreamServer.BFRAMES_MAX]) self.config.streamserver.pFrames = ConfigInteger(default=eStreamServer.PFRAMES_DEFAULT, limits=[eStreamServer.PFRAMES_MIN, eStreamServer.PFRAMES_MAX]) self.config.streamserver.slices = ConfigInteger(default=eStreamServer.SLICES_DEFAULT, limits=[eStreamServer.SLICES_MIN, eStreamServer.SLICES_MAX]) self.config.streamserver.level = ConfigSelection(StreamServerControl.LEVELS, default=str(eStreamServer.LEVEL_DEFAULT)) self.config.streamserver.profile = ConfigSelection(StreamServerControl.PROFILES, default=str(eStreamServer.PROFILE_DEFAULT)) #servers self.config.streamserver.rtsp = ConfigSubsection() self.config.streamserver.rtsp.enabled = ConfigOnOff(default=False) self.config.streamserver.rtsp.port = ConfigInteger(554, StreamServerControl.PORT_LIMITS) self.config.streamserver.rtsp.path = ConfigText(default="stream", fixed_size=False) self.config.streamserver.rtsp.user = ConfigText(default="", fixed_size=False) self.config.streamserver.rtsp.password = ConfigPassword(default="") self.config.streamserver.hls = ConfigSubsection() self.config.streamserver.hls.enabled = ConfigOnOff(default=False) self.config.streamserver.hls.path = ConfigText(default="stream", fixed_size=False) self.config.streamserver.hls.user = ConfigText(default="", fixed_size=False) self.config.streamserver.hls.password = ConfigPassword(default="") self.config.streamserver.hls.port = ConfigInteger(8080, StreamServerControl.PORT_LIMITS) self.config.streamserver.lastservice = ConfigText(default=config.tv.lastservice.value) self.config.streamserver.mediator = ConfigSubsection() self.config.streamserver.mediator.enabled = ConfigOnOff(default=False) self.config.streamserver.mediator.boxid = ConfigText() self.config.streamserver.mediator.boxkey = ConfigText() self.config.streamserver.mediator.streaminggroups = ConfigSubsection() self.config.streamserver.mediator.streaminggroups.member_alias = ConfigText(default="dreambox", fixed_size=False) self.config.streamserver.mediator.streaminggroups.stream_alias = ConfigText(default="", fixed_size=False) self.config.streamserver.mediator.streaminggroups.hide_empty = ConfigYesNo(default=False) self.config.streamserver.client = ConfigSubsection() self.config.streamserver.client.boxid = ConfigText(default="", fixed_size=False) self.config.streamserver.client.boxkey = ConfigText(default="", fixed_size=False) self.loadConfig()
def __init__(self, session, action, value, url): self.defaultImg = 'Extensions/OnDemand/icons/FolderIcon.png' self.showWMA = str(config.ondemand.ShowiRadioWMA.value) self.showDefault = str(config.ondemand.ShowTuneinDefault.value) self.showIcon = str(config.ondemand.ShowTuneinLogos.value) if self.showIcon == 'True': if self.showDefault == 'False': self.defaultImg = '' self.favoriteConfig = Config() if os_path.exists(FAVORITE_FILE): self.favoriteConfig.loadFromFile(FAVORITE_FILE) self.favoriteConfig.entriescount = ConfigInteger(0) self.favoriteConfig.Entries = ConfigSubList() self.initFavoriteConfig() self.genreList = [] self.getGenreList(self.genreList) self.screenName = "TuneinStreamsThumbCommon" StreamsThumbCommon.__init__(self, session, action, value, url, self.screenName) self.skin = """ <screen position="0,0" size="e,e" flags="wfNoBorder" > <widget name="lab1" position="0,0" size="e,e" font="Regular;24" halign="center" valign="center" transparent="0" zPosition="5" /> <widget source="Title" render="Label" position="20,0" size="e,50" font="Regular;32" /> <widget name="list" position="0,50" size="e,e-50" scrollbarMode="showOnDemand" transparent="1" /> <ePixmap pixmap="ViX-Common/buttons/green.png" position="800,10" size="40,40" transparent="1" alphatest="on" /> <widget source="key_green" render="Label" position="810,0" zPosition="1" size="200,40" font="Regular;20" valign="center" halign="center" transparent="1" /> </screen>""" self["key_green"] = StaticText(_("Add to Favorites")) self["genreActions"] = ActionMap(["ColorActions"], { "red": self.red_pressed, "green": self.green_pressed, "yellow": self.yellow_pressed, "blue": self.blue_pressed, }, -1)
from Screens.Screen import Screen from Components.config import config from Components.config import Config from Components.config import ConfigSelection from Components.config import ConfigText from Components.config import getConfigListEntry from Components.ConfigList import ConfigListScreen from Components.ActionMap import ActionMap from Components.Button import Button from ConfigTextWithSuggestions import ConfigTextWithSuggestions from . import _ searchContext = Config() searchContext.searchTerm = ConfigTextWithSuggestions("", False, threaded=True) searchContext.orderBy = ConfigSelection([("relevance", _("Relevance")), ("viewCount", _("View Count")), ("published", _("Published")), ("rating", _("Rating"))], "relevance") searchContext.time = ConfigSelection([("all_time", _("All Time")), ("this_month", _("This Month")), ("this_week", _("This Week")), ("today", _("Today"))], "all_time") searchContext.racy = ConfigSelection([("include", _("Yes")), ("exclude", _("No"))], "exclude") searchContext.categories = ConfigSelection( [(None, _("All")), ("Autos", _("Autos & Vehicles")), ("Music", _("Music")), ("Animals", _("Pets & Animals")), ("Sports", _("Sports")), ("Travel", _("Travel & Events")), ("Shortmov", _("Short Movies")),
from Screens.Screen import Screen from Components.config import Config from Components.config import ConfigText from Components.config import ConfigYesNo from Components.config import getConfigListEntry from Components.ConfigList import ConfigListScreen from Components.ActionMap import ActionMap from Components.Button import Button from ConfigTextWithSuggestions import ConfigTextWithSuggestions from . import _ playlistContext = Config() playlistContext.name = ConfigText(_("Name"), False) playlistContext.description = ConfigText(_("Description"), False) playlistContext.private = ConfigYesNo() class YouTubeAddPlaylistDialog(Screen, ConfigListScreen): def __init__(self, session): Screen.__init__(self, session) self.session = session self["actions"] = ActionMap(["YouTubeAddPlaylistActions"], { "save": self.keySave, "cancel": self.keyCancel }, -2)
def __init__(self, session): self.session = session Screen.__init__(self, session) self.CurrentService = self.session.nav.getCurrentlyPlayingServiceReference() self.session.nav.stopService() self["cover"] = Cover() self["key_red"] = StaticText(_("Record")) self["key_green"] = StaticText(_("Genres")) self["key_yellow"] = StaticText(_("Stations")) self["key_blue"] = StaticText(_("Favorites")) self.__event_tracker = ServiceEventTracker(screen=self, eventmap= { iPlayableService.evUpdatedInfo: self.__evUpdatedInfo, iPlayableService.evUser+10: self.__evAudioDecodeError, iPlayableService.evUser+12: self.__evPluginError }) InfoBarSeek.__init__(self, actionmap = "MediaPlayerSeekActions") self.mode = self.FAVORITELIST self["list"] = SHOUTcastList() self["list"].connectSelChanged(self.onSelectionChanged) self["statustext"] = Label(_("Getting SHOUTcast genre list...")) self["actions"] = ActionMap(["WizardActions", "DirectionActions", "ColorActions", "EPGSelectActions"], { "ok": self.ok_pressed, "back": self.close, "input_date_time": self.menu_pressed, "red": self.red_pressed, "green": self.green_pressed, "yellow": self.yellow_pressed, "blue": self.blue_pressed, }, -1) self.stationList = [] self.stationListIndex = 0 self.genreList = [] self.genreListIndex = 0 self.favoriteList = [] self.favoriteListIndex = 0 self.favoriteConfig = Config() if os.path.exists(self.FAVORITE_FILE): self.favoriteConfig.loadFromFile(self.FAVORITE_FILE) else: self.favoriteConfig.loadFromFile(self.FAVORITE_FILE_DEFAULT) self.favoriteConfig.entriescount = ConfigInteger(0) self.favoriteConfig.Entries = ConfigSubList() self.initFavouriteConfig() self.stationListXML = "" self["titel"] = Label() self["station"] = Label() self["headertext"] = Label() self["console"] = Label() self.headerTextString = "" self.stationListHeader = "" self.tunein = "" self.searchSHOUTcastString = "" self.currentStreamingURL = "" self.currentStreamingStation = "" self.stationListURL = "" self.onClose.append(self.__onClose) self.onLayoutFinish.append(self.getFavoriteList) self.reloadStationListTimer = eTimer() self.reloadStationListTimer.timeout.get().append(self.reloadStationListTimerTimeout) self.reloadStationListTimerVar = int(config.plugins.shoutcast.reloadstationlist.value) self.visible = True global containerStreamripper if containerStreamripper is None: containerStreamripper = eConsoleAppContainer() containerStreamripper.dataAvail.append(self.streamripperDataAvail) containerStreamripper.appClosed.append(self.streamripperClosed) if containerStreamripper.running(): self["key_red"].setText(_("Stop record")) # just to hear to recording music when starting the plugin... self.currentStreamingStation = _("Recording stream station") self.playServiceStream("http://localhost:9191")