From 229f1d3e77143ffe1351fcd05a66665132e3e6d1 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 3 Nov 2008 20:48:01 +0100 Subject: save backup network configuration files and not only gui stuff from enigma2 and change the default backup location to harddisk (on behalf of sat-man) --- lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/python/Plugins/SystemPlugins') diff --git a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py index 9ff8c05d..7a918da6 100644 --- a/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/ConfigurationBackup/plugin.py @@ -104,8 +104,8 @@ class BackupSetup(Screen): self.list = [ ] self["config"] = ConfigList(self.list) self.backup = ConfigSubsection() - self.backup.type = ConfigSelection(choices = [("settings", _("only /etc/enigma2 directory")), ("var", _("/var directory")), ("skin", _("/usr/share/enigma2 directory"))], default="settings") - self.backup.location = ConfigSelection(choices = [("usb", _("USB Stick")), ("cf", _("CF Drive")), ("hdd", _("Harddisk"))]) + self.backup.type = ConfigSelection(choices = [("settings", _("enigma2 and network")), ("var", _("/var directory")), ("skin", _("/usr/share/enigma2 directory"))], default="settings") + self.backup.location = ConfigSelection(choices = [("hdd", _("Harddisk")), ("usb", _("USB Stick")), ("cf", _("CF Drive"))]) self.list.append(getConfigListEntry(_("Backup Mode"), self.backup.type)) self.list.append(getConfigListEntry(_("Backup Location"), self.backup.location)) @@ -132,7 +132,7 @@ class BackupSetup(Screen): self.path = BackupPath[self.backup.location.value] if self.backup.type.value == "settings": print "Backup Mode: Settings" - self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + self.path + "/" + str(dt) + "_settings_backup.tar.gz /etc/enigma2/"]) + self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + self.path + "/" + str(dt) + "_settings_backup.tar.gz /etc/enigma2/ /etc/network/interfaces /etc/wpa_supplicant.conf"]) elif self.backup.type.value == "var": print "Backup Mode: var" self.session.open(Console, title = "Backup running", cmdlist = [ "tar -czvf " + self.path + "/" + str(dt) + "_var_backup.tar.gz /var/"]) -- cgit v1.2.3 From 58163e18dce8d07d32500c8b24e616518e40710b Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 13 Nov 2008 13:32:15 +0100 Subject: add possibility to change delay after diseqc reset command and delay after diseqc peripherial poweron command via satellite equipment control plugin --- lib/dvb/sec.cpp | 4 ++-- lib/dvb/sec.h | 2 ++ lib/python/Components/NimManager.py | 8 ++++++++ .../Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/python/Plugins/SystemPlugins') diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 2a6016e0..2b7f717b 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -637,11 +637,11 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA diseqc.data[2] = 0; // diseqc reset sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_DISEQC_RESET_CMD]) ); diseqc.data[2] = 3; // diseqc peripherial powersupply on sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 150) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_DISEQC_PERIPHERIAL_POWERON_CMD]) ); } for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat) diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 42e53ebe..e68ed167 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -267,6 +267,8 @@ public: MOTOR_COMMAND_RETRIES, // max transmit tries of rotor command when the rotor dont start turning (with power measurement) MOTOR_RUNNING_TIMEOUT, // max motor running time before timeout DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS, // delay after change voltage before transmit toneburst/diseqc + DELAY_AFTER_DISEQC_RESET_CMD, + DELAY_AFTER_DISEQC_PERIPHERIAL_POWERON_CMD, MAX_PARAMS }; private: diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 7060168e..f4e91083 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -858,6 +858,14 @@ def InitSecParams(): x.addNotifier(lambda configElement: secClass.setParam(secClass.MOTOR_COMMAND_RETRIES, configElement.value)) config.sec.motor_command_retries = x + x = ConfigInteger(default=50, limits = (0, 9999)) + x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_DISEQC_RESET_CMD, configElement.value)) + config.sec.delay_after_diseqc_reset_cmd = x + + x = ConfigInteger(default=150, limits = (0, 9999)) + x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_DISEQC_PERIPHERIAL_POWERON_CMD, configElement.value)) + config.sec.delay_after_diseqc_peripherial_poweron_cmd = x + # TODO add support for satpos depending nims to advanced nim configuration # so a second/third/fourth cable from a motorized lnb can used behind a # diseqc 1.0 / diseqc 1.1 / toneburst switch diff --git a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py index 7b3d08f6..ec223d3e 100644 --- a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py @@ -23,6 +23,8 @@ class SecParameterSetup(Screen, ConfigListScreen): Screen.__init__(self, session) list = [ + ("Delay after diseqc reset command", config.sec.delay_after_diseqc_reset_cmd), + ("Delay after diseqc peripherial poweron command", config.sec.delay_after_diseqc_peripherial_poweron_cmd), ("Delay after continuous tone change", config.sec.delay_after_continuous_tone_change), ("Delay after last voltage change", config.sec.delay_after_final_voltage_change), ("Delay between diseqc commands", config.sec.delay_between_diseqc_repeats), -- cgit v1.2.3 From 103f4bf674f20b4431233ac066089e6de16ea480 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 14 Nov 2008 22:31:31 +0100 Subject: callbacks that are added upon hotplug events can be added to a hotplugNotifier list now. use this to speed up Audio CD recognition in MediaPlayer --- .../Plugins/Extensions/MediaPlayer/plugin.py | 35 ++++++++++++---------- lib/python/Plugins/SystemPlugins/Hotplug/plugin.py | 8 +++++ 2 files changed, 28 insertions(+), 15 deletions(-) (limited to 'lib/python/Plugins/SystemPlugins') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index b12e03e5..876e2a48 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -21,6 +21,7 @@ from Components.Harddisk import harddiskmanager from Components.config import config from Tools.Directories import fileExists, pathExists, resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCOPE_SKIN_IMAGE from settings import MediaPlayerSettings +from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier import random class MyPlayList(PlayList): @@ -96,6 +97,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self["repeat"] = MultiPixmap() self.seek_target = None + hotplugNotifier.append(self.hotplugCB) class MoviePlayerActionMap(NumberActionMap): def __init__(self, player, contexts = [ ], actions = { }, prio=0): @@ -171,7 +173,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.coverArtFileName = "" self.isAudioCD = False self.AudioCD_albuminfo = {} - + self.cdAudioTrackFiles = [] self.applySettings() self.playlistIOInternal = PlaylistIOInternal() @@ -203,6 +205,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB if config.mediaplayer.saveDirOnExit.getValue(): config.mediaplayer.defaultDir.setValue(self.filelist.getCurrentDirectory()) config.mediaplayer.defaultDir.save() + hotplugNotifier.remove(self.hotplugCB) self.close() def checkSkipShowHideLock(self): @@ -445,6 +448,8 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB def showMenu(self): menu = [] + if len(self.cdAudioTrackFiles): + menu.insert(0,(_("Play Audio-CD..."), "audiocd")) if self.currList == "filelist": if self.filelist.canDescent(): menu.append((_("add directory to playlist"), "copydir")) @@ -462,9 +467,6 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB menu.append((_("load playlist"), "loadplaylist")); menu.append((_("delete saved playlist"), "deleteplaylist")); menu.append((_("Edit settings"), "settings")) - drivepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) - if pathExists(drivepath): - menu.insert(0,(_("Play Audio-CD..."), "audiocd")) self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu) def menuCallback(self, choice): @@ -504,16 +506,6 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB elif choice[1] == "settings": self.session.openWithCallback(self.applySettings, MediaPlayerSettings, self) elif choice[1] == "audiocd": - from Components.Scanner import scanDevice - drivepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) - self.cdAudioTrackFiles = [] - res = scanDevice(drivepath) - list = [ (r.description, r, res[r], self.session) for r in res ] - if list: - (desc, scanner, files, session) = list[0] - for file in files: - if file.mimetype == "audio/x-cda": - self.cdAudioTrackFiles.append(file.path) self.playAudioCD() def playAudioCD(self): @@ -867,7 +859,20 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB def subtitleSelection(self): from Screens.Subtitles import Subtitles - self.session.open(Subtitles) + self.session.open(Subtitles) + + def hotplugCB(self, dev, media_state): + if dev == harddiskmanager.getCD(): + from Components.Scanner import scanDevice + devpath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) + self.cdAudioTrackFiles = [] + res = scanDevice(devpath) + list = [ (r.description, r, res[r], self.session) for r in res ] + if list: + (desc, scanner, files, session) = list[0] + for file in files: + if file.mimetype == "audio/x-cda": + self.cdAudioTrackFiles.append(file.path) class MediaPlayerLCDScreen(Screen): skin = """ diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py index 469b1dd0..97ddf4a1 100644 --- a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py @@ -8,6 +8,8 @@ DEVICEDB = \ "/devices/pci0000:00/0000:00:14.2/usb1/1-1/1-1:1.0/host0/target1:0:0/0:0:0:0": "SD Slot" } +hotplugNotifier = [ ] + class Hotplug(Protocol): def getUserfriendlyDeviceName(self, phys): return DEVICEDB.get(phys, "USB Storage") @@ -48,6 +50,12 @@ class Hotplug(Protocol): harddiskmanager.addHotplugPartition(dev, self.getUserfriendlyDeviceName(physdevpath)) elif media_state == '0': harddiskmanager.removeHotplugPartition(dev) + + for callback in hotplugNotifier: + try: + callback(dev, media_state) + except AttributeError: + hotplugNotifier.remove(callback) def autostart(reason, **kwargs): if reason == 0: -- cgit v1.2.3