From e5953c16c3ff3664f0f7a763f242a3eb69fed19d Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 2 Nov 2009 16:02:59 +0100 Subject: Revert "disable m2ts support for release 2.6" This reverts commit bce2a7b606d6fdfdcac86c7ccc1c02f147dc26c9. --- lib/python/Plugins/Extensions/MediaPlayer/plugin.py | 2 +- lib/service/servicemp3.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 0e3bdf02..596f2d5a 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -110,7 +110,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB # 'None' is magic to start at the list of mountpoints defaultDir = config.mediaplayer.defaultDir.getValue() - self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls") + self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|m2ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls") self["filelist"] = self.filelist self.playlist = MyPlayList() diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index e1bf23dd..7f87ffad 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -42,6 +42,7 @@ eServiceFactoryMP3::eServiceFactoryMP3() extensions.push_back("mp4"); extensions.push_back("mov"); extensions.push_back("m4a"); + extensions.push_back("m2ts"); sc->addServiceFactory(eServiceFactoryMP3::id, this, extensions); } -- cgit v1.2.3 From 3434371ea1aa6f585ef4bb406ba5ac4e4e06a7ee Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 2 Nov 2009 16:04:08 +0100 Subject: Revert "disable unicable for release 2.6" This reverts commit 597d64c2e00be8759286e37fd15823b1c1518845. --- lib/python/Components/NimManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 5154e2b0..70cde47c 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -939,7 +939,7 @@ def InitNimManager(nimmgr): lnb_choices = { "universal_lnb": _("Universal LNB"), -# "unicable": _("Unicable"), + "unicable": _("Unicable"), "c_band": _("C-Band"), "user_defined": _("User defined")} -- cgit v1.2.3 From e6a3b9fdb8f5ac0774a27794b175d79cf0973976 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 4 Nov 2009 12:59:17 +0100 Subject: DVDBurn fix capacity report for full dual layer media in Media Toolbox --- .../Plugins/Extensions/DVDBurn/DVDToolbox.py | 42 ++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py index feb39a95..53287a36 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py @@ -82,7 +82,9 @@ class DVDToolbox(Screen): self.update() def mediainfoCB(self, mediuminfo, retval, extra_args): - capacity = 1 + formatted_capacity = 0 + read_capacity = 0 + capacity = 0 used = 0 infotext = "" mediatype = "" @@ -93,21 +95,17 @@ class DVDToolbox(Screen): self.formattable = True else: self.formattable = False - if line.find("Legacy lead-out at:") > -1: + elif line.find("Legacy lead-out at:") > -1: used = int(line.rsplit('=',1)[1]) / 1048576.0 - print "[lead out] used =", used + print "[dvd+rw-mediainfo] lead out used =", used elif line.find("formatted:") > -1: - capacity = int(line.rsplit('=',1)[1]) / 1048576.0 - print "[formatted] capacity =", capacity - elif capacity == 1 and line.find("READ CAPACITY:") > -1: - capacity = int(line.rsplit('=',1)[1]) / 1048576.0 - print "[READ CAP] capacity =", capacity - elif line.find("Disc status:") > -1: - if line.find("blank") > -1: - print "[Disc status] capacity=%d, used=0" % (capacity) - capacity = used - used = 0 - elif line.find("Free Blocks:") > -1: + formatted_capacity = int(line.rsplit('=',1)[1]) / 1048576.0 + print "[dvd+rw-mediainfo] formatted capacity =", formatted_capacity + elif formatted_capacity == 0 and line.find("READ CAPACITY:") > -1: + read_capacity = int(line.rsplit('=',1)[1]) / 1048576.0 + print "[dvd+rw-mediainfo] READ CAPACITY =", read_capacity + for line in mediuminfo.splitlines(): + if line.find("Free Blocks:") > -1: try: size = eval(line[14:].replace("KB","*1024")) except: @@ -116,8 +114,22 @@ class DVDToolbox(Screen): capacity = size / 1048576 if used: used = capacity-used - print "[free blocks] capacity=%d, used=%d" % (capacity, used) + print "[dvd+rw-mediainfo] free blocks capacity=%d, used=%d" % (capacity, used) + elif line.find("Disc status:") > -1: + if line.find("blank") > -1: + print "[dvd+rw-mediainfo] Disc status blank capacity=%d, used=0" % (capacity) + capacity = used + used = 0 + elif line.find("complete") > -1 and formatted_capacity == 0: + print "[dvd+rw-mediainfo] Disc status complete capacity=0, used=%d" % (capacity) + used = read_capacity + capacity = 1 + else: + capacity = formatted_capacity infotext += line+'\n' + if capacity and used > capacity: + used = read_capacity or capacity + capacity = formatted_capacity or capacity self["details"].setText(infotext) if self.formattable: self["key_yellow"].text = _("Format") -- cgit v1.2.3 From 1915c7f7dbbec39c4d5592d9a0bee5454e4c452c Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Nov 2009 08:34:03 +0100 Subject: add missing file --- lib/python/Screens/RecordPaths.py | 194 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 lib/python/Screens/RecordPaths.py (limited to 'lib') diff --git a/lib/python/Screens/RecordPaths.py b/lib/python/Screens/RecordPaths.py new file mode 100644 index 00000000..c833266f --- /dev/null +++ b/lib/python/Screens/RecordPaths.py @@ -0,0 +1,194 @@ +from Screens.Screen import Screen +from Screens.LocationBox import MovieLocationBox, TimeshiftLocationBox +from Screens.MessageBox import MessageBox +from Components.Label import Label +from Components.config import config, ConfigSelection, getConfigListEntry, configfile +from Components.ConfigList import ConfigListScreen +from Components.ActionMap import ActionMap +from Tools.Directories import fileExists + + +class RecordPathsSettings(Screen,ConfigListScreen): + skin = """ + + + + + + + """ + + def __init__(self, session): + from Components.Sources.StaticText import StaticText + Screen.__init__(self, session) + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Save")) + + ConfigListScreen.__init__(self, []) + self.initConfigList() + + self["setupActions"] = ActionMap(["SetupActions", "ColorActions"], + { + "green": self.save, + "red": self.cancel, + "cancel": self.cancel, + "ok": self.ok, + }, -2) + + def checkReadWriteDir(self, configele): + print "checkReadWrite: ", configele.value + if configele.value in [x[0] for x in self.styles] or fileExists(configele.value, "w"): + configele.last_value = configele.value + return True + else: + dir = configele.value + configele.value = configele.last_value + self.session.open( + MessageBox, + _("The directory %s is not writable.\nMake sure you select a writable directory instead.")%dir, + type = MessageBox.TYPE_ERROR + ) + return False + + def initConfigList(self): + self.styles = [ ("", _("")), ("", _("")), ("", _("")) ] + styles_keys = [x[0] for x in self.styles] + tmp = config.movielist.videodirs.value + default = config.usage.default_path.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + print "DefaultPath: ", default, tmp + self.default_dirname = ConfigSelection(default = default, choices = tmp) + tmp = config.movielist.videodirs.value + default = config.usage.timer_path.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + print "TimerPath: ", default, tmp + self.timer_dirname = ConfigSelection(default = default, choices = self.styles+tmp) + tmp = config.movielist.videodirs.value + default = config.usage.instantrec_path.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + print "InstantrecPath: ", default, tmp + self.instantrec_dirname = ConfigSelection(default = default, choices = self.styles+tmp) + default = config.usage.timeshift_path.value + tmp = config.usage.allowed_timeshift_paths.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + print "TimeshiftPath: ", default, tmp + self.timeshift_dirname = ConfigSelection(default = default, choices = tmp) + self.default_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + self.timer_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + self.instantrec_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + self.timeshift_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + + self.list = [] + if config.usage.setup_level.index >= 2: + self.default_entry = getConfigListEntry(_("Default movie location"), self.default_dirname) + self.list.append(self.default_entry) + self.timer_entry = getConfigListEntry(_("Timer record location"), self.timer_dirname) + self.list.append(self.timer_entry) + self.instantrec_entry = getConfigListEntry(_("Instant record location"), self.instantrec_dirname) + self.list.append(self.instantrec_entry) + else: + self.default_entry = getConfigListEntry(_("Movie location"), self.default_dirname) + self.list.append(self.default_entry) + self.timeshift_entry = getConfigListEntry(_("Timeshift location"), self.timeshift_dirname) + self.list.append(self.timeshift_entry) + self["config"].setList(self.list) + + def ok(self): + currentry = self["config"].getCurrent() + self.lastvideodirs = config.movielist.videodirs.value + self.lasttimeshiftdirs = config.usage.allowed_timeshift_paths.value + if config.usage.setup_level.index >= 2: + txt = _("Default movie location") + else: + txt = _("Movie location") + if currentry == self.default_entry: + self.entrydirname = self.default_dirname + self.session.openWithCallback( + self.dirnameSelected, + MovieLocationBox, + txt, + self.default_dirname.value + ) + elif currentry == self.timer_entry: + self.entrydirname = self.timer_dirname + self.session.openWithCallback( + self.dirnameSelected, + MovieLocationBox, + _("Initial location in new timers"), + self.timer_dirname.value + ) + elif currentry == self.instantrec_entry: + self.entrydirname = self.instantrec_dirname + self.session.openWithCallback( + self.dirnameSelected, + MovieLocationBox, + _("Location for instant recordings"), + self.instantrec_dirname.value + ) + elif currentry == self.timeshift_entry: + self.entrydirname = self.timeshift_dirname + config.usage.timeshift_path.value = self.timeshift_dirname.value + self.session.openWithCallback( + self.dirnameSelected, + TimeshiftLocationBox + ) + + def dirnameSelected(self, res): + if res is not None: + self.entrydirname.value = res + if config.movielist.videodirs.value != self.lastvideodirs: + styles_keys = [x[0] for x in self.styles] + tmp = config.movielist.videodirs.value + default = self.default_dirname.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + self.default_dirname.setChoices(tmp, default=default) + tmp = config.movielist.videodirs.value + default = self.timer_dirname.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + self.timer_dirname.setChoices(self.styles+tmp, default=default) + tmp = config.movielist.videodirs.value + default = self.instantrec_dirname.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + self.instantrec_dirname.setChoices(self.styles+tmp, default=default) + self.entrydirname.value = res + if config.usage.allowed_timeshift_paths.value != self.lasttimeshiftdirs: + tmp = config.usage.allowed_timeshift_paths.value + default = self.instantrec_dirname.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + self.timeshift_dirname.setChoices(tmp, default=default) + self.entrydirname.value = res + if self.entrydirname.last_value != res: + self.checkReadWriteDir(self.entrydirname) + + def save(self): + currentry = self["config"].getCurrent() + if self.checkReadWriteDir(currentry[1]): + config.usage.default_path.value = self.default_dirname.value + config.usage.timer_path.value = self.timer_dirname.value + config.usage.instantrec_path.value = self.instantrec_dirname.value + config.usage.timeshift_path.value = self.timeshift_dirname.value + config.usage.default_path.save() + config.usage.timer_path.save() + config.usage.instantrec_path.save() + config.usage.timeshift_path.save() + self.close() + + def cancel(self): + self.close() + -- cgit v1.2.3 From e66d0ee5f86946cf2d0c3dc5a0ea369917e0cfd3 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Nov 2009 11:43:37 +0100 Subject: Revert "small fix" This reverts commit 1c954ba161bc3cd4b838b3c5a423d41847f0382a. --- lib/python/Screens/InfoBarGenerics.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index df853218..9a6a099c 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -910,8 +910,8 @@ class InfoBarSeek: def seekFwd(self): seek = self.getSeek() - if seek and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1): + if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed: self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) self.fast_winding_hint_message_showed = True return @@ -945,8 +945,8 @@ class InfoBarSeek: def seekBack(self): seek = self.getSeek() - if seek and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1): + if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed: self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) self.fast_winding_hint_message_showed = True return -- cgit v1.2.3 From 37e3c1814cc8ea6ef4eaef9a4bbc5d757d98972f Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Nov 2009 11:44:06 +0100 Subject: Revert "disable fast winding for non TS mediafiles until we have a usable solution for this.." This reverts commit b643641e2c6288eff61d0346a3dda82bd820b3b7. --- .../Extensions/DVDPlayer/src/servicedvd.cpp | 2 +- lib/python/Screens/InfoBarGenerics.py | 14 ------------ lib/service/servicedvb.cpp | 2 +- lib/service/servicemp3.cpp | 26 +--------------------- lib/service/servicexine.cpp | 2 +- 5 files changed, 4 insertions(+), 42 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 0372c497..94f2ee38 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -696,7 +696,7 @@ RESULT eServiceDVD::setTrickmode(int /*trick*/) RESULT eServiceDVD::isCurrentlySeekable() { - return m_state == stRunning ? 3 : 0; + return m_state == stRunning; } RESULT eServiceDVD::keyPressed(int key) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 9a6a099c..b98cd469 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -691,7 +691,6 @@ class InfoBarSeek: iPlayableService.evEOF: self.__evEOF, iPlayableService.evSOF: self.__evSOF, }) - self.fast_winding_hint_message_showed = False class InfoBarSeekActionMap(HelpableActionMap): def __init__(self, screen, *args, **kwargs): @@ -818,7 +817,6 @@ class InfoBarSeek: # print "seekable" def __serviceStarted(self): - self.fast_winding_hint_message_showed = False self.seekstate = self.SEEK_STATE_PLAY self.__seekableStatusChanged() @@ -909,12 +907,6 @@ class InfoBarSeek: self.showAfterSeek() def seekFwd(self): - seek = self.getSeek() - if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed: - self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) - self.fast_winding_hint_message_showed = True - return if self.seekstate == self.SEEK_STATE_PLAY: self.setSeekState(self.makeStateForward(int(config.seek.enter_forward.value))) elif self.seekstate == self.SEEK_STATE_PAUSE: @@ -944,12 +936,6 @@ class InfoBarSeek: self.setSeekState(self.makeStateSlowMotion(speed)) def seekBack(self): - seek = self.getSeek() - if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed: - self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) - self.fast_winding_hint_message_showed = True - return seekstate = self.seekstate if seekstate == self.SEEK_STATE_PLAY: self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index ddc675e6..1a28fbdd 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1370,7 +1370,7 @@ RESULT eDVBServicePlay::setTrickmode(int trick) RESULT eDVBServicePlay::isCurrentlySeekable() { - return m_is_pvr || m_timeshift_active ? 3 : 0; // fast forward/backward possible and seeking possible + return m_is_pvr || m_timeshift_active; } RESULT eDVBServicePlay::frontendInfo(ePtr &ptr) diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 52f2bc99..c95609a3 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -641,31 +641,7 @@ RESULT eServiceMP3::setTrickmode(int trick) RESULT eServiceMP3::isCurrentlySeekable() { - int ret = 3; // seeking and fast/slow winding possible - GstElement *sink; - - if (!m_gst_playbin) - return 0; - if (m_state != stRunning) - return 0; - - g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL); - - // disable fast winding yet when a dvbvideosink or dvbaudiosink is used - // for this we must do some changes on different places.. (gstreamer.. our sinks.. enigma2) - if (sink) { - ret &= ~2; // only seeking possible - gst_object_unref(sink); - } - else { - g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL); - if (sink) { - ret &= ~2; // only seeking possible - gst_object_unref(sink); - } - } - - return ret; + return 1; } RESULT eServiceMP3::info(ePtr&i) diff --git a/lib/service/servicexine.cpp b/lib/service/servicexine.cpp index 6b9adfb9..44e6a6e0 100644 --- a/lib/service/servicexine.cpp +++ b/lib/service/servicexine.cpp @@ -315,7 +315,7 @@ RESULT eServiceXine::setTrickmode(int trick) RESULT eServiceXine::isCurrentlySeekable() { - return 3; + return 1; } RESULT eServiceXine::info(ePtr&i) -- cgit v1.2.3 From 43115f56227db0f655402fef45d1a2fc60533f86 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Nov 2009 12:16:16 +0100 Subject: Revert "bug #258" This reverts commit 65ae5578663b82ddf54926047682ec1b6afdf4b6. its broken yet... --- lib/python/Components/config.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 lib/python/Components/config.py (limited to 'lib') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py old mode 100755 new mode 100644 -- cgit v1.2.3 From 3c8f046e30595b284a2b9c391a7ee7bdf662a284 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Nov 2009 12:16:56 +0100 Subject: Revert "bug #258" This reverts commit 0bc4d77344f249d7e3c0adb2b2ea58d74f2d02ea. its broken yet --- lib/python/Components/config.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) mode change 100644 => 100755 lib/python/Components/config.py (limited to 'lib') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py old mode 100644 new mode 100755 index d9f2104e..876e3a34 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1184,10 +1184,7 @@ class ConfigSatlist(ConfigSelection): def __init__(self, list, default = None): if default is not None: default = str(default) - choices = [(str(orbpos), desc) for (orbpos, desc, flags) in list] - choices.sort(key = lambda x: int(x[0])) - - ConfigSelection.__init__(self, choices = choices, default = default) + ConfigSelection.__init__(self, choices = [(str(orbpos), desc) for (orbpos, desc, flags) in list], default = default) def getOrbitalPosition(self): if self.value == "": -- cgit v1.2.3 From 4e08450f3d15c875231a264dfeec4fa0bcfa8997 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Mon, 9 Nov 2009 17:38:21 +0100 Subject: WirelessLan/plugin.py: - properly escape spaces inside an SSID name when returning the ConfigString. This fixes #175 --- lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 74520dcc..9f6a13fe 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -276,8 +276,15 @@ def configStrings(iface): return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -Dralink\n post-down wpa_cli terminate" if driver == 'madwifi': if config.plugins.wlan.essid.value == "hidden...": - return " pre-up iwconfig "+iface+" essid "+config.plugins.wlan.hiddenessid.value+"\n pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate" - return " pre-up iwconfig "+iface+" essid "+config.plugins.wlan.essid.value+"\n pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate" + if ' ' in config.plugins.wlan.hiddenessid.value: + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' + else: + return ' pre-up iwconfig '+iface+' essid '+config.plugins.wlan.hiddenessid.value+'\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' + else: + if ' ' in config.plugins.wlan.essid.value: + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' + else: + return ' pre-up iwconfig '+iface+' essid '+config.plugins.wlan.essid.value+'\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' if driver == 'zydas': return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -dd -Dzydas\n post-down wpa_cli terminate" -- cgit v1.2.3 From a87dcad83a4096c1d29ccdf5cda873ee43629f70 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 11 Nov 2009 18:34:04 +0100 Subject: WirelessLan/plugin.py: - always use quotes for the ssid name, small cleanup --- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 9f6a13fe..b7a64b9a 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -271,22 +271,14 @@ def callFunction(iface): def configStrings(iface): driver = iNetwork.detectWlanModule() - print "WLAN-MODULE",driver - if driver == 'ralink': - return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -Dralink\n post-down wpa_cli terminate" - if driver == 'madwifi': + print "Found WLAN-Driver:",driver + if driver in ('ralink', 'zydas'): + return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate" + else: if config.plugins.wlan.essid.value == "hidden...": - if ' ' in config.plugins.wlan.hiddenessid.value: - return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' - else: - return ' pre-up iwconfig '+iface+' essid '+config.plugins.wlan.hiddenessid.value+'\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' else: - if ' ' in config.plugins.wlan.essid.value: - return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' - else: - return ' pre-up iwconfig '+iface+' essid '+config.plugins.wlan.essid.value+'\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -Dmadwifi\n post-down wpa_cli terminate' - if driver == 'zydas': - return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -dd -Dzydas\n post-down wpa_cli terminate" + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' def Plugins(**kwargs): return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."}) -- cgit v1.2.3 From 5eaa358e8324f2a4f9440b84bdfad72749a4a379 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 14 Nov 2009 14:53:30 +0100 Subject: decoder.cpp: remove flush in audio stop request.. when its realy needed it should be done in driver... --- lib/dvb/decoder.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib') diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp index 09350698..ef8dadc3 100644 --- a/lib/dvb/decoder.cpp +++ b/lib/dvb/decoder.cpp @@ -222,9 +222,6 @@ int eDVBAudio::startPid(int pid, int type) void eDVBAudio::stop() { -#if HAVE_DVB_API_VERSION > 2 - flush(); -#endif eDebugNoNewLine("AUDIO_STOP - "); if (::ioctl(m_fd, AUDIO_STOP) < 0) eDebug("failed (%m)"); -- cgit v1.2.3 From 58d96b9ff49080139dbe98546a7fe78953fca987 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 10 Nov 2009 16:35:00 +0100 Subject: fixes bug #281 add "yes to all" and "no to all" to "Delete no more configured satellite" dialog if orbpos isn't needed anymore in current sat config --- lib/python/Screens/Satconfig.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 8b5089a3..e24e4636 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -8,6 +8,7 @@ from Components.NimManager import nimmanager from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement from Components.Sources.List import List from Screens.MessageBox import MessageBox +from Screens.ChoiceBox import ChoiceBox from time import mktime, localtime from datetime import datetime @@ -342,10 +343,10 @@ class NimSetup(Screen, ConfigListScreen): new_configured_sats = nimmanager.getConfiguredSats() self.unconfed_sats = old_configured_sats - new_configured_sats self.satpos_to_remove = None - self.deleteConfirmed(False) + self.deleteConfirmed((None, "no")) def deleteConfirmed(self, confirmed): - if confirmed: + if confirmed[1] == "yes" or confirmed[1] == "yestoall": eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove) if self.satpos_to_remove is not None: @@ -365,11 +366,15 @@ class NimSetup(Screen, ConfigListScreen): else: h = _("E") sat_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10) - self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Delete no more configured satellite\n%s?") %(sat_name)) + + if confirmed[1] == "yes" or confirmed[1] == "no": + self.session.openWithCallback(self.deleteConfirmed, ChoiceBox, _("Delete no more configured satellite\n%s?") %(sat_name), [(_("Yes"), "yes"), (_("No"), "no"), (_("Yes to all"), "yestoall"), (_("No to all"), "notoall")]) + if confirmed[1] == "yestoall" or confirmed[1] == "notoall": + self.deleteConfirmed(confirmed) break if not self.satpos_to_remove: self.close() - + def __init__(self, session, slotid): Screen.__init__(self, session) self.list = [ ] -- cgit v1.2.3 From b01b4beb24bab09840bf11e2f7ca06cccfd5677c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 7 Nov 2009 12:21:25 +0100 Subject: fixes bug #280 don't allow scanning on a nim configured as advanced with no LNB assigned to any sat --- lib/python/Screens/ScanSetup.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index bea08724..fa787a70 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -524,6 +524,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): for n in nimmanager.nim_slots: if n.config_mode == "nothing": continue + if n.config_mode == "advanced" and len(nimmanager.getSatListForNim(n.slot)) < 1: + continue if n.config_mode in ("loopthrough", "satposdepends"): root_id = nimmanager.sec.getRoot(n.slot_id, int(n.config.connectedTo.value)) if n.type == nimmanager.nim_slots[root_id].type: # check if connected from a DVB-S to DVB-S2 Nim or vice versa -- cgit v1.2.3 From 58965c6783464b3390b7ad0687f4ed4a559f9ce2 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 16 Nov 2009 19:03:34 +0100 Subject: fixes bug #291 don't crash if auto scart switching is enabled and the scart voltage is high on enigma2 startup not the best solution since the whole scart switching stuff is broken by design, but this fix prevents the crash --- lib/python/Screens/MessageBox.py | 4 +++- lib/python/Screens/Scart.py | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/MessageBox.py b/lib/python/Screens/MessageBox.py index 86bf07d3..f3538b7b 100644 --- a/lib/python/Screens/MessageBox.py +++ b/lib/python/Screens/MessageBox.py @@ -12,9 +12,11 @@ class MessageBox(Screen): TYPE_WARNING = 2 TYPE_ERROR = 3 - def __init__(self, session, text, type = TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True, enable_input = True): + def __init__(self, session, text, type = TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True, enable_input = True, msgBoxID = None): self.type = type Screen.__init__(self, session) + + self.msgBoxID = msgBoxID self["text"] = Label(text) self["Text"] = StaticText(text) diff --git a/lib/python/Screens/Scart.py b/lib/python/Screens/Scart.py index dc511448..00e78593 100644 --- a/lib/python/Screens/Scart.py +++ b/lib/python/Screens/Scart.py @@ -1,10 +1,13 @@ from Screen import Screen from MessageBox import MessageBox from Components.AVSwitch import AVSwitch +from Tools import Notifications class Scart(Screen): def __init__(self, session, start_visible=True): Screen.__init__(self, session) + self.msgBox = None + self.notificationVisible = None self.avswitch = AVSwitch() @@ -22,7 +25,11 @@ class Scart(Screen): if not self.msgVisible: self.msgVisible = True self.avswitch.setInput("SCART") - self.msgBox = self.session.openWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR) + if not self.session.in_exec: + self.notificationVisible = True + Notifications.AddNotificationWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR, msgBoxID = "scart_msgbox") + else: + self.msgBox = self.session.openWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR) def MsgBoxClosed(self, *val): self.msgBox = None @@ -35,3 +42,13 @@ class Scart(Screen): return self.avswitch.setInput("ENCODER") self.msgVisible = False + if self.notificationVisible: + self.avswitch.setInput("ENCODER") + self.notificationVisible = False + for notification in Notifications.current_notifications: + try: + if notification[1].msgBoxID == "scart_msgbox": + notification[1].close() + except: + print "other notification is open. try another one." + \ No newline at end of file -- cgit v1.2.3 From ada04d7a63c97fdd3817c98ae7eb783c14a6d943 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 17 Nov 2009 18:34:45 +0100 Subject: epgcache.cpp: fix segfault on unknown arg --- lib/dvb/epgcache.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index f80e1775..5381195a 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -1717,6 +1717,7 @@ void fillTuple(ePyObject tuple, const char *argstring, int argcount, ePyObject s ++argcount; continue; default: // ignore unknown + tmp = ePyObjec(); eDebug("fillTuple unknown '%c'... insert 'None' in result", c); } if (!tmp) @@ -2061,6 +2062,7 @@ void fillTuple2(ePyObject tuple, const char *argstring, int argcount, eventData inc_refcount = true; break; default: // ignore unknown + tmp = ePyObject(); eDebug("fillTuple2 unknown '%c'... insert None in Result", argstring[pos]); } if (!tmp) -- cgit v1.2.3 From 8b95dcf3c8e3e67046e17948117c66d9780f70f9 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 17 Nov 2009 18:38:49 +0100 Subject: epgcache.cpp: fix typo --- lib/dvb/epgcache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index 5381195a..2dc36412 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -1717,7 +1717,7 @@ void fillTuple(ePyObject tuple, const char *argstring, int argcount, ePyObject s ++argcount; continue; default: // ignore unknown - tmp = ePyObjec(); + tmp = ePyObject(); eDebug("fillTuple unknown '%c'... insert 'None' in result", c); } if (!tmp) -- cgit v1.2.3 From ddca0c3920d66bdbb3c77851c09ba7d4f6bc16b9 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 18 Nov 2009 17:04:20 +0100 Subject: servicedvb.cpp: apply global ac3(bitstream) delay and global pcm(decode) delay on setAC3Delay and setPCMDelay call.. not only on zap --- lib/service/servicedvb.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 1a28fbdd..6d9cad09 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -2398,17 +2398,8 @@ void eDVBServicePlay::updateDecoder() } } - std::string config_delay; - int config_delay_int = 0; - if(ePythonConfigQuery::getConfigValue("config.av.generalAC3delay", config_delay) == 0) - config_delay_int = atoi(config_delay.c_str()); - m_decoder->setAC3Delay(ac3_delay == -1 ? config_delay_int : ac3_delay + config_delay_int); - - if(ePythonConfigQuery::getConfigValue("config.av.generalPCMdelay", config_delay) == 0) - config_delay_int = atoi(config_delay.c_str()); - else - config_delay_int = 0; - m_decoder->setPCMDelay(pcm_delay == -1 ? config_delay_int : pcm_delay + config_delay_int); + setAC3Delay(ac3_delay == -1 ? 0 : ac3_delay); + setPCMDelay(pcm_delay == -1 ? 0 : pcm_delay); m_decoder->setVideoPID(vpid, vpidtype); selectAudioStream(); @@ -2932,16 +2923,28 @@ void eDVBServicePlay::setAC3Delay(int delay) { if (m_dvb_service) m_dvb_service->setCacheEntry(eDVBService::cAC3DELAY, delay ? delay : -1); - if (m_decoder) - m_decoder->setAC3Delay(delay); + if (m_decoder) { + std::string config_delay; + int config_delay_int = 0; + if(ePythonConfigQuery::getConfigValue("config.av.generalAC3delay", config_delay) == 0) + config_delay_int = atoi(config_delay.c_str()); + m_decoder->setAC3Delay(delay + config_delay_int); + } } void eDVBServicePlay::setPCMDelay(int delay) { if (m_dvb_service) m_dvb_service->setCacheEntry(eDVBService::cPCMDELAY, delay ? delay : -1); - if (m_decoder) - m_decoder->setPCMDelay(delay); + if (m_decoder) { + std::string config_delay; + int config_delay_int = 0; + if(ePythonConfigQuery::getConfigValue("config.av.generalPCMdelay", config_delay) == 0) + config_delay_int = atoi(config_delay.c_str()); + else + config_delay_int = 0; + m_decoder->setPCMDelay(delay + config_delay_int); + } } void eDVBServicePlay::video_event(struct iTSMPEGDecoder::videoEvent event) -- cgit v1.2.3 From 3823b59986d6d47a8ca4b5db642c426f2e2b2652 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 19 Nov 2009 08:48:37 +0100 Subject: config.py: fix set/getValue for ConfigSelectionNumber --- lib/python/Components/config.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 876e3a34..a6007b10 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1034,13 +1034,13 @@ class ConfigSelectionNumber(ConfigSelection): step += stepwidth ConfigSelection.__init__(self, choices, default) - + def getValue(self): - return int(self.text) + return int(ConfigSelection.getValue(self)) def setValue(self, val): - self.text = str(val) - + ConfigSelection.setValue(self, str(val)) + def handleKey(self, key): if not self.wraparound: if key == KEY_RIGHT: @@ -1050,8 +1050,6 @@ class ConfigSelectionNumber(ConfigSelection): if self.choices.index(self.value) == 0: return ConfigSelection.handleKey(self, key) - - class ConfigNumber(ConfigText): def __init__(self, default = 0): -- cgit v1.2.3 From a30169eba9644afe90859835be314055209fa3c1 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 19 Nov 2009 11:13:17 +0100 Subject: Components/About.py: fix /etc/image-version parser..now we also show image type (release/experimental) and major minor revision --- lib/python/Components/About.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py index bb2d7568..58d67dc9 100644 --- a/lib/python/Components/About.py +++ b/lib/python/Components/About.py @@ -19,11 +19,20 @@ class About: #0120 2005 11 29 01 16 #0123 4567 89 01 23 45 version = splitted[1] + image_type = version[0] # 0 = release, 1 = experimental + major = version[1] + minor = version[2] + revision = version[3] year = version[4:8] month = version[8:10] day = version[10:12] - - return '-'.join(("dev", year, month, day)) + if image_type == '0': + image_type = "Release" + else: + image_type = "Experimental" + date = '-'.join((year, month, day)) + version = '.'.join((major, minor, revision)) + return ' '.join((image_type, version, date)) file.close() except IOError: pass -- cgit v1.2.3 From 78c9520c9cc8030a7a14a895fb1775d5965d7a7e Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 20 Nov 2009 13:06:50 +0100 Subject: lib/python/Components/About.py: dont show version information for Experimental images.. only show date here.. --- lib/python/Components/About.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py index 58d67dc9..8e332e33 100644 --- a/lib/python/Components/About.py +++ b/lib/python/Components/About.py @@ -26,13 +26,14 @@ class About: year = version[4:8] month = version[8:10] day = version[10:12] + date = '-'.join((year, month, day)) if image_type == '0': image_type = "Release" + version = '.'.join((major, minor, revision)) + return ' '.join((image_type, version, date)) else: image_type = "Experimental" - date = '-'.join((year, month, day)) - version = '.'.join((major, minor, revision)) - return ' '.join((image_type, version, date)) + return ' '.join((image_type, date)) file.close() except IOError: pass -- cgit v1.2.3 From 8a1642be593db66a12a14f50e20cc297232a1ce2 Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 22 Nov 2009 22:56:00 +0100 Subject: servicemp3.cpp: temporary store ac3/pcm delay for gstreamer based playbacks (until e2 restart) --- lib/service/servicemp3.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index c95609a3..0c528997 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -1604,6 +1604,7 @@ int eServiceMP3::getPCMDelay() void eServiceMP3::setAC3Delay(int delay) { + ac3_delay = delay; if (!m_gst_playbin || m_state != stRunning) return; else @@ -1631,6 +1632,7 @@ void eServiceMP3::setAC3Delay(int delay) void eServiceMP3::setPCMDelay(int delay) { + pcm_delay = delay; if (!m_gst_playbin || m_state != stRunning) return; else -- cgit v1.2.3 From c1ffa86e1de5591f4d91d09fd90323df8587920c Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 22 Nov 2009 23:10:35 +0100 Subject: servicemp3.cpp: dont apply ac3/pcm delay when no video is running --- lib/service/servicemp3.cpp | 49 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 0c528997..0f604b84 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -1610,18 +1610,27 @@ void eServiceMP3::setAC3Delay(int delay) else { GstElement *sink; - std::string config_delay; int config_delay_int = delay; - if(ePythonConfigQuery::getConfigValue("config.av.generalAC3delay", config_delay) == 0) - config_delay_int += atoi(config_delay.c_str()); + g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL); + + if (sink) + { + std::string config_delay; + if(ePythonConfigQuery::getConfigValue("config.av.generalAC3delay", config_delay) == 0) + config_delay_int += atoi(config_delay.c_str()); + gst_object_unref(sink); + } + else + { + eDebug("dont apply ac3 delay when no video is running!"); + config_delay_int = 0; + } g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL); - if (!sink) - return; - else { + if (sink) + { gchar *name = gst_element_get_name(sink); - if (strstr(name, "dvbaudiosink")) eTSMPEGDecoder::setHwAC3Delay(config_delay_int); g_free(name); @@ -1638,21 +1647,31 @@ void eServiceMP3::setPCMDelay(int delay) else { GstElement *sink; - std::string config_delay; int config_delay_int = delay; - if(ePythonConfigQuery::getConfigValue("config.av.generalPCMdelay", config_delay) == 0) - config_delay_int += atoi(config_delay.c_str()); + g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL); + + if (sink) + { + std::string config_delay; + if(ePythonConfigQuery::getConfigValue("config.av.generalPCMdelay", config_delay) == 0) + config_delay_int += atoi(config_delay.c_str()); + gst_object_unref(sink); + } + else + { + eDebug("dont apply pcm delay when no video is running!"); + config_delay_int = 0; + } g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL); - if (!sink) - return; - else { + if (sink) + { gchar *name = gst_element_get_name(sink); - if (strstr(name, "dvbaudiosink")) eTSMPEGDecoder::setHwPCMDelay(config_delay_int); - else { + else + { // this is realy untested..and not used yet gint64 offset = config_delay_int; offset *= 1000000; // milli to nano -- cgit v1.2.3 From 9b424161b583c7bfe5a58e979a9468101a6b6efd Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 23 Nov 2009 10:26:49 +0100 Subject: servicedvb.cpp: more exact resume after seek and slowmotion --- lib/service/servicedvb.cpp | 38 ++++++++++++++++++++++++++------------ lib/service/servicedvb.h | 4 +++- 2 files changed, 29 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 6d9cad09..6b258ac1 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -917,7 +917,7 @@ eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *serv m_is_pvr = !m_reference.path.empty(); m_timeshift_enabled = m_timeshift_active = 0, m_timeshift_changed = 0; - m_skipmode = 0; + m_skipmode = m_fastforward = m_slowmotion = 0; CONNECT(m_service_handler.serviceEvent, eDVBServicePlay::serviceEvent); CONNECT(m_service_handler_timeshift.serviceEvent, eDVBServicePlay::serviceEventTimeshift); @@ -1185,7 +1185,10 @@ RESULT eDVBServicePlay::setSlowMotion(int ratio) eDebug("eDVBServicePlay::setSlowMotion(%d)", ratio); setFastForward_internal(0); if (m_decoder) + { + m_slowmotion = ratio; return m_decoder->setSlowMotion(ratio); + } else return -1; } @@ -1197,10 +1200,11 @@ RESULT eDVBServicePlay::setFastForward(int ratio) return setFastForward_internal(ratio); } -RESULT eDVBServicePlay::setFastForward_internal(int ratio) +RESULT eDVBServicePlay::setFastForward_internal(int ratio, bool final_seek) { - int skipmode, ffratio; - + int skipmode, ffratio, ret = 0; + pts_t pos=0; + if (ratio > 8) { skipmode = ratio; @@ -1225,19 +1229,28 @@ RESULT eDVBServicePlay::setFastForward_internal(int ratio) if (m_cue) m_cue->setSkipmode(skipmode * 90000); /* convert to 90000 per second */ } - + m_skipmode = skipmode; - + + if (final_seek) + eDebug("trickplay stopped .. ret %d, pos %lld", getPlayPosition(pos), pos); + + m_fastforward = ffratio; + if (!m_decoder) return -1; - + if (ffratio == 0) ; /* return m_decoder->play(); is done in caller*/ else if (ffratio != 1) - return m_decoder->setFastForward(ffratio); + ret = m_decoder->setFastForward(ffratio); else - return m_decoder->setTrickmode(); - return 0; + ret = m_decoder->setTrickmode(); + + if (pos) + eDebug("final seek after trickplay ret %d", seekTo(pos)); + + return ret; } RESULT eDVBServicePlay::seek(ePtr &ptr) @@ -1278,9 +1291,10 @@ RESULT eDVBServicePlay::pause() RESULT eDVBServicePlay::unpause() { eDebug("eDVBServicePlay::unpause"); - setFastForward_internal(0); + setFastForward_internal(0, m_slowmotion || m_fastforward > 1); if (m_decoder) { + m_slowmotion = 0; m_is_paused = 0; return m_decoder->play(); } else @@ -2229,7 +2243,7 @@ void eDVBServicePlay::switchToLive() m_new_subtitle_page_connection = 0; m_rds_decoder_event_connection = 0; m_video_event_connection = 0; - m_is_paused = m_skipmode = 0; /* not supported in live mode */ + m_is_paused = m_skipmode = m_fastforward = m_slowmotion = 0; /* not supported in live mode */ /* free the timeshift service handler, we need the resources */ m_service_handler_timeshift.free(); diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index b4d0f196..e3c7fd58 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -220,7 +220,7 @@ private: int m_current_audio_stream; int selectAudioStream(int n = -1); - RESULT setFastForward_internal(int ratio); + RESULT setFastForward_internal(int ratio, bool final_seek=false); /* timeshift */ ePtr m_record; @@ -233,6 +233,8 @@ private: void updateDecoder(); int m_skipmode; + int m_fastforward; + int m_slowmotion; /* cuesheet */ -- cgit v1.2.3 From 071d793631002b697b3b666af4e6c47406e37a1b Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 26 Nov 2009 14:34:55 +0100 Subject: servicedvb.cpp: fix transition from slowmotion or decoder fast forward to pause --- lib/service/servicedvb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 6b258ac1..1cdadcf9 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1279,9 +1279,10 @@ RESULT eDVBServicePlay::getLength(pts_t &len) RESULT eDVBServicePlay::pause() { eDebug("eDVBServicePlay::pause"); - setFastForward_internal(0); + setFastForward_internal(0, m_slowmotion || m_fastforward > 1); if (m_decoder) { + m_slowmotion = 0; m_is_paused = 1; return m_decoder->pause(); } else -- cgit v1.2.3 From 2013076d767842eba5ac94aaf3e58c94303d05e2 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 26 Nov 2009 18:34:31 +0100 Subject: servicedvb.cpp: fix "some seconds no audio after audio track change on TS Playback" --- lib/service/servicedvb.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 1cdadcf9..f85ce9cc 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1743,6 +1743,7 @@ int eDVBServicePlay::selectAudioStream(int i) { eDVBServicePMTHandler::program program; eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler; + pts_t position = -1; if (h.getProgramInfo(program)) return -1; @@ -1765,6 +1766,9 @@ int eDVBServicePlay::selectAudioStream(int i) apidtype = program.audioStreams[stream].type; } + if (i != -1 && apid != m_current_audio_pid && (m_is_pvr || m_timeshift_active)) + eDebug("getPlayPosition ret %d, pos %lld in selectAudioStream", getPlayPosition(position), position); + m_current_audio_pid = apid; if (m_is_primary && m_decoder->setAudioPID(apid, apidtype)) @@ -1773,6 +1777,9 @@ int eDVBServicePlay::selectAudioStream(int i) return -4; } + if (position != -1) + eDebug("seekTo ret %d", seekTo(position)); + int rdsPid = apid; /* if we are not in PVR mode, timeshift is not active and we are not in pip mode, check if we need to enable the rds reader */ -- cgit v1.2.3 From c72b0788e404a940f29888a696756d6b4cd6644f Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 1 Dec 2009 10:32:01 +0100 Subject: Components/Lcd.py: use 1 instead of 0 for Oled standby default value (with new drivers the oled is completely disabled on lowest step) --- lib/python/Components/Lcd.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index 0e501237..7d27c097 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -42,9 +42,18 @@ def InitLcd(): def setLCDinverted(configElement): ilcd.setInverted(configElement.value); + standby_default = 0 + ilcd = LCD() - config.lcd.standby = ConfigSlider(default=0, limits=(0, 10)) + if not ilcd.isOled(): + config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20)) + config.lcd.contrast.addNotifier(setLCDcontrast); + else: + config.lcd.contrast = ConfigNothing() + standby_default = 1 + + config.lcd.standby = ConfigSlider(default=standby_default, limits=(0, 10)) config.lcd.standby.addNotifier(setLCDbright); config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby) @@ -53,12 +62,6 @@ def InitLcd(): config.lcd.bright.apply = lambda : setLCDbright(config.lcd.bright) config.lcd.bright.callNotifiersOnSaveAndCancel = True - if not ilcd.isOled(): - config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20)) - config.lcd.contrast.addNotifier(setLCDcontrast); - else: - config.lcd.contrast = ConfigNothing() - config.lcd.invert = ConfigYesNo(default=False) config.lcd.invert.addNotifier(setLCDinverted); else: -- cgit v1.2.3 From b79bdb964320dabf4180ef6820a1ce335afccaa5 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 3 Dec 2009 15:23:41 +0100 Subject: Plugins/Plugin.py, InfoBarGenerics.py: add WHERE_AUDIOMENU for plugins .. requested by Tode for the AudioSync Plugin fixes bug #305 --- lib/python/Plugins/Plugin.py | 2 ++ lib/python/Screens/InfoBarGenerics.py | 47 ++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py index d7fc6898..dc68ebf3 100755 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -52,6 +52,8 @@ class PluginDescriptor: # reason (True: Networkconfig read finished, False: Networkconfig reload initiated ) WHERE_NETWORKCONFIG_READ = 12 + WHERE_AUDIOMENU = 13 + def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False): self.name = name self.internal = internal diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index b98cd469..b672b682 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1663,17 +1663,46 @@ class InfoBarAudioSelection: else: break + availableKeys = [] + usedKeys = [] + if SystemInfo["CanDownmixAC3"]: - tlist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix), - ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), - ("--", "")] + tlist - keys = [ "red", "green", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n - selection += 3 - else: - tlist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), ("--", "")] + tlist - keys = [ "red", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n + flist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix), + ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")] + usedKeys.extend(["red", "green"]) + availableKeys.extend(["yellow", "blue"]) selection += 2 - self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection") + else: + flist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")] + usedKeys.extend(["red"]) + availableKeys.extend(["green", "yellow", "blue"]) + selection += 1 + + if hasattr(self, "runPlugin"): + class PluginCaller: + def __init__(self, fnc, *args): + self.fnc = fnc + self.args = args + def __call__(self, *args, **kwargs): + self.fnc(*self.args) + + Plugins = [ (p.name, PluginCaller(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] + + for p in Plugins: + selection += 1 + flist.append((p[0], "CALLFUNC", p[1])) + if availableKeys: + usedKeys.append(availableKeys[0]) + del availableKeys[0] + else: + usedKeys.append("") + + flist.append(("--", "")) + usedKeys.append("") + selection += 1 + + keys = usedKeys + [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ] + [""] * n + self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = flist + tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection") else: del self.audioTracks -- cgit v1.2.3 From 44fb489521cf6ad1defba93311366df08d7938a4 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 3 Dec 2009 16:37:52 +0100 Subject: Components/SystemInfo.py: add new SystemInfo entry "DeepstandbySupport" --- lib/python/Components/SystemInfo.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/SystemInfo.py b/lib/python/Components/SystemInfo.py index d2b405a2..f9c4065f 100644 --- a/lib/python/Components/SystemInfo.py +++ b/lib/python/Components/SystemInfo.py @@ -1,5 +1,6 @@ from enigma import eDVBResourceManager from Tools.Directories import fileExists +from Tools.HardwareInfo import HardwareInfo SystemInfo = { } @@ -27,3 +28,4 @@ def countFrontpanelLEDs(): SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs() SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0") SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0") +SystemInfo["DeepstandbySupport"] = HardwareInfo().get_device_name() != "dm800" -- cgit v1.2.3 From 1d05937cd1d720c4b23fb852ad8fcf3d9466ec4a Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 3 Dec 2009 16:40:44 +0100 Subject: Menu.py: add possibility to use the exclamation mark as NOT indicator in menu/setup.xml for requires entries (thx to Moritz Venn) --- lib/python/Screens/Menu.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/Menu.py b/lib/python/Screens/Menu.py index 5f2032f1..bb0709e5 100644 --- a/lib/python/Screens/Menu.py +++ b/lib/python/Screens/Menu.py @@ -97,8 +97,12 @@ class Menu(Screen): def addMenu(self, destList, node): requires = node.get("requires") - if requires and not SystemInfo.get(requires, False): - return + if requires: + if requires[0] == '!': + if SystemInfo.get(requires[1:], False): + return + elif not SystemInfo.get(requires, False): + return MenuTitle = _(node.get("text", "??").encode("UTF-8")) entryID = node.get("entryID", "undefined") weight = node.get("weight", 50) @@ -120,8 +124,12 @@ class Menu(Screen): def addItem(self, destList, node): requires = node.get("requires") - if requires and not SystemInfo.get(requires, False): - return + if requires: + if requires[0] == '!': + if SystemInfo.get(requires[1:], False): + return + elif not SystemInfo.get(requires, False): + return item_text = node.get("text", "").encode("UTF-8") entryID = node.get("entryID", "undefined") weight = node.get("weight", 50) -- cgit v1.2.3 From 9fba96095af3d4a6b1b596893f4e005dc0b6f16d Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 3 Dec 2009 16:46:01 +0100 Subject: use new DeepstandbySupport SystemInfo entry at some places... this fixes bug #307 Conflicts: lib/python/Screens/TimerEntry.py --- data/menu.xml | 3 ++- lib/python/Screens/SleepTimerEdit.py | 7 ++++++- lib/python/Screens/TaskView.py | 7 ++++++- lib/python/Screens/TimerEntry.py | 7 ++++++- 4 files changed, 20 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/data/menu.xml b/data/menu.xml index 403e0b81..59195f15 100644 --- a/data/menu.xml +++ b/data/menu.xml @@ -104,6 +104,7 @@ self.session.openWithCallback(msgClosed, FactoryReset) 2 3 - 1 + 1 + 1 diff --git a/lib/python/Screens/SleepTimerEdit.py b/lib/python/Screens/SleepTimerEdit.py index ff061d88..e5e7af4e 100644 --- a/lib/python/Screens/SleepTimerEdit.py +++ b/lib/python/Screens/SleepTimerEdit.py @@ -5,6 +5,7 @@ from Components.Input import Input from Components.Label import Label from Components.Pixmap import Pixmap from Components.config import config, ConfigInteger +from Components.SystemInfo import SystemInfo from enigma import eEPGCache from SleepTimer import SleepTimer from time import time @@ -77,7 +78,11 @@ class SleepTimerEdit(Screen): self["red_text"].setText(_("Action:") + " " + _("Disable timer")) if config.SleepTimer.action.value == "shutdown": - self["green_text"].setText(_("Sleep timer action:") + " " + _("Deep Standby")) + if SystemInfo["DeepstandbySupport"]: + shutdownString = _("Deep Standby") + else: + shutdownString = _("Shutdown") + self["green_text"].setText(_("Sleep timer action:") + " " + shutdownString) elif config.SleepTimer.action.value == "standby": self["green_text"].setText(_("Sleep timer action:") + " " + _("Standby")) diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 1453c05f..eb926ca3 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -1,6 +1,7 @@ from Screen import Screen from Components.ConfigList import ConfigListScreen from Components.config import config, ConfigSubsection, ConfigSelection, getConfigListEntry +from Components.SystemInfo import SystemInfo from InfoBarGenerics import InfoBarNotifications import Screens.Standby from Tools import Notifications @@ -44,7 +45,11 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): self.afterevents = [ "nothing", "standby", "deepstandby", "close" ] self.settings = ConfigSubsection() - self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby"))], default = self.afterevents[afterEvent]) + if SystemInfo["DeepstandbySupport"]: + shutdownString = _("go to deep standby") + else: + shutdownString = _("shut down") + self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", shutdownString)], default = self.afterevents[afterEvent]) self.setupList() self.state_changed() diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index 5813bac5..42a3195c 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -9,6 +9,7 @@ from Components.Button import Button from Components.Label import Label from Components.Pixmap import Pixmap from Components.UsageConfig import defaultMoviePath +from Components.SystemInfo import SystemInfo from Screens.MovieSelection import getPreferredTagEditor from Screens.LocationBox import MovieLocationBox from Screens.ChoiceBox import ChoiceBox @@ -93,7 +94,11 @@ class TimerEntry(Screen, ConfigListScreen): day[weekday] = 1 self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[justplay]) - self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby")), ("auto", _("auto"))], default = afterevent) + if SystemInfo["DeepstandbySupport"]: + shutdownString = _("go to deep standby") + else: + shutdownString = _("shut down") + self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent) self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type) self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False) self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False) -- cgit v1.2.3 From 15b64dc4fbead7b5c15cb309a82914f79ae78b0a Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Nov 2009 11:37:29 +0100 Subject: disable fast winding for non TS mediafiles until we have a usable solution for this.. --- .../Extensions/DVDPlayer/src/servicedvd.cpp | 2 +- lib/python/Screens/InfoBarGenerics.py | 14 ++++++++++++ lib/service/servicedvb.cpp | 2 +- lib/service/servicemp3.cpp | 26 +++++++++++++++++++++- lib/service/servicexine.cpp | 2 +- 5 files changed, 42 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 94f2ee38..0372c497 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -696,7 +696,7 @@ RESULT eServiceDVD::setTrickmode(int /*trick*/) RESULT eServiceDVD::isCurrentlySeekable() { - return m_state == stRunning; + return m_state == stRunning ? 3 : 0; } RESULT eServiceDVD::keyPressed(int key) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index b672b682..24ebada7 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -691,6 +691,7 @@ class InfoBarSeek: iPlayableService.evEOF: self.__evEOF, iPlayableService.evSOF: self.__evSOF, }) + self.fast_winding_hint_message_showed = False class InfoBarSeekActionMap(HelpableActionMap): def __init__(self, screen, *args, **kwargs): @@ -817,6 +818,7 @@ class InfoBarSeek: # print "seekable" def __serviceStarted(self): + self.fast_winding_hint_message_showed = False self.seekstate = self.SEEK_STATE_PLAY self.__seekableStatusChanged() @@ -907,6 +909,12 @@ class InfoBarSeek: self.showAfterSeek() def seekFwd(self): + seek = self.getSeek() + if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed: + self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) + self.fast_winding_hint_message_showed = True + return if self.seekstate == self.SEEK_STATE_PLAY: self.setSeekState(self.makeStateForward(int(config.seek.enter_forward.value))) elif self.seekstate == self.SEEK_STATE_PAUSE: @@ -936,6 +944,12 @@ class InfoBarSeek: self.setSeekState(self.makeStateSlowMotion(speed)) def seekBack(self): + seek = self.getSeek() + if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed: + self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) + self.fast_winding_hint_message_showed = True + return seekstate = self.seekstate if seekstate == self.SEEK_STATE_PLAY: self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index f85ce9cc..16d09bc6 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1385,7 +1385,7 @@ RESULT eDVBServicePlay::setTrickmode(int trick) RESULT eDVBServicePlay::isCurrentlySeekable() { - return m_is_pvr || m_timeshift_active; + return m_is_pvr || m_timeshift_active ? 3 : 0; // fast forward/backward possible and seeking possible } RESULT eDVBServicePlay::frontendInfo(ePtr &ptr) diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 0f604b84..c0ae42fd 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -641,7 +641,31 @@ RESULT eServiceMP3::setTrickmode(int trick) RESULT eServiceMP3::isCurrentlySeekable() { - return 1; + int ret = 3; // seeking and fast/slow winding possible + GstElement *sink; + + if (!m_gst_playbin) + return 0; + if (m_state != stRunning) + return 0; + + g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL); + + // disable fast winding yet when a dvbvideosink or dvbaudiosink is used + // for this we must do some changes on different places.. (gstreamer.. our sinks.. enigma2) + if (sink) { + ret &= ~2; // only seeking possible + gst_object_unref(sink); + } + else { + g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL); + if (sink) { + ret &= ~2; // only seeking possible + gst_object_unref(sink); + } + } + + return ret; } RESULT eServiceMP3::info(ePtr&i) diff --git a/lib/service/servicexine.cpp b/lib/service/servicexine.cpp index 44e6a6e0..6b9adfb9 100644 --- a/lib/service/servicexine.cpp +++ b/lib/service/servicexine.cpp @@ -315,7 +315,7 @@ RESULT eServiceXine::setTrickmode(int trick) RESULT eServiceXine::isCurrentlySeekable() { - return 1; + return 3; } RESULT eServiceXine::info(ePtr&i) -- cgit v1.2.3 From 870613c85f6569ac1d04a387d0a164357a7289ba Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Nov 2009 11:43:01 +0100 Subject: small fix --- lib/python/Screens/InfoBarGenerics.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 24ebada7..5d240138 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -910,8 +910,8 @@ class InfoBarSeek: def seekFwd(self): seek = self.getSeek() - if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed: + if seek and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1): self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) self.fast_winding_hint_message_showed = True return @@ -945,8 +945,8 @@ class InfoBarSeek: def seekBack(self): seek = self.getSeek() - if seek and (seek.isCurrentlySeekable() & 1) and not (seek.isCurrentlySeekable() & 2): - if not self.fast_winding_hint_message_showed: + if seek and not (seek.isCurrentlySeekable() & 2): + if not self.fast_winding_hint_message_showed and (seek.isCurrentlySeekable() & 1): self.session.open(MessageBox, _("No fast winding possible yet.. but you can use the number buttons to skip forward/backward!"), MessageBox.TYPE_INFO, timeout=10) self.fast_winding_hint_message_showed = True return -- cgit v1.2.3 From 296b611baa6c7d557522449147dfa020cea9cc18 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 7 Dec 2009 14:23:16 +0100 Subject: fix digital+ (mhw2) epg (still disabled in epgcache.h!) now also support digital + epg on hispasat --- lib/dvb/epgcache.cpp | 246 ++++++++++++++++++++++++++++++++++++------------- lib/dvb/epgcache.h | 4 + lib/dvb/lowlevel/mhw.h | 4 +- 3 files changed, 187 insertions(+), 67 deletions(-) (limited to 'lib') diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index 2dc36412..48cbfbfd 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -254,6 +254,11 @@ void eEPGCache::DVBChannelAdded(eDVBChannel *chan) data->prevChannelState = -1; #ifdef ENABLE_PRIVATE_EPG data->m_PrivatePid = -1; +#endif +#ifdef ENABLE_MHW_EPG + data->m_mhw2_channel_pid = 0x231; // defaults for astra 19.2 D+ + data->m_mhw2_title_pid = 0x234; // defaults for astra 19.2 D+ + data->m_mhw2_summary_pid = 0x236; // defaults for astra 19.2 D+ #endif singleLock s(channel_map_lock); m_knownChannels.insert( std::pair(chan, data) ); @@ -879,6 +884,62 @@ void eEPGCache::gotMessage( const Message &msg ) } break; } +#endif +#ifdef ENABLE_MHW_EPG + case Message::got_mhw2_channel_pid: + { + singleLock s(channel_map_lock); + for (channelMapIterator it(m_knownChannels.begin()); it != m_knownChannels.end(); ++it) + { + eDVBChannel *channel = (eDVBChannel*) it->first; + channel_data *data = it->second; + eDVBChannelID chid = channel->getChannelID(); + if ( chid.transport_stream_id.get() == msg.service.tsid && + chid.original_network_id.get() == msg.service.onid ) + { + data->m_mhw2_channel_pid = msg.pid; + eDebug("[EPGC] got mhw2 channel pid %04x", msg.pid); + break; + } + } + break; + } + case Message::got_mhw2_title_pid: + { + singleLock s(channel_map_lock); + for (channelMapIterator it(m_knownChannels.begin()); it != m_knownChannels.end(); ++it) + { + eDVBChannel *channel = (eDVBChannel*) it->first; + channel_data *data = it->second; + eDVBChannelID chid = channel->getChannelID(); + if ( chid.transport_stream_id.get() == msg.service.tsid && + chid.original_network_id.get() == msg.service.onid ) + { + data->m_mhw2_title_pid = msg.pid; + eDebug("[EPGC] got mhw2 title pid %04x", msg.pid); + break; + } + } + break; + } + case Message::got_mhw2_summary_pid: + { + singleLock s(channel_map_lock); + for (channelMapIterator it(m_knownChannels.begin()); it != m_knownChannels.end(); ++it) + { + eDVBChannel *channel = (eDVBChannel*) it->first; + channel_data *data = it->second; + eDVBChannelID chid = channel->getChannelID(); + if ( chid.transport_stream_id.get() == msg.service.tsid && + chid.original_network_id.get() == msg.service.onid ) + { + data->m_mhw2_summary_pid = msg.pid; + eDebug("[EPGC] got mhw2 summary pid %04x", msg.pid); + break; + } + } + break; + } #endif case Message::timeChanged: cleanLoop(); @@ -1175,7 +1236,7 @@ void eEPGCache::channel_data::startEPG() isRunning |= MHW; memcpy(&m_MHWFilterMask, &mask, sizeof(eDVBSectionFilterMask)); - mask.pid = 0x231; + mask.pid = m_mhw2_channel_pid; mask.data[0] = 0xC8; mask.mask[0] = 0xFF; mask.data[1] = 0; @@ -1186,6 +1247,7 @@ void eEPGCache::channel_data::startEPG() memcpy(&m_MHWFilterMask2, &mask, sizeof(eDVBSectionFilterMask)); mask.data[1] = 0; mask.mask[1] = 0; + m_MHWTimeoutet=false; #endif mask.pid = 0x12; @@ -2489,6 +2551,50 @@ void eEPGCache::PMTready(eDVBServicePMTHandler *pmthandler) int tmp=0; switch ((*es)->getType()) { + case 0xC1: // user private + for (DescriptorConstIterator desc = (*es)->getDescriptors()->begin(); + desc != (*es)->getDescriptors()->end(); ++desc) + { + switch ((*desc)->getTag()) + { + case 0xC2: // user defined + if ((*desc)->getLength() == 8) + { + __u8 buffer[10]; + (*desc)->writeToBuffer(buffer); + if (!strncmp((unsigned char*)buffer+2, "EPGDATA", 7)) + { + eServiceReferenceDVB ref; + if (!pmthandler->getServiceReference(ref)) + { + int pid = (*es)->getPid(); + messages.send(Message(Message::got_mhw2_channel_pid, ref, pid)); + } + } + else if(!strncmp((unsigned char*)buffer+2, "FICHAS", 6)) + { + eServiceReferenceDVB ref; + if (!pmthandler->getServiceReference(ref)) + { + int pid = (*es)->getPid(); + messages.send(Message(Message::got_mhw2_summary_pid, ref, pid)); + } + } + else if(!strncmp((unsigned char*)buffer+2, "GENEROS", 7)) + { + eServiceReferenceDVB ref; + if (!pmthandler->getServiceReference(ref)) + { + int pid = (*es)->getPid(); + messages.send(Message(Message::got_mhw2_title_pid, ref, pid)); + } + } + } + break; + default: + break; + } + } case 0x05: // private for (DescriptorConstIterator desc = (*es)->getDescriptors()->begin(); desc != (*es)->getDescriptors()->end(); ++desc) @@ -2893,7 +2999,7 @@ void eEPGCache::channel_data::storeTitle(std::map<__u32, mhw_title_t>::iterator packet->segment_last_table_id = 0x50; __u8 *title = isMHW2 ? ((__u8*)(itTitle->second.title))-4 : (__u8*)itTitle->second.title; - std::string prog_title = (char *) delimitName( title, name, isMHW2 ? 33 : 23 ); + std::string prog_title = (char *) delimitName( title, name, isMHW2 ? 35 : 23 ); int prog_title_length = prog_title.length(); int packet_length = EIT_SIZE + EIT_LOOP_SIZE + EIT_SHORT_EVENT_DESCRIPTOR_SIZE + @@ -3222,14 +3328,14 @@ void eEPGCache::channel_data::readMHWData2(const __u8 *data) { eDebug("[EPGC] mhw2 aborted %d", state); } - else if (m_MHWFilterMask2.pid == 0x231 && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 0) + else if (m_MHWFilterMask2.pid == m_mhw2_channel_pid && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 0) // Channels table { - int num_channels = data[119]; + int num_channels = data[120]; m_channels.resize(num_channels); - if(dataLen > 119) + if(dataLen > 120) { - int ptr = 120 + 8 * num_channels; + int ptr = 121 + 8 * num_channels; if( dataLen > ptr ) { for( int chid = 0; chid < num_channels; ++chid ) @@ -3245,7 +3351,7 @@ void eEPGCache::channel_data::readMHWData2(const __u8 *data) else goto abort; // data seems consistent... - const __u8 *tmp = data+120; + const __u8 *tmp = data+121; for (int i=0; i < num_channels; ++i) { mhw_channel_name_t channel; @@ -3256,6 +3362,7 @@ void eEPGCache::channel_data::readMHWData2(const __u8 *data) channel.channel_id_hi = *(tmp++); channel.channel_id_lo = *(tmp++); m_channels[i]=channel; +// eDebug("%d(%02x) %04x: %02x %02x", i, i, (channel.channel_id_hi << 8) | channel.channel_id_lo, *tmp, *(tmp+1)); tmp+=2; } for (int i=0; i < num_channels; ++i) @@ -3266,83 +3373,86 @@ void eEPGCache::channel_data::readMHWData2(const __u8 *data) for (; x < channel_name_len; ++x) channel.name[x]=*(tmp++); channel.name[x+1]=0; +// eDebug("%d(%02x) %s", i, i, channel.name); } haveData |= MHW; eDebug("[EPGC] mhw2 %d channels found", m_channels.size()); } - else if (m_MHWFilterMask2.pid == 0x231 && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 1) + else if (m_MHWFilterMask2.pid == m_mhw2_channel_pid && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 1) { // Themes table eDebug("[EPGC] mhw2 themes nyi"); } - else if (m_MHWFilterMask2.pid == 0x234 && m_MHWFilterMask2.data[0] == 0xe6) + else if (m_MHWFilterMask2.pid == m_mhw2_title_pid && m_MHWFilterMask2.data[0] == 0xe6) // Titles table { int pos=18; - bool valid=true; - int len = ((data[1]&0xf)<<8) + data[2] - 16; + bool valid=false; bool finish=false; - if(data[dataLen-1] != 0xff) - return; - while( pos < dataLen ) + +// eDebug("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", +// data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], +// data[11], data[12], data[13], data[14], data[15], data[16], data[17] ); + + while( pos < dataLen && !valid) { - valid = false; - pos += 7; - if( pos < dataLen ) - { - pos += 3; - if( pos < dataLen ) - { - if( data[pos] > 0xc0 ) - { - pos += ( data[pos] - 0xc0 ); - pos += 4; - if( pos < dataLen ) - { - if( data[pos] == 0xff ) - { - ++pos; - valid = true; - } - } - } - } - } - if( !valid ) - { - if (checkTimeout()) - goto start_summary; - return; - } + pos += 18; + pos += (data[pos] & 0x3F) + 4; + if( pos == dataLen ) + valid = true; } + + if (!valid) + { + if (dataLen > 18) + eDebug("mhw2 title table invalid!!"); + if (checkTimeout()) + goto abort; + if (!m_MHWTimeoutTimer->isActive()) + startTimeout(5000); + return; // continue reading + } + // data seems consistent... mhw_title_t title; pos = 18; - while (pos < len) + while (pos < dataLen) { +// eDebugNoNewLine(" [%02x] %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x [%02x %02x %02x %02x %02x %02x %02x] LL - DESCR - ", +// data[pos], data[pos+1], data[pos+2], data[pos+3], data[pos+4], data[pos+5], data[pos+6], data[pos+7], +// data[pos+8], data[pos+9], data[pos+10], data[pos+11], data[pos+12], data[pos+13], data[pos+14], data[pos+15], data[pos+16], data[pos+17]); title.channel_id = data[pos]+1; - title.program_id_ml = data[pos+1]; - title.program_id_lo = data[pos+2]; - title.mhw2_mjd_hi = data[pos+3]; - title.mhw2_mjd_lo = data[pos+4]; - title.mhw2_hours = data[pos+5]; - title.mhw2_minutes = data[pos+6]; - title.mhw2_seconds = data[pos+7]; - int duration = ((data[pos+8] << 8)|data[pos+9]) >> 4; + title.mhw2_mjd_hi = data[pos+11]; + title.mhw2_mjd_lo = data[pos+12]; + title.mhw2_hours = data[pos+13]; + title.mhw2_minutes = data[pos+14]; + title.mhw2_seconds = data[pos+15]; + int duration = ((data[pos+16] << 8)|data[pos+17]) >> 4; title.mhw2_duration_hi = (duration&0xFF00) >> 8; title.mhw2_duration_lo = duration&0xFF; - __u8 slen = data[pos+10] & 0x3f; + + // Create unique key per title + __u32 title_id = (data[pos+7] << 24) | (data[pos+8] << 16) | (data[pos+9] << 8) | data[pos+10]; + + __u8 slen = data[pos+18] & 0x3f; __u8 *dest = ((__u8*)title.title)-4; - memcpy(dest, &data[pos+11], slen>33 ? 33 : slen); - memset(dest+slen, 0, 33-slen); - pos += 11 + slen; + memcpy(dest, &data[pos+19], slen>35 ? 35 : slen); + memset(dest+slen, 0, 35-slen); + pos += 19 + slen; +// eDebug("%02x [%02x %02x]: %s", data[pos], data[pos+1], data[pos+2], dest); + // not used theme id (data[7] & 0x3f) + (data[pos] & 0x3f); __u32 summary_id = (data[pos+1] << 8) | data[pos+2]; - // Create unique key per title - __u32 title_id = (title.channel_id<<16) | (title.program_id_ml<<8) | title.program_id_lo; +// if (title.channel_id > m_channels.size()) +// eDebug("channel_id(%d %02x) to big!!", title.channel_id); + +// eDebug("pos %d prog_id %02x %02x chid %02x summary_id %04x dest %p len %d\n", +// pos, title.program_id_ml, title.program_id_lo, title.channel_id, summary_id, dest, slen); - pos += 4; +// eDebug("title_id %08x -> summary_id %04x\n", title_id, summary_id); + + pos += 3; std::map<__u32, mhw_title_t>::iterator it = m_titles.find( title_id ); if ( it == m_titles.end() ) @@ -3381,7 +3491,7 @@ start_summary: { // Titles table has been read, there are summaries to read. // Start reading summaries, store corresponding titles on the fly. - startMHWReader2(0x236, 0x96); + startMHWReader2(m_mhw2_summary_pid, 0x96); startTimeout(15000); return; } @@ -3389,7 +3499,7 @@ start_summary: else return; } - else if (m_MHWFilterMask2.pid == 0x236 && m_MHWFilterMask2.data[0] == 0x96) + else if (m_MHWFilterMask2.pid == m_mhw2_summary_pid && m_MHWFilterMask2.data[0] == 0x96) // Summaries table { if (!checkTimeout()) @@ -3423,10 +3533,13 @@ start_summary: } else return; // continue reading + if (valid) { // data seems consistent... __u32 summary_id = (data[3]<<8)|data[4]; +// eDebug ("summary id %04x\n", summary_id); +// eDebug("[%02x %02x] %02x %02x %02x %02x %02x %02x %02x %02x XX\n", data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13] ); // ugly workaround to convert const __u8* to char* char *tmp=0; @@ -3444,7 +3557,7 @@ start_summary: len += lenline + 1; } if( len > 0 ) - tmp[pos+len] = 0; + tmp[pos+len] = 0; else tmp[pos+1] = 0; @@ -3460,8 +3573,11 @@ start_summary: startTimeout(15000); std::string the_text = (char *) (data + pos + 1); +// eDebug ("summary id %04x : %s\n", summary_id, data+pos+1); + while( itProgId != m_program_ids.end() && itProgId->first == summary_id ) { +// eDebug("."); // Find corresponding title, store title and summary in epgcache. std::map<__u32, mhw_title_t>::iterator itTitle( m_titles.find( itProgId->second ) ); if ( itTitle != m_titles.end() ) @@ -3481,16 +3597,16 @@ start_summary: } if (isRunning & eEPGCache::MHW) { - if ( m_MHWFilterMask2.pid == 0x231 && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 0) + if ( m_MHWFilterMask2.pid == m_mhw2_channel_pid && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 0) { // Channels table has been read, start reading the themes table. - startMHWReader2(0x231, 0xC8, 1); + startMHWReader2(m_mhw2_channel_pid, 0xC8, 1); return; } - else if ( m_MHWFilterMask2.pid == 0x231 && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 1) + else if ( m_MHWFilterMask2.pid == m_mhw2_channel_pid && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 1) { // Themes table has been read, start reading the titles table. - startMHWReader2(0x234, 0xe6); + startMHWReader2(m_mhw2_title_pid, 0xe6); return; } else diff --git a/lib/dvb/epgcache.h b/lib/dvb/epgcache.h index 7d1b163f..4d45d87e 100644 --- a/lib/dvb/epgcache.h +++ b/lib/dvb/epgcache.h @@ -202,6 +202,7 @@ class eEPGCache: public eMainloop, private eThread, public Object ePtr m_MHWReader, m_MHWReader2; eDVBSectionFilterMask m_MHWFilterMask, m_MHWFilterMask2; ePtr m_MHWTimeoutTimer; + __u16 m_mhw2_channel_pid, m_mhw2_title_pid, m_mhw2_summary_pid; bool m_MHWTimeoutet; void MHWTimeout() { m_MHWTimeoutet=true; } void readMHWData(const __u8 *data); @@ -242,6 +243,9 @@ public: leaveChannel, quit, got_private_pid, + got_mhw2_channel_pid, + got_mhw2_title_pid, + got_mhw2_summary_pid, timeChanged }; int type; diff --git a/lib/dvb/lowlevel/mhw.h b/lib/dvb/lowlevel/mhw.h index 0b4904fa..f06c86e8 100644 --- a/lib/dvb/lowlevel/mhw.h +++ b/lib/dvb/lowlevel/mhw.h @@ -78,9 +78,9 @@ typedef struct { u_char ppv_id_ml :8; u_char ppv_id_lo :8; u_char program_id_hi :8; - u_char program_id_mh :8; // mhw2_title end (33chars max) + u_char program_id_mh :8; u_char program_id_ml :8; - u_char program_id_lo :8; + u_char program_id_lo :8; // mhw2_title end (35chars max) u_char mhw2_mjd_hi :8; u_char mhw2_mjd_lo :8; u_char mhw2_duration_hi :8; -- cgit v1.2.3 From 91a47217298bc34d42a62e70ba0e6caaef3373cb Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 9 Dec 2009 15:25:35 +0100 Subject: lib/dvb/dvb.cpp: allow non relative seeking even without valid decoding demux here --- lib/dvb/dvb.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index a8dfb193..656b6da0 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -1324,16 +1324,6 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off return; } - m_cue->m_lock.RdLock(); - if (!m_cue->m_decoding_demux) - { - start = current_offset; - size = max; - eDebug("getNextSourceSpan, no decoding demux. forcing normal play"); - m_cue->m_lock.Unlock(); - return; - } - if (m_skipmode_n) { eDebug("skipmode %d:%d (x%d)", m_skipmode_m, m_skipmode_n, m_skipmode_frames); @@ -1341,7 +1331,6 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off } eDebug("getNextSourceSpan, current offset is %08llx, m_skipmode_m = %d!", current_offset, m_skipmode_m); - int frame_skip_success = 0; if (m_skipmode_m) @@ -1386,6 +1375,8 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off } } + m_cue->m_lock.RdLock(); + while (!m_cue->m_seek_requests.empty()) { std::pair seek = m_cue->m_seek_requests.front(); @@ -1410,6 +1401,13 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off eDebug("decoder getPTS failed, can't seek relative"); continue; } + if (!m_cue->m_decoding_demux) + { + eDebug("getNextSourceSpan, no decoding demux. couldn't seek to %llx... ignore request!", pts); + start = current_offset; + size = max; + continue; + } if (getCurrentPosition(m_cue->m_decoding_demux, now, 1)) { eDebug("seekTo: getCurrentPosition failed!"); -- cgit v1.2.3 From d4426631ae17978c6bb8121e1ca826e16eccc6de Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 9 Dec 2009 15:47:56 +0100 Subject: fix skip backward from live to timeshift --- lib/python/Screens/InfoBarGenerics.py | 3 --- lib/service/servicedvb.cpp | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 5d240138..58cee9f3 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1220,10 +1220,7 @@ class InfoBarTimeshift: self.setSeekState(self.SEEK_STATE_PAUSE) if back: - self.doSeek(-5) # seek some gops before end self.ts_rewind_timer.start(200, 1) - else: - self.doSeek(-1) # seek 1 gop before end def rewindService(self): self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 16d09bc6..c8e64b80 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -2285,12 +2285,13 @@ void eDVBServicePlay::switchToTimeshift() r.path = m_timeshift_file; m_cue = new eCueSheet(); + m_cue->seekTo(0, -1000); m_service_handler_timeshift.tune(r, 1, m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ eDebug("eDVBServicePlay::switchToTimeshift, in pause mode now."); pause(); updateDecoder(); /* mainly to switch off PCR, and to set pause */ - + m_event((iPlayableService*)this, evSeekableStatusChanged); } -- cgit v1.2.3 From 46b2ddde6868639c2c437f1bed6d6db27a71038d Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 14 Dec 2009 10:27:38 +0100 Subject: Bugfix by Anders Holst: A bug was detected in the recent recordpath patch. It could cause a crash when using the green or yellow button to select a tag in the movielist. --- lib/python/Screens/MovieSelection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/MovieSelection.py b/lib/python/Screens/MovieSelection.py index 15f6b465..0468f8a0 100644 --- a/lib/python/Screens/MovieSelection.py +++ b/lib/python/Screens/MovieSelection.py @@ -398,7 +398,7 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo): def showTagsN(self, tagele): if not self.tags: self.showTagWarning() - elif not tagele or tagele.value in self.selected_tags or not tagele.value in self.tags: + elif not tagele or (self.selected_tags and tagele.value in self.selected_tags) or not tagele.value in self.tags: self.showTagsMenu(tagele) else: self.selected_tags_ele = tagele -- cgit v1.2.3 From 1eb03ca87ad5537ec41506a84f32c90774a66f1b Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 15 Dec 2009 19:33:32 +0100 Subject: fix merge conflict. --- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 2000 ++++++++++++++++---- 1 file changed, 1666 insertions(+), 334 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 6bfaec52..8aafd9a7 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -1,402 +1,1734 @@ -from enigma import eTimer +from Plugins.Plugin import PluginDescriptor +from Screens.Console import Console +from Screens.ChoiceBox import ChoiceBox +from Screens.MessageBox import MessageBox from Screens.Screen import Screen +from Screens.Ipkg import Ipkg from Components.ActionMap import ActionMap, NumberActionMap -from Components.Pixmap import Pixmap,MultiPixmap -from Components.Label import Label +from Components.Input import Input +from Components.Ipkg import IpkgComponent from Components.Sources.StaticText import StaticText -from Components.Sources.List import List +from Components.ScrollLabel import ScrollLabel +from Components.Pixmap import Pixmap from Components.MenuList import MenuList -from Components.config import config, getConfigListEntry, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword -from Components.ConfigList import ConfigListScreen -from Components.Network import Network, iNetwork +from Components.Sources.List import List +from Components.Slider import Slider +from Components.Harddisk import harddiskmanager +from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations from Components.Console import Console -from Plugins.Plugin import PluginDescriptor -from os import system, path as os_path, listdir -from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE +from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest +from Components.SelectionList import SelectionList +from Components.PluginComponent import plugins +from Components.About import about +from Components.DreamInfoHandler import DreamInfoHandler +from Components.Language import language +from Components.AVSwitch import AVSwitch +from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR from Tools.LoadPixmap import LoadPixmap -from Wlan import Wlan, wpaSupplicant, iStatus +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad +from cPickle import dump, load +from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK +from time import time, gmtime, strftime, localtime +from stat import ST_MTIME +from datetime import date +from twisted.web import client +from twisted.internet import reactor -plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan" +from ImageWizard import ImageWizard +from BackupRestore import BackupSelection, RestoreMenu, BackupScreen, RestoreScreen, getBackupPath, getBackupFilename +#from SoftwareTools import extensions -list = [] -list.append("WEP") -list.append("WPA") -list.append("WPA2") -list.append("WPA/WPA2") +config.plugins.configurationbackup = ConfigSubsection() +config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False) +config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) -weplist = [] -weplist.append("ASCII") -weplist.append("HEX") +def write_cache(cache_file, cache_data): + #Does a cPickle dump + if not os_path.isdir( os_path.dirname(cache_file) ): + try: + mkdir( os_path.dirname(cache_file) ) + except OSError: + print os_path.dirname(cache_file), 'is a file' + fd = open(cache_file, 'w') + dump(cache_data, fd, -1) + fd.close() -config.plugins.wlan = ConfigSubsection() -config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False)) -config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False)) +def valid_cache(cache_file, cache_ttl): + #See if the cache file exists and is still living + try: + mtime = stat(cache_file)[ST_MTIME] + except: + return 0 + curr_time = time() + if (curr_time - mtime) > cache_ttl: + return 0 + else: + return 1 -config.plugins.wlan.encryption = ConfigSubsection() -config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False)) -config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2" )) -config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII")) -config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False)) +def load_cache(cache_file): + #Does a cPickle load + fd = open(cache_file) + cache_data = load(fd) + fd.close() + return cache_data -class WlanStatus(Screen): +class UpdatePluginMenu(Screen): skin = """ - + - - - - - - - - - - - - - - - - - - - - + + + + {"template": [ + MultiContentEntryText(pos = (2, 2), size = (290, 22), flags = RT_HALIGN_LEFT, text = 1), # index 0 is the MenuText, + ], + "fonts": [gFont("Regular", 20)], + "itemHeight": 25 + } + + + + + {"template": [ + MultiContentEntryText(pos = (2, 2), size = (240, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, + ], + "fonts": [gFont("Regular", 20)], + "itemHeight": 300 + } + + """ - - def __init__(self, session, iface): + + def __init__(self, session, args = 0): Screen.__init__(self, session) - self.session = session - self.iface = iface - - self["LabelBSSID"] = StaticText(_('Accesspoint:')) - self["LabelESSID"] = StaticText(_('SSID:')) - self["LabelQuality"] = StaticText(_('Link Quality:')) - self["LabelSignal"] = StaticText(_('Signal Strength:')) - self["LabelBitrate"] = StaticText(_('Bitrate:')) - self["LabelEnc"] = StaticText(_('Encryption:')) - - self["BSSID"] = StaticText() - self["ESSID"] = StaticText() - self["quality"] = StaticText() - self["signal"] = StaticText() - self["bitrate"] = StaticText() - self["enc"] = StaticText() - - self["IFtext"] = StaticText() - self["IF"] = StaticText() - self["Statustext"] = StaticText() - self["statuspic"] = MultiPixmap() - self["statuspic"].hide() + self.skin_path = plugin_path + self.menu = args + self.list = [] + self.oktext = _("\nPress OK on your remote control to continue.") + self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) + if self.menu == 0: + self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext, None)) + self.list.append(("install-plugins", _("Install extensions"), _("\nInstall new Extensions or Plugins to your dreambox" ) + self.oktext, None)) + self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext, None)) + self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext, None)) + self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None)) + self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local packages and install them." ) + self.oktext, None)) + for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): + if p.__call__.has_key("SoftwareSupported"): + callFnc = p.__call__["SoftwareSupported"](None) + if callFnc is not None: + if p.__call__.has_key("menuEntryName"): + menuEntryName = p.__call__["menuEntryName"](None) + else: + menuEntryName = _('Extended Software') + if p.__call__.has_key("menuEntryDescription"): + menuEntryDescription = p.__call__["menuEntryDescription"](None) + else: + menuEntryDescription = _('Extended Software Plugin') + self.list.append(('default-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) + if config.usage.setup_level.index >= 2: # expert+ + self.list.append(("advanced", _("Advanced Options"), _("\nAdvanced options and settings." ) + self.oktext, None)) + elif self.menu == 1: + self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None)) + self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None)) + self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None)) + if config.usage.setup_level.index >= 2: # expert+ + self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None)) + self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None)) + for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): + if p.__call__.has_key("AdvancedSoftwareSupported"): + callFnc = p.__call__["AdvancedSoftwareSupported"](None) + if callFnc is not None: + if p.__call__.has_key("menuEntryName"): + menuEntryName = p.__call__["menuEntryName"](None) + else: + menuEntryName = _('Advanced Software') + if p.__call__.has_key("menuEntryDescription"): + menuEntryDescription = p.__call__["menuEntryDescription"](None) + else: + menuEntryDescription = _('Advanced Software Plugin') + self.list.append(('advanced-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) + + self["menu"] = List(self.list) self["key_red"] = StaticText(_("Close")) - self.resetList() - self.updateStatusbar() - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions", "ShortcutActions"], + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { - "ok": self.exit, - "back": self.exit, - "red": self.exit, + "ok": self.go, + "back": self.close, + "red": self.close, }, -1) - self.timer = eTimer() - self.timer.timeout.get().append(self.resetList) - self.onShown.append(lambda: self.timer.start(5000)) + self.onLayoutFinish.append(self.layoutFinished) - self.onClose.append(self.cleanup) + self.backuppath = getBackupPath() + self.backupfile = getBackupFilename() + self.fullbackupfilename = self.backuppath + "/" + self.backupfile + self.onShown.append(self.setWindowTitle) + + def layoutFinished(self): + idx = 0 + self["menu"].index = idx + + def setWindowTitle(self): + self.setTitle(_("Software manager")) - def cleanup(self): - iStatus.stopWlanConsole() + def go(self): + current = self["menu"].getCurrent() + if current: + currentEntry = current[0] + if self.menu == 0: + if (currentEntry == "software-update"): + self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!")) + elif (currentEntry == "software-restore"): + self.session.open(ImageWizard) + elif (currentEntry == "install-plugins"): + self.session.open(PluginManager, self.skin_path) + elif (currentEntry == "system-backup"): + self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True) + elif (currentEntry == "system-restore"): + if os_path.exists(self.fullbackupfilename): + self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your Enigma2 backup?\nEnigma2 will restart after the restore")) + else: + self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO, timeout = 10) + elif (currentEntry == "ipkg-install"): + try: + from Plugins.Extensions.MediaScanner.plugin import main + main(self.session) + except: + self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO, timeout = 10) + elif (currentEntry == "default-plugin"): + self.extended = current[3] + self.extended(self.session, None) + elif (currentEntry == "advanced"): + self.session.open(UpdatePluginMenu, 1) + elif self.menu == 1: + if (currentEntry == "ipkg-manager"): + self.session.open(PacketManager, self.skin_path) + elif (currentEntry == "backuplocation"): + parts = [ (r.description, r.mountpoint, self.session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)] + for x in parts: + if not access(x[1], F_OK|R_OK|W_OK) or x[1] == '/': + parts.remove(x) + for x in parts: + if x[1].startswith('/autofs/'): + parts.remove(x) + if len(parts): + self.session.openWithCallback(self.backuplocation_choosen, ChoiceBox, title = _("Please select medium to use as backup location"), list = parts) + elif (currentEntry == "backupfiles"): + self.session.openWithCallback(self.backupfiles_choosen,BackupSelection) + elif (currentEntry == "advancedrestore"): + self.session.open(RestoreMenu, self.skin_path) + elif (currentEntry == "ipkg-source"): + self.session.open(IPKGMenu, self.skin_path) + elif (currentEntry == "advanced-plugin"): + self.extended = current[3] + self.extended(self.session, None) + + def backupfiles_choosen(self, ret): + self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) + + def backuplocation_choosen(self, option): + if option is not None: + config.plugins.configurationbackup.backuplocation.value = str(option[1]) + config.plugins.configurationbackup.backuplocation.save() + config.plugins.configurationbackup.save() + config.save() + self.createBackupfolders() + + def runUpgrade(self, result): + if result: + self.session.open(UpdatePlugin, self.skin_path) + + def createBackupfolders(self): + print "Creating backup folder if not already there..." + self.backuppath = getBackupPath() + try: + if (os_path.exists(self.backuppath) == False): + makedirs(self.backuppath) + except OSError: + self.session.open(MessageBox, _("Sorry, your backup destination is not writeable.\n\nPlease choose another one."), MessageBox.TYPE_INFO, timeout = 10) + + def backupDone(self,retval = None): + if retval is True: + self.session.open(MessageBox, _("Backup done."), MessageBox.TYPE_INFO, timeout = 10) + else: + self.session.open(MessageBox, _("Backup failed."), MessageBox.TYPE_INFO, timeout = 10) + + def startRestore(self, ret = False): + if (ret == True): + self.exe = True + self.session.open(RestoreScreen, runRestore = True) + +class IPKGMenu(Screen): + skin = """ + + + + + + + """ + + def __init__(self, session, plugin_path): + Screen.__init__(self, session) + self.skin_path = plugin_path + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Edit")) + + self.sel = [] + self.val = [] + self.entry = False + self.exe = False + self.path = "" + + self["actions"] = NumberActionMap(["SetupActions"], + { + "ok": self.KeyOk, + "cancel": self.keyCancel + }, -1) + + self["shortcuts"] = ActionMap(["ShortcutActions"], + { + "red": self.keyCancel, + "green": self.KeyOk, + }) + self.flist = [] + self["filelist"] = MenuList(self.flist) + self.fill_list() + self.onLayoutFinish.append(self.layoutFinished) + def layoutFinished(self): - self.setTitle(_("Wireless Network State")) + self.setWindowTitle() + + def setWindowTitle(self): + self.setTitle(_("Select upgrade source to edit.")) + + def fill_list(self): + self.flist = [] + self.path = '/etc/ipkg/' + if (os_path.exists(self.path) == False): + self.entry = False + return + for file in listdir(self.path): + if (file.endswith(".conf")): + if file != 'arch.conf': + self.flist.append((file)) + self.entry = True + self["filelist"].l.setList(self.flist) + + def KeyOk(self): + if (self.exe == False) and (self.entry == True): + self.sel = self["filelist"].getCurrent() + self.val = self.path + self.sel + self.session.open(IPKGSource, self.val) + + def keyCancel(self): + self.close() + + def Exit(self): + self.close() + + +class IPKGSource(Screen): + skin = """ + + + + + + + """ + + def __init__(self, session, configfile = None): + Screen.__init__(self, session) + self.session = session + self.configfile = configfile + text = "" + if self.configfile: + try: + fp = file(configfile, 'r') + sources = fp.readlines() + if sources: + text = sources[0] + fp.close() + except IOError: + pass + + desk = getDesktop(0) + x= int(desk.size().width()) + y= int(desk.size().height()) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Save")) + + if (y>=720): + self["text"] = Input(text, maxSize=False, type=Input.TEXT) + else: + self["text"] = Input(text, maxSize=False, visible_width = 55, type=Input.TEXT) + + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions"], + { + "ok": self.go, + "back": self.close, + "red": self.close, + "green": self.go, + "left": self.keyLeft, + "right": self.keyRight, + "home": self.keyHome, + "end": self.keyEnd, + "deleteForward": self.keyDeleteForward, + "deleteBackward": self.keyDeleteBackward, + "1": self.keyNumberGlobal, + "2": self.keyNumberGlobal, + "3": self.keyNumberGlobal, + "4": self.keyNumberGlobal, + "5": self.keyNumberGlobal, + "6": self.keyNumberGlobal, + "7": self.keyNumberGlobal, + "8": self.keyNumberGlobal, + "9": self.keyNumberGlobal, + "0": self.keyNumberGlobal + }, -1) + + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + self["text"].right() + + def setWindowTitle(self): + self.setTitle(_("Edit upgrade source url.")) + + def go(self): + text = self["text"].getText() + if text: + fp = file(self.configfile, 'w') + fp.write(text) + fp.write("\n") + fp.close() + self.close() + + def keyLeft(self): + self["text"].left() + + def keyRight(self): + self["text"].right() + + def keyHome(self): + self["text"].home() + + def keyEnd(self): + self["text"].end() + + def keyDeleteForward(self): + self["text"].delete() + + def keyDeleteBackward(self): + self["text"].deleteBackward() + + def keyNumberGlobal(self, number): + self["text"].number(number) + + +class PacketManager(Screen): + skin = """ + + + + + + + + {"template": [ + MultiContentEntryText(pos = (5, 1), size = (440, 28), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (5, 26), size = (440, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description + MultiContentEntryPixmapAlphaTest(pos = (445, 2), size = (48, 48), png = 4), # index 4 is the status pixmap + MultiContentEntryPixmapAlphaTest(pos = (5, 50), size = (510, 2), png = 5), # index 4 is the div pixmap + ], + "fonts": [gFont("Regular", 22),gFont("Regular", 14)], + "itemHeight": 52 + } + + + """ - def resetList(self): - iStatus.getDataForInterface(self.iface,self.getInfoCB) + def __init__(self, session, plugin_path, args = None): + Screen.__init__(self, session) + self.session = session + self.skin_path = plugin_path + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], + { + "ok": self.go, + "back": self.exit, + "red": self.exit, + "green": self.reload, + }, -1) - def getInfoCB(self,data,status): - if data is not None: - if data is True: - if status is not None: - self["BSSID"].setText(status[self.iface]["acesspoint"]) - self["ESSID"].setText(status[self.iface]["essid"]) - self["quality"].setText(status[self.iface]["quality"]+"%") - self["signal"].setText(status[self.iface]["signal"]) - self["bitrate"].setText(status[self.iface]["bitrate"]) - self["enc"].setText(status[self.iface]["encryption"]) - self.updateStatusLink(status) + self.list = [] + self.statuslist = [] + self["list"] = List(self.list) + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Reload")) + + self.list_updating = True + self.packetlist = [] + self.installed_packetlist = {} + self.Console = Console() + self.cmdList = [] + self.cachelist = [] + self.cache_ttl = 86400 #600 is default, 0 disables, Seconds cache is considered valid (24h should be ok for caching ipkgs) + self.cache_file = '/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache' #Path to cache directory + self.oktext = _("\nAfter pressing OK, please wait!") + self.unwanted_extensions = ('-dbg', '-dev', '-doc', 'busybox') + + self.ipkg = IpkgComponent() + self.ipkg.addCallback(self.ipkgCallback) + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.rebuildList) def exit(self): - self.timer.stop() - self.close(True) - - def updateStatusbar(self): - self["BSSID"].setText(_("Please wait...")) - self["ESSID"].setText(_("Please wait...")) - self["quality"].setText(_("Please wait...")) - self["signal"].setText(_("Please wait...")) - self["bitrate"].setText(_("Please wait...")) - self["enc"].setText(_("Please wait...")) - self["IFtext"].setText(_("Network:")) - self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface)) - self["Statustext"].setText(_("Link:")) - - def updateStatusLink(self,status): - if status is not None: - if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False: - self["statuspic"].setPixmapNum(1) - else: - self["statuspic"].setPixmapNum(0) - self["statuspic"].show() + self.ipkg.stop() + if self.Console is not None: + if len(self.Console.appContainers): + for name in self.Console.appContainers.keys(): + self.Console.kill(name) + self.close() + + def reload(self): + if (os_path.exists(self.cache_file) == True): + remove(self.cache_file) + self.list_updating = True + self.rebuildList() + + def setWindowTitle(self): + self.setTitle(_("Packet manager")) + + def setStatus(self,status = None): + if status: + self.statuslist = [] + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if status == 'update': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) + self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'',statuspng, divpng )) + self['list'].setList(self.statuslist) + elif status == 'error': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'',statuspng, divpng )) + self['list'].setList(self.statuslist) + + def rebuildList(self): + self.setStatus('update') + self.inv_cache = 0 + self.vc = valid_cache(self.cache_file, self.cache_ttl) + if self.cache_ttl > 0 and self.vc != 0: + try: + self.buildPacketList() + except: + self.inv_cache = 1 + if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0: + self.run = 0 + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + + def go(self, returnValue = None): + cur = self["list"].getCurrent() + if cur: + status = cur[3] + package = cur[0] + self.cmdList = [] + if status == 'installed': + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package })) + if len(self.cmdList): + self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + package + "\n" + self.oktext) + elif status == 'upgradeable': + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package })) + if len(self.cmdList): + self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to upgrade the package:\n") + package + "\n" + self.oktext) + elif status == "installable": + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package })) + if len(self.cmdList): + self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + package + "\n" + self.oktext) + + def runRemove(self, result): + if result: + self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) + + def runRemoveFinished(self): + self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def RemoveReboot(self, result): + if result is None: + return + if result is False: + cur = self["list"].getCurrent() + if cur: + item = self['list'].getIndex() + self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installable') + self.cachelist[item] = [cur[0], cur[1], cur[2], 'installable'] + self['list'].setList(self.list) + write_cache(self.cache_file, self.cachelist) + self.reloadPluginlist() + if result: + quitMainloop(3) + + def runUpgrade(self, result): + if result: + self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) + + def runUpgradeFinished(self): + self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def UpgradeReboot(self, result): + if result is None: + return + if result is False: + cur = self["list"].getCurrent() + if cur: + item = self['list'].getIndex() + self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installed') + self.cachelist[item] = [cur[0], cur[1], cur[2], 'installed'] + self['list'].setList(self.list) + write_cache(self.cache_file, self.cachelist) + self.reloadPluginlist() + if result: + quitMainloop(3) + + def ipkgCallback(self, event, param): + if event == IpkgComponent.EVENT_ERROR: + self.list_updating = False + self.setStatus('error') + elif event == IpkgComponent.EVENT_DONE: + if self.list_updating: + self.list_updating = False + if not self.Console: + self.Console = Console() + cmd = "ipkg list" + self.Console.ePopen(cmd, self.IpkgList_Finished) + #print event, "-", param + pass + + def IpkgList_Finished(self, result, retval, extra_args = None): + if len(result): + self.packetlist = [] + for x in result.splitlines(): + split = x.split(' - ') #self.blacklisted_packages + if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): + self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()]) + if not self.Console: + self.Console = Console() + cmd = "ipkg list_installed" + self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) + + def IpkgListInstalled_Finished(self, result, retval, extra_args = None): + if len(result): + self.installed_packetlist = {} + for x in result.splitlines(): + split = x.split(' - ') + if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): + self.installed_packetlist[split[0].strip()] = split[1].strip() + self.buildPacketList() + + def buildEntryComponent(self, name, version, description, state): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if state == 'installed': + installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) + return((name, version, description, state, installedpng, divpng)) + elif state == 'upgradeable': + upgradeablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgradeable.png")) + return((name, version, description, state, upgradeablepng, divpng)) + else: + installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) + return((name, version, description, state, installablepng, divpng)) + + def buildPacketList(self): + self.list = [] + self.cachelist = [] + + if self.cache_ttl > 0 and self.vc != 0: + print 'Loading packagelist cache from ',self.cache_file + try: + self.cachelist = load_cache(self.cache_file) + if len(self.cachelist) > 0: + for x in self.cachelist: + self.list.append(self.buildEntryComponent(x[0], x[1], x[2], x[3])) + self['list'].setList(self.list) + except: + self.inv_cache = 1 + + if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0: + print 'rebuilding fresh package list' + for x in self.packetlist: + status = "" + if self.installed_packetlist.has_key(x[0].strip()): + if self.installed_packetlist[x[0].strip()] == x[1].strip(): + status = "installed" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) + else: + status = "upgradeable" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) + else: + status = "installable" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) + if not any(x[0].strip().endswith(x) for x in self.unwanted_extensions): + self.cachelist.append([x[0].strip(), x[1].strip(), x[2].strip(), status]) + write_cache(self.cache_file, self.cachelist) + self['list'].setList(self.list) + + def reloadPluginlist(self): + plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) + + +class PluginManager(Screen, DreamInfoHandler): + + lastDownloadDate = None -class WlanScan(Screen): skin = """ - + + - + + + + {"templates": + {"default": (51,[ + MultiContentEntryText(pos = (30, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (30, 25), size = (470, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description + MultiContentEntryPixmapAlphaTest(pos = (475, 0), size = (48, 48), png = 5), # index 5 is the status pixmap + MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 6), # index 6 is the div pixmap + ]), + "category": (40,[ + MultiContentEntryText(pos = (30, 0), size = (500, 22), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (30, 22), size = (500, 16), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the description + MultiContentEntryPixmapAlphaTest(pos = (0, 38), size = (550, 2), png = 3), # index 3 is the div pixmap + ]) + }, + "fonts": [gFont("Regular", 22),gFont("Regular", 16)], + "itemHeight": 52 + } + + + + """ + + def __init__(self, session, plugin_path, args = None): + Screen.__init__(self, session) + self.session = session + self.skin_path = plugin_path + aboutInfo = about.getImageVersionString() + if aboutInfo.startswith("dev-"): + self.ImageVersion = 'Experimental' + else: + self.ImageVersion = 'Stable' + self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" + + DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion, language = self.language) + self.directory = resolveFilename(SCOPE_METADIR) + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "HelpActions" ], + { + "ok": self.handleCurrent, + "back": self.exit, + "red": self.exit, + "green": self.handleCurrent, + "yellow": self.handleSelected, + "showEventInfo": self.handleSelected, + "displayHelp": self.handleHelp, + }, -1) + + self.list = [] + self.statuslist = [] + self.selectedFiles = [] + self.categoryList = [] + self["list"] = List(self.list) + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText("") + self["key_yellow"] = StaticText("") + self["key_blue"] = StaticText("") + self["status"] = StaticText("") + + self.list_updating = True + self.packetlist = [] + self.installed_packetlist = {} + self.available_packetlist = [] + self.available_updates = 0 + self.Console = Console() + self.cmdList = [] + self.oktext = _("\nAfter pressing OK, please wait!") + self.unwanted_extensions = ('-dbg', '-dev', '-doc') + + self.ipkg = IpkgComponent() + self.ipkg.addCallback(self.ipkgCallback) + if not self.selectionChanged in self["list"].onSelectionChanged: + self["list"].onSelectionChanged.append(self.selectionChanged) + + self.currList = "" + self.currentSelectedTag = None + self.currentSelectedIndex = None + + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.rebuildList) + + def setWindowTitle(self): + self.setTitle(_("Plugin manager")) + + def exit(self): + if self.currList == "packages": + self.currList = "category" + self.currentSelectedTag = None + self["list"].style = "category" + self['list'].setList(self.categoryList) + self["list"].setIndex(self.currentSelectedIndex) + self["list"].updateList(self.categoryList) + self.selectionChanged() + else: + self.ipkg.stop() + if self.Console is not None: + if len(self.Console.appContainers): + for name in self.Console.appContainers.keys(): + self.Console.kill(name) + self.prepareInstall() + if len(self.cmdList): + self.session.openWithCallback(self.runExecute, PluginManagerInfo, self.skin_path, self.cmdList) + else: + self.close() + + def handleHelp(self): + if self.currList != "status": + self.session.open(PluginManagerHelp, self.skin_path) + + def setState(self,status = None): + if status: + self.currList = "status" + self.statuslist = [] + self["key_green"].setText("") + self["key_blue"].setText("") + self["key_yellow"].setText("") + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if status == 'update': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) + self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'', '', statuspng, divpng, None, '' )) + self["list"].style = "default" + self['list'].setList(self.statuslist) + elif status == 'sync': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) + self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' )) + self["list"].style = "default" + self['list'].setList(self.statuslist) + elif status == 'error': + statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' )) + self["list"].style = "default" + self['list'].setList(self.statuslist) + + def statusCallback(self, status, progress): + pass + + def selectionChanged(self): + current = self["list"].getCurrent() + self["status"].setText("") + if current: + if self.currList == "packages": + self["key_red"].setText(_("Back")) + if current[4] == 'installed': + self["key_green"].setText(_("Remove")) + elif current[4] == 'installable': + self["key_green"].setText(_("Install")) + elif current[4] == 'remove': + self["key_green"].setText(_("Undo\nRemove")) + elif current[4] == 'install': + self["key_green"].setText(_("Undo\nInstall")) + self["key_yellow"].setText(_("View details")) + self["key_blue"].setText("") + if len(self.selectedFiles) == 0 and self.available_updates is not 0: + self["status"].setText(_("There are at least ") + str(self.available_updates) + _(" updates available.")) + elif len(self.selectedFiles) is not 0: + self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) + else: + self["status"].setText(_("There is nothing to be done.")) + elif self.currList == "category": + self["key_red"].setText(_("Close")) + self["key_green"].setText("") + self["key_yellow"].setText("") + self["key_blue"].setText("") + if len(self.selectedFiles) == 0 and self.available_updates is not 0: + self["status"].setText(_("There are at least ") + str(self.available_updates) + _(" updates available.")) + self["key_yellow"].setText(_("Update")) + elif len(self.selectedFiles) is not 0: + self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) + self["key_yellow"].setText(_("Process")) + else: + self["status"].setText(_("There is nothing to be done.")) + + def getSelectionState(self, detailsFile): + for entry in self.selectedFiles: + if entry[0] == detailsFile: + return True + return False + + def rebuildList(self): + self.setState('update') + if not PluginManager.lastDownloadDate or (time() - PluginManager.lastDownloadDate) > 3600: + # Only update from internet once per hour + PluginManager.lastDownloadDate = time() + print "last update time > 1h" + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + else: + print "last update time < 1h" + self.startIpkgList() + + def ipkgCallback(self, event, param): + if event == IpkgComponent.EVENT_ERROR: + self.list_updating = False + self.setState('error') + elif event == IpkgComponent.EVENT_DONE: + self.startIpkgList() + pass + + def startIpkgList(self): + if self.list_updating: + if not self.Console: + self.Console = Console() + cmd = "ipkg list" + self.Console.ePopen(cmd, self.IpkgList_Finished) + + def IpkgList_Finished(self, result, retval, extra_args = None): + if len(result): + self.available_packetlist = [] + for x in result.splitlines(): + split = x.split(' - ') + if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): + self.available_packetlist.append([split[0].strip(), split[1].strip(), split[2].strip()]) + self.startInstallMetaPackage() + + def startInstallMetaPackage(self): + if self.list_updating: + self.list_updating = False + if not self.Console: + self.Console = Console() + cmd = "ipkg install enigma2-meta enigma2-plugins-meta enigma2-skins-meta" + self.Console.ePopen(cmd, self.InstallMetaPackage_Finished) + + def InstallMetaPackage_Finished(self, result, retval, extra_args = None): + if len(result): + self.fillPackagesIndexList() + if not self.Console: + self.Console = Console() + self.setState('sync') + cmd = "ipkg list_installed" + self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) + + def IpkgListInstalled_Finished(self, result, retval, extra_args = None): + if len(result): + self.installed_packetlist = {} + for x in result.splitlines(): + split = x.split(' - ') + if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): + self.installed_packetlist[split[0].strip()] = split[1].strip() + self.countUpdates() + if self.currentSelectedTag is None: + self.buildCategoryList() + else: + self.buildPacketList(self.currentSelectedTag) + + def countUpdates(self): + self.available_updates = 0 + for package in self.packagesIndexlist[:]: + attributes = package[0]["attributes"] + packagename = attributes["packagename"] + for x in self.available_packetlist: + if x[0].strip() == packagename: + if self.installed_packetlist.has_key(packagename): + if self.installed_packetlist[packagename] != x[1].strip(): + self.available_updates +=1 + + def handleCurrent(self): + current = self["list"].getCurrent() + if current: + if self.currList == "category": + self.currentSelectedIndex = self["list"].index + selectedTag = current[2] + self.buildPacketList(selectedTag) + elif self.currList == "packages": + if current[7] is not '': + idx = self["list"].getIndex() + detailsFile = self.list[idx][1] + if self.list[idx][7] == True: + for entry in self.selectedFiles: + if entry[0] == detailsFile: + self.selectedFiles.remove(entry) + else: + alreadyinList = False + for entry in self.selectedFiles: + if entry[0] == detailsFile: + alreadyinList = True + if not alreadyinList: + self.selectedFiles.append((detailsFile,current[4],current[3])) + if current[4] == 'installed': + self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'remove', True) + elif current[4] == 'installable': + self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'install', True) + elif current[4] == 'remove': + self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installed', False) + elif current[4] == 'install': + self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installable',False) + self["list"].setList(self.list) + self["list"].setIndex(idx) + self["list"].updateList(self.list) + self.selectionChanged() + + def handleSelected(self): + current = self["list"].getCurrent() + if current: + if self.currList == "packages": + if current[7] is not '': + detailsfile = self.directory[0] + "/" + current[1] + if (os_path.exists(detailsfile) == True): + self.session.openWithCallback(self.detailsClosed, PluginDetails, self.skin_path, current) + else: + self.session.open(MessageBox, _("Sorry, no Details available!"), MessageBox.TYPE_INFO, timeout = 10) + elif self.currList == "category": + self.prepareInstall() + if len(self.cmdList): + self.session.openWithCallback(self.runExecute, PluginManagerInfo, self.skin_path, self.cmdList) + + def detailsClosed(self, result): + if result: + if not self.Console: + self.Console = Console() + self.setState('sync') + PluginManager.lastDownloadDate = time() + self.selectedFiles = [] + cmd = "ipkg update" + self.Console.ePopen(cmd, self.InstallMetaPackage_Finished) + + def buildEntryComponent(self, name, details, description, packagename, state, selected = False): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if state == 'installed': + installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) + return((name, details, description, packagename, state, installedpng, divpng, selected)) + elif state == 'installable': + installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) + return((name, details, description, packagename, state, installablepng, divpng, selected)) + elif state == 'remove': + removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + return((name, details, description, packagename, state, removepng, divpng, selected)) + elif state == 'install': + installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) + return((name, details, description, packagename, state, installpng, divpng, selected)) + + def buildPacketList(self, categorytag = None): + if categorytag is not None: + self.currList = "packages" + self.currentSelectedTag = categorytag + self.packetlist = [] + for package in self.packagesIndexlist[:]: + prerequisites = package[0]["prerequisites"] + if prerequisites.has_key("tag"): + for foundtag in prerequisites["tag"]: + if categorytag == foundtag: + attributes = package[0]["attributes"] + if attributes.has_key("packagetype"): + if attributes["packagetype"] == "internal": + continue + self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) + else: + self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) + self.list = [] + for x in self.packetlist: + status = "" + selectState = self.getSelectionState(x[1].strip()) + if self.installed_packetlist.has_key(x[3].strip()): + if selectState == True: + status = "remove" + else: + status = "installed" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), x[3].strip(), status, selected = selectState)) + else: + if selectState == True: + status = "install" + else: + status = "installable" + self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), x[3].strip(), status, selected = selectState)) + if len(self.list): + self.list.sort(key=lambda x: x[0]) + self["list"].style = "default" + self['list'].setList(self.list) + self["list"].updateList(self.list) + self.selectionChanged() + + def buildCategoryList(self): + self.currList = "category" + self.categories = [] + self.categoryList = [] + for package in self.packagesIndexlist[:]: + prerequisites = package[0]["prerequisites"] + if prerequisites.has_key("tag"): + for foundtag in prerequisites["tag"]: + attributes = package[0]["attributes"] + if foundtag not in self.categories: + self.categories.append(foundtag) + self.categoryList.append(self.buildCategoryComponent(foundtag)) + self.categoryList.sort(key=lambda x: x[0]) + self["list"].style = "category" + self['list'].setList(self.categoryList) + self["list"].updateList(self.categoryList) + self.selectionChanged() + + def buildCategoryComponent(self, tag = None): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + if tag is not None: + if tag == 'System': + return(( _("System"), _("View list of available system extensions" ), tag, divpng )) + elif tag == 'Skin': + return(( _("Skins"), _("View list of available skins" ), tag, divpng )) + elif tag == 'Recording': + return(( _("Recordings"), _("View list of available recording extensions" ), tag, divpng )) + elif tag == 'Network': + return(( _("Network"), _("View list of available networking extensions" ), tag, divpng )) + elif tag == 'CI': + return(( _("CommonInterface"), _("View list of available CommonInterface extensions" ), tag, divpng )) + elif tag == 'Default': + return(( _("Default Settings"), _("View list of available default settings" ), tag, divpng )) + elif tag == 'SAT': + return(( _("Satteliteequipment"), _("View list of available Satteliteequipment extensions." ), tag, divpng )) + elif tag == 'Software': + return(( _("Software"), _("View list of available software extensions" ), tag, divpng )) + elif tag == 'Multimedia': + return(( _("Multimedia"), _("View list of available multimedia extensions." ), tag, divpng )) + elif tag == 'Display': + return(( _("Display and Userinterface"), _("View list of available Display and Userinterface extensions." ), tag, divpng )) + elif tag == 'EPG': + return(( _("Electronic Program Guide"), _("View list of available EPG extensions." ), tag, divpng )) + elif tag == 'Communication': + return(( _("Communication"), _("View list of available communication extensions." ), tag, divpng )) + else: # dynamically generate non existent tags + return(( str(tag), _("View list of available ") + str(tag) + _(" extensions." ), tag, divpng )) + + def prepareInstall(self): + self.cmdList = [] + if self.available_updates > 0: + self.cmdList.append((IpkgComponent.CMD_UPGRADE, { "test_only": False })) + if self.selectedFiles and len(self.selectedFiles): + for plugin in self.selectedFiles: + detailsfile = self.directory[0] + "/" + plugin[0] + if (os_path.exists(detailsfile) == True): + self.fillPackageDetails(plugin[0]) + self.package = self.packageDetails[0] + if self.package[0].has_key("attributes"): + self.attributes = self.package[0]["attributes"] + if self.attributes.has_key("package"): + self.packagefiles = self.attributes["package"] + if plugin[1] == 'installed': + if self.packagefiles: + for package in self.packagefiles[:]: + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package["name"] })) + else: + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": plugin[2] })) + else: + if self.packagefiles: + for package in self.packagefiles[:]: + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] })) + else: + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": plugin[2] })) + else: + if plugin[1] == 'installed': + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": plugin[2] })) + else: + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": plugin[2] })) + + def runExecute(self, result): + if result: + self.session.openWithCallback(self.runExecuteFinished, Ipkg, cmdList = self.cmdList) + else: + self.close() + + def runExecuteFinished(self): + self.session.openWithCallback(self.ExecuteReboot, MessageBox, _("Install or remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def ExecuteReboot(self, result): + if result is None: + return + if result is False: + self.reloadPluginlist() + self.detailsClosed(True) + if result: + quitMainloop(3) + + def reloadPluginlist(self): + plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) + + +class PluginManagerInfo(Screen): + skin = """ + + + + + + {"template": [ - MultiContentEntryText(pos = (0, 0), size = (550, 30), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the essid - MultiContentEntryText(pos = (0, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 5), # index 5 is the interface - MultiContentEntryText(pos = (175, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 4), # index 0 is the encryption - MultiContentEntryText(pos = (350, 0), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 0 is the signal - MultiContentEntryText(pos = (350, 30), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 3), # index 0 is the maxrate - MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (550, 2), png = 6), # index 6 is the div pixmap + MultiContentEntryText(pos = (50, 1), size = (150, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (50, 25), size = (540, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the state + MultiContentEntryPixmapAlphaTest(pos = (0, 1), size = (48, 48), png = 2), # index 2 is the status pixmap + MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 3), # index 3 is the div pixmap ], - "fonts": [gFont("Regular", 28),gFont("Regular", 18)], - "itemHeight": 54 + "fonts": [gFont("Regular", 22),gFont("Regular", 18)], + "itemHeight": 52 } - - + + """ - def __init__(self, session, iface): + def __init__(self, session, plugin_path, cmdlist = None): Screen.__init__(self, session) self.session = session - self.iface = iface self.skin_path = plugin_path - self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") - self.APList = None - self.newAPList = None - self.WlanList = None - self.cleanList = None - self.oldlist = None - self.listLenght = None - self.rescanTimer = eTimer() - self.rescanTimer.callback.append(self.rescanTimerFired) - - self["info"] = StaticText() - + self.cmdlist = cmdlist + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], + { + "ok": self.process, + "back": self.exit, + "red": self.exit, + "green": self.process, + }, -1) + self.list = [] self["list"] = List(self.list) - - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText(_("Connect")) - self["key_yellow"] = StaticText() - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions"], + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Continue")) + self["status"] = StaticText(_("Following tasks will be done after you press continue!")) + + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.rebuildList) + + def setWindowTitle(self): + self.setTitle(_("Plugin manager activity information")) + + def rebuildList(self): + self.list = [] + if self.cmdlist is not None: + for entry in self.cmdlist: + action = "" + info = "" + cmd = entry[0] + if cmd == 0: + action = 'install' + elif cmd == 2: + action = 'remove' + else: + action = 'upgrade' + args = entry[1] + if cmd == 0: + info = args['package'] + elif cmd == 2: + info = args['package'] + else: + info = _("Dreambox software because updates are available.") + + self.list.append(self.buildEntryComponent(action,info)) + self['list'].setList(self.list) + self['list'].updateList(self.list) + + def buildEntryComponent(self, action,info): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + upgradepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) + installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) + removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + if action == 'install': + return(( _('Installing'), info, installpng, divpng)) + elif action == 'remove': + return(( _('Removing'), info, removepng, divpng)) + else: + return(( _('Upgrading'), info, upgradepng, divpng)) + + def exit(self): + self.close(False) + + def process(self): + self.close(True) + + +class PluginManagerHelp(Screen): + skin = """ + + + + + + {"template": [ + MultiContentEntryText(pos = (50, 1), size = (540, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (50, 25), size = (540, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the state + MultiContentEntryPixmapAlphaTest(pos = (0, 1), size = (48, 48), png = 2), # index 2 is the status pixmap + MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 3), # index 3 is the div pixmap + ], + "fonts": [gFont("Regular", 22),gFont("Regular", 18)], + "itemHeight": 52 + } + + + + + """ + + def __init__(self, session, plugin_path): + Screen.__init__(self, session) + self.session = session + self.skin_path = plugin_path + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { - "ok": self.select, - "back": self.cancel, + "back": self.exit, + "red": self.exit, }, -1) - - self["shortcuts"] = ActionMap(["ShortcutActions"], + + self.list = [] + self["list"] = List(self.list) + self["key_red"] = StaticText(_("Close")) + self["status"] = StaticText(_("A small overview of the available icon states and actions.")) + + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.rebuildList) + + def setWindowTitle(self): + self.setTitle(_("Plugin manager help")) + + def rebuildList(self): + self.list = [] + self.list.append(self.buildEntryComponent('install')) + self.list.append(self.buildEntryComponent('installable')) + self.list.append(self.buildEntryComponent('installed')) + self.list.append(self.buildEntryComponent('remove')) + self['list'].setList(self.list) + self['list'].updateList(self.list) + + def buildEntryComponent(self, state): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) + installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) + removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) + installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) + + if state == 'installed': + return(( _('This plugin is installed.'), _('You can remove this plugin.'), installedpng, divpng)) + elif state == 'installable': + return(( _('This plugin is not installed.'), _('You can install this plugin.'), installablepng, divpng)) + elif state == 'install': + return(( _('This plugin will be installed.'), _('You can cancel the installation.'), installpng, divpng)) + elif state == 'remove': + return(( _('This plugin will be removed.'), _('You can cancel the removal.'), removepng, divpng)) + + def exit(self): + self.close() + + +class PluginDetails(Screen, DreamInfoHandler): + skin = """ + + + + + + + + + + + """ + def __init__(self, session, plugin_path, packagedata = None): + Screen.__init__(self, session) + self.skin_path = plugin_path + self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" + self.attributes = None + self.translatedAttributes = None + DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, language = self.language) + self.directory = resolveFilename(SCOPE_METADIR) + if packagedata: + self.pluginname = packagedata[0] + self.details = packagedata[1] + self.pluginstate = packagedata[4] + self.statuspicinstance = packagedata[5] + self.divpicinstance = packagedata[6] + self.fillPackageDetails(self.details) + + self.thumbnail = "" + + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { - "red": self.cancel, - "green": self.select, - }) - self.onLayoutFinish.append(self.layoutFinished) - self.getAccessPoints(refresh = False) - - def layoutFinished(self): - self.setTitle(_("Choose a wireless network")) - - def select(self): - cur = self["list"].getCurrent() - if cur is not None: - self.rescanTimer.stop() - del self.rescanTimer - if cur[1] is not None: - essid = cur[1] - self.close(essid,self.getWlanList()) - else: - self.close(None,None) - else: - self.rescanTimer.stop() - del self.rescanTimer - self.close(None,None) - - def WlanSetupClosed(self, *ret): - if ret[0] == 2: - self.rescanTimer.stop() - del self.rescanTimer - self.close(None) - - def cancel(self): - if self.oldInterfaceState is False: - iNetwork.setAdapterAttribute(self.iface, "up", False) - iNetwork.deactivateInterface(self.iface,self.deactivateInterfaceCB) + "back": self.exit, + "red": self.exit, + "green": self.go, + "up": self.pageUp, + "down": self.pageDown, + "left": self.pageUp, + "right": self.pageDown, + }, -1) + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText("") + self["author"] = StaticText() + self["statuspic"] = Pixmap() + self["divpic"] = Pixmap() + self["screenshot"] = Pixmap() + self["detailtext"] = ScrollLabel() + + self["statuspic"].hide() + self["screenshot"].hide() + self["divpic"].hide() + + self.package = self.packageDetails[0] + if self.package[0].has_key("attributes"): + self.attributes = self.package[0]["attributes"] + if self.package[0].has_key("translation"): + self.translatedAttributes = self.package[0]["translation"] + + self.cmdList = [] + self.oktext = _("\nAfter pressing OK, please wait!") + self.picload = ePicLoad() + self.picload.PictureData.get().append(self.paintScreenshotPixmapCB) + self.onShown.append(self.setWindowTitle) + self.onLayoutFinish.append(self.setInfos) + + def setWindowTitle(self): + self.setTitle(_("Package details for: " + self.pluginname)) + + def exit(self): + self.close(False) + + def pageUp(self): + self["detailtext"].pageUp() + + def pageDown(self): + self["detailtext"].pageDown() + + def statusCallback(self, status, progress): + pass + + def setInfos(self): + if self.translatedAttributes.has_key("name"): + self.pluginname = self.translatedAttributes["name"] + elif self.attributes.has_key("name"): + self.pluginname = self.attributes["name"] else: - self.rescanTimer.stop() - del self.rescanTimer - self.close(None) - - def deactivateInterfaceCB(self,data): - if data is not None: - if data is True: - self.rescanTimer.stop() - del self.rescanTimer - self.close(None) - - def rescanTimerFired(self): - self.rescanTimer.stop() - self.updateAPList() - - def buildEntryComponent(self, essid, bssid, encrypted, iface, maxrate, signal): -<<<<<<< HEAD:lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py - print "buildEntryComponent",essid - print "buildEntryComponent",bssid -======= ->>>>>>> origin/bug_203_fix_wrong_networkstate:lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png")) - encryption = encrypted and _("Yes") or _("No") - if bssid == 'hidden...': - return((essid, bssid, None, None, None, None, divpng)) - else: - return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng)) - - def updateAPList(self): - self.oldlist = [] - self.oldlist = self.cleanList - self.newAPList = [] - newList = [] - tmpList = [] - newListIndex = None - currentListEntry = None - currentListIndex = None - newList = self.getAccessPoints(refresh = True) - - for oldentry in self.oldlist: - if oldentry not in newList: - newList.append(oldentry) - - for newentry in newList: - if newentry[1] == "hidden...": - continue - tmpList.append(newentry) - - if len(tmpList): - if "hidden..." not in tmpList: - tmpList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) - - for entry in tmpList: - self.newAPList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] )) - - currentListEntry = self["list"].getCurrent() - idx = 0 - for entry in self.newAPList: - if entry == currentListEntry: - newListIndex = idx - idx +=1 - self['list'].setList(self.newAPList) - self["list"].setIndex(newListIndex) - self["list"].updateList(self.newAPList) - self.listLenght = len(self.newAPList) - self.buildWlanList() - self.setInfo() - - def getAccessPoints(self, refresh = False): - self.APList = [] - self.cleanList = [] - self.w = Wlan(self.iface) - aps = self.w.getNetworkList() - if aps is not None: - print "[NetworkWizard.py] got Accespoints!" - tmpList = [] - compList = [] - for ap in aps: - a = aps[ap] - if a['active']: - tmpList.append( (a['essid'], a['bssid']) ) - compList.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) ) - - for entry in tmpList: - if entry[0] == "": - for compentry in compList: - if compentry[1] == entry[1]: - compList.remove(compentry) - for entry in compList: - self.cleanList.append( ( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ) ) - - if "hidden..." not in self.cleanList: - self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) + self.pluginname = _("unknown") - for entry in self.cleanList: - self.APList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] )) - - if refresh is False: - self['list'].setList(self.APList) - self.listLenght = len(self.APList) - self.setInfo() - self.rescanTimer.start(5000) - return self.cleanList - - def setInfo(self): - length = self.getLength() - if length == 0: - self["info"].setText(_("No wireless networks found! Please refresh.")) - elif length == 1: - self["info"].setText(_("1 wireless network found!")) + if self.translatedAttributes.has_key("author"): + self.author = self.translatedAttributes["author"] + elif self.attributes.has_key("author"): + self.author = self.attributes["author"] else: - self["info"].setText(str(length)+_(" wireless networks found!")) + self.author = _("unknown") - def buildWlanList(self): - self.WlanList = [] - currList = [] - currList = self['list'].list - for entry in currList: - self.WlanList.append( (entry[1], entry[0]) ) + if self.translatedAttributes.has_key("description"): + self.description = self.translatedAttributes["description"] + elif self.attributes.has_key("description"): + self.description = self.attributes["description"] + else: + self.description = _("No description available.") - def getLength(self): - return self.listLenght + if self.translatedAttributes.has_key("screenshot"): + self.loadThumbnail(self.translatedAttributes) + else: + self.loadThumbnail(self.attributes) - def getWlanList(self): - return self.WlanList + self["author"].setText(_("Author: ") + self.author) + self["detailtext"].setText(self.description.strip()) + if self.pluginstate == 'installable': + self["key_green"].setText(_("Install")) + else: + self["key_green"].setText(_("Remove")) + def loadThumbnail(self, entry): + thumbnailUrl = None + if entry.has_key("screenshot"): + thumbnailUrl = entry["screenshot"] + if thumbnailUrl is not None: + self.thumbnail = "/tmp/" + thumbnailUrl.split('/')[-1] + print "[PluginDetails] downloading screenshot " + thumbnailUrl + " to " + self.thumbnail + client.downloadPage(thumbnailUrl,self.thumbnail).addCallback(self.setThumbnail).addErrback(self.fetchFailed) + else: + self.setThumbnail(noScreenshot = True) -def WlanStatusScreenMain(session, iface): - session.open(WlanStatus, iface) + def setThumbnail(self, noScreenshot = False): + if not noScreenshot: + filename = self.thumbnail + else: + filename = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/noprev.png") + sc = AVSwitch().getFramebufferScale() + self.picload.setPara((self["screenshot"].instance.size().width(), self["screenshot"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000")) + self.picload.startDecode(filename) -def callFunction(iface): - w = Wlan(iface) - i = w.getWirelessInterfaces() - if i: - if iface in i: - return WlanStatusScreenMain - return None + if self.statuspicinstance != None: + self["statuspic"].instance.setPixmap(self.statuspicinstance.__deref__()) + self["statuspic"].show() + if self.divpicinstance != None: + self["divpic"].instance.setPixmap(self.divpicinstance.__deref__()) + self["divpic"].show() + def paintScreenshotPixmapCB(self, picInfo=None): + ptr = self.picload.getData() + if ptr != None: + self["screenshot"].instance.setPixmap(ptr.__deref__()) + self["screenshot"].show() + else: + self.setThumbnail(noScreenshot = True) -def configStrings(iface): - driver = iNetwork.detectWlanModule() - print "Found WLAN-Driver:",driver - if driver in ('ralink', 'zydas'): - return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate" - else: - if config.plugins.wlan.essid.value == "hidden...": - return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' + def go(self): + if self.attributes.has_key("package"): + self.packagefiles = self.attributes["package"] + self.cmdList = [] + if self.pluginstate == 'installed': + if self.packagefiles: + for package in self.packagefiles[:]: + self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package["name"] })) + if len(self.cmdList): + self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + self.pluginname + "\n" + self.oktext) else: - return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' + if self.packagefiles: + for package in self.packagefiles[:]: + self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] })) + if len(self.cmdList): + self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + self.pluginname + "\n" + self.oktext) + + def runUpgrade(self, result): + if result: + self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) + + def runUpgradeFinished(self): + self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def UpgradeReboot(self, result): + if result is None: + return + if result is False: + self.close(True) + if result: + quitMainloop(3) + + def runRemove(self, result): + if result: + self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) + + def runRemoveFinished(self): + self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + + def RemoveReboot(self, result): + if result is None: + return + if result is False: + self.close(True) + if result: + quitMainloop(3) + + def reloadPluginlist(self): + plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) + + def fetchFailed(self,string): + self.setThumbnail(noScreenshot = True) + print "[PluginDetails] fetch failed " + string.getErrorMessage() + + +class UpdatePlugin(Screen): + skin = """ + + + + + + """ + + def __init__(self, session, args = None): + Screen.__init__(self, session) + + self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 } + + self.slider = Slider(0, 4) + self["slider"] = self.slider + self.activityslider = Slider(0, 100) + self["activityslider"] = self.activityslider + self.status = StaticText(_("Upgrading Dreambox... Please wait")) + self["status"] = self.status + self.package = StaticText() + self["package"] = self.package + + self.packages = 0 + self.error = 0 + + self.activity = 0 + self.activityTimer = eTimer() + self.activityTimer.callback.append(self.doActivityTimer) + self.activityTimer.start(100, False) + + self.ipkg = IpkgComponent() + self.ipkg.addCallback(self.ipkgCallback) + + self.updating = True + self.package.setText(_("Package list update")) + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + + self["actions"] = ActionMap(["WizardActions"], + { + "ok": self.exit, + "back": self.exit + }, -1) + + def doActivityTimer(self): + self.activity += 1 + if self.activity == 100: + self.activity = 0 + self.activityslider.setValue(self.activity) + + def ipkgCallback(self, event, param): + if event == IpkgComponent.EVENT_DOWNLOAD: + self.status.setText(_("Downloading")) + elif event == IpkgComponent.EVENT_UPGRADE: + if self.sliderPackages.has_key(param): + self.slider.setValue(self.sliderPackages[param]) + self.package.setText(param) + self.status.setText(_("Upgrading")) + self.packages += 1 + elif event == IpkgComponent.EVENT_INSTALL: + self.package.setText(param) + self.status.setText(_("Installing")) + self.packages += 1 + elif event == IpkgComponent.EVENT_CONFIGURING: + self.package.setText(param) + self.status.setText(_("Configuring")) + elif event == IpkgComponent.EVENT_MODIFIED: + self.session.openWithCallback( + self.modificationCallback, + MessageBox, + _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) + ) + elif event == IpkgComponent.EVENT_ERROR: + self.error += 1 + elif event == IpkgComponent.EVENT_DONE: + if self.updating: + self.updating = False + self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False}) + elif self.error == 0: + self.slider.setValue(4) + + self.activityTimer.stop() + self.activityslider.setValue(0) + + self.package.setText("") + self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages) + else: + self.activityTimer.stop() + self.activityslider.setValue(0) + error = _("your dreambox might be unusable now. Please consult the manual for further assistance before rebooting your dreambox.") + if self.packages == 0: + error = _("No packages were upgraded yet. So you can check your network and try again.") + if self.updating: + error = _("Your dreambox isn't connected to the internet properly. Please check it and try again.") + self.status.setText(_("Error") + " - " + error) + #print event, "-", param + pass + + def modificationCallback(self, res): + self.ipkg.write(res and "N" or "Y") + + def exit(self): + if not self.ipkg.isRunning(): + if self.packages != 0 and self.error == 0: + self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?")) + else: + self.close() + + def exitAnswer(self, result): + if result is not None and result: + quitMainloop(2) + self.close() + + +class IpkgInstaller(Screen): + skin = """ + + + + + + + + + """ + + def __init__(self, session, list): + Screen.__init__(self, session) + + self.list = SelectionList() + self["list"] = self.list + for listindex in range(len(list)): + self.list.addSelection(list[listindex], list[listindex], listindex, True) + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Install")) + self["introduction"] = StaticText(_("Press OK to toggle the selection.")) + + self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], + { + "ok": self.list.toggleSelection, + "cancel": self.close, + "red": self.close, + "green": self.install + }, -1) + + def install(self): + list = self.list.getSelectionsList() + cmdList = [] + for item in list: + cmdList.append((IpkgComponent.CMD_INSTALL, { "package": item[1] })) + self.session.open(Ipkg, cmdList = cmdList) + + +def filescan_open(list, session, **kwargs): + filelist = [x.path for x in list] + session.open(IpkgInstaller, filelist) # list + +def filescan(**kwargs): + from Components.Scanner import Scanner, ScanPath + return \ + Scanner(mimetypes = ["application/x-debian-package"], + paths_to_scan = + [ + ScanPath(path = "ipk", with_subdirs = True), + ScanPath(path = "", with_subdirs = False), + ], + name = "Ipkg", + description = _("Install extensions."), + openfnc = filescan_open, ) + + + +def UpgradeMain(session, **kwargs): + session.open(UpdatePluginMenu) + +def startSetup(menuid): + if menuid != "setup": + return [ ] + return [(_("Software manager"), UpgradeMain, "software_manager", 50)] -def Plugins(**kwargs): - return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."}) - \ No newline at end of file +def Plugins(path, **kwargs): + global plugin_path + plugin_path = path + list = [ + PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), + PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) + ] + if config.usage.setup_level.index >= 2: # expert+ + list.append(PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=UpgradeMain)) + return list -- cgit v1.2.3 From e198493e29c22e49dff1da47e83a989cdbd1d913 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 15 Dec 2009 19:35:25 +0100 Subject: fix wrong fix ;-( --- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 1994 ++++---------------- 1 file changed, 328 insertions(+), 1666 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 8aafd9a7..6873ffa4 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -1,1734 +1,396 @@ -from Plugins.Plugin import PluginDescriptor -from Screens.Console import Console -from Screens.ChoiceBox import ChoiceBox -from Screens.MessageBox import MessageBox +from enigma import eTimer from Screens.Screen import Screen -from Screens.Ipkg import Ipkg from Components.ActionMap import ActionMap, NumberActionMap -from Components.Input import Input -from Components.Ipkg import IpkgComponent +from Components.Pixmap import Pixmap,MultiPixmap +from Components.Label import Label from Components.Sources.StaticText import StaticText -from Components.ScrollLabel import ScrollLabel -from Components.Pixmap import Pixmap -from Components.MenuList import MenuList from Components.Sources.List import List -from Components.Slider import Slider -from Components.Harddisk import harddiskmanager -from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations +from Components.MenuList import MenuList +from Components.config import config, getConfigListEntry, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword +from Components.ConfigList import ConfigListScreen +from Components.Network import Network, iNetwork from Components.Console import Console -from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest -from Components.SelectionList import SelectionList -from Components.PluginComponent import plugins -from Components.About import about -from Components.DreamInfoHandler import DreamInfoHandler -from Components.Language import language -from Components.AVSwitch import AVSwitch -from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR +from Plugins.Plugin import PluginDescriptor +from os import system, path as os_path, listdir +from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE from Tools.LoadPixmap import LoadPixmap -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad -from cPickle import dump, load -from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK -from time import time, gmtime, strftime, localtime -from stat import ST_MTIME -from datetime import date -from twisted.web import client -from twisted.internet import reactor - -from ImageWizard import ImageWizard -from BackupRestore import BackupSelection, RestoreMenu, BackupScreen, RestoreScreen, getBackupPath, getBackupFilename -#from SoftwareTools import extensions - -config.plugins.configurationbackup = ConfigSubsection() -config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False) -config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) - -def write_cache(cache_file, cache_data): - #Does a cPickle dump - if not os_path.isdir( os_path.dirname(cache_file) ): - try: - mkdir( os_path.dirname(cache_file) ) - except OSError: - print os_path.dirname(cache_file), 'is a file' - fd = open(cache_file, 'w') - dump(cache_data, fd, -1) - fd.close() - -def valid_cache(cache_file, cache_ttl): - #See if the cache file exists and is still living - try: - mtime = stat(cache_file)[ST_MTIME] - except: - return 0 - curr_time = time() - if (curr_time - mtime) > cache_ttl: - return 0 - else: - return 1 - -def load_cache(cache_file): - #Does a cPickle load - fd = open(cache_file) - cache_data = load(fd) - fd.close() - return cache_data - - -class UpdatePluginMenu(Screen): - skin = """ - - - - - - - {"template": [ - MultiContentEntryText(pos = (2, 2), size = (290, 22), flags = RT_HALIGN_LEFT, text = 1), # index 0 is the MenuText, - ], - "fonts": [gFont("Regular", 20)], - "itemHeight": 25 - } - - - - - {"template": [ - MultiContentEntryText(pos = (2, 2), size = (240, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, - ], - "fonts": [gFont("Regular", 20)], - "itemHeight": 300 - } - - - """ - - def __init__(self, session, args = 0): - Screen.__init__(self, session) - self.skin_path = plugin_path - self.menu = args - self.list = [] - self.oktext = _("\nPress OK on your remote control to continue.") - self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) - if self.menu == 0: - self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext, None)) - self.list.append(("install-plugins", _("Install extensions"), _("\nInstall new Extensions or Plugins to your dreambox" ) + self.oktext, None)) - self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext, None)) - self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext, None)) - self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None)) - self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local packages and install them." ) + self.oktext, None)) - for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): - if p.__call__.has_key("SoftwareSupported"): - callFnc = p.__call__["SoftwareSupported"](None) - if callFnc is not None: - if p.__call__.has_key("menuEntryName"): - menuEntryName = p.__call__["menuEntryName"](None) - else: - menuEntryName = _('Extended Software') - if p.__call__.has_key("menuEntryDescription"): - menuEntryDescription = p.__call__["menuEntryDescription"](None) - else: - menuEntryDescription = _('Extended Software Plugin') - self.list.append(('default-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) - if config.usage.setup_level.index >= 2: # expert+ - self.list.append(("advanced", _("Advanced Options"), _("\nAdvanced options and settings." ) + self.oktext, None)) - elif self.menu == 1: - self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None)) - self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None)) - self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None)) - if config.usage.setup_level.index >= 2: # expert+ - self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None)) - self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None)) - for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): - if p.__call__.has_key("AdvancedSoftwareSupported"): - callFnc = p.__call__["AdvancedSoftwareSupported"](None) - if callFnc is not None: - if p.__call__.has_key("menuEntryName"): - menuEntryName = p.__call__["menuEntryName"](None) - else: - menuEntryName = _('Advanced Software') - if p.__call__.has_key("menuEntryDescription"): - menuEntryDescription = p.__call__["menuEntryDescription"](None) - else: - menuEntryDescription = _('Advanced Software Plugin') - self.list.append(('advanced-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) - - self["menu"] = List(self.list) - self["key_red"] = StaticText(_("Close")) - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], - { - "ok": self.go, - "back": self.close, - "red": self.close, - }, -1) - - self.onLayoutFinish.append(self.layoutFinished) - self.backuppath = getBackupPath() - self.backupfile = getBackupFilename() - self.fullbackupfilename = self.backuppath + "/" + self.backupfile - self.onShown.append(self.setWindowTitle) - - def layoutFinished(self): - idx = 0 - self["menu"].index = idx - - def setWindowTitle(self): - self.setTitle(_("Software manager")) +from Wlan import Wlan, wpaSupplicant, iStatus - def go(self): - current = self["menu"].getCurrent() - if current: - currentEntry = current[0] - if self.menu == 0: - if (currentEntry == "software-update"): - self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!")) - elif (currentEntry == "software-restore"): - self.session.open(ImageWizard) - elif (currentEntry == "install-plugins"): - self.session.open(PluginManager, self.skin_path) - elif (currentEntry == "system-backup"): - self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True) - elif (currentEntry == "system-restore"): - if os_path.exists(self.fullbackupfilename): - self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your Enigma2 backup?\nEnigma2 will restart after the restore")) - else: - self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO, timeout = 10) - elif (currentEntry == "ipkg-install"): - try: - from Plugins.Extensions.MediaScanner.plugin import main - main(self.session) - except: - self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO, timeout = 10) - elif (currentEntry == "default-plugin"): - self.extended = current[3] - self.extended(self.session, None) - elif (currentEntry == "advanced"): - self.session.open(UpdatePluginMenu, 1) - elif self.menu == 1: - if (currentEntry == "ipkg-manager"): - self.session.open(PacketManager, self.skin_path) - elif (currentEntry == "backuplocation"): - parts = [ (r.description, r.mountpoint, self.session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)] - for x in parts: - if not access(x[1], F_OK|R_OK|W_OK) or x[1] == '/': - parts.remove(x) - for x in parts: - if x[1].startswith('/autofs/'): - parts.remove(x) - if len(parts): - self.session.openWithCallback(self.backuplocation_choosen, ChoiceBox, title = _("Please select medium to use as backup location"), list = parts) - elif (currentEntry == "backupfiles"): - self.session.openWithCallback(self.backupfiles_choosen,BackupSelection) - elif (currentEntry == "advancedrestore"): - self.session.open(RestoreMenu, self.skin_path) - elif (currentEntry == "ipkg-source"): - self.session.open(IPKGMenu, self.skin_path) - elif (currentEntry == "advanced-plugin"): - self.extended = current[3] - self.extended(self.session, None) +plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan" - def backupfiles_choosen(self, ret): - self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) +list = [] +list.append("WEP") +list.append("WPA") +list.append("WPA2") +list.append("WPA/WPA2") - def backuplocation_choosen(self, option): - if option is not None: - config.plugins.configurationbackup.backuplocation.value = str(option[1]) - config.plugins.configurationbackup.backuplocation.save() - config.plugins.configurationbackup.save() - config.save() - self.createBackupfolders() +weplist = [] +weplist.append("ASCII") +weplist.append("HEX") - def runUpgrade(self, result): - if result: - self.session.open(UpdatePlugin, self.skin_path) +config.plugins.wlan = ConfigSubsection() +config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False)) +config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False)) - def createBackupfolders(self): - print "Creating backup folder if not already there..." - self.backuppath = getBackupPath() - try: - if (os_path.exists(self.backuppath) == False): - makedirs(self.backuppath) - except OSError: - self.session.open(MessageBox, _("Sorry, your backup destination is not writeable.\n\nPlease choose another one."), MessageBox.TYPE_INFO, timeout = 10) +config.plugins.wlan.encryption = ConfigSubsection() +config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False)) +config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2" )) +config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII")) +config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False)) - def backupDone(self,retval = None): - if retval is True: - self.session.open(MessageBox, _("Backup done."), MessageBox.TYPE_INFO, timeout = 10) - else: - self.session.open(MessageBox, _("Backup failed."), MessageBox.TYPE_INFO, timeout = 10) - - def startRestore(self, ret = False): - if (ret == True): - self.exe = True - self.session.open(RestoreScreen, runRestore = True) -class IPKGMenu(Screen): +class WlanStatus(Screen): skin = """ - + - - - - """ - - def __init__(self, session, plugin_path): - Screen.__init__(self, session) - self.skin_path = plugin_path - - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText(_("Edit")) - - self.sel = [] - self.val = [] - self.entry = False - self.exe = False - - self.path = "" - - self["actions"] = NumberActionMap(["SetupActions"], - { - "ok": self.KeyOk, - "cancel": self.keyCancel - }, -1) - - self["shortcuts"] = ActionMap(["ShortcutActions"], - { - "red": self.keyCancel, - "green": self.KeyOk, - }) - self.flist = [] - self["filelist"] = MenuList(self.flist) - self.fill_list() - self.onLayoutFinish.append(self.layoutFinished) - - def layoutFinished(self): - self.setWindowTitle() - - def setWindowTitle(self): - self.setTitle(_("Select upgrade source to edit.")) - - def fill_list(self): - self.flist = [] - self.path = '/etc/ipkg/' - if (os_path.exists(self.path) == False): - self.entry = False - return - for file in listdir(self.path): - if (file.endswith(".conf")): - if file != 'arch.conf': - self.flist.append((file)) - self.entry = True - self["filelist"].l.setList(self.flist) - - def KeyOk(self): - if (self.exe == False) and (self.entry == True): - self.sel = self["filelist"].getCurrent() - self.val = self.path + self.sel - self.session.open(IPKGSource, self.val) - - def keyCancel(self): - self.close() - - def Exit(self): - self.close() - - -class IPKGSource(Screen): - skin = """ - - - - - - - """ - - def __init__(self, session, configfile = None): - Screen.__init__(self, session) - self.session = session - self.configfile = configfile - text = "" - if self.configfile: - try: - fp = file(configfile, 'r') - sources = fp.readlines() - if sources: - text = sources[0] - fp.close() - except IOError: - pass - - desk = getDesktop(0) - x= int(desk.size().width()) - y= int(desk.size().height()) - - self["key_red"] = StaticText(_("Cancel")) - self["key_green"] = StaticText(_("Save")) - - if (y>=720): - self["text"] = Input(text, maxSize=False, type=Input.TEXT) - else: - self["text"] = Input(text, maxSize=False, visible_width = 55, type=Input.TEXT) - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions"], - { - "ok": self.go, - "back": self.close, - "red": self.close, - "green": self.go, - "left": self.keyLeft, - "right": self.keyRight, - "home": self.keyHome, - "end": self.keyEnd, - "deleteForward": self.keyDeleteForward, - "deleteBackward": self.keyDeleteBackward, - "1": self.keyNumberGlobal, - "2": self.keyNumberGlobal, - "3": self.keyNumberGlobal, - "4": self.keyNumberGlobal, - "5": self.keyNumberGlobal, - "6": self.keyNumberGlobal, - "7": self.keyNumberGlobal, - "8": self.keyNumberGlobal, - "9": self.keyNumberGlobal, - "0": self.keyNumberGlobal - }, -1) - - self.onLayoutFinish.append(self.layoutFinished) - - def layoutFinished(self): - self.setWindowTitle() - self["text"].right() - - def setWindowTitle(self): - self.setTitle(_("Edit upgrade source url.")) - - def go(self): - text = self["text"].getText() - if text: - fp = file(self.configfile, 'w') - fp.write(text) - fp.write("\n") - fp.close() - self.close() - - def keyLeft(self): - self["text"].left() - - def keyRight(self): - self["text"].right() - def keyHome(self): - self["text"].home() - - def keyEnd(self): - self["text"].end() - - def keyDeleteForward(self): - self["text"].delete() - - def keyDeleteBackward(self): - self["text"].deleteBackward() + + + + + + + + + + + + + - def keyNumberGlobal(self, number): - self["text"].number(number) - - -class PacketManager(Screen): - skin = """ - - - - - - - - {"template": [ - MultiContentEntryText(pos = (5, 1), size = (440, 28), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (5, 26), size = (440, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description - MultiContentEntryPixmapAlphaTest(pos = (445, 2), size = (48, 48), png = 4), # index 4 is the status pixmap - MultiContentEntryPixmapAlphaTest(pos = (5, 50), size = (510, 2), png = 5), # index 4 is the div pixmap - ], - "fonts": [gFont("Regular", 22),gFont("Regular", 14)], - "itemHeight": 52 - } - - + + + + + """ - - def __init__(self, session, plugin_path, args = None): + + def __init__(self, session, iface): Screen.__init__(self, session) self.session = session - self.skin_path = plugin_path - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], - { - "ok": self.go, - "back": self.exit, - "red": self.exit, - "green": self.reload, - }, -1) - - self.list = [] - self.statuslist = [] - self["list"] = List(self.list) - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText(_("Reload")) - - self.list_updating = True - self.packetlist = [] - self.installed_packetlist = {} - self.Console = Console() - self.cmdList = [] - self.cachelist = [] - self.cache_ttl = 86400 #600 is default, 0 disables, Seconds cache is considered valid (24h should be ok for caching ipkgs) - self.cache_file = '/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache' #Path to cache directory - self.oktext = _("\nAfter pressing OK, please wait!") - self.unwanted_extensions = ('-dbg', '-dev', '-doc', 'busybox') - - self.ipkg = IpkgComponent() - self.ipkg.addCallback(self.ipkgCallback) - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.rebuildList) - - def exit(self): - self.ipkg.stop() - if self.Console is not None: - if len(self.Console.appContainers): - for name in self.Console.appContainers.keys(): - self.Console.kill(name) - self.close() - - def reload(self): - if (os_path.exists(self.cache_file) == True): - remove(self.cache_file) - self.list_updating = True - self.rebuildList() + self.iface = iface + + self["LabelBSSID"] = StaticText(_('Accesspoint:')) + self["LabelESSID"] = StaticText(_('SSID:')) + self["LabelQuality"] = StaticText(_('Link Quality:')) + self["LabelSignal"] = StaticText(_('Signal Strength:')) + self["LabelBitrate"] = StaticText(_('Bitrate:')) + self["LabelEnc"] = StaticText(_('Encryption:')) - def setWindowTitle(self): - self.setTitle(_("Packet manager")) - - def setStatus(self,status = None): - if status: - self.statuslist = [] - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if status == 'update': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) - self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'',statuspng, divpng )) - self['list'].setList(self.statuslist) - elif status == 'error': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'',statuspng, divpng )) - self['list'].setList(self.statuslist) - - def rebuildList(self): - self.setStatus('update') - self.inv_cache = 0 - self.vc = valid_cache(self.cache_file, self.cache_ttl) - if self.cache_ttl > 0 and self.vc != 0: - try: - self.buildPacketList() - except: - self.inv_cache = 1 - if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0: - self.run = 0 - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - - def go(self, returnValue = None): - cur = self["list"].getCurrent() - if cur: - status = cur[3] - package = cur[0] - self.cmdList = [] - if status == 'installed': - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package })) - if len(self.cmdList): - self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + package + "\n" + self.oktext) - elif status == 'upgradeable': - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package })) - if len(self.cmdList): - self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to upgrade the package:\n") + package + "\n" + self.oktext) - elif status == "installable": - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package })) - if len(self.cmdList): - self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + package + "\n" + self.oktext) - - def runRemove(self, result): - if result: - self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) - - def runRemoveFinished(self): - self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) - - def RemoveReboot(self, result): - if result is None: - return - if result is False: - cur = self["list"].getCurrent() - if cur: - item = self['list'].getIndex() - self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installable') - self.cachelist[item] = [cur[0], cur[1], cur[2], 'installable'] - self['list'].setList(self.list) - write_cache(self.cache_file, self.cachelist) - self.reloadPluginlist() - if result: - quitMainloop(3) - - def runUpgrade(self, result): - if result: - self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) + self["BSSID"] = StaticText() + self["ESSID"] = StaticText() + self["quality"] = StaticText() + self["signal"] = StaticText() + self["bitrate"] = StaticText() + self["enc"] = StaticText() + + self["IFtext"] = StaticText() + self["IF"] = StaticText() + self["Statustext"] = StaticText() + self["statuspic"] = MultiPixmap() + self["statuspic"].hide() + self["key_red"] = StaticText(_("Close")) - def runUpgradeFinished(self): - self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + self.resetList() + self.updateStatusbar() - def UpgradeReboot(self, result): - if result is None: - return - if result is False: - cur = self["list"].getCurrent() - if cur: - item = self['list'].getIndex() - self.list[item] = self.buildEntryComponent(cur[0], cur[1], cur[2], 'installed') - self.cachelist[item] = [cur[0], cur[1], cur[2], 'installed'] - self['list'].setList(self.list) - write_cache(self.cache_file, self.cachelist) - self.reloadPluginlist() - if result: - quitMainloop(3) - - def ipkgCallback(self, event, param): - if event == IpkgComponent.EVENT_ERROR: - self.list_updating = False - self.setStatus('error') - elif event == IpkgComponent.EVENT_DONE: - if self.list_updating: - self.list_updating = False - if not self.Console: - self.Console = Console() - cmd = "ipkg list" - self.Console.ePopen(cmd, self.IpkgList_Finished) - #print event, "-", param - pass - - def IpkgList_Finished(self, result, retval, extra_args = None): - if len(result): - self.packetlist = [] - for x in result.splitlines(): - split = x.split(' - ') #self.blacklisted_packages - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()]) - if not self.Console: - self.Console = Console() - cmd = "ipkg list_installed" - self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) - - def IpkgListInstalled_Finished(self, result, retval, extra_args = None): - if len(result): - self.installed_packetlist = {} - for x in result.splitlines(): - split = x.split(' - ') - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.installed_packetlist[split[0].strip()] = split[1].strip() - self.buildPacketList() - - def buildEntryComponent(self, name, version, description, state): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if state == 'installed': - installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) - return((name, version, description, state, installedpng, divpng)) - elif state == 'upgradeable': - upgradeablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgradeable.png")) - return((name, version, description, state, upgradeablepng, divpng)) - else: - installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) - return((name, version, description, state, installablepng, divpng)) - - def buildPacketList(self): - self.list = [] - self.cachelist = [] - - if self.cache_ttl > 0 and self.vc != 0: - print 'Loading packagelist cache from ',self.cache_file - try: - self.cachelist = load_cache(self.cache_file) - if len(self.cachelist) > 0: - for x in self.cachelist: - self.list.append(self.buildEntryComponent(x[0], x[1], x[2], x[3])) - self['list'].setList(self.list) - except: - self.inv_cache = 1 - - if self.cache_ttl == 0 or self.inv_cache == 1 or self.vc == 0: - print 'rebuilding fresh package list' - for x in self.packetlist: - status = "" - if self.installed_packetlist.has_key(x[0].strip()): - if self.installed_packetlist[x[0].strip()] == x[1].strip(): - status = "installed" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) - else: - status = "upgradeable" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) - else: - status = "installable" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status)) - if not any(x[0].strip().endswith(x) for x in self.unwanted_extensions): - self.cachelist.append([x[0].strip(), x[1].strip(), x[2].strip(), status]) - write_cache(self.cache_file, self.cachelist) - self['list'].setList(self.list) - - def reloadPluginlist(self): - plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) - - -class PluginManager(Screen, DreamInfoHandler): - - lastDownloadDate = None - - skin = """ - - - - - - - - - - - - {"templates": - {"default": (51,[ - MultiContentEntryText(pos = (30, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (30, 25), size = (470, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description - MultiContentEntryPixmapAlphaTest(pos = (475, 0), size = (48, 48), png = 5), # index 5 is the status pixmap - MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 6), # index 6 is the div pixmap - ]), - "category": (40,[ - MultiContentEntryText(pos = (30, 0), size = (500, 22), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (30, 22), size = (500, 16), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the description - MultiContentEntryPixmapAlphaTest(pos = (0, 38), size = (550, 2), png = 3), # index 3 is the div pixmap - ]) - }, - "fonts": [gFont("Regular", 22),gFont("Regular", 16)], - "itemHeight": 52 - } - - - - """ - - def __init__(self, session, plugin_path, args = None): - Screen.__init__(self, session) - self.session = session - self.skin_path = plugin_path - aboutInfo = about.getImageVersionString() - if aboutInfo.startswith("dev-"): - self.ImageVersion = 'Experimental' - else: - self.ImageVersion = 'Stable' - self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" - - DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion, language = self.language) - self.directory = resolveFilename(SCOPE_METADIR) - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "HelpActions" ], + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions", "ShortcutActions"], { - "ok": self.handleCurrent, + "ok": self.exit, "back": self.exit, "red": self.exit, - "green": self.handleCurrent, - "yellow": self.handleSelected, - "showEventInfo": self.handleSelected, - "displayHelp": self.handleHelp, }, -1) + self.timer = eTimer() + self.timer.timeout.get().append(self.resetList) + self.onShown.append(lambda: self.timer.start(5000)) + self.onLayoutFinish.append(self.layoutFinished) + self.onClose.append(self.cleanup) - self.list = [] - self.statuslist = [] - self.selectedFiles = [] - self.categoryList = [] - self["list"] = List(self.list) - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText("") - self["key_yellow"] = StaticText("") - self["key_blue"] = StaticText("") - self["status"] = StaticText("") - - self.list_updating = True - self.packetlist = [] - self.installed_packetlist = {} - self.available_packetlist = [] - self.available_updates = 0 - self.Console = Console() - self.cmdList = [] - self.oktext = _("\nAfter pressing OK, please wait!") - self.unwanted_extensions = ('-dbg', '-dev', '-doc') - - self.ipkg = IpkgComponent() - self.ipkg.addCallback(self.ipkgCallback) - if not self.selectionChanged in self["list"].onSelectionChanged: - self["list"].onSelectionChanged.append(self.selectionChanged) - - self.currList = "" - self.currentSelectedTag = None - self.currentSelectedIndex = None - - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.rebuildList) - - def setWindowTitle(self): - self.setTitle(_("Plugin manager")) + def cleanup(self): + iStatus.stopWlanConsole() + + def layoutFinished(self): + self.setTitle(_("Wireless Network State")) + + def resetList(self): + iStatus.getDataForInterface(self.iface,self.getInfoCB) + + def getInfoCB(self,data,status): + if data is not None: + if data is True: + if status is not None: + self["BSSID"].setText(status[self.iface]["acesspoint"]) + self["ESSID"].setText(status[self.iface]["essid"]) + self["quality"].setText(status[self.iface]["quality"]+"%") + self["signal"].setText(status[self.iface]["signal"]) + self["bitrate"].setText(status[self.iface]["bitrate"]) + self["enc"].setText(status[self.iface]["encryption"]) + self.updateStatusLink(status) def exit(self): - if self.currList == "packages": - self.currList = "category" - self.currentSelectedTag = None - self["list"].style = "category" - self['list'].setList(self.categoryList) - self["list"].setIndex(self.currentSelectedIndex) - self["list"].updateList(self.categoryList) - self.selectionChanged() - else: - self.ipkg.stop() - if self.Console is not None: - if len(self.Console.appContainers): - for name in self.Console.appContainers.keys(): - self.Console.kill(name) - self.prepareInstall() - if len(self.cmdList): - self.session.openWithCallback(self.runExecute, PluginManagerInfo, self.skin_path, self.cmdList) + self.timer.stop() + self.close(True) + + def updateStatusbar(self): + self["BSSID"].setText(_("Please wait...")) + self["ESSID"].setText(_("Please wait...")) + self["quality"].setText(_("Please wait...")) + self["signal"].setText(_("Please wait...")) + self["bitrate"].setText(_("Please wait...")) + self["enc"].setText(_("Please wait...")) + self["IFtext"].setText(_("Network:")) + self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface)) + self["Statustext"].setText(_("Link:")) + + def updateStatusLink(self,status): + if status is not None: + if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False: + self["statuspic"].setPixmapNum(1) else: - self.close() - - def handleHelp(self): - if self.currList != "status": - self.session.open(PluginManagerHelp, self.skin_path) - - def setState(self,status = None): - if status: - self.currList = "status" - self.statuslist = [] - self["key_green"].setText("") - self["key_blue"].setText("") - self["key_yellow"].setText("") - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if status == 'update': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) - self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) - elif status == 'sync': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) - self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) - elif status == 'error': - statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) - - def statusCallback(self, status, progress): - pass + self["statuspic"].setPixmapNum(0) + self["statuspic"].show() - def selectionChanged(self): - current = self["list"].getCurrent() - self["status"].setText("") - if current: - if self.currList == "packages": - self["key_red"].setText(_("Back")) - if current[4] == 'installed': - self["key_green"].setText(_("Remove")) - elif current[4] == 'installable': - self["key_green"].setText(_("Install")) - elif current[4] == 'remove': - self["key_green"].setText(_("Undo\nRemove")) - elif current[4] == 'install': - self["key_green"].setText(_("Undo\nInstall")) - self["key_yellow"].setText(_("View details")) - self["key_blue"].setText("") - if len(self.selectedFiles) == 0 and self.available_updates is not 0: - self["status"].setText(_("There are at least ") + str(self.available_updates) + _(" updates available.")) - elif len(self.selectedFiles) is not 0: - self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) - else: - self["status"].setText(_("There is nothing to be done.")) - elif self.currList == "category": - self["key_red"].setText(_("Close")) - self["key_green"].setText("") - self["key_yellow"].setText("") - self["key_blue"].setText("") - if len(self.selectedFiles) == 0 and self.available_updates is not 0: - self["status"].setText(_("There are at least ") + str(self.available_updates) + _(" updates available.")) - self["key_yellow"].setText(_("Update")) - elif len(self.selectedFiles) is not 0: - self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) - self["key_yellow"].setText(_("Process")) - else: - self["status"].setText(_("There is nothing to be done.")) - - def getSelectionState(self, detailsFile): - for entry in self.selectedFiles: - if entry[0] == detailsFile: - return True - return False - - def rebuildList(self): - self.setState('update') - if not PluginManager.lastDownloadDate or (time() - PluginManager.lastDownloadDate) > 3600: - # Only update from internet once per hour - PluginManager.lastDownloadDate = time() - print "last update time > 1h" - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - else: - print "last update time < 1h" - self.startIpkgList() - - def ipkgCallback(self, event, param): - if event == IpkgComponent.EVENT_ERROR: - self.list_updating = False - self.setState('error') - elif event == IpkgComponent.EVENT_DONE: - self.startIpkgList() - pass - - def startIpkgList(self): - if self.list_updating: - if not self.Console: - self.Console = Console() - cmd = "ipkg list" - self.Console.ePopen(cmd, self.IpkgList_Finished) - - def IpkgList_Finished(self, result, retval, extra_args = None): - if len(result): - self.available_packetlist = [] - for x in result.splitlines(): - split = x.split(' - ') - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.available_packetlist.append([split[0].strip(), split[1].strip(), split[2].strip()]) - self.startInstallMetaPackage() - - def startInstallMetaPackage(self): - if self.list_updating: - self.list_updating = False - if not self.Console: - self.Console = Console() - cmd = "ipkg install enigma2-meta enigma2-plugins-meta enigma2-skins-meta" - self.Console.ePopen(cmd, self.InstallMetaPackage_Finished) - - def InstallMetaPackage_Finished(self, result, retval, extra_args = None): - if len(result): - self.fillPackagesIndexList() - if not self.Console: - self.Console = Console() - self.setState('sync') - cmd = "ipkg list_installed" - self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) - - def IpkgListInstalled_Finished(self, result, retval, extra_args = None): - if len(result): - self.installed_packetlist = {} - for x in result.splitlines(): - split = x.split(' - ') - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.installed_packetlist[split[0].strip()] = split[1].strip() - self.countUpdates() - if self.currentSelectedTag is None: - self.buildCategoryList() - else: - self.buildPacketList(self.currentSelectedTag) - - def countUpdates(self): - self.available_updates = 0 - for package in self.packagesIndexlist[:]: - attributes = package[0]["attributes"] - packagename = attributes["packagename"] - for x in self.available_packetlist: - if x[0].strip() == packagename: - if self.installed_packetlist.has_key(packagename): - if self.installed_packetlist[packagename] != x[1].strip(): - self.available_updates +=1 - - def handleCurrent(self): - current = self["list"].getCurrent() - if current: - if self.currList == "category": - self.currentSelectedIndex = self["list"].index - selectedTag = current[2] - self.buildPacketList(selectedTag) - elif self.currList == "packages": - if current[7] is not '': - idx = self["list"].getIndex() - detailsFile = self.list[idx][1] - if self.list[idx][7] == True: - for entry in self.selectedFiles: - if entry[0] == detailsFile: - self.selectedFiles.remove(entry) - else: - alreadyinList = False - for entry in self.selectedFiles: - if entry[0] == detailsFile: - alreadyinList = True - if not alreadyinList: - self.selectedFiles.append((detailsFile,current[4],current[3])) - if current[4] == 'installed': - self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'remove', True) - elif current[4] == 'installable': - self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'install', True) - elif current[4] == 'remove': - self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installed', False) - elif current[4] == 'install': - self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installable',False) - self["list"].setList(self.list) - self["list"].setIndex(idx) - self["list"].updateList(self.list) - self.selectionChanged() - - def handleSelected(self): - current = self["list"].getCurrent() - if current: - if self.currList == "packages": - if current[7] is not '': - detailsfile = self.directory[0] + "/" + current[1] - if (os_path.exists(detailsfile) == True): - self.session.openWithCallback(self.detailsClosed, PluginDetails, self.skin_path, current) - else: - self.session.open(MessageBox, _("Sorry, no Details available!"), MessageBox.TYPE_INFO, timeout = 10) - elif self.currList == "category": - self.prepareInstall() - if len(self.cmdList): - self.session.openWithCallback(self.runExecute, PluginManagerInfo, self.skin_path, self.cmdList) - - def detailsClosed(self, result): - if result: - if not self.Console: - self.Console = Console() - self.setState('sync') - PluginManager.lastDownloadDate = time() - self.selectedFiles = [] - cmd = "ipkg update" - self.Console.ePopen(cmd, self.InstallMetaPackage_Finished) - - def buildEntryComponent(self, name, details, description, packagename, state, selected = False): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if state == 'installed': - installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) - return((name, details, description, packagename, state, installedpng, divpng, selected)) - elif state == 'installable': - installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) - return((name, details, description, packagename, state, installablepng, divpng, selected)) - elif state == 'remove': - removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - return((name, details, description, packagename, state, removepng, divpng, selected)) - elif state == 'install': - installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) - return((name, details, description, packagename, state, installpng, divpng, selected)) - - def buildPacketList(self, categorytag = None): - if categorytag is not None: - self.currList = "packages" - self.currentSelectedTag = categorytag - self.packetlist = [] - for package in self.packagesIndexlist[:]: - prerequisites = package[0]["prerequisites"] - if prerequisites.has_key("tag"): - for foundtag in prerequisites["tag"]: - if categorytag == foundtag: - attributes = package[0]["attributes"] - if attributes.has_key("packagetype"): - if attributes["packagetype"] == "internal": - continue - self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) - else: - self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) - self.list = [] - for x in self.packetlist: - status = "" - selectState = self.getSelectionState(x[1].strip()) - if self.installed_packetlist.has_key(x[3].strip()): - if selectState == True: - status = "remove" - else: - status = "installed" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), x[3].strip(), status, selected = selectState)) - else: - if selectState == True: - status = "install" - else: - status = "installable" - self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), x[3].strip(), status, selected = selectState)) - if len(self.list): - self.list.sort(key=lambda x: x[0]) - self["list"].style = "default" - self['list'].setList(self.list) - self["list"].updateList(self.list) - self.selectionChanged() - - def buildCategoryList(self): - self.currList = "category" - self.categories = [] - self.categoryList = [] - for package in self.packagesIndexlist[:]: - prerequisites = package[0]["prerequisites"] - if prerequisites.has_key("tag"): - for foundtag in prerequisites["tag"]: - attributes = package[0]["attributes"] - if foundtag not in self.categories: - self.categories.append(foundtag) - self.categoryList.append(self.buildCategoryComponent(foundtag)) - self.categoryList.sort(key=lambda x: x[0]) - self["list"].style = "category" - self['list'].setList(self.categoryList) - self["list"].updateList(self.categoryList) - self.selectionChanged() - - def buildCategoryComponent(self, tag = None): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - if tag is not None: - if tag == 'System': - return(( _("System"), _("View list of available system extensions" ), tag, divpng )) - elif tag == 'Skin': - return(( _("Skins"), _("View list of available skins" ), tag, divpng )) - elif tag == 'Recording': - return(( _("Recordings"), _("View list of available recording extensions" ), tag, divpng )) - elif tag == 'Network': - return(( _("Network"), _("View list of available networking extensions" ), tag, divpng )) - elif tag == 'CI': - return(( _("CommonInterface"), _("View list of available CommonInterface extensions" ), tag, divpng )) - elif tag == 'Default': - return(( _("Default Settings"), _("View list of available default settings" ), tag, divpng )) - elif tag == 'SAT': - return(( _("Satteliteequipment"), _("View list of available Satteliteequipment extensions." ), tag, divpng )) - elif tag == 'Software': - return(( _("Software"), _("View list of available software extensions" ), tag, divpng )) - elif tag == 'Multimedia': - return(( _("Multimedia"), _("View list of available multimedia extensions." ), tag, divpng )) - elif tag == 'Display': - return(( _("Display and Userinterface"), _("View list of available Display and Userinterface extensions." ), tag, divpng )) - elif tag == 'EPG': - return(( _("Electronic Program Guide"), _("View list of available EPG extensions." ), tag, divpng )) - elif tag == 'Communication': - return(( _("Communication"), _("View list of available communication extensions." ), tag, divpng )) - else: # dynamically generate non existent tags - return(( str(tag), _("View list of available ") + str(tag) + _(" extensions." ), tag, divpng )) - - def prepareInstall(self): - self.cmdList = [] - if self.available_updates > 0: - self.cmdList.append((IpkgComponent.CMD_UPGRADE, { "test_only": False })) - if self.selectedFiles and len(self.selectedFiles): - for plugin in self.selectedFiles: - detailsfile = self.directory[0] + "/" + plugin[0] - if (os_path.exists(detailsfile) == True): - self.fillPackageDetails(plugin[0]) - self.package = self.packageDetails[0] - if self.package[0].has_key("attributes"): - self.attributes = self.package[0]["attributes"] - if self.attributes.has_key("package"): - self.packagefiles = self.attributes["package"] - if plugin[1] == 'installed': - if self.packagefiles: - for package in self.packagefiles[:]: - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package["name"] })) - else: - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": plugin[2] })) - else: - if self.packagefiles: - for package in self.packagefiles[:]: - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] })) - else: - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": plugin[2] })) - else: - if plugin[1] == 'installed': - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": plugin[2] })) - else: - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": plugin[2] })) - - def runExecute(self, result): - if result: - self.session.openWithCallback(self.runExecuteFinished, Ipkg, cmdList = self.cmdList) - else: - self.close() - - def runExecuteFinished(self): - self.session.openWithCallback(self.ExecuteReboot, MessageBox, _("Install or remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) - - def ExecuteReboot(self, result): - if result is None: - return - if result is False: - self.reloadPluginlist() - self.detailsClosed(True) - if result: - quitMainloop(3) - - def reloadPluginlist(self): - plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) - - -class PluginManagerInfo(Screen): +class WlanScan(Screen): skin = """ - + + - - - {"template": [ - MultiContentEntryText(pos = (50, 1), size = (150, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (50, 25), size = (540, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the state - MultiContentEntryPixmapAlphaTest(pos = (0, 1), size = (48, 48), png = 2), # index 2 is the status pixmap - MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 3), # index 3 is the div pixmap - ], - "fonts": [gFont("Regular", 22),gFont("Regular", 18)], - "itemHeight": 52 - } - - - - - """ - - def __init__(self, session, plugin_path, cmdlist = None): - Screen.__init__(self, session) - self.session = session - self.skin_path = plugin_path - self.cmdlist = cmdlist - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], - { - "ok": self.process, - "back": self.exit, - "red": self.exit, - "green": self.process, - }, -1) - - self.list = [] - self["list"] = List(self.list) - self["key_red"] = StaticText(_("Cancel")) - self["key_green"] = StaticText(_("Continue")) - self["status"] = StaticText(_("Following tasks will be done after you press continue!")) - - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.rebuildList) - - def setWindowTitle(self): - self.setTitle(_("Plugin manager activity information")) - - def rebuildList(self): - self.list = [] - if self.cmdlist is not None: - for entry in self.cmdlist: - action = "" - info = "" - cmd = entry[0] - if cmd == 0: - action = 'install' - elif cmd == 2: - action = 'remove' - else: - action = 'upgrade' - args = entry[1] - if cmd == 0: - info = args['package'] - elif cmd == 2: - info = args['package'] - else: - info = _("Dreambox software because updates are available.") - - self.list.append(self.buildEntryComponent(action,info)) - self['list'].setList(self.list) - self['list'].updateList(self.list) - - def buildEntryComponent(self, action,info): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - upgradepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) - installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) - removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - if action == 'install': - return(( _('Installing'), info, installpng, divpng)) - elif action == 'remove': - return(( _('Removing'), info, removepng, divpng)) - else: - return(( _('Upgrading'), info, upgradepng, divpng)) - - def exit(self): - self.close(False) - - def process(self): - self.close(True) - - -class PluginManagerHelp(Screen): - skin = """ - - - - + + {"template": [ - MultiContentEntryText(pos = (50, 1), size = (540, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (50, 25), size = (540, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the state - MultiContentEntryPixmapAlphaTest(pos = (0, 1), size = (48, 48), png = 2), # index 2 is the status pixmap - MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 3), # index 3 is the div pixmap + MultiContentEntryText(pos = (0, 0), size = (550, 30), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the essid + MultiContentEntryText(pos = (0, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 5), # index 5 is the interface + MultiContentEntryText(pos = (175, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 4), # index 0 is the encryption + MultiContentEntryText(pos = (350, 0), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 0 is the signal + MultiContentEntryText(pos = (350, 30), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 3), # index 0 is the maxrate + MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (550, 2), png = 6), # index 6 is the div pixmap ], - "fonts": [gFont("Regular", 22),gFont("Regular", 18)], - "itemHeight": 52 + "fonts": [gFont("Regular", 28),gFont("Regular", 18)], + "itemHeight": 54 } - - + + """ - def __init__(self, session, plugin_path): + def __init__(self, session, iface): Screen.__init__(self, session) self.session = session + self.iface = iface self.skin_path = plugin_path - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], - { - "back": self.exit, - "red": self.exit, - }, -1) - + self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up") + self.APList = None + self.newAPList = None + self.WlanList = None + self.cleanList = None + self.oldlist = None + self.listLenght = None + self.rescanTimer = eTimer() + self.rescanTimer.callback.append(self.rescanTimerFired) + + self["info"] = StaticText() + self.list = [] self["list"] = List(self.list) + self["key_red"] = StaticText(_("Close")) - self["status"] = StaticText(_("A small overview of the available icon states and actions.")) - - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.rebuildList) - - def setWindowTitle(self): - self.setTitle(_("Plugin manager help")) - - def rebuildList(self): - self.list = [] - self.list.append(self.buildEntryComponent('install')) - self.list.append(self.buildEntryComponent('installable')) - self.list.append(self.buildEntryComponent('installed')) - self.list.append(self.buildEntryComponent('remove')) - self['list'].setList(self.list) - self['list'].updateList(self.list) - - def buildEntryComponent(self, state): - divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) - installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png")) - installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png")) - removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) - installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png")) - - if state == 'installed': - return(( _('This plugin is installed.'), _('You can remove this plugin.'), installedpng, divpng)) - elif state == 'installable': - return(( _('This plugin is not installed.'), _('You can install this plugin.'), installablepng, divpng)) - elif state == 'install': - return(( _('This plugin will be installed.'), _('You can cancel the installation.'), installpng, divpng)) - elif state == 'remove': - return(( _('This plugin will be removed.'), _('You can cancel the removal.'), removepng, divpng)) - - def exit(self): - self.close() - - -class PluginDetails(Screen, DreamInfoHandler): - skin = """ - - - - - - - - - - - """ - def __init__(self, session, plugin_path, packagedata = None): - Screen.__init__(self, session) - self.skin_path = plugin_path - self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" - self.attributes = None - self.translatedAttributes = None - DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, language = self.language) - self.directory = resolveFilename(SCOPE_METADIR) - if packagedata: - self.pluginname = packagedata[0] - self.details = packagedata[1] - self.pluginstate = packagedata[4] - self.statuspicinstance = packagedata[5] - self.divpicinstance = packagedata[6] - self.fillPackageDetails(self.details) - - self.thumbnail = "" - - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], + self["key_green"] = StaticText(_("Connect")) + self["key_yellow"] = StaticText() + + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions"], { - "back": self.exit, - "red": self.exit, - "green": self.go, - "up": self.pageUp, - "down": self.pageDown, - "left": self.pageUp, - "right": self.pageDown, + "ok": self.select, + "back": self.cancel, }, -1) - - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText("") - self["author"] = StaticText() - self["statuspic"] = Pixmap() - self["divpic"] = Pixmap() - self["screenshot"] = Pixmap() - self["detailtext"] = ScrollLabel() - - self["statuspic"].hide() - self["screenshot"].hide() - self["divpic"].hide() - - self.package = self.packageDetails[0] - if self.package[0].has_key("attributes"): - self.attributes = self.package[0]["attributes"] - if self.package[0].has_key("translation"): - self.translatedAttributes = self.package[0]["translation"] - - self.cmdList = [] - self.oktext = _("\nAfter pressing OK, please wait!") - self.picload = ePicLoad() - self.picload.PictureData.get().append(self.paintScreenshotPixmapCB) - self.onShown.append(self.setWindowTitle) - self.onLayoutFinish.append(self.setInfos) - - def setWindowTitle(self): - self.setTitle(_("Package details for: " + self.pluginname)) - - def exit(self): - self.close(False) - - def pageUp(self): - self["detailtext"].pageUp() - - def pageDown(self): - self["detailtext"].pageDown() - - def statusCallback(self, status, progress): - pass - - def setInfos(self): - if self.translatedAttributes.has_key("name"): - self.pluginname = self.translatedAttributes["name"] - elif self.attributes.has_key("name"): - self.pluginname = self.attributes["name"] - else: - self.pluginname = _("unknown") - - if self.translatedAttributes.has_key("author"): - self.author = self.translatedAttributes["author"] - elif self.attributes.has_key("author"): - self.author = self.attributes["author"] - else: - self.author = _("unknown") - - if self.translatedAttributes.has_key("description"): - self.description = self.translatedAttributes["description"] - elif self.attributes.has_key("description"): - self.description = self.attributes["description"] - else: - self.description = _("No description available.") - - if self.translatedAttributes.has_key("screenshot"): - self.loadThumbnail(self.translatedAttributes) - else: - self.loadThumbnail(self.attributes) - - self["author"].setText(_("Author: ") + self.author) - self["detailtext"].setText(self.description.strip()) - if self.pluginstate == 'installable': - self["key_green"].setText(_("Install")) - else: - self["key_green"].setText(_("Remove")) - - def loadThumbnail(self, entry): - thumbnailUrl = None - if entry.has_key("screenshot"): - thumbnailUrl = entry["screenshot"] - if thumbnailUrl is not None: - self.thumbnail = "/tmp/" + thumbnailUrl.split('/')[-1] - print "[PluginDetails] downloading screenshot " + thumbnailUrl + " to " + self.thumbnail - client.downloadPage(thumbnailUrl,self.thumbnail).addCallback(self.setThumbnail).addErrback(self.fetchFailed) - else: - self.setThumbnail(noScreenshot = True) - - def setThumbnail(self, noScreenshot = False): - if not noScreenshot: - filename = self.thumbnail - else: - filename = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/noprev.png") - - sc = AVSwitch().getFramebufferScale() - self.picload.setPara((self["screenshot"].instance.size().width(), self["screenshot"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000")) - self.picload.startDecode(filename) - - if self.statuspicinstance != None: - self["statuspic"].instance.setPixmap(self.statuspicinstance.__deref__()) - self["statuspic"].show() - if self.divpicinstance != None: - self["divpic"].instance.setPixmap(self.divpicinstance.__deref__()) - self["divpic"].show() - - def paintScreenshotPixmapCB(self, picInfo=None): - ptr = self.picload.getData() - if ptr != None: - self["screenshot"].instance.setPixmap(ptr.__deref__()) - self["screenshot"].show() - else: - self.setThumbnail(noScreenshot = True) - - def go(self): - if self.attributes.has_key("package"): - self.packagefiles = self.attributes["package"] - self.cmdList = [] - if self.pluginstate == 'installed': - if self.packagefiles: - for package in self.packagefiles[:]: - self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package["name"] })) - if len(self.cmdList): - self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + self.pluginname + "\n" + self.oktext) - else: - if self.packagefiles: - for package in self.packagefiles[:]: - self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] })) - if len(self.cmdList): - self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + self.pluginname + "\n" + self.oktext) - - def runUpgrade(self, result): - if result: - self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) - - def runUpgradeFinished(self): - self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) - - def UpgradeReboot(self, result): - if result is None: - return - if result is False: - self.close(True) - if result: - quitMainloop(3) - - def runRemove(self, result): - if result: - self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) - - def runRemoveFinished(self): - self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) - - def RemoveReboot(self, result): - if result is None: - return - if result is False: - self.close(True) - if result: - quitMainloop(3) - - def reloadPluginlist(self): - plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) - - def fetchFailed(self,string): - self.setThumbnail(noScreenshot = True) - print "[PluginDetails] fetch failed " + string.getErrorMessage() - - -class UpdatePlugin(Screen): - skin = """ - - - - - - """ - - def __init__(self, session, args = None): - Screen.__init__(self, session) - - self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 } - - self.slider = Slider(0, 4) - self["slider"] = self.slider - self.activityslider = Slider(0, 100) - self["activityslider"] = self.activityslider - self.status = StaticText(_("Upgrading Dreambox... Please wait")) - self["status"] = self.status - self.package = StaticText() - self["package"] = self.package - - self.packages = 0 - self.error = 0 - - self.activity = 0 - self.activityTimer = eTimer() - self.activityTimer.callback.append(self.doActivityTimer) - self.activityTimer.start(100, False) - - self.ipkg = IpkgComponent() - self.ipkg.addCallback(self.ipkgCallback) - - self.updating = True - self.package.setText(_("Package list update")) - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - - self["actions"] = ActionMap(["WizardActions"], + + self["shortcuts"] = ActionMap(["ShortcutActions"], { - "ok": self.exit, - "back": self.exit - }, -1) - - def doActivityTimer(self): - self.activity += 1 - if self.activity == 100: - self.activity = 0 - self.activityslider.setValue(self.activity) - - def ipkgCallback(self, event, param): - if event == IpkgComponent.EVENT_DOWNLOAD: - self.status.setText(_("Downloading")) - elif event == IpkgComponent.EVENT_UPGRADE: - if self.sliderPackages.has_key(param): - self.slider.setValue(self.sliderPackages[param]) - self.package.setText(param) - self.status.setText(_("Upgrading")) - self.packages += 1 - elif event == IpkgComponent.EVENT_INSTALL: - self.package.setText(param) - self.status.setText(_("Installing")) - self.packages += 1 - elif event == IpkgComponent.EVENT_CONFIGURING: - self.package.setText(param) - self.status.setText(_("Configuring")) - elif event == IpkgComponent.EVENT_MODIFIED: - self.session.openWithCallback( - self.modificationCallback, - MessageBox, - _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) - ) - elif event == IpkgComponent.EVENT_ERROR: - self.error += 1 - elif event == IpkgComponent.EVENT_DONE: - if self.updating: - self.updating = False - self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False}) - elif self.error == 0: - self.slider.setValue(4) - - self.activityTimer.stop() - self.activityslider.setValue(0) - - self.package.setText("") - self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages) - else: - self.activityTimer.stop() - self.activityslider.setValue(0) - error = _("your dreambox might be unusable now. Please consult the manual for further assistance before rebooting your dreambox.") - if self.packages == 0: - error = _("No packages were upgraded yet. So you can check your network and try again.") - if self.updating: - error = _("Your dreambox isn't connected to the internet properly. Please check it and try again.") - self.status.setText(_("Error") + " - " + error) - #print event, "-", param - pass - - def modificationCallback(self, res): - self.ipkg.write(res and "N" or "Y") - - def exit(self): - if not self.ipkg.isRunning(): - if self.packages != 0 and self.error == 0: - self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?")) + "red": self.cancel, + "green": self.select, + }) + self.onLayoutFinish.append(self.layoutFinished) + self.getAccessPoints(refresh = False) + + def layoutFinished(self): + self.setTitle(_("Choose a wireless network")) + + def select(self): + cur = self["list"].getCurrent() + if cur is not None: + self.rescanTimer.stop() + del self.rescanTimer + if cur[1] is not None: + essid = cur[1] + self.close(essid,self.getWlanList()) else: - self.close() - - def exitAnswer(self, result): - if result is not None and result: - quitMainloop(2) - self.close() - - -class IpkgInstaller(Screen): - skin = """ - - - - - - - - - """ + self.close(None,None) + else: + self.rescanTimer.stop() + del self.rescanTimer + self.close(None,None) - def __init__(self, session, list): - Screen.__init__(self, session) - - self.list = SelectionList() - self["list"] = self.list - for listindex in range(len(list)): - self.list.addSelection(list[listindex], list[listindex], listindex, True) + def WlanSetupClosed(self, *ret): + if ret[0] == 2: + self.rescanTimer.stop() + del self.rescanTimer + self.close(None) + + def cancel(self): + if self.oldInterfaceState is False: + iNetwork.setAdapterAttribute(self.iface, "up", False) + iNetwork.deactivateInterface(self.iface,self.deactivateInterfaceCB) + else: + self.rescanTimer.stop() + del self.rescanTimer + self.close(None) + + def deactivateInterfaceCB(self,data): + if data is not None: + if data is True: + self.rescanTimer.stop() + del self.rescanTimer + self.close(None) + + def rescanTimerFired(self): + self.rescanTimer.stop() + self.updateAPList() + + def buildEntryComponent(self, essid, bssid, encrypted, iface, maxrate, signal): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png")) + encryption = encrypted and _("Yes") or _("No") + if bssid == 'hidden...': + return((essid, bssid, None, None, None, None, divpng)) + else: + return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng)) + + def updateAPList(self): + self.oldlist = [] + self.oldlist = self.cleanList + self.newAPList = [] + newList = [] + tmpList = [] + newListIndex = None + currentListEntry = None + currentListIndex = None + newList = self.getAccessPoints(refresh = True) + + for oldentry in self.oldlist: + if oldentry not in newList: + newList.append(oldentry) + + for newentry in newList: + if newentry[1] == "hidden...": + continue + tmpList.append(newentry) + + if len(tmpList): + if "hidden..." not in tmpList: + tmpList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) + + for entry in tmpList: + self.newAPList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] )) + + currentListEntry = self["list"].getCurrent() + idx = 0 + for entry in self.newAPList: + if entry == currentListEntry: + newListIndex = idx + idx +=1 + self['list'].setList(self.newAPList) + self["list"].setIndex(newListIndex) + self["list"].updateList(self.newAPList) + self.listLenght = len(self.newAPList) + self.buildWlanList() + self.setInfo() + + def getAccessPoints(self, refresh = False): + self.APList = [] + self.cleanList = [] + self.w = Wlan(self.iface) + aps = self.w.getNetworkList() + if aps is not None: + print "[NetworkWizard.py] got Accespoints!" + tmpList = [] + compList = [] + for ap in aps: + a = aps[ap] + if a['active']: + tmpList.append( (a['essid'], a['bssid']) ) + compList.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) ) + + for entry in tmpList: + if entry[0] == "": + for compentry in compList: + if compentry[1] == entry[1]: + compList.remove(compentry) + for entry in compList: + self.cleanList.append( ( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ) ) + + if "hidden..." not in self.cleanList: + self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) - self["key_red"] = StaticText(_("Close")) - self["key_green"] = StaticText(_("Install")) - self["introduction"] = StaticText(_("Press OK to toggle the selection.")) + for entry in self.cleanList: + self.APList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] )) - self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], - { - "ok": self.list.toggleSelection, - "cancel": self.close, - "red": self.close, - "green": self.install - }, -1) + if refresh is False: + self['list'].setList(self.APList) + self.listLenght = len(self.APList) + self.setInfo() + self.rescanTimer.start(5000) + return self.cleanList + + def setInfo(self): + length = self.getLength() + if length == 0: + self["info"].setText(_("No wireless networks found! Please refresh.")) + elif length == 1: + self["info"].setText(_("1 wireless network found!")) + else: + self["info"].setText(str(length)+_(" wireless networks found!")) + + def buildWlanList(self): + self.WlanList = [] + currList = [] + currList = self['list'].list + for entry in currList: + self.WlanList.append( (entry[1], entry[0]) ) - def install(self): - list = self.list.getSelectionsList() - cmdList = [] - for item in list: - cmdList.append((IpkgComponent.CMD_INSTALL, { "package": item[1] })) - self.session.open(Ipkg, cmdList = cmdList) + def getLength(self): + return self.listLenght + def getWlanList(self): + return self.WlanList -def filescan_open(list, session, **kwargs): - filelist = [x.path for x in list] - session.open(IpkgInstaller, filelist) # list -def filescan(**kwargs): - from Components.Scanner import Scanner, ScanPath - return \ - Scanner(mimetypes = ["application/x-debian-package"], - paths_to_scan = - [ - ScanPath(path = "ipk", with_subdirs = True), - ScanPath(path = "", with_subdirs = False), - ], - name = "Ipkg", - description = _("Install extensions."), - openfnc = filescan_open, ) +def WlanStatusScreenMain(session, iface): + session.open(WlanStatus, iface) +def callFunction(iface): + w = Wlan(iface) + i = w.getWirelessInterfaces() + if i: + if iface in i: + return WlanStatusScreenMain + return None -def UpgradeMain(session, **kwargs): - session.open(UpdatePluginMenu) -def startSetup(menuid): - if menuid != "setup": - return [ ] - return [(_("Software manager"), UpgradeMain, "software_manager", 50)] +def configStrings(iface): + driver = iNetwork.detectWlanModule() + print "Found WLAN-Driver:",driver + if driver in ('ralink', 'zydas'): + return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate" + else: + if config.plugins.wlan.essid.value == "hidden...": + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' + else: + return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate' -def Plugins(path, **kwargs): - global plugin_path - plugin_path = path - list = [ - PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), - PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) - ] - if config.usage.setup_level.index >= 2: # expert+ - list.append(PluginDescriptor(name=_("Software manager"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=UpgradeMain)) - return list +def Plugins(**kwargs): + return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."}) -- cgit v1.2.3 From d9d9b21f1b6dae099a07cb50e7fcbbb4a4d3f2ee Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 13 Dec 2009 12:35:54 +0100 Subject: CutListEditor: always restart service on cutlist editor close --- lib/python/Plugins/Extensions/CutListEditor/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index efe9f761..abd606d6 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -195,7 +195,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He self.onClose.append(self.__onClose) def __onClose(self): - self.session.nav.playService(self.old_service) + self.session.nav.playService(self.old_service, forceRestart=True) def updateStateLabel(self, state): self["SeekState"].setText(state[3].strip()) -- cgit v1.2.3 From 7373f39fe2ebe1b5007ed56ddd86d9ce0ad3efb7 Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 13 Dec 2009 12:37:15 +0100 Subject: add preStart event and use it to load the cutlist --- lib/dvb/dvb.cpp | 2 ++ lib/dvb/idvb.h | 2 +- lib/dvb/pmt.cpp | 3 +++ lib/dvb/pmt.h | 1 + lib/service/servicedvb.cpp | 4 +++- 5 files changed, 10 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 656b6da0..17712dde 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -1764,6 +1764,8 @@ RESULT eDVBChannel::playFile(const char *file) m_pvr_thread->setStreamMode(1); m_pvr_thread->setScatterGather(this); + m_event(this, evtPreStart); + if (m_pvr_thread->start(file, m_pvr_fd_dst)) { delete m_pvr_thread; diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index cff4dbb9..4ef7efad 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -522,7 +522,7 @@ public: virtual RESULT getCurrentFrontendParameters(ePtr &)=0; enum { - evtEOF, evtSOF, evtFailed + evtPreStart, evtEOF, evtSOF, evtFailed }; virtual RESULT connectStateChange(const Slot1 &stateChange, ePtr &connection)=0; virtual RESULT connectEvent(const Slot2 &eventChange, ePtr &connection)=0; diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 9bd065b3..ee89a3a4 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -75,6 +75,9 @@ void eDVBServicePMTHandler::channelEvent(iDVBChannel *channel, int event) { switch (event) { + case iDVBChannel::evtPreStart: + serviceEvent(eventPreStart); + break; case iDVBChannel::evtEOF: serviceEvent(eventEOF); break; diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index a9ca23f2..483c06b1 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -123,6 +123,7 @@ public: eventNewProgramInfo, // we just received a PMT eventTuned, // a channel was sucessfully (re-)tuned in, you may start additional filters now + eventPreStart, // before start filepush thread eventSOF, // seek pre start eventEOF, // a file playback did end diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index c8e64b80..77e2bd4e 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1029,6 +1029,9 @@ void eDVBServicePlay::serviceEvent(int event) m_event((iPlayableService*)this, evUpdatedInfo); break; } + case eDVBServicePMTHandler::eventPreStart: + loadCuesheet(); + break; case eDVBServicePMTHandler::eventEOF: m_event((iPlayableService*)this, evEOF); break; @@ -1095,7 +1098,6 @@ RESULT eDVBServicePlay::start() m_event_handler.inject(event, 0); m_event_handler.inject(empty, 1); } - loadCuesheet(); m_event(this, evStart); } return 0; -- cgit v1.2.3 From 8b4017d003a6d7ed074212a8f335707080eace6a Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 17 Dec 2009 14:46:04 +0100 Subject: elock.h: add possibility to create recursive mutexes --- lib/base/elock.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/base/elock.h b/lib/base/elock.h index 51582e67..01757182 100644 --- a/lib/base/elock.h +++ b/lib/base/elock.h @@ -83,9 +83,18 @@ class eSingleLock pthread_mutex_t m_lock; eSingleLock(eSingleLock &); public: - eSingleLock() + eSingleLock(bool recursive=false) { - pthread_mutex_init(&m_lock, 0); + if (recursive) + { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&m_lock, &attr); + pthread_mutexattr_destroy(&attr); + } + else + pthread_mutex_init(&m_lock, 0); } ~eSingleLock() { -- cgit v1.2.3 From bce2ef4220fecb2c2e296c85ec2fbef5794f4492 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 17 Dec 2009 14:58:54 +0100 Subject: lib/dvb/tstools.h/cpp: make eDVBTSTool thread safe (i.e. this fixes seeking in timeshift and seeking in files without additional startcode/accespoint file --- lib/dvb/tstools.cpp | 10 ++++++++-- lib/dvb/tstools.h | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index 2e5c5665..dafd70fe 100644 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -7,6 +7,7 @@ #include eDVBTSTools::eDVBTSTools() + :m_file_lock(true) { m_pid = -1; m_maxrange = 256*1024; @@ -47,6 +48,7 @@ int eDVBTSTools::openFile(const char *filename, int nostreaminfo) m_samples_taken = 0; + eSingleLocker l(m_file_lock); if (m_file.open(filename, 1) < 0) return -1; return 0; @@ -54,6 +56,7 @@ int eDVBTSTools::openFile(const char *filename, int nostreaminfo) void eDVBTSTools::closeFile() { + eSingleLocker l(m_file_lock); m_file.close(); } @@ -78,7 +81,8 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) return -1; offset -= offset % 188; - + + eSingleLocker l(m_file_lock); if (m_file.lseek(offset, SEEK_SET) < 0) { eDebug("lseek failed"); @@ -355,7 +359,8 @@ void eDVBTSTools::calcEnd() { if (!m_file.valid()) return; - + + eSingleLocker l(m_file_lock); off_t end = m_file.lseek(0, SEEK_END); if (llabs(end - m_last_filelength) > 1*1024*1024) @@ -504,6 +509,7 @@ int eDVBTSTools::findPMT(int &pmt_pid, int &service_id) return -1; } + eSingleLocker l(m_file_lock); if (m_file.lseek(0, SEEK_SET) < 0) { eDebug("seek failed"); diff --git a/lib/dvb/tstools.h b/lib/dvb/tstools.h index c230a341..ed8b9241 100644 --- a/lib/dvb/tstools.h +++ b/lib/dvb/tstools.h @@ -4,6 +4,7 @@ #include #include #include +#include /* * Note: we're interested in PTS values, not STC values. @@ -75,9 +76,10 @@ public: private: int m_pid; int m_maxrange; - + + eSingleLock m_file_lock; eRawFile m_file; - + int m_begin_valid, m_end_valid; pts_t m_pts_begin, m_pts_end; off_t m_offset_begin, m_offset_end; -- cgit v1.2.3 From 65cdbab7809075cf446121f985380f98a5bb4af2 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 21 Dec 2009 16:04:41 +0100 Subject: lib/dvb/tstools.cpp: add more debug output to timestamp parser --- lib/dvb/tstools.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index dafd70fe..82d6d54f 100644 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -138,7 +138,7 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) pts |= ((unsigned long long)(packet[ 9]&0xFF)) << 1; pts |= ((unsigned long long)(packet[10]&0x80)) >> 7; offset -= 188; - eDebug("PCR found at %llx: %16llx", offset, pts); + eDebug("PCR %16llx found at %lld pid %02x (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x)", pts, offset, pid, packet[0], packet[1], packet[2], packet[3], packet[4], packet[5], packet[6], packet[7], packet[8], packet[9], packet[10]); if (fixed && fixupPTS(offset, pts)) return -1; return 0; @@ -175,11 +175,11 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) pts |= ((unsigned long long)(payload[13]&0xFE)) >> 1; offset -= 188; -// eDebug("found pts %08llx at %08llx pid %02x stream: %02x", pts, offset, pid, payload[3]); - + eDebug("PTS %16llx found at %lld pid %02x stream: %02x", pts, offset, pid, payload[3]); + /* convert to zero-based */ if (fixed && fixupPTS(offset, pts)) - return -1; + return -1; return 0; } } @@ -216,10 +216,13 @@ int eDVBTSTools::fixupPTS(const off_t &offset, pts_t &now) now -= pos; return 0; } + eDebug("eDVBTSTools::fixupPTS failed!"); + return -1; } int eDVBTSTools::getOffset(off_t &offset, pts_t &pts, int marg) { + eDebug("getOffset for pts 0x%llx", pts); if (m_use_streaminfo) { if (pts >= m_pts_end && marg > 0 && m_end_valid) @@ -445,6 +448,8 @@ void eDVBTSTools::takeSamples() m_samples_taken = 1; m_samples.clear(); pts_t dummy; + int retries=2; + if (calcLen(dummy) == -1) return; @@ -454,21 +459,27 @@ void eDVBTSTools::takeSamples() bytes_per_sample = 40*1024*1024; bytes_per_sample -= bytes_per_sample % 188; - - for (off_t offset = m_offset_begin; offset < m_offset_end; offset += bytes_per_sample) + + eDebug("samples step %lld, pts begin %llx, pts end %llx, offs begin %lld, offs end %lld:", + bytes_per_sample, m_pts_begin, m_pts_end, m_offset_begin, m_offset_end); + + for (off_t offset = m_offset_begin; offset < m_offset_end;) { pts_t p; - takeSample(offset, p); + if (takeSample(offset, p) && retries--) + continue; + retries = 2; + offset += bytes_per_sample; } m_samples[0] = m_offset_begin; m_samples[m_pts_end - m_pts_begin] = m_offset_end; - -// eDebug("begin, end: %llx %llx", m_offset_begin, m_offset_end); } /* returns 0 when a sample was taken. */ int eDVBTSTools::takeSample(off_t off, pts_t &p) { + off_t offset_org = off; + if (!eDVBTSTools::getPTS(off, p, 1)) { /* as we are happily mixing PTS and PCR values (no comment, please), we might @@ -486,18 +497,18 @@ int eDVBTSTools::takeSample(off_t off, pts_t &p) { if ((l->second > off) || (u->second < off)) { - eDebug("ignoring sample %llx %llx %llx (%lld %lld %lld)", + eDebug("ignoring sample %lld %lld %lld (%llx %llx %llx)", l->second, off, u->second, l->first, p, u->first); return 1; } } } - + eDebug("adding sample %lld: pts 0x%llx -> pos %lld (diff %lld bytes)", offset_org, p, off, off-offset_org); m_samples[p] = off; return 0; } - return 1; + return -1; } int eDVBTSTools::findPMT(int &pmt_pid, int &service_id) -- cgit v1.2.3 From 3a65450f335f7b831cf8a01267fa43c6c19bfc58 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 21 Dec 2009 16:06:02 +0100 Subject: lib/dvb/tstools.cpp: support for stream id extension defined in ISO 13818-1 Amendment 2.. this fixes skipping in some bluray ts files --- lib/dvb/tstools.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index 82d6d54f..d5ad2494 100644 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -148,24 +148,83 @@ int eDVBTSTools::getPTS(off_t &offset, pts_t &pts, int fixed) } else payload = packet + 4; - /* if (m_pid >= 0) if (pid != m_pid) continue; */ if (!pusi) continue; - - + /* somehow not a startcode. (this is invalid, since pusi was set.) ignore it. */ if (payload[0] || payload[1] || (payload[2] != 1)) continue; - + + if (payload[3] == 0xFD) + { // stream use extension mechanism defined in ISO 13818-1 Amendment 2 + if (payload[7] & 1) // PES extension flag + { + int offs = 0; + if (payload[7] & 0x80) // pts avail + offs += 5; + if (payload[7] & 0x40) // dts avail + offs += 5; + if (payload[7] & 0x20) // escr avail + offs += 6; + if (payload[7] & 0x10) // es rate + offs += 3; + if (payload[7] & 0x8) // dsm trickmode + offs += 1; + if (payload[7] & 0x4) // additional copy info + offs += 1; + if (payload[7] & 0x2) // crc + offs += 2; + if (payload[8] < offs) + continue; + uint8_t pef = payload[9+offs++]; // pes extension field + if (pef & 1) // pes extension flag 2 + { + if (pef & 0x80) // private data flag + offs += 16; + if (pef & 0x40) // pack header field flag + offs += 1; + if (pef & 0x20) // program packet sequence counter flag + offs += 2; + if (pef & 0x10) // P-STD buffer flag + offs += 2; + if (payload[8] < offs) + continue; + uint8_t stream_id_extension_len = payload[9+offs++] & 0x7F; + if (stream_id_extension_len >= 1) + { + if (payload[8] < (offs + stream_id_extension_len) ) + continue; + if (payload[9+offs] & 0x80) // stream_id_extension_bit (should not set) + continue; + switch (payload[9+offs]) + { + case 0x55 ... 0x5f: // VC-1 + break; + case 0x71: // AC3 / DTS + break; + default: + eDebug("skip unknwn stream_id_extension %02x\n", payload[9+offs]); + continue; + } + } + else + continue; + } + else + continue; + } + else + continue; + } /* drop non-audio, non-video packets because other streams can be non-compliant.*/ - if (((payload[3] & 0xE0) != 0xC0) && // audio - ((payload[3] & 0xF0) != 0xE0)) // video + else if (((payload[3] & 0xE0) != 0xC0) && // audio + ((payload[3] & 0xF0) != 0xE0)) // video continue; - + if (payload[7] & 0x80) /* PTS */ { pts = ((unsigned long long)(payload[ 9]&0xE)) << 29; -- cgit v1.2.3 From 37b6491b12090e02c5a7ad9ea2d161c528c8788b Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 21 Dec 2009 20:32:41 +0100 Subject: servicedvb.cpp: small cleanup --- lib/service/servicedvb.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 77e2bd4e..e6af1e66 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -2300,6 +2300,7 @@ void eDVBServicePlay::switchToTimeshift() void eDVBServicePlay::updateDecoder() { int vpid = -1, vpidtype = -1, pcrpid = -1, tpid = -1, achannel = -1, ac3_delay=-1, pcm_delay=-1; + bool mustPlay = false; eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler; @@ -2380,11 +2381,10 @@ void eDVBServicePlay::updateDecoder() Py_DECREF(subs); } } - m_decoder->play(); /* pids will be set later */ } if (m_cue) m_cue->setDecodingDemux(m_decode_demux, m_decoder); - m_decoder->play(); /* pids will be set later. */ + mustPlay = true; } m_timeshift_changed = 0; @@ -2449,7 +2449,11 @@ void eDVBServicePlay::updateDecoder() m_decoder->setRadioPic(radio_pic); } - m_decoder->set(); + if (mustPlay) + m_decoder->play(); + else + m_decoder->set(); + m_decoder->setAudioChannel(achannel); /* don't worry about non-existing services, nor pvr services */ -- cgit v1.2.3 From 41b99d4a2d737817b75c93c8331f038326d13862 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 22 Dec 2009 14:18:00 +0100 Subject: NimManager.py: increased delay after enable voltage before send motor diseqc command... this fixes bug #261 --- lib/python/Components/NimManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 78e17bb7..d374f7e7 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -899,7 +899,7 @@ def InitSecParams(): x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER, configElement.value)) config.sec.delay_after_voltage_change_before_measure_idle_inputpower = x - x = ConfigInteger(default=750, limits = (0, 9999)) + x = ConfigInteger(default=900, limits = (0, 9999)) x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_MOTOR_CMD, configElement.value)) config.sec.delay_after_enable_voltage_before_motor_command = x -- cgit v1.2.3 From 2701861d66fd17ed825de7bbfdea8e000fdb30b4 Mon Sep 17 00:00:00 2001 From: thedoc Date: Wed, 23 Dec 2009 11:42:22 +0100 Subject: fixes bug #322 change default visibility of blinking dish icon to true --- lib/python/Components/UsageConfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 680b5944..60827107 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -7,7 +7,7 @@ import os def InitUsageConfig(): config.usage = ConfigSubsection(); - config.usage.showdish = ConfigYesNo(default = False) + config.usage.showdish = ConfigYesNo(default = True) config.usage.multibouquet = ConfigYesNo(default = False) config.usage.quickzap_bouquet_change = ConfigYesNo(default = False) config.usage.e1like_radio_mode = ConfigYesNo(default = False) -- cgit v1.2.3 From dc5f101d2790968876caee8bba4ce8ab9210aa2e Mon Sep 17 00:00:00 2001 From: thedoc Date: Tue, 15 Dec 2009 15:38:30 +0100 Subject: fixes bug #269 add "activate picture in picture" to ChannelSelection context menu to activate PiP for the currently selected service --- lib/python/Screens/ChannelSelection.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 0432823b..d4a098c3 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -25,6 +25,7 @@ from Screens.InputBox import InputBox, PinInput from Screens.MessageBox import MessageBox from Screens.ServiceInfo import ServiceInfo profile("ChannelSelection.py 4") +from Screens.PictureInPicture import PictureInPicture from Screens.RdsDisplay import RassInteractive from ServiceReference import ServiceReference from Tools.BoundFunction import boundFunction @@ -101,6 +102,7 @@ class ChannelContextMenu(Screen): if not inBouquetRootList: isPlayable = not (current_sel_flags & (eServiceReference.isMarker|eServiceReference.isDirectory)) if isPlayable: + append_when_current_valid(current, menu, (_("Activate Picture in Picture"), self.showServiceInPiP), level = 0) if config.ParentalControl.configured.value: if parentalControl.getProtectionLevel(csel.getCurrentSelection().toCompareString()) == -1: append_when_current_valid(current, menu, (_("add to parental protection"), boundFunction(self.addParentalProtection, csel.getCurrentSelection())), level = 0) @@ -189,6 +191,21 @@ class ChannelContextMenu(Screen): self.close() else: self.session.openWithCallback(self.close, MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR) + + def showServiceInPiP(self): + if self.session.pipshown: + del self.session.pip + self.session.pip = self.session.instantiateDialog(PictureInPicture) + self.session.pip.show() + newservice = self.csel.servicelist.getCurrent() + if self.session.pip.playService(newservice): + self.session.pipshown = True + self.session.pip.servicePath = self.csel.getCurrentServicePath() + self.close() + else: + self.session.pipshown = False + del self.session.pip + self.session.openWithCallback(self.close, MessageBox, _("Could not open Picture in Picture"), MessageBox.TYPE_ERROR) def addServiceToBouquetSelected(self): bouquets = self.csel.getBouquetList() -- cgit v1.2.3 From a88994b2d0bab5d8a5d0b38b5a66f374372b0830 Mon Sep 17 00:00:00 2001 From: thedoc Date: Tue, 15 Dec 2009 16:18:52 +0100 Subject: fixes bug #354 change MenuList to ChoiceList in ChannelContext and assign Blue button to PiP activation --- data/skin_default.xml | 4 ++-- lib/python/Components/ChoiceList.py | 2 +- lib/python/Screens/ChannelSelection.py | 27 +++++++++++++++++---------- 3 files changed, 20 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/data/skin_default.xml b/data/skin_default.xml index 71f579cb..7aaff38f 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -70,8 +70,8 @@ - - + + diff --git a/lib/python/Components/ChoiceList.py b/lib/python/Components/ChoiceList.py index 4700e9e6..33868d61 100755 --- a/lib/python/Components/ChoiceList.py +++ b/lib/python/Components/ChoiceList.py @@ -3,7 +3,7 @@ from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont from Tools.LoadPixmap import LoadPixmap -def ChoiceEntryComponent(key, text): +def ChoiceEntryComponent(key = "", text = ["--"]): res = [ text ] if text[0] == "--": res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 00, 800, 25, 0, RT_HALIGN_LEFT, "-"*200)) diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index d4a098c3..e8bbce15 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -21,6 +21,7 @@ profile("ChannelSelection.py 2.3") from Components.Input import Input profile("ChannelSelection.py 3") from Components.ParentalControl import parentalControl +from Components.ChoiceList import ChoiceList, ChoiceEntryComponent from Screens.InputBox import InputBox, PinInput from Screens.MessageBox import MessageBox from Screens.ServiceInfo import ServiceInfo @@ -70,9 +71,9 @@ OFF = 0 EDIT_BOUQUET = 1 EDIT_ALTERNATIVES = 2 -def append_when_current_valid(current, menu, args, level = 0): +def append_when_current_valid(current, menu, args, level = 0, key = ""): if current and current.valid() and level <= config.usage.setup_level.index: - menu.append(args) + menu.append(ChoiceEntryComponent(key, args)) class ChannelContextMenu(Screen): def __init__(self, session, csel): @@ -81,13 +82,15 @@ class ChannelContextMenu(Screen): self.csel = csel self.bsel = None - self["actions"] = ActionMap(["OkCancelActions"], + self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "NumberActions"], { "ok": self.okbuttonClick, - "cancel": self.cancelClick + "cancel": self.cancelClick, + "blue": self.showServiceInPiP }) menu = [ ] + self.pipAvailable = False current = csel.getCurrentSelection() current_root = csel.getRoot() current_sel_path = current.getPath() @@ -102,7 +105,6 @@ class ChannelContextMenu(Screen): if not inBouquetRootList: isPlayable = not (current_sel_flags & (eServiceReference.isMarker|eServiceReference.isDirectory)) if isPlayable: - append_when_current_valid(current, menu, (_("Activate Picture in Picture"), self.showServiceInPiP), level = 0) if config.ParentalControl.configured.value: if parentalControl.getProtectionLevel(csel.getCurrentSelection().toCompareString()) == -1: append_when_current_valid(current, menu, (_("add to parental protection"), boundFunction(self.addParentalProtection, csel.getCurrentSelection())), level = 0) @@ -124,8 +126,11 @@ class ChannelContextMenu(Screen): append_when_current_valid(current, menu, (_("remove entry"), self.removeCurrentService), level = 0) if current_root and current_root.getPath().find("flags == %d" %(FLAG_SERVICE_NEW_FOUND)) != -1: append_when_current_valid(current, menu, (_("remove new found flag"), self.removeNewFoundFlag), level = 0) + if isPlayable: + append_when_current_valid(current, menu, (_("Activate Picture in Picture"), self.showServiceInPiP), level = 0, key = "blue") + self.pipAvailable = True else: - menu.append((_("add bouquet"), self.showBouquetInputBox)) + menu.append(ChoiceEntryComponent(text = (_("add bouquet"), self.showBouquetInputBox))) append_when_current_valid(current, menu, (_("remove entry"), self.removeBouquet), level = 0) if inBouquet: # current list is editable? @@ -133,7 +138,7 @@ class ChannelContextMenu(Screen): if not csel.movemode: append_when_current_valid(current, menu, (_("enable move mode"), self.toggleMoveMode), level = 1) if not inBouquetRootList and current_root and not (current_root.flags & eServiceReference.isGroup): - menu.append((_("add marker"), self.showMarkerInputBox)) + menu.append(ChoiceEntryComponent(text = (_("add marker"), self.showMarkerInputBox))) if haveBouquets: append_when_current_valid(current, menu, (_("enable bouquet edit"), self.bouquetMarkStart), level = 0) else: @@ -158,11 +163,11 @@ class ChannelContextMenu(Screen): append_when_current_valid(current, menu, (_("end alternatives edit"), self.bouquetMarkEnd), level = 0) append_when_current_valid(current, menu, (_("abort alternatives edit"), self.bouquetMarkAbort), level = 0) - menu.append((_("back"), self.cancelClick)) - self["menu"] = MenuList(menu) + menu.append(ChoiceEntryComponent(text = (_("back"), self.cancelClick))) + self["menu"] = ChoiceList(menu) def okbuttonClick(self): - self["menu"].getCurrent()[1]() + self["menu"].getCurrent()[0][1]() def cancelClick(self): self.close(False) @@ -193,6 +198,8 @@ class ChannelContextMenu(Screen): self.session.openWithCallback(self.close, MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR) def showServiceInPiP(self): + if not self.pipAvailable: + return if self.session.pipshown: del self.session.pip self.session.pip = self.session.instantiateDialog(PictureInPicture) -- cgit v1.2.3 From 738bb44f393edf2a58eef973f7f5a01c2e2bbaa3 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 23 Dec 2009 19:25:36 +0100 Subject: fix EVIOCGRAB ioctl switch to non exclusive access on input devices when call eRCInput::lock (i.e. this fixes no more working Tuxtxt plugin) remove some incorrect code eRCInput::lock now no more returns a device handle .. this is not possible this way.. --- lib/driver/rc.cpp | 22 ++++++++-------------- lib/driver/rc.h | 7 +++---- lib/driver/rcconsole.cpp | 1 - lib/driver/rcinput.cpp | 6 +++++- lib/driver/rcinput.h | 1 + 5 files changed, 17 insertions(+), 20 deletions(-) (limited to 'lib') diff --git a/lib/driver/rc.cpp b/lib/driver/rc.cpp index 8dab0201..c56fde44 100644 --- a/lib/driver/rc.cpp +++ b/lib/driver/rc.cpp @@ -81,7 +81,6 @@ eRCShortDriver::eRCShortDriver(const char *filename): eRCDriver(eRCInput::getIns { sn=eSocketNotifier::create(eApp, handle, eSocketNotifier::Read); CONNECT(sn->activated, eRCShortDriver::keyPressed); - eRCInput::getInstance()->setFile(handle); } } @@ -115,7 +114,6 @@ eRCInputEventDriver::eRCInputEventDriver(const char *filename): eRCDriver(eRCInp { sn=eSocketNotifier::create(eApp, handle, eSocketNotifier::Read); CONNECT(sn->activated, eRCInputEventDriver::keyPressed); - eRCInput::getInstance()->setFile(handle); } } @@ -132,7 +130,7 @@ void eRCInputEventDriver::setExclusive(bool b) if (handle >= 0) { int grab = b; - if (::ioctl(handle, EVIOCGRAB, &grab) < 0) + if (::ioctl(handle, EVIOCGRAB, grab) < 0) perror("EVIOCGRAB"); } } @@ -175,7 +173,6 @@ eRCInput::eRCInput() { ASSERT( !instance); instance=this; - handle = -1; locked = 0; keyboardMode = kmNone; } @@ -193,21 +190,18 @@ bool eRCInput::open() return false; } -int eRCInput::lock() +void eRCInput::lock() { locked=1; - return handle; + for (std::map::iterator i=devices.begin(); i != devices.end(); ++i) + i->second->setExclusive(false); } void eRCInput::unlock() { - if (locked) - locked=0; -} - -void eRCInput::setFile(int newh) -{ - handle=newh; + locked=0; + for (std::map::iterator i=devices.begin(); i != devices.end(); ++i) + i->second->setExclusive(true); } void eRCInput::addDevice(const std::string &id, eRCDevice *dev) @@ -226,7 +220,7 @@ eRCDevice *eRCInput::getDevice(const std::string &id) if (i == devices.end()) { eDebug("failed, possible choices are:"); - for (std::map::iterator i=devices.begin(); i != devices.end(); ++i) + for (std::map::iterator i=devices.begin(); i != devices.end(); ++i) eDebug("%s", i->first.c_str()); return 0; } diff --git a/lib/driver/rc.h b/lib/driver/rc.h index ef0588c4..52909468 100644 --- a/lib/driver/rc.h +++ b/lib/driver/rc.h @@ -53,6 +53,7 @@ public: * \param key The key to get the description for. * \result User readable description of given key. */ + virtual void setExclusive(bool b) { }; }; /** @@ -89,6 +90,7 @@ public: ~eRCDriver(); void enable(int en) { enabled=en; } + virtual void setExclusive(bool) { } }; class eRCShortDriver: public eRCDriver @@ -174,7 +176,6 @@ public: class eRCInput: public Object { int locked; - int handle; static eRCInput *instance; int keyboardMode; #ifdef SWIG @@ -200,8 +201,6 @@ public: void close(); bool open(); - void setFile(int handle); - /* This is only relevant for "keyboard"-styled input devices, i.e. not plain remote controls. It's up to the input device driver to decide wheter an input device is a keyboard or @@ -238,7 +237,7 @@ public: void setKeyboardMode(int mode) { keyboardMode = mode; } int getKeyboardMode() { return keyboardMode; } static eRCInput *getInstance() { return instance; } - int lock(); + void lock(); void unlock(); int islocked() { return locked; } }; diff --git a/lib/driver/rcconsole.cpp b/lib/driver/rcconsole.cpp index bcce5601..eb5aee3d 100644 --- a/lib/driver/rcconsole.cpp +++ b/lib/driver/rcconsole.cpp @@ -16,7 +16,6 @@ eRCConsoleDriver::eRCConsoleDriver(const char *filename): eRCDriver(eRCInput::ge { sn=eSocketNotifier::create(eApp, handle, eSocketNotifier::Read); CONNECT(sn->activated, eRCConsoleDriver::keyPressed); - eRCInput::getInstance()->setFile(handle); } /* set console mode */ diff --git a/lib/driver/rcinput.cpp b/lib/driver/rcinput.cpp index 0aada8df..e593087d 100644 --- a/lib/driver/rcinput.cpp +++ b/lib/driver/rcinput.cpp @@ -83,9 +83,13 @@ eRCDeviceInputDev::eRCDeviceInputDev(eRCInputEventDriver *driver) break; } } - driver->setExclusive(!iskeyboard); + setExclusive(true); eDebug("Input device \"%s\" is %sa keyboard.", id.c_str(), iskeyboard ? "" : "not "); +} +void eRCDeviceInputDev::setExclusive(bool b) +{ + driver->setExclusive(!iskeyboard && b); } const char *eRCDeviceInputDev::getDescription() const diff --git a/lib/driver/rcinput.h b/lib/driver/rcinput.h index c7f56975..3b4579c5 100644 --- a/lib/driver/rcinput.h +++ b/lib/driver/rcinput.h @@ -10,6 +10,7 @@ public: void handleCode(long code); eRCDeviceInputDev(eRCInputEventDriver *driver); const char *getDescription() const; + void setExclusive(bool); }; #endif -- cgit v1.2.3 From a03c8f3703decf54844695107ddce289df77a0aa Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 23 Dec 2009 21:56:03 +0100 Subject: NimManager.py/Satconfig.py: add possibility to change the tone amplitide (22Khz amplitude) in Tunerconfig for Alps BSBE2 tuners when the usage level is configured as expert --- lib/python/Components/NimManager.py | 12 ++++++++++++ lib/python/Screens/Satconfig.py | 2 ++ 2 files changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index d374f7e7..613305d0 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1213,10 +1213,21 @@ def InitNimManager(nimmgr): tmp.lnb = lnb nim.advanced.sat[x] = tmp + def toneAmplitudeChanged(configElement): + fe_id = configElement.fe_id + slot_id = configElement.slot_id + if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2': + open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value) + + empty_slots = 0 for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] if slot.isCompatible("DVB-S"): + nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7") + nim.toneAmplitude.fe_id = x - empty_slots + nim.toneAmplitude.slot_id = x + nim.toneAmplitude.addNotifier(toneAmplitudeChanged) nim.diseqc13V = ConfigYesNo(False) nim.diseqcMode = ConfigSelection(diseqc_mode_choices, "diseqc_a_b") nim.connectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) @@ -1306,6 +1317,7 @@ def InitNimManager(nimmgr): nim.terrestrial = ConfigSelection(choices = list) nim.terrestrial_5V = ConfigOnOff() else: + empty_slots += 1 nim.configMode = ConfigSelection(choices = { "nothing": _("disabled") }, default="nothing"); if slot.type is not None: print "pls add support for this frontend type!", slot.type diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index e24e4636..634d231a 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -145,6 +145,8 @@ class NimSetup(Screen, ConfigListScreen): currSat = self.nimConfig.advanced.sat[cur_orb_pos] self.fillListWithAdvancedSatEntrys(currSat) self.have_advanced = True + if self.nim.description == "Alps BSBE2" and config.usage.setup_level.index >= 2: # expert + self.list.append(getConfigListEntry(_("Tone Amplitude"), self.nimConfig.toneAmplitude)) elif self.nim.isCompatible("DVB-C"): self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode) self.list.append(self.configMode) -- cgit v1.2.3 From a285571e31b3b1a99764a674319621f0298833c2 Mon Sep 17 00:00:00 2001 From: thedoc Date: Wed, 23 Dec 2009 21:57:24 +0100 Subject: fixes bug #273 add a quick shortcut to switch to "nothing connected" in the sat config screen for remote debugging purposes (undocumented) --- data/keymap.xml | 4 ++++ lib/python/Screens/Satconfig.py | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/data/keymap.xml b/data/keymap.xml index 25538f87..9461d509 100755 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -98,6 +98,10 @@ + + + + diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 634d231a..d5249b99 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -5,7 +5,8 @@ from Components.ActionMap import ActionMap from Components.ConfigList import ConfigListScreen from Components.MenuList import MenuList from Components.NimManager import nimmanager -from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement +from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement,\ + ConfigSatlist from Components.Sources.List import List from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox @@ -383,10 +384,11 @@ class NimSetup(Screen, ConfigListScreen): ConfigListScreen.__init__(self, self.list) - self["actions"] = ActionMap(["SetupActions"], + self["actions"] = ActionMap(["SetupActions", "SatlistShortcutAction"], { "ok": self.keySave, "cancel": self.keyCancel, + "nothingconnected": self.nothingConnectedShortcut }, -2) self.slotid = slotid @@ -423,6 +425,11 @@ class NimSetup(Screen, ConfigListScreen): # we need to call saveAll to reset the connectedTo choices self.saveAll() self.close() + + def nothingConnectedShortcut(self): + if type(self["config"].getCurrent()[1]) is ConfigSatlist: + self["config"].getCurrent()[1].setValue("3601") + self["config"].invalidateCurrent() class NimSelection(Screen): def __init__(self, session): -- cgit v1.2.3 From abc94b7a0600bc3580102f28d26c27b25ffbdba1 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 29 Dec 2009 13:30:18 +0100 Subject: import SystemInfo one time is enough --- lib/python/Screens/TimerEntry.py | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index d7ba73d7..b231b568 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -10,7 +10,6 @@ from Components.Label import Label from Components.Pixmap import Pixmap from Components.SystemInfo import SystemInfo from Components.UsageConfig import defaultMoviePath -from Components.SystemInfo import SystemInfo from Screens.MovieSelection import getPreferredTagEditor from Screens.LocationBox import MovieLocationBox from Screens.ChoiceBox import ChoiceBox -- cgit v1.2.3 From df11647105be3033f3f6222ed83f69b0a1c3c3df Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 30 Dec 2009 11:13:26 +0100 Subject: no more ask for 50hz in videowizzard when 720p/1080i is selected.. and now multi is used as default for 720p and 1080i this fixes bug #262 --- lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py | 7 +++++-- lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index cd1529aa..49b5d53d 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -131,8 +131,11 @@ class VideoWizard(WizardLanguage, Rc): def modeSelect(self, mode): ratesList = self.listRates(mode) print "ratesList:", ratesList - self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0]) - + if self.port == "DVI" and mode in ("720p", "1080i"): + self.hw.setMode(port = self.port, mode = mode, rate = "multi") + else: + self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0]) + def listRates(self, querymode = None): if querymode is None: querymode = self.mode diff --git a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml index 29ac4297..5dea661d 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml +++ b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml @@ -20,7 +20,7 @@ self.selectKey("DOWN") self["portpic"].hide() - + self.condition = (self.port != "DVI" or self.mode == "PC") @@ -33,7 +33,7 @@ self.selectKey("UP") self.selectKey("DOWN") - + self.hw.saveMode(self.port, self.mode, self.rate) -- cgit v1.2.3 From 148af18dacd5f36aa785277d11126d03118e9437 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 30 Dec 2009 17:11:58 +0100 Subject: show a short symbol when a unhandled key is pressed this fixes bug #293 --- data/skin_default.xml | 4 ++++ data/skin_default/Makefile.am | 1 + data/skin_default/unhandled-key.png | Bin 0 -> 1335 bytes lib/python/Screens/InfoBar.py | 6 ++--- lib/python/Screens/InfoBarGenerics.py | 41 +++++++++++++++++++++++++++++++++- lib/python/Screens/Makefile.am | 2 +- lib/python/Screens/UnhandledKey.py | 7 ++++++ 7 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 data/skin_default/unhandled-key.png create mode 100644 lib/python/Screens/UnhandledKey.py (limited to 'lib') diff --git a/data/skin_default.xml b/data/skin_default.xml index 71f579cb..bf21b715 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -253,6 +253,10 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count > 7 and 2 or 3) + + + + diff --git a/data/skin_default/Makefile.am b/data/skin_default/Makefile.am index e2d2abcc..3106af97 100644 --- a/data/skin_default/Makefile.am +++ b/data/skin_default/Makefile.am @@ -50,6 +50,7 @@ dist_install_DATA = \ sleeptimer.png \ timeline-now.png \ timeline.png \ + unhandled-key.png \ verticalline-plugins.png \ vkey_backspace.png \ vkey_bg.png \ diff --git a/data/skin_default/unhandled-key.png b/data/skin_default/unhandled-key.png new file mode 100644 index 00000000..8e543498 Binary files /dev/null and b/data/skin_default/unhandled-key.png differ diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index a15c7ac1..5b061245 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -12,7 +12,7 @@ profile("LOAD:InfoBarGenerics") from Screens.InfoBarGenerics import InfoBarShowHide, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \ InfoBarEPG, InfoBarSeek, InfoBarInstantRecord, \ - InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \ + InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarUnhandledKey, \ InfoBarSubserviceSelection, InfoBarShowMovies, InfoBarTimeshift, \ InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \ InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \ @@ -29,7 +29,7 @@ from Screens.HelpMenu import HelpableScreen class InfoBar(InfoBarBase, InfoBarShowHide, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, InfoBarInstantRecord, InfoBarAudioSelection, - HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, + HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarUnhandledKey, InfoBarSubserviceSelection, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarServiceErrorPopupSupport, InfoBarJobman, @@ -52,7 +52,7 @@ class InfoBar(InfoBarBase, InfoBarShowHide, for x in HelpableScreen, \ InfoBarBase, InfoBarShowHide, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \ - InfoBarInstantRecord, InfoBarAudioSelection, \ + InfoBarInstantRecord, InfoBarAudioSelection, InfoBarUnhandledKey, \ InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \ InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \ InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, \ diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index a3e56a40..c8aa00cb 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -26,13 +26,14 @@ from Screens.PictureInPicture import PictureInPicture from Screens.SubtitleDisplay import SubtitleDisplay from Screens.RdsDisplay import RdsInfoDisplay, RassInteractive from Screens.TimeDateInput import TimeDateInput +from Screens.UnhandledKey import UnhandledKey from ServiceReference import ServiceReference from Tools import Notifications from Tools.Directories import fileExists from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \ - iPlayableService, eServiceReference, eEPGCache + iPlayableService, eServiceReference, eEPGCache, eActionMap from time import time, localtime, strftime from os import stat as os_stat @@ -47,6 +48,44 @@ class InfoBarDish: def __init__(self): self.dishDialog = self.session.instantiateDialog(Dish) +class InfoBarUnhandledKey: + def __init__(self): + self.unhandledKeyDialog = self.session.instantiateDialog(UnhandledKey) + self.hideTimer = eTimer() + self.hideTimer.callback.append(self.unhandledKeyDialog.hide) + self.checkUnusedTimer = eTimer() + self.checkUnusedTimer.callback.append(self.checkUnused) + self.onLayoutFinish.append(self.unhandledKeyDialog.hide) + eActionMap.getInstance().bindAction('', -0x7FFFFFFF, self.actionA) #highest prio + eActionMap.getInstance().bindAction('', 0x7FFFFFFF, self.actionB) #lowest prio + self.key = -1; + self.flags = 0; + self.uflags = 0; + + #this function is called on every keypress! + def actionA(self, key, flag): + if flag != 4: + if self.key != key: + if self.checkUnusedTimer.isActive(): + self.checkUnusedTimer.stop() + self.checkUnused() + self.key = key + self.flags = self.uflags = 0 + self.flags |= (1< Date: Wed, 30 Dec 2009 17:12:22 +0100 Subject: action.cpp: remove debug info --- lib/actions/action.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/actions/action.cpp b/lib/actions/action.cpp index 0eb4cdb1..a2d85ffd 100644 --- a/lib/actions/action.cpp +++ b/lib/actions/action.cpp @@ -208,7 +208,7 @@ void eActionMap::keyPressed(const std::string &device, int key, int flags) } } else { - eDebug("wildcard."); +// eDebug("wildcard."); ePyObject pArgs = PyTuple_New(2); PyTuple_SET_ITEM(pArgs, 0, PyInt_FromLong(key)); PyTuple_SET_ITEM(pArgs, 1, PyInt_FromLong(flags)); -- cgit v1.2.3 From 7c30efab7f3c66c8cf259d6926d4ed1312cb456c Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 30 Dec 2009 17:53:10 +0100 Subject: save multi framerate even to configfile --- lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 49b5d53d..512bcec3 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -132,6 +132,7 @@ class VideoWizard(WizardLanguage, Rc): ratesList = self.listRates(mode) print "ratesList:", ratesList if self.port == "DVI" and mode in ("720p", "1080i"): + self.rate = "multi" self.hw.setMode(port = self.port, mode = mode, rate = "multi") else: self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0]) -- cgit v1.2.3 From 9e9404e05b7b080b2e4b752794656bf68b629f16 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 30 Dec 2009 18:08:16 +0100 Subject: InfoBarGenerics.py: small cleanup --- lib/python/Screens/InfoBarGenerics.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 8c96c76b..95b0e8c1 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -66,9 +66,6 @@ class InfoBarUnhandledKey: def actionA(self, key, flag): if flag != 4: if self.key != key: - if self.checkUnusedTimer.isActive(): - self.checkUnusedTimer.stop() - self.checkUnused() self.key = key self.flags = self.uflags = 0 self.flags |= (1< Date: Wed, 30 Dec 2009 18:35:59 +0100 Subject: InfoBarGenerics.py: fix handling for unused key indication when two times the same key is pressed, small cleanup --- lib/python/Screens/InfoBarGenerics.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 95b0e8c1..471b2510 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -58,15 +58,13 @@ class InfoBarUnhandledKey: self.onLayoutFinish.append(self.unhandledKeyDialog.hide) eActionMap.getInstance().bindAction('', -0x7FFFFFFF, self.actionA) #highest prio eActionMap.getInstance().bindAction('', 0x7FFFFFFF, self.actionB) #lowest prio - self.key = -1; - self.flags = 0; + self.flags = (1<<1); self.uflags = 0; #this function is called on every keypress! def actionA(self, key, flag): if flag != 4: - if self.key != key: - self.key = key + if self.flags & (1<<1): self.flags = self.uflags = 0 self.flags |= (1< Date: Thu, 31 Dec 2009 09:55:18 +0100 Subject: InfoBarGenerics.py: rename timer to fix automatic infobar hide after channel change --- lib/python/Screens/InfoBarGenerics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 471b2510..7ae0b123 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -51,8 +51,8 @@ class InfoBarDish: class InfoBarUnhandledKey: def __init__(self): self.unhandledKeyDialog = self.session.instantiateDialog(UnhandledKey) - self.hideTimer = eTimer() - self.hideTimer.callback.append(self.unhandledKeyDialog.hide) + self.hideUnhandledKeySymbolTimer = eTimer() + self.hideUnhandledKeySymbolTimer.callback.append(self.unhandledKeyDialog.hide) self.checkUnusedTimer = eTimer() self.checkUnusedTimer.callback.append(self.checkUnused) self.onLayoutFinish.append(self.unhandledKeyDialog.hide) @@ -79,7 +79,7 @@ class InfoBarUnhandledKey: def checkUnused(self): if self.flags == self.uflags: self.unhandledKeyDialog.show() - self.hideTimer.start(2000, True) + self.hideUnhandledKeySymbolTimer.start(2000, True) class InfoBarShowHide: """ InfoBar show/hide control, accepts toggleShow and hide actions, might start -- cgit v1.2.3 From c9315c0737c473abd384dc8950b4c6bbd16dcccc Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 1 Jan 2010 14:00:47 +0100 Subject: fixes bug #362 allow assigning standby function to long power button press --- lib/python/Components/UsageConfig.py | 3 ++- mytest.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 60827107..f133f9f6 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -51,7 +51,8 @@ def InitUsageConfig(): config.usage.on_long_powerpress = ConfigSelection(default = "show_menu", choices = [ ("show_menu", _("show shutdown menu")), - ("shutdown", _("immediate shutdown")) ] ) + ("shutdown", _("immediate shutdown")), + ("standby", _("Standby")) ] ) config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [ ("0", "DVB-S/-C/-T"), diff --git a/mytest.py b/mytest.py index c748538a..7eb045ee 100755 --- a/mytest.py +++ b/mytest.py @@ -380,6 +380,8 @@ class PowerKey: menu_screen = self.session.openWithCallback(self.MenuClosed, MainMenu, x) menu_screen.setTitle(_("Standby / Restart")) return + elif action == "standby": + self.standby() def powerdown(self): self.standbyblocked = 0 -- cgit v1.2.3 From b6f95a8f5457c60ccc14192a4d13d3c05fa608be Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 1 Jan 2010 14:07:03 +0100 Subject: fixes bug #362 allow configuring short power button action to shutdown, standby, menu --- data/setup.xml | 1 + lib/python/Components/UsageConfig.py | 6 ++++++ mytest.py | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/data/setup.xml b/data/setup.xml index 9425afda..92bbc0f1 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -31,6 +31,7 @@ config.usage.quickzap_bouquet_change config.usage.e1like_radio_mode config.usage.on_long_powerpress + config.usage.on_short_powerpress config.usage.infobar_timeout config.usage.output_12V config.usage.show_infobar_on_zap diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index f133f9f6..21478e90 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -53,6 +53,12 @@ def InitUsageConfig(): ("show_menu", _("show shutdown menu")), ("shutdown", _("immediate shutdown")), ("standby", _("Standby")) ] ) + + config.usage.on_short_powerpress = ConfigSelection(default = "standby", choices = [ + ("show_menu", _("show shutdown menu")), + ("shutdown", _("immediate shutdown")), + ("standby", _("Standby")) ] ) + config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [ ("0", "DVB-S/-C/-T"), diff --git a/mytest.py b/mytest.py index 7eb045ee..4b687e05 100755 --- a/mytest.py +++ b/mytest.py @@ -363,9 +363,10 @@ class PowerKey: def powerlong(self): if Screens.Standby.inTryQuitMainloop or (self.session.current_dialog and not self.session.current_dialog.ALLOW_SUSPEND): return + self.doAction(action = config.usage.on_long_powerpress.value) + def doAction(self, action): self.standbyblocked = 1 - action = config.usage.on_long_powerpress.value if action == "shutdown": self.shutdown() elif action == "show_menu": @@ -388,8 +389,7 @@ class PowerKey: def powerup(self): if self.standbyblocked == 0: - self.standbyblocked = 1 - self.standby() + self.doAction(action = config.usage.on_short_powerpress.value) def standby(self): if not Screens.Standby.inStandby and self.session.current_dialog and self.session.current_dialog.ALLOW_SUSPEND and self.session.in_exec: -- cgit v1.2.3 From 91c9f9216cc8fcb1d8f6d8cea9f0cf6a23632aec Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 1 Jan 2010 14:43:26 +0100 Subject: fixes bug #369 close ChannelSelection after PiP is activated --- lib/python/Screens/ChannelSelection.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index e8bbce15..36a54e77 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -208,7 +208,7 @@ class ChannelContextMenu(Screen): if self.session.pip.playService(newservice): self.session.pipshown = True self.session.pip.servicePath = self.csel.getCurrentServicePath() - self.close() + self.close(True) else: self.session.pipshown = False del self.session.pip @@ -672,7 +672,11 @@ class ChannelSelectionEdit: self.entry_marked = True def doContext(self): - self.session.open(ChannelContextMenu, self) + self.session.openWithCallback(self.exitContext, ChannelContextMenu, self) + + def exitContext(self, close = False): + if close: + self.cancel() MODE_TV = 0 MODE_RADIO = 1 -- cgit v1.2.3 From 541bb75365f3594dccea757a8183df6ac0e8e5e8 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 2 Jan 2010 09:49:01 +0100 Subject: only show pip option in contextmenu when the hardware can handle pip --- lib/python/Screens/ChannelSelection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 36a54e77..5fbfd591 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -22,6 +22,7 @@ from Components.Input import Input profile("ChannelSelection.py 3") from Components.ParentalControl import parentalControl from Components.ChoiceList import ChoiceList, ChoiceEntryComponent +from Components.SystemInfo import SystemInfo from Screens.InputBox import InputBox, PinInput from Screens.MessageBox import MessageBox from Screens.ServiceInfo import ServiceInfo @@ -126,7 +127,7 @@ class ChannelContextMenu(Screen): append_when_current_valid(current, menu, (_("remove entry"), self.removeCurrentService), level = 0) if current_root and current_root.getPath().find("flags == %d" %(FLAG_SERVICE_NEW_FOUND)) != -1: append_when_current_valid(current, menu, (_("remove new found flag"), self.removeNewFoundFlag), level = 0) - if isPlayable: + if isPlayable and SystemInfo.get("NumVideoDecoders", 1) > 1: append_when_current_valid(current, menu, (_("Activate Picture in Picture"), self.showServiceInPiP), level = 0, key = "blue") self.pipAvailable = True else: -- cgit v1.2.3 From c6292b648af8c27f5c7da6fce0cdb96a53935cd4 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 2 Jan 2010 12:12:31 +0100 Subject: fixed evSeekableStateChanged handling --- lib/service/servicedvb.cpp | 18 ++++++++++-------- lib/service/servicedvb.h | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 602eccfb..c7bb5d99 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1391,7 +1391,7 @@ RESULT eDVBServicePlay::isCurrentlySeekable() if (m_decoder) { ret = (m_is_pvr || m_timeshift_active) ? 3 : 0; // fast forward/backward possible and seeking possible - if (m_decoder->getVideoWidth() == -1) + if (m_decoder->getVideoProgressive() == -1) ret &= ~2; } return ret; @@ -2267,9 +2267,7 @@ void eDVBServicePlay::switchToLive() m_timeshift_active = 0; m_timeshift_changed = 1; - m_event((iPlayableService*)this, evSeekableStatusChanged); - - updateDecoder(); + updateDecoder(true); } void eDVBServicePlay::switchToTimeshift() @@ -2299,12 +2297,10 @@ void eDVBServicePlay::switchToTimeshift() eDebug("eDVBServicePlay::switchToTimeshift, in pause mode now."); pause(); - updateDecoder(); /* mainly to switch off PCR, and to set pause */ - - m_event((iPlayableService*)this, evSeekableStatusChanged); + updateDecoder(true); /* mainly to switch off PCR, and to set pause */ } -void eDVBServicePlay::updateDecoder() +void eDVBServicePlay::updateDecoder(bool sendSeekableStateChanged) { int vpid = -1, vpidtype = -1, pcrpid = -1, tpid = -1, achannel = -1, ac3_delay=-1, pcm_delay=-1; bool mustPlay = false; @@ -2398,6 +2394,7 @@ void eDVBServicePlay::updateDecoder() if (m_decoder) { + bool wasSeekable = m_decoder->getVideoProgressive() != -1; if (m_dvb_service) { achannel = m_dvb_service->getCacheEntry(eDVBService::cACHANNEL); @@ -2472,8 +2469,13 @@ void eDVBServicePlay::updateDecoder() m_dvb_service->setCacheEntry(eDVBService::cPCRPID, pcrpid); m_dvb_service->setCacheEntry(eDVBService::cTPID, tpid); } + if (!sendSeekableStateChanged && (m_decoder->getVideoProgressive() != -1) != wasSeekable) + sendSeekableStateChanged = true; } m_have_video_pid = (vpid > 0 && vpid < 0x2000); + + if (sendSeekableStateChanged) + m_event((iPlayableService*)this, evSeekableStatusChanged); } void eDVBServicePlay::loadCuesheet() diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index e3c7fd58..42647b92 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -230,7 +230,7 @@ private: void switchToLive(); void switchToTimeshift(); - void updateDecoder(); + void updateDecoder(bool sendSeekableStateChanged=false); int m_skipmode; int m_fastforward; -- cgit v1.2.3 From 08413feb6f7217a4ddb598dfc0ab46e80adb5f99 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 2 Jan 2010 13:48:36 +0100 Subject: Components/config.py: dont show configtext input help in ConfigDirectory's --- lib/python/Components/config.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index a6007b10..471b59ec 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1138,6 +1138,9 @@ class ConfigDirectory(ConfigText): else: return ConfigText.getMulti(self, selected) + def onSelect(self, session): + self.allmarked = (self.value != "") + # a slider. class ConfigSlider(ConfigElement): def __init__(self, default = 0, increment = 1, limits = (0, 100)): -- cgit v1.2.3 From bfdb564afd26ddcb8b0a11834c4edb363d2842a3 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 5 Jan 2010 18:50:00 +0100 Subject: servicedvb.cpp: fix handling for single IN cut (needed when only the start of a movie is cutted away) --- lib/service/servicedvb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index c7bb5d99..615329c9 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -2576,7 +2576,7 @@ void eDVBServicePlay::cutlistToCuesheet() { if (i == m_cue_entries.end()) { - if (!have_any_span) + if (!have_any_span && !in) break; out = length; } else { @@ -2606,6 +2606,7 @@ void eDVBServicePlay::cutlistToCuesheet() { have_any_span = 1; m_cue->addSourceSpan(in, out); + in = out = 0; } in = length; -- cgit v1.2.3 From e7d3f74e6679c23d3f6174e2d8857b5788748af9 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 5 Jan 2010 14:41:54 +0100 Subject: bug #238 added m4v file extension to media player capabilities Conflicts: lib/python/Plugins/Extensions/MediaPlayer/plugin.py --- lib/python/Components/FileList.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index 222512ea..841a2fe5 100755 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -23,6 +23,7 @@ EXTENSIONS = { "ts": "movie", "avi": "movie", "divx": "movie", + "m4v": "movie", "mpg": "movie", "mpeg": "movie", "mkv": "movie", -- cgit v1.2.3 From fa33ac1ea2677108bb2bb926fcc8153fe03ffccf Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 9 Jan 2010 20:42:14 +0100 Subject: small fix in spinner handling... fixes bug #378 --- lib/base/ebase.cpp | 1 + lib/base/ebase.h | 4 +++- lib/gdi/grc.cpp | 8 +++++++- lib/gdi/grc.h | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp index 313732ab..5bafe732 100644 --- a/lib/base/ebase.cpp +++ b/lib/base/ebase.cpp @@ -225,6 +225,7 @@ int eMainloop::processOneEvent(unsigned int twisted_timeout, PyObject **res, ePy } m_is_idle = 1; + ++m_idle_count; if (this == eApp) { diff --git a/lib/base/ebase.h b/lib/base/ebase.h index 524052bd..c69133f6 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -195,6 +195,7 @@ class eMainloop int processOneEvent(unsigned int user_timeout, PyObject **res=0, ePyObject additional=ePyObject()); int retval; int m_is_idle; + int m_idle_count; eSocketNotifier *m_inActivate; int m_interrupt_requested; @@ -210,7 +211,7 @@ public: #endif eMainloop() - :app_quit_now(0),loop_level(0),retval(0), m_is_idle(0), m_inActivate(0), m_interrupt_requested(0) + :app_quit_now(0),loop_level(0),retval(0), m_is_idle(0), m_idle_count(0), m_inActivate(0), m_interrupt_requested(0) { existing_loops.push_back(this); } @@ -240,6 +241,7 @@ public: /* m_is_idle needs to be atomic, but it doesn't really matter much, as it's read-only from outside */ int isIdle() { return m_is_idle; } + int idleCount() { return m_idle_count; } }; /** diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index 1f1b06a0..dff6b059 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -164,7 +164,13 @@ void *gRC::thread() if (pthread_cond_timedwait(&cond, &mutex, &timeout) == ETIMEDOUT) { if (eApp && !eApp->isIdle()) - idle = 0; + { + int idle_count = eApp->idleCount(); + if (idle_count == m_prev_idle_count) + idle = 0; + else + m_prev_idle_count = idle_count; + } } if (!idle) diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h index 5d0106b3..3b8201ad 100644 --- a/lib/gdi/grc.h +++ b/lib/gdi/grc.h @@ -176,6 +176,7 @@ class gRC: public iObject, public Object ePtr m_compositing; + int m_prev_idle_count; public: gRC(); virtual ~gRC(); -- cgit v1.2.3 From 2b8451631894b48330eee673493c1dd84e87916c Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 10 Jan 2010 13:45:57 +0100 Subject: Screen.py: add missing dict.__init__ call --- lib/python/Screens/Screen.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/python/Screens/Screen.py b/lib/python/Screens/Screen.py index 7ac7841c..f0bf773d 100644 --- a/lib/python/Screens/Screen.py +++ b/lib/python/Screens/Screen.py @@ -15,6 +15,7 @@ class Screen(dict, GUISkin): global_screen = None def __init__(self, session, parent = None): + dict.__init__(self) self.skinName = self.__class__.__name__ self.session = session self.parent = parent -- cgit v1.2.3 From 547ecaf9bfda061aca736aefb04ca0743a6395cc Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 14 Jan 2010 14:11:20 +0100 Subject: fixes bug #393 change DVI picture to HDMI picture for dm500hd --- lib/python/Plugins/SystemPlugins/Videomode/HDMI.png | Bin 0 -> 4098 bytes lib/python/Plugins/SystemPlugins/Videomode/Makefile.am | 4 +++- .../Plugins/SystemPlugins/Videomode/VideoWizard.py | 5 ++++- lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png | Bin 0 -> 261 bytes 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 lib/python/Plugins/SystemPlugins/Videomode/HDMI.png create mode 100644 lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/Videomode/HDMI.png b/lib/python/Plugins/SystemPlugins/Videomode/HDMI.png new file mode 100644 index 00000000..5aa83047 Binary files /dev/null and b/lib/python/Plugins/SystemPlugins/Videomode/HDMI.png differ diff --git a/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am b/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am index 2ec0b335..1ac1d5dd 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Videomode/Makefile.am @@ -16,4 +16,6 @@ dist_install_DATA = \ LICENSE \ Scart.png \ videowizard.xml \ - YPbPr.png + YPbPr.png \ + HDMI.png \ + lcd_HDMI.png diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 512bcec3..15f4d516 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -99,7 +99,10 @@ class VideoWizard(WizardLanguage, Rc): print "input selection moved:", self.selection self.inputSelect(self.selection) if self["portpic"].instance is not None: - self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + self.selection + ".png")) + picname = self.selection + if picname == "DVI" and HardwareInfo().get_device_name() == "dm500hd": + picname = "HDMI" + self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + picname + ".png")) def inputSelect(self, port): print "inputSelect:", port diff --git a/lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png b/lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png new file mode 100644 index 00000000..425da5c3 Binary files /dev/null and b/lib/python/Plugins/SystemPlugins/Videomode/lcd_HDMI.png differ -- cgit v1.2.3 From 0f01de80dad98af94f07fe4d912791831eacff6a Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 21 Jan 2010 11:32:40 +0100 Subject: fix cutlist editor for HD skins --- lib/python/Plugins/Extensions/CutListEditor/plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index abd606d6..0627df3b 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -10,7 +10,7 @@ from Components.VideoWindow import VideoWindow from Components.Label import Label from Screens.InfoBarGenerics import InfoBarSeek, InfoBarCueSheetSupport from Components.GUIComponent import GUIComponent -from enigma import eListboxPythonMultiContent, eListbox, gFont, iPlayableService, RT_HALIGN_RIGHT +from enigma import eListboxPythonMultiContent, eListbox, getDesktop, gFont, iPlayableService, RT_HALIGN_RIGHT from Screens.FixedMenu import FixedMenu from Screens.HelpMenu import HelpableScreen from ServiceReference import ServiceReference @@ -167,7 +167,8 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He self.onPlayStateChanged.append(self.updateStateLabel) self.updateStateLabel(self.seekstate) - self["Video"] = VideoWindow(decoder = 0) + desktopSize = getDesktop(0).size() + self["Video"] = VideoWindow(decoder = 0, fb_width=desktopSize.width(), fb_height=desktopSize.height()) self["actions"] = HelpableActionMap(self, "CutListEditorActions", { -- cgit v1.2.3 From 6551b5fbbed0acb407e3eba5c9c510ca74e352f7 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 21 Jan 2010 11:33:45 +0100 Subject: show Multi EPG in epg selection list --- lib/python/Screens/InfoBarGenerics.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 7ae0b123..f2aff6c6 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -598,6 +598,7 @@ class InfoBarEPG: if list: list.append((_("show single service EPG..."), self.openSingleServiceEPG)) + list.append((_("Multi EPG"), self.openMultiServiceEPG)) self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list, skin_name = "EPGExtensionsList") else: self.openSingleServiceEPG() -- cgit v1.2.3 From 2ca3e0c2f189c3b2ee885911d03f6947ac152254 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 22 Jan 2010 15:37:36 +0100 Subject: servicedvb.cpp: compile fix for bug 411 --- lib/service/servicedvb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 25e723ed..1df4e639 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -2089,7 +2089,7 @@ RESULT eDVBServicePlay::startTimeshift() return 0; } -RESULT eDVBServicePlay::stopTimeshift(bool switchToLive=true) +RESULT eDVBServicePlay::stopTimeshift(bool switchToLive) { if (!m_timeshift_enabled) return -1; -- cgit v1.2.3 From 7c75162a934f5cb088801396f2b3129d74a119e6 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 22 Jan 2010 17:23:03 +0100 Subject: another compile fix for bug #411 --- lib/service/iservice.h | 2 +- lib/service/servicedvb.cpp | 4 ++-- lib/service/servicedvb.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/service/iservice.h b/lib/service/iservice.h index 8b64f166..c35313f0 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -593,7 +593,7 @@ class iTimeshiftService: public iObject #endif public: virtual RESULT startTimeshift()=0; - virtual RESULT stopTimeshift(bool switchToLive=true)=0; + virtual RESULT stopTimeshift(bool swToLive=true)=0; virtual int isTimeshiftActive()=0; /* this essentially seeks to the relative end of the timeshift buffer */ diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 1df4e639..9f10644c 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -2089,12 +2089,12 @@ RESULT eDVBServicePlay::startTimeshift() return 0; } -RESULT eDVBServicePlay::stopTimeshift(bool switchToLive) +RESULT eDVBServicePlay::stopTimeshift(bool swToLive) { if (!m_timeshift_enabled) return -1; - if (switchToLive) + if (swToLive) switchToLive(); m_timeshift_enabled = 0; diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 6ab3b347..1262836e 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -159,7 +159,7 @@ public: // iTimeshiftService RESULT startTimeshift(); - RESULT stopTimeshift(bool switchToLive=true); + RESULT stopTimeshift(bool swToLive=true); int isTimeshiftActive(); RESULT activateTimeshift(); -- cgit v1.2.3 From 2d2f681283ecec948254e21180e61aa5152ebc2c Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 23 Jan 2010 13:42:01 +0100 Subject: lib/python/Screens/RecordPaths.py: fix spinners in some conditions this fixes bug #414 --- lib/python/Screens/RecordPaths.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/RecordPaths.py b/lib/python/Screens/RecordPaths.py index c833266f..22ca9fcf 100644 --- a/lib/python/Screens/RecordPaths.py +++ b/lib/python/Screens/RecordPaths.py @@ -6,7 +6,7 @@ from Components.config import config, ConfigSelection, getConfigListEntry, confi from Components.ConfigList import ConfigListScreen from Components.ActionMap import ActionMap from Tools.Directories import fileExists - +from Components.UsageConfig import preferredPath class RecordPathsSettings(Screen,ConfigListScreen): skin = """ @@ -115,7 +115,7 @@ class RecordPathsSettings(Screen,ConfigListScreen): self.dirnameSelected, MovieLocationBox, txt, - self.default_dirname.value + preferredPath(self.default_dirname.value) ) elif currentry == self.timer_entry: self.entrydirname = self.timer_dirname @@ -123,7 +123,7 @@ class RecordPathsSettings(Screen,ConfigListScreen): self.dirnameSelected, MovieLocationBox, _("Initial location in new timers"), - self.timer_dirname.value + preferredPath(self.timer_dirname.value) ) elif currentry == self.instantrec_entry: self.entrydirname = self.instantrec_dirname @@ -131,7 +131,7 @@ class RecordPathsSettings(Screen,ConfigListScreen): self.dirnameSelected, MovieLocationBox, _("Location for instant recordings"), - self.instantrec_dirname.value + preferredPath(self.instantrec_dirname.value) ) elif currentry == self.timeshift_entry: self.entrydirname = self.timeshift_dirname -- cgit v1.2.3 From 6b1138ae6ea57dfb1a345d2a4ad393ba0bc587c8 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sun, 24 Jan 2010 12:23:42 +0100 Subject: fixes bug #380 stop service when entering tuner setup (and ask to restore afterwards) --- lib/python/Screens/Makefile.am | 2 +- lib/python/Screens/Satconfig.py | 16 +++++++++++++--- lib/python/Screens/ServiceStopScreen.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 lib/python/Screens/ServiceStopScreen.py (limited to 'lib') diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index 5457bf64..d96b491e 100755 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -14,5 +14,5 @@ install_PYTHON = \ SubtitleDisplay.py SubservicesQuickzap.py ParentalControlSetup.py NumericalTextInputHelpDialog.py \ SleepTimerEdit.py Ipkg.py RdsDisplay.py Globals.py DefaultWizard.py \ SessionGlobals.py LocationBox.py WizardLanguage.py TaskView.py Rc.py VirtualKeyBoard.py \ - TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py + TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py ServiceStopScreen.py diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index d5249b99..62480b5f 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -10,11 +10,12 @@ from Components.config import getConfigListEntry, config, ConfigNothing, ConfigS from Components.Sources.List import List from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox +from Screens.ServiceStopScreen import ServiceStopScreen from time import mktime, localtime from datetime import datetime -class NimSetup(Screen, ConfigListScreen): +class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): def createSimpleSetup(self, list, mode): nim = self.nimConfig if mode == "single": @@ -376,11 +377,14 @@ class NimSetup(Screen, ConfigListScreen): self.deleteConfirmed(confirmed) break if not self.satpos_to_remove: - self.close() + self.restoreService(_("Zap back to service before tuner setup?")) def __init__(self, session, slotid): Screen.__init__(self, session) self.list = [ ] + + ServiceStopScreen.__init__(self) + self.stopService() ConfigListScreen.__init__(self, self.list) @@ -405,6 +409,12 @@ class NimSetup(Screen, ConfigListScreen): ConfigListScreen.keyRight(self) self.newConfig() + def keyCancel(self): + if self["config"].isChanged(): + self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?")) + else: + self.restoreService(_("Zap back to service before tuner setup?")) + def saveAll(self): if self.nim.isCompatible("DVB-S"): # reset connectedTo to all choices to properly store the default value @@ -424,7 +434,7 @@ class NimSetup(Screen, ConfigListScreen): x[1].cancel() # we need to call saveAll to reset the connectedTo choices self.saveAll() - self.close() + self.restoreService(_("Zap back to service before tuner setup?")) def nothingConnectedShortcut(self): if type(self["config"].getCurrent()[1]) is ConfigSatlist: diff --git a/lib/python/Screens/ServiceStopScreen.py b/lib/python/Screens/ServiceStopScreen.py new file mode 100644 index 00000000..3b3dda88 --- /dev/null +++ b/lib/python/Screens/ServiceStopScreen.py @@ -0,0 +1,29 @@ +from Screens.MessageBox import MessageBox + +class ServiceStopScreen: + def __init__(self): + try: + self.session + except: + print "[ServiceStopScreen] ERROR: no self.session set" + + self.oldref = None + self.onClose.append(self.__onClose) + + def stopService(self): + self.oldref = self.session.nav.getCurrentlyPlayingServiceReference() + self.session.nav.stopService() + + def __onClose(self): + self.session.nav.playService(self.oldref) + + def restoreService(self, msg = _("Zap back to previously tuned service?")): + if self.oldref: + self.session.openWithCallback(self.restartPrevService, MessageBox, msg, MessageBox.TYPE_YESNO) + else: + self.restartPrevService(False) + + def restartPrevService(self, yesno): + if not yesno: + self.oldref=None + self.close() \ No newline at end of file -- cgit v1.2.3 From 6c77c3ab8156d72dfd616d83c276ef7f3ca1b1a7 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sun, 24 Jan 2010 13:24:37 +0100 Subject: fixes bug #288 last playing position for recorded services was stored only if between 1% and 99% of the recording's length. this lead to voodoo for the user, since long recordings naturally have a longer 1% than short ones. so the 1% rule is gone now and we display the position of the marker in the message box, asking the user if playing should continue at this position. --- lib/python/Screens/InfoBarGenerics.py | 4 +++- lib/service/servicedvb.cpp | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index f2aff6c6..87631086 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -2015,8 +2015,10 @@ class InfoBarCueSheetSupport: if last is not None: self.resume_point = last + + l = last / 90000 if config.usage.on_movie_start.value == "ask": - Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?"), timeout=10) + Notifications.AddNotificationWithCallback(self.playLastCB, MessageBox, _("Do you want to resume this playback?") + "\n" + (_("Resume position at %s") % ("%d:%02d:%02d" % (l/3600, l%3600/60, l%60))), timeout=10) elif config.usage.on_movie_start.value == "resume": # TRANSLATORS: The string "Resuming playback" flashes for a moment # TRANSLATORS: at the start of a movie, when the user has selected diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 9f10644c..558bf0c2 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1128,11 +1128,7 @@ RESULT eDVBServicePlay::stop() if (length) { - int perc = play_position * 100LL / length; - - /* only store last play position when between 1% and 99% */ - if ((1 < perc) && (perc < 99)) - m_cue_entries.insert(cueEntry(play_position, 3)); /* last play position */ + m_cue_entries.insert(cueEntry(play_position, 3)); /* last play position */ } m_cuesheet_changed = 1; } -- cgit v1.2.3 From 7a3d4cb061893cf157d980b164a0635706f70aa5 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 12:11:34 +0100 Subject: disabe fan on enter standby, restart fan on leave standby this fixes bug #418 --- lib/python/Components/FanControl.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py index cc133ac0..cee0523e 100644 --- a/lib/python/Components/FanControl.py +++ b/lib/python/Components/FanControl.py @@ -11,6 +11,20 @@ class FanControl: else: self.fancount = 0 self.createConfig() + config.misc.standbyCounter.addNotifier(self.standbyCounterChanged, initial_call = False) + + def leaveStandby(self): + for fanid in range(self.getFanCount()): + cfg = self.getConfig(fanid) + self.setVoltage(fanid, cfg.vlt.value) + self.setPWM(fanid, cfg.pwm.value) + + def standbyCounterChanged(self, configElement): + from Screens.Standby import inStandby + inStandby.onClose.append(self.leaveStandby) + for fanid in range(self.getFanCount()): + self.setVoltage(fanid, 0) + self.setPWM(fanid, 0) def createConfig(self): def setVlt(fancontrol, fanid, configElement): -- cgit v1.2.3 From c50a4697aa4a47d93f9ac7c3526758ff5a7ace26 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 12:14:14 +0100 Subject: cleanup lcd code --- lib/python/Components/Lcd.py | 11 +++++++++++ lib/python/Screens/Standby.py | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index 7d27c097..dde158b6 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -28,6 +28,14 @@ class LCD: def isOled(self): return eDBoxLCD.getInstance().isOled() +def leaveStandby(): + config.lcd.bright.apply() + +def standbyCounterChanged(configElement): + from Screens.Standby import inStandby + inStandby.onClose.append(leaveStandby) + config.lcd.standby.apply() + def InitLcd(): detected = eDBoxLCD.getInstance().detected() SystemInfo["Display"] = detected @@ -72,3 +80,6 @@ def InitLcd(): config.lcd.standby = ConfigNothing() config.lcd.bright.apply = lambda : doNothing() config.lcd.standby.apply = lambda : doNothing() + + config.misc.standbyCounter.addNotifier(standbyCounterChanged, initial_call = False) + diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py index c598b545..406b87cb 100644 --- a/lib/python/Screens/Standby.py +++ b/lib/python/Screens/Standby.py @@ -15,8 +15,6 @@ class Standby(Screen): #restart last played service #unmute adc self.leaveMute() - #set brightness of lcd - config.lcd.bright.apply() #kill me self.close(True) @@ -63,8 +61,6 @@ class Standby(Screen): self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") - #set lcd brightness to standby value - config.lcd.standby.apply() self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose) -- cgit v1.2.3 From 547807d59d64f24305afbbfd071b71a691c64c18 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 15:22:28 +0100 Subject: speedup closing the servicelist in some cases this fixes bug #421 --- lib/python/Screens/ChannelSelection.py | 58 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 5fbfd591..8ac53867 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -31,7 +31,6 @@ from Screens.PictureInPicture import PictureInPicture from Screens.RdsDisplay import RassInteractive from ServiceReference import ServiceReference from Tools.BoundFunction import boundFunction -from re import compile from os import remove profile("ChannelSelection.py after imports") @@ -713,6 +712,7 @@ class ChannelSelectionBase(Screen): self.servicePathTV = [ ] self.servicePathRadio = [ ] self.servicePath = [ ] + self.rootChanged = False self.mode = MODE_TV @@ -819,6 +819,7 @@ class ChannelSelectionBase(Screen): else: self.servicelist.setMode(ServiceList.MODE_NORMAL) self.servicelist.setRoot(root, justSet) + self.rootChanged = True self.buildTitleString() def removeModeStr(self, str): @@ -1303,19 +1304,21 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.lastroot.save() def restoreRoot(self): - self.clearPath() - re = compile('.+?;') - tmp = re.findall(self.lastroot.value) - cnt = 0 - for i in tmp: - self.servicePath.append(eServiceReference(i[:-1])) - cnt += 1 - if cnt: - path = self.servicePath.pop() - self.enterPath(path) - else: - self.showFavourites() - self.saveRoot() + tmp = [x for x in self.lastroot.value.split(';') if x != ''] + current = [x.toString() for x in self.servicePath] + if tmp != current or self.rootChanged: + self.clearPath() + cnt = 0 + for i in tmp: + self.servicePath.append(eServiceReference(i)) + cnt += 1 + if cnt: + path = self.servicePath.pop() + self.enterPath(path) + else: + self.showFavourites() + self.saveRoot() + self.rootChanged = False def preEnterPath(self, refstr): if self.servicePath and self.servicePath[0] != eServiceReference(refstr): @@ -1463,19 +1466,20 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS config.radio.lastroot.save() def restoreRoot(self): - self.clearPath() - re = compile('.+?;') - tmp = re.findall(config.radio.lastroot.value) - cnt = 0 - for i in tmp: - self.servicePathRadio.append(eServiceReference(i[:-1])) - cnt += 1 - if cnt: - path = self.servicePathRadio.pop() - self.enterPath(path) - else: - self.showFavourites() - self.saveRoot() + tmp = [x for x in self.lastroot.value.split(';') if x != ''] + current = [x.toString() for x in self.servicePath] + if tmp != current or self.rootChanged: + cnt = 0 + for i in tmp: + self.servicePathRadio.append(eServiceReference(i)) + cnt += 1 + if cnt: + path = self.servicePathRadio.pop() + self.enterPath(path) + else: + self.showFavourites() + self.saveRoot() + self.rootChanged = False def preEnterPath(self, refstr): if self.servicePathRadio and self.servicePathRadio[0] != eServiceReference(refstr): -- cgit v1.2.3 From e9412ee5133233df673d5a2b9f43fa2675a7526c Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 19:59:42 +0100 Subject: ChannelSelection.py: small fix for bug #420 --- lib/python/Screens/ChannelSelection.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 8ac53867..eb03ee65 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -1181,6 +1181,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.servicelist.setPlayableIgnoreService(eServiceReference()) def setMode(self): + self.rootChanged = True self.restoreRoot() lastservice=eServiceReference(self.lastservice.value) if lastservice.valid(): -- cgit v1.2.3 From c372fb3326e2c8386eb34723ea7cf354642aaa99 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 27 Jan 2010 23:30:01 +0100 Subject: ChannelSelection.py: another small fix for bug #420 --- lib/python/Screens/ChannelSelection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index eb03ee65..4ca6fa39 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -1467,7 +1467,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS config.radio.lastroot.save() def restoreRoot(self): - tmp = [x for x in self.lastroot.value.split(';') if x != ''] + tmp = [x for x in config.radio.lastroot.value.split(';') if x != ''] current = [x.toString() for x in self.servicePath] if tmp != current or self.rootChanged: cnt = 0 -- cgit v1.2.3 From 1ff71d24c512a57686d8cdbef41bc0112ca9be72 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 29 Jan 2010 00:49:43 +0100 Subject: don't use string concatenation within translation brackets --- lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index d9ccab57..dcff3ca2 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -252,7 +252,7 @@ class RestoreMenu(Screen): if (self.exe == False) and (self.entry == True): self.sel = self["filelist"].getCurrent() self.val = self.path + "/" + self.sel - self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n" + self.sel + "\nSystem will restart after the restore!")) + self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n") + self.sel + _("\nSystem will restart after the restore!")) def keyCancel(self): self.close() -- cgit v1.2.3 From 3c28b6e8cb29946dceefc70cad16154c84f38e54 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 3 Feb 2010 23:59:59 +0100 Subject: fixes bug #435 add support for INVERSION_AUTO parameter returned by the cable scan tool --- lib/python/Screens/ScanSetup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index fa787a70..1dbc1505 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -138,7 +138,8 @@ class CableTransponderSearchSupport: "QAM128" : parm.Modulation_QAM128, "QAM256" : parm.Modulation_QAM256 } inv = { "INVERSION_OFF" : parm.Inversion_Off, - "INVERSION_ON" : parm.Inversion_On } + "INVERSION_ON" : parm.Inversion_On, + "INVERSION_AUTO" : parm.Inversion_Unknown } fec = { "FEC_AUTO" : parm.FEC_Auto, "FEC_1_2" : parm.FEC_1_2, "FEC_2_3" : parm.FEC_2_3, -- cgit v1.2.3 From 9c0372ef21e444e5196174dce77583c8ab906de4 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 4 Feb 2010 01:11:33 +0100 Subject: fixes bug #380 don't spawn countless "zap back to service" message boxes on removing >1 orbital positions --- lib/python/Screens/Satconfig.py | 3 +-- lib/python/Screens/ServiceStopScreen.py | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 62480b5f..156f7780 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -347,6 +347,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): new_configured_sats = nimmanager.getConfiguredSats() self.unconfed_sats = old_configured_sats - new_configured_sats self.satpos_to_remove = None + self.restoreService(_("Zap back to service before tuner setup?")) self.deleteConfirmed((None, "no")) def deleteConfirmed(self, confirmed): @@ -376,8 +377,6 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): if confirmed[1] == "yestoall" or confirmed[1] == "notoall": self.deleteConfirmed(confirmed) break - if not self.satpos_to_remove: - self.restoreService(_("Zap back to service before tuner setup?")) def __init__(self, session, slotid): Screen.__init__(self, session) diff --git a/lib/python/Screens/ServiceStopScreen.py b/lib/python/Screens/ServiceStopScreen.py index 3b3dda88..7f0d26a5 100644 --- a/lib/python/Screens/ServiceStopScreen.py +++ b/lib/python/Screens/ServiceStopScreen.py @@ -13,6 +13,9 @@ class ServiceStopScreen: def stopService(self): self.oldref = self.session.nav.getCurrentlyPlayingServiceReference() self.session.nav.stopService() + if self.session.pipshown: # try to disable pip + self.session.pipshown = False + del self.session.pip def __onClose(self): self.session.nav.playService(self.oldref) -- cgit v1.2.3 From ee589820f97c969057e01c33f99b68c72851f20f Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 4 Feb 2010 14:04:20 +0100 Subject: fixes bug #380 pip is'n available in every state of e2, so don't try to get the status if it's not available --- lib/python/Screens/ServiceStopScreen.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/ServiceStopScreen.py b/lib/python/Screens/ServiceStopScreen.py index 7f0d26a5..628a93a5 100644 --- a/lib/python/Screens/ServiceStopScreen.py +++ b/lib/python/Screens/ServiceStopScreen.py @@ -6,16 +6,26 @@ class ServiceStopScreen: self.session except: print "[ServiceStopScreen] ERROR: no self.session set" - + self.oldref = None self.onClose.append(self.__onClose) + def pipAvailable(self): + # pip isn't available in every state of e2 + try: + self.session.pipshown + pipavailable = True + except: + pipavailable = False + return pipavailable + def stopService(self): self.oldref = self.session.nav.getCurrentlyPlayingServiceReference() self.session.nav.stopService() - if self.session.pipshown: # try to disable pip - self.session.pipshown = False - del self.session.pip + if self.pipAvailable(): + if self.session.pipshown: # try to disable pip + self.session.pipshown = False + del self.session.pip def __onClose(self): self.session.nav.playService(self.oldref) -- cgit v1.2.3 From dac3bd25fd4e16c34c706a9aaf0ba039e33465f4 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Feb 2010 14:25:18 +0100 Subject: lib/base/ioprio.cpp: fix for more current linuxkernel --- lib/base/ioprio.cpp | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/base/ioprio.cpp b/lib/base/ioprio.cpp index fb257401..3117b5e6 100644 --- a/lib/base/ioprio.cpp +++ b/lib/base/ioprio.cpp @@ -12,23 +12,25 @@ extern "C" int sys_ioprio_set(int, int, int); extern "C" int sys_ioprio_get(int, int); -#if defined(__i386__) -#define __NR_ioprio_set 289 -#define __NR_ioprio_get 290 -#elif defined(__ppc__) || defined(__powerpc__) -#define __NR_ioprio_set 273 -#define __NR_ioprio_get 274 -#elif defined(__x86_64__) -#define __NR_ioprio_set 251 -#define __NR_ioprio_get 252 -#elif defined(__ia64__) -#define __NR_ioprio_set 1274 -#define __NR_ioprio_get 1275 -#elif defined(__mips__) -#define __NR_ioprio_set 4284 -#define __NR_ioprio_get 4285 -#else -#error "Unsupported arch" +#ifndef __NR_ioprio_set + #if defined(__i386__) + #define __NR_ioprio_set 289 + #define __NR_ioprio_get 290 + #elif defined(__ppc__) || defined(__powerpc__) + #define __NR_ioprio_set 273 + #define __NR_ioprio_get 274 + #elif defined(__x86_64__) + #define __NR_ioprio_set 251 + #define __NR_ioprio_get 252 + #elif defined(__ia64__) + #define __NR_ioprio_set 1274 + #define __NR_ioprio_get 1275 + #elif defined(__mips__) + #define __NR_ioprio_set 4284 + #define __NR_ioprio_get 4285 + #else + #error "Unsupported arch" + #endif #endif #if defined(_syscall3) && defined(_syscall2) -- cgit v1.2.3 From 07546e9555132554de255826213f52e456b5ee1e Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Feb 2010 14:26:01 +0100 Subject: lib/python/Plugins/Extensions/DVDPlayer/plugin.py: also check with upper case --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index e895a141..6e4d9cc6 100755 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -736,6 +736,7 @@ def filescan(**kwargs): paths_to_scan = [ ScanPath(path = "video_ts", with_subdirs = False), + ScanPath(path = "VIDEO_TS", with_subdirs = False), ScanPath(path = "", with_subdirs = False), ], name = "DVD", -- cgit v1.2.3 From a57f7724f413c42aa22c87331c986eeac45ac957 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Feb 2010 14:26:35 +0100 Subject: lib/python/Tools/HardwareInfo.py: remove debug output --- lib/python/Tools/HardwareInfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Tools/HardwareInfo.py b/lib/python/Tools/HardwareInfo.py index 612a565f..e72d2912 100644 --- a/lib/python/Tools/HardwareInfo.py +++ b/lib/python/Tools/HardwareInfo.py @@ -3,7 +3,7 @@ class HardwareInfo: def __init__(self): if HardwareInfo.device_name is not None: - print "using cached result" +# print "using cached result" return HardwareInfo.device_name = "unknown" -- cgit v1.2.3 From e50f482422a4d0f1d08f0970dc7988e2e3ebc78e Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Feb 2010 19:45:42 +0100 Subject: lib/python/Plugins/SystemPlugins/SoftwareManager: more robust code this i.e. fixes: Traceback (most recent call last): File "/usr/lib/enigma2/python/Tools/BoundFunction.py", line 9, in __call__ return self.fnc(*self.args + args, **newkwargs) File "/usr/lib/enigma2/python/Components/Console.py", line 56, in finishedCB self.callbacks[name](data,retval,extra_args) File "/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py", line 108, in IpkgListAvailableCB SoftwareTools.available_packetlist.append([name, split[1].strip(), split[2].strip()]) File "/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py", line 108, in IpkgListAvailableCB SoftwareTools.available_packetlist.append([name, split[1].strip(), split[2].strip()]) ref bug #383 --- .../SystemPlugins/SoftwareManager/SoftwareTools.py | 25 +++++++++++++--------- .../SystemPlugins/SoftwareManager/plugin.py | 25 ++++++++++++++-------- 2 files changed, 31 insertions(+), 19 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index 4e7591ef..e8cf6dc2 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -94,14 +94,17 @@ class SoftwareTools(DreamInfoHandler): def IpkgListAvailableCB(self, result, retval, extra_args = None): (callback) = extra_args - if len(result): + if result: if SoftwareTools.list_updating: SoftwareTools.available_packetlist = [] for x in result.splitlines(): - split = x.split(' - ') - name = split[0].strip() + tokens = x.split(' - ') + name = tokens[0].strip() if not any(name.endswith(x) for x in self.unwanted_extensions): - SoftwareTools.available_packetlist.append([name, split[1].strip(), split[2].strip()]) + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + descr = l > 2 and tokens[2].strip() or "" + SoftwareTools.available_packetlist.append([name, version, descr]) if callback is None: self.startInstallMetaPackage() else: @@ -126,7 +129,7 @@ class SoftwareTools(DreamInfoHandler): def InstallMetaPackageCB(self, result, retval, extra_args = None): (callback) = extra_args - if len(result): + if result: self.fillPackagesIndexList() if callback is None: self.startIpkgListInstalled() @@ -152,13 +155,15 @@ class SoftwareTools(DreamInfoHandler): def IpkgListInstalledCB(self, result, retval, extra_args = None): (callback) = extra_args - if len(result): + if result: SoftwareTools.installed_packetlist = {} for x in result.splitlines(): - split = x.split(' - ') - name = split[0].strip() + tokens = x.split(' - ') + name = tokens[0].strip() if not any(name.endswith(x) for x in self.unwanted_extensions): - SoftwareTools.installed_packetlist[name] = split[1].strip() + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + SoftwareTools.installed_packetlist[name] = version if callback is None: self.countUpdates() else: @@ -203,7 +208,7 @@ class SoftwareTools(DreamInfoHandler): def IpkgUpdateCB(self, result, retval, extra_args = None): (callback) = extra_args - if len(result): + if result: if self.Console: if len(self.Console.appContainers) == 0: if callback is not None: diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index b20ba51e..4dbe7f70 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -1558,24 +1558,31 @@ class PacketManager(Screen): pass def IpkgList_Finished(self, result, retval, extra_args = None): - if len(result): + if result: self.packetlist = [] for x in result.splitlines(): - split = x.split(' - ') #self.blacklisted_packages - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()]) + tokens = x.split(' - ') #self.blacklisted_packages + name = tokens[0].strip() + if not any(name.endswith(x) for x in self.unwanted_extensions): + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + descr = l > 2 and tokens[2].strip() or "" + self.packetlist.append([name, version, descr]) if not self.Console: self.Console = Console() cmd = "ipkg list_installed" self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) def IpkgListInstalled_Finished(self, result, retval, extra_args = None): - if len(result): + if result: self.installed_packetlist = {} for x in result.splitlines(): - split = x.split(' - ') - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.installed_packetlist[split[0].strip()] = split[1].strip() + tokens = x.split(' - ') #self.blacklisted_packages + name = tokens[0].strip() + if not any(name.endswith(x) for x in self.unwanted_extensions): + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + self.installed_packetlist[name] = version self.buildPacketList() def buildEntryComponent(self, name, version, description, state): @@ -1703,7 +1710,7 @@ def Plugins(path, **kwargs): plugin_path = path list = [ PluginDescriptor(where = [PluginDescriptor.WHERE_NETWORKCONFIG_READ], fnc = autostart), - PluginDescriptor(name=_("Software management"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), + PluginDescriptor(name=_("Software management"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) ] if config.usage.setup_level.index >= 2: # expert+ -- cgit v1.2.3 From 30eb05e6ba834df51db97db306bfb1cab94c9b20 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 11 Feb 2010 14:15:33 +0100 Subject: NetworkWizard/NetworkWizard.py: * fix automatic interface selection if only one network adapter is available in some situations. refs #218 --- lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py index 150dba9d..a8b34acd 100755 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py @@ -104,6 +104,9 @@ class NetworkWizard(WizardLanguage, Rc): self.rescanTimer.stop() self.Adapterlist = iNetwork.getAdapterList() self.InstalledInterfaceCount = len(self.Adapterlist) + if self.Adapterlist is not None: + if self.InstalledInterfaceCount == 1 and self.selectedInterface is None: + self.selectedInterface = self.Adapterlist[0] self.originalAth0State = iNetwork.getAdapterAttribute('ath0', 'up') self.originalEth0State = iNetwork.getAdapterAttribute('eth0', 'up') self.originalWlan0State = iNetwork.getAdapterAttribute('wlan0', 'up') -- cgit v1.2.3 From e058cb26c1fe4a6352ac5987c94694c0ecc1ff98 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 11 Feb 2010 14:27:16 +0100 Subject: WirelessLan/plugin.py: * fix sometimes not correctly returned ssid name from wlanscan screen. * don't count the hidden network helper entry as found network. * some small optimizations. refs #204 --- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 6873ffa4..a3f5d225 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -151,6 +151,7 @@ class WlanStatus(Screen): self["statuspic"].setPixmapNum(0) self["statuspic"].show() + class WlanScan(Screen): skin = """ @@ -190,7 +191,7 @@ class WlanScan(Screen): self.WlanList = None self.cleanList = None self.oldlist = None - self.listLenght = None + self.listLength = None self.rescanTimer = eTimer() self.rescanTimer.callback.append(self.rescanTimerFired) @@ -226,7 +227,10 @@ class WlanScan(Screen): self.rescanTimer.stop() del self.rescanTimer if cur[1] is not None: - essid = cur[1] + if cur[1] == 'hidden...': + essid = cur[1] + else: + essid = cur[0] self.close(essid,self.getWlanList()) else: self.close(None,None) @@ -305,7 +309,7 @@ class WlanScan(Screen): self['list'].setList(self.newAPList) self["list"].setIndex(newListIndex) self["list"].updateList(self.newAPList) - self.listLenght = len(self.newAPList) + self.listLength = len(self.newAPList) self.buildWlanList() self.setInfo() @@ -315,7 +319,7 @@ class WlanScan(Screen): self.w = Wlan(self.iface) aps = self.w.getNetworkList() if aps is not None: - print "[NetworkWizard.py] got Accespoints!" + print "[WirelessLan.py] got Accespoints!" tmpList = [] compList = [] for ap in aps: @@ -340,31 +344,34 @@ class WlanScan(Screen): if refresh is False: self['list'].setList(self.APList) - self.listLenght = len(self.APList) + self.listLength = len(self.APList) self.setInfo() self.rescanTimer.start(5000) return self.cleanList def setInfo(self): length = self.getLength() - if length == 0: + if length <= 1: self["info"].setText(_("No wireless networks found! Please refresh.")) - elif length == 1: + elif length == 2: self["info"].setText(_("1 wireless network found!")) else: - self["info"].setText(str(length)+_(" wireless networks found!")) + self["info"].setText(str(length-1)+_(" wireless networks found!")) def buildWlanList(self): self.WlanList = [] - currList = [] - currList = self['list'].list - for entry in currList: - self.WlanList.append( (entry[1], entry[0]) ) + for entry in self['list'].list: + if entry[1] == "hidden...": + self.WlanList.append(( "hidden...",_("enter hidden network SSID") ))#continue + else: + self.WlanList.append( (entry[0], entry[0]) ) def getLength(self): - return self.listLenght + return self.listLength def getWlanList(self): + if self.WlanList is None: + self.buildWlanList() return self.WlanList -- cgit v1.2.3 From 7c2f35aa189b8e3d4d5e3fece3362d71ee160762 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 11 Feb 2010 23:12:47 +0100 Subject: add possibility to disable/enable listbox selection in multicontent templates fixes bug #443 --- .../Components/Converter/TemplatedMultiContent.py | 20 +++++++++++--------- lib/python/Components/Renderer/Listbox.py | 4 ++++ lib/python/Components/Sources/List.py | 5 +++-- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Converter/TemplatedMultiContent.py b/lib/python/Components/Converter/TemplatedMultiContent.py index b86d94bf..b5a98449 100644 --- a/lib/python/Components/Converter/TemplatedMultiContent.py +++ b/lib/python/Components/Converter/TemplatedMultiContent.py @@ -10,8 +10,8 @@ class TemplatedMultiContent(StringList): del l["self"] # cleanup locals a bit del l["args"] - self.template = eval(args, {}, l) self.active_style = None + self.template = eval(args, {}, l) assert "fonts" in self.template assert "itemHeight" in self.template assert "template" in self.template or "templates" in self.template @@ -25,7 +25,6 @@ class TemplatedMultiContent(StringList): if not self.content: from enigma import eListboxPythonMultiContent self.content = eListboxPythonMultiContent() - self.setTemplate() # also setup fonts (also given by source) index = 0 @@ -35,30 +34,33 @@ class TemplatedMultiContent(StringList): # if only template changed, don't reload list if what[0] == self.CHANGED_SPECIFIC and what[1] == "style": - self.setTemplate() - return - - if self.source: + pass + elif self.source: self.content.setList(self.source.list) - self.setTemplate() + self.setTemplate() self.downstream_elements.changed(what) def setTemplate(self): if self.source: style = self.source.style + if style == self.active_style: - return # style did not change + return # if skin defined "templates", that means that it defines multiple styles in a dict. template should still be a default templates = self.template.get("templates") template = self.template.get("template") itemheight = self.template["itemHeight"] + selectionEnabled = self.template.get("selectionEnabled", True) if templates and style and style in templates: # if we have a custom style defined in the source, and different templates in the skin, look it up template = templates[style][1] itemheight = templates[style][0] + if len(templates[style]) > 2: + selectionEnabled = templates[style][2] self.content.setTemplate(template) - self.content.setItemHeight(itemheight) + self.selectionEnabled = selectionEnabled + self.active_style = style diff --git a/lib/python/Components/Renderer/Listbox.py b/lib/python/Components/Renderer/Listbox.py index 7a895330..640121e1 100644 --- a/lib/python/Components/Renderer/Listbox.py +++ b/lib/python/Components/Renderer/Listbox.py @@ -77,6 +77,10 @@ class Listbox(Renderer, object): selection_enabled = property(lambda self: self.__selection_enabled, setSelectionEnabled) def changed(self, what): + if hasattr(self.source, "selectionEnabled"): + self.selection_enabled = self.source.selectionEnabled + if len(what) > 1 and isinstance(what[1], str) and what[1] == "style": + return self.content = self.source.content def entry_changed(self, index): diff --git a/lib/python/Components/Sources/List.py b/lib/python/Components/Sources/List.py index 1eab32b2..6f0670a1 100644 --- a/lib/python/Components/Sources/List.py +++ b/lib/python/Components/Sources/List.py @@ -91,8 +91,9 @@ to generate HTML.""" return self.__style def setStyle(self, style): - self.__style = style - self.changed((self.CHANGED_SPECIFIC, "style")) + if self.__style != style: + self.__style = style + self.changed((self.CHANGED_SPECIFIC, "style")) style = property(getStyle, setStyle) -- cgit v1.2.3 From 49d3b0f03998616458f86c340b4bbb39f0ab4c4e Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 13 Feb 2010 18:47:15 +0100 Subject: lib/driver/rc.cpp,rcinput.cpp: only do EVIOCGRAB when event bit 0x1E is set in event device evbits --- lib/driver/rc.cpp | 5 ++++- lib/driver/rcinput.cpp | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/driver/rc.cpp b/lib/driver/rc.cpp index c56fde44..c1ff13ea 100644 --- a/lib/driver/rc.cpp +++ b/lib/driver/rc.cpp @@ -129,8 +129,11 @@ void eRCInputEventDriver::setExclusive(bool b) { if (handle >= 0) { + long evbits; int grab = b; - if (::ioctl(handle, EVIOCGRAB, grab) < 0) + if (::ioctl(handle, EVIOCGBIT(0, EV_MAX+1), &evbits) < 0) + perror("EVIOCGBIT"); + else if ((evbits & (1 << 0x1E)) && ::ioctl(handle, EVIOCGRAB, grab) < 0) perror("EVIOCGRAB"); } } diff --git a/lib/driver/rcinput.cpp b/lib/driver/rcinput.cpp index e593087d..2bfeefa1 100644 --- a/lib/driver/rcinput.cpp +++ b/lib/driver/rcinput.cpp @@ -89,7 +89,8 @@ eRCDeviceInputDev::eRCDeviceInputDev(eRCInputEventDriver *driver) void eRCDeviceInputDev::setExclusive(bool b) { - driver->setExclusive(!iskeyboard && b); + if (!iskeyboard) + driver->setExclusive(b); } const char *eRCDeviceInputDev::getDescription() const -- cgit v1.2.3 From 01d75322e7f2c56a3fc67db645440a5a71ef3d1e Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 15 Feb 2010 10:25:34 +0100 Subject: lib/python/Components/PluginsComponent.py: even allow .pyo files --- lib/python/Components/PluginComponent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index c91d6ad5..5e439fdf 100755 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -46,7 +46,7 @@ class PluginComponent: for pluginname in os_listdir(directory_category): path = directory_category + "/" + pluginname if os_path.isdir(path): - if fileExists(path + "/plugin.pyc") or fileExists(path + "/plugin.py"): + if fileExists(path + "/plugin.pyc") or fileExists(path + "/plugin.pyo") or fileExists(path + "/plugin.py"): try: plugin = my_import('.'.join(["Plugins", c, pluginname, "plugin"])) -- cgit v1.2.3 From abd1ad03da2989e3f57a999b9e50be0c95833891 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 5 Feb 2010 00:18:33 +0100 Subject: fixes bug #436 add support for mixed nims --- lib/python/Components/NimManager.py | 47 ++++++++++++++++++++++++++++++++++--- lib/python/Screens/Satconfig.py | 18 +++++++++++++- 2 files changed, 61 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 613305d0..6650c717 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -444,7 +444,7 @@ class SecConfigure: self.update() class NIM(object): - def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None): + def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}): self.slot = slot if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None): @@ -455,6 +455,7 @@ class NIM(object): self.description = description self.has_outputs = has_outputs self.internally_connectable = internally_connectable + self.multi_type = multi_type def isCompatible(self, what): compatible = { @@ -466,6 +467,9 @@ class NIM(object): } return what in compatible[self.type] + def getType(self): + return self.type + def connectableTo(self): connectable = { "DVB-S": ("DVB-S", "DVB-S2"), @@ -491,6 +495,13 @@ class NIM(object): def internallyConnectableTo(self): return self.internally_connectable + + def isMultiType(self): + return (len(self.multi_type) > 0) + + # returns dict {: } + def getMultiTypeList(self): + return self.multi_type slot_id = property(getSlotID) @@ -636,7 +647,15 @@ class NimManager: entries[current_slot]["has_outputs"] = (input == "yes") elif line.strip().startswith("Internally_Connectable:"): input = int(line.strip()[len("Internally_Connectable:") + 1:]) - entries[current_slot]["internally_connectable"] = input + entries[current_slot]["internally_connectable"] = input + elif line.strip().startswith("Mode"): + # "Mode 0: DVB-T" -> ["Mode 0", " DVB-T"] + split = line.strip().split(":") + # "Mode 0" -> ["Mode, "0"] + split2 = split[0].split(" ") + modes = entries[current_slot].get("multi_type", {}) + modes[split2[1]] = split[1].strip() + entries[current_slot]["multi_type"] = modes elif line.strip().startswith("empty"): entries[current_slot]["type"] = None entries[current_slot]["name"] = _("N/A") @@ -650,12 +669,17 @@ class NimManager: entry["has_outputs"] = True if not (entry.has_key("internally_connectable")): entry["internally_connectable"] = None - self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"])) + if not (entry.has_key("multi_type")): + entry["multi_type"] = {} + self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"])) def hasNimType(self, chktype): for slot in self.nim_slots: if slot.isCompatible(chktype): return True + for type in slot.getMultiTypeList().values(): + if chktype == type: + return True return False def getNimType(self, slotid): @@ -1218,11 +1242,28 @@ def InitNimManager(nimmgr): slot_id = configElement.slot_id if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2': open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value) + + def tunerTypeChanged(configElement): + fe_id = configElement.fe_id + open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value) empty_slots = 0 for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] + if slot.isMultiType(): + typeList = [] + value = None + for id in slot.getMultiTypeList().keys(): + type = slot.getMultiTypeList()[id] + typeList.append((id, type)) + if type == slot.getType(): + value = id + nim.multiType = ConfigSelection(typeList, "0") + nim.multiType.value = value + nim.multiType.fe_id = x - empty_slots + nim.multiType.addNotifier(tunerTypeChanged) + if slot.isCompatible("DVB-S"): nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7") nim.toneAmplitude.fe_id = x - empty_slots diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 156f7780..0d10a2c0 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -94,6 +94,11 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedType = None self.advancedManufacturer = None self.advancedSCR = None + + if self.nim.isMultiType(): + multiType = self.nimConfig.multiType + self.multiType = getConfigListEntry(_("Tuner type"), multiType) + self.list.append(self.multiType) if self.nim.isCompatible("DVB-S"): self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode) @@ -200,10 +205,19 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry, \ self.advancedLof, self.advancedPowerMeasurement, self.turningSpeed, \ self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \ - self.uncommittedDiseqcCommand, self.cableScanType) + self.uncommittedDiseqcCommand, self.cableScanType, self.multiType) + if self["config"].getCurrent() == self.multiType: + print "enumerating:" + nimmanager.enumerateNIMs() + print "mode value:", self.multiType[1].value + from Components.NimManager import InitNimManager + InitNimManager(nimmanager) + self.nim = nimmanager.nim_slots[self.slotid] + self.nimConfig = self.nim.config for x in checkList: if self["config"].getCurrent() == x: self.createSetup() + break def run(self): if self.have_advanced and self.nim.config_mode == "advanced": @@ -511,6 +525,8 @@ class NimSelection(Screen): text = _("nothing connected") elif nimConfig.configMode.value == "enabled": text = _("enabled") + if x.isMultiType(): + text = _("Switchable tuner types:") + "(" + ','.join(x.getMultiTypeList().values()) + ")" + "\n" + text self.list.append((slotid, x.friendly_full_description, text, x)) self["nimlist"].setList(self.list) -- cgit v1.2.3 From 1ebcd01ce9cb0e279e6f51e3629427c1964210ca Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 5 Feb 2010 00:32:41 +0100 Subject: fixes bug #436 remove some debug code fix multiType entry for non multiType nims --- lib/python/Screens/Satconfig.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 0d10a2c0..047bde23 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -76,6 +76,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): print "Creating setup" self.list = [ ] + self.multiType = None self.configMode = None self.diseqcModeEntry = None self.advancedSatsEntry = None @@ -207,9 +208,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \ self.uncommittedDiseqcCommand, self.cableScanType, self.multiType) if self["config"].getCurrent() == self.multiType: - print "enumerating:" nimmanager.enumerateNIMs() - print "mode value:", self.multiType[1].value from Components.NimManager import InitNimManager InitNimManager(nimmanager) self.nim = nimmanager.nim_slots[self.slotid] -- cgit v1.2.3 From bdea0dd8ac75294737564b1c2a4178a32ba3d284 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 23 Feb 2010 22:57:29 +0100 Subject: lib/python/Components/Ipkg.py: small fix for opkg --- lib/python/Components/Ipkg.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Ipkg.py b/lib/python/Components/Ipkg.py index 0ba1165c..71447775 100755 --- a/lib/python/Components/Ipkg.py +++ b/lib/python/Components/Ipkg.py @@ -1,4 +1,5 @@ from enigma import eConsoleAppContainer +from Tools.Directories import fileExists class IpkgComponent: EVENT_INSTALL = 0 @@ -20,7 +21,7 @@ class IpkgComponent: def __init__(self, ipkg = '/usr/bin/ipkg'): self.ipkg = ipkg - + self.opkgAvail = fileExists('/usr/bin/opkg') self.cmd = eConsoleAppContainer() self.cache = None self.callbackList = [] @@ -89,7 +90,10 @@ class IpkgComponent: if data.find('Downloading') == 0: self.callCallbacks(self.EVENT_DOWNLOAD, data.split(' ', 5)[1].strip()) elif data.find('Upgrading') == 0: - self.callCallbacks(self.EVENT_UPGRADE, data.split(' ', 1)[1].split(' ')[0]) + if self.opkgAvail: + self.callCallbacks(self.EVENT_UPGRADE, data.split(' ', 1)[1].split(' ')[0]) + else: + self.callCallbacks(self.EVENT_UPGRADE, data.split(' ', 1)[1].split(' ')[0]) elif data.find('Installing') == 0: self.callCallbacks(self.EVENT_INSTALL, data.split(' ', 1)[1].split(' ')[0]) elif data.find('Removing') == 0: -- cgit v1.2.3 From eca33f89346b4ad0e7bbaef7438e8a87daa963a9 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 11 Jan 2010 19:18:34 +0100 Subject: Add some parental control improvements (made by Tode) --- data/skin_default/Makefile.am | 4 + data/skin_default/lock.png | Bin 0 -> 1053 bytes data/skin_default/lockBouquet.png | Bin 0 -> 1176 bytes data/skin_default/unlock.png | Bin 0 -> 965 bytes data/skin_default/unlockBouquet.png | Bin 0 -> 1141 bytes lib/python/Components/ParentalControl.py | 316 +++++++++++++++++++-------- lib/python/Components/ParentalControlList.py | 29 ++- lib/python/Screens/ParentalControlSetup.py | 79 +++++-- 8 files changed, 320 insertions(+), 108 deletions(-) create mode 100644 data/skin_default/lock.png create mode 100644 data/skin_default/lockBouquet.png create mode 100644 data/skin_default/unlock.png create mode 100644 data/skin_default/unlockBouquet.png mode change 100755 => 100644 lib/python/Components/ParentalControl.py mode change 100755 => 100644 lib/python/Screens/ParentalControlSetup.py (limited to 'lib') diff --git a/data/skin_default/Makefile.am b/data/skin_default/Makefile.am index 9e9b7cd4..85bb800d 100755 --- a/data/skin_default/Makefile.am +++ b/data/skin_default/Makefile.am @@ -32,6 +32,8 @@ dist_install_DATA = \ expanded-plugins.png \ info-bg_mp.png \ info-bg.png \ + lock.png \ + lockBouquet.png \ mediaplayer_bg.png \ mute.png \ nim_active.png \ @@ -52,6 +54,8 @@ dist_install_DATA = \ timeline-now.png \ timeline.png \ unhandled-key.png \ + unlock.png \ + unlockBouquet.png \ verticalline-plugins.png \ vkey_backspace.png \ vkey_bg.png \ diff --git a/data/skin_default/lock.png b/data/skin_default/lock.png new file mode 100644 index 00000000..d0ae7f64 Binary files /dev/null and b/data/skin_default/lock.png differ diff --git a/data/skin_default/lockBouquet.png b/data/skin_default/lockBouquet.png new file mode 100644 index 00000000..d503dd2b Binary files /dev/null and b/data/skin_default/lockBouquet.png differ diff --git a/data/skin_default/unlock.png b/data/skin_default/unlock.png new file mode 100644 index 00000000..bd4486e9 Binary files /dev/null and b/data/skin_default/unlock.png differ diff --git a/data/skin_default/unlockBouquet.png b/data/skin_default/unlockBouquet.png new file mode 100644 index 00000000..c5d146d7 Binary files /dev/null and b/data/skin_default/unlockBouquet.png differ diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py old mode 100755 new mode 100644 index d68e01ff..4830d20a --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -1,19 +1,34 @@ -from Components.config import config, ConfigSubsection, ConfigSelection, ConfigPIN, ConfigYesNo, ConfigSubList, ConfigInteger +from Components.config import config, ConfigSubsection, ConfigSelection, ConfigPIN, ConfigText, ConfigYesNo, ConfigSubList, ConfigInteger +#from Screens.ChannelSelection import service_types_tv from Screens.InputBox import PinInput from Screens.MessageBox import MessageBox from Tools.BoundFunction import boundFunction from ServiceReference import ServiceReference from Tools import Notifications from Tools.Directories import resolveFilename, SCOPE_CONFIG +from enigma import eTimer +import time + +TYPE_SERVICE = "SERVICE" +TYPE_BOUQUETSERVICE = "BOUQUETSERVICE" +TYPE_BOUQUET = "BOUQUET" +LIST_BLACKLIST = "blacklist" +LIST_WHITELIST = "whitelist" + +IMG_WHITESERVICE = LIST_WHITELIST + "-" + TYPE_SERVICE +IMG_WHITEBOUQUET = LIST_WHITELIST + "-" + TYPE_BOUQUET +IMG_BLACKSERVICE = LIST_BLACKLIST + "-" + TYPE_SERVICE +IMG_BLACKBOUQUET = LIST_BLACKLIST + "-" + TYPE_BOUQUET def InitParentalControl(): config.ParentalControl = ConfigSubsection() config.ParentalControl.configured = ConfigYesNo(default = False) config.ParentalControl.mode = ConfigSelection(default = "simple", choices = [("simple", _("simple")), ("complex", _("complex"))]) - config.ParentalControl.storeservicepin = ConfigSelection(default = "never", choices = [("never", _("never")), ("5_minutes", _("5 minutes")), ("30_minutes", _("30 minutes")), ("60_minutes", _("60 minutes")), ("restart", _("until restart"))]) + config.ParentalControl.storeservicepin = ConfigSelection(default = "never", choices = [("never", _("never")), ("5", _("5 minutes")), ("30", _("30 minutes")), ("60", _("60 minutes")), ("standby", _("until standby/restart"))]) + config.ParentalControl.storeservicepincancel = ConfigSelection(default = "never", choices = [("never", _("never")), ("5", _("5 minutes")), ("30", _("30 minutes")), ("60", _("60 minutes")), ("standby", _("until standby/restart"))]) config.ParentalControl.servicepinactive = ConfigYesNo(default = False) config.ParentalControl.setuppinactive = ConfigYesNo(default = False) - config.ParentalControl.type = ConfigSelection(default = "blacklist", choices = [("whitelist", _("whitelist")), ("blacklist", _("blacklist"))]) + config.ParentalControl.type = ConfigSelection(default = "blacklist", choices = [(LIST_WHITELIST, _("whitelist")), (LIST_BLACKLIST, _("blacklist"))]) config.ParentalControl.setuppin = ConfigPIN(default = -1) config.ParentalControl.retries = ConfigSubsection() @@ -39,40 +54,58 @@ def InitParentalControl(): class ParentalControl: def __init__(self): - self.open() + #Do not call open on init, because bouquets are not ready at that moment +# self.open() self.serviceLevel = {} - - def addWhitelistService(self, service): - self.whitelist.append(service) + #Instead: Use Flags to see, if we already initialized config and called open + self.configInitialized = False + self.filesOpened = False + #This is the timer that is used to see, if the time for caching the pin is over + #Of course we could also work without a timer and compare the times every + #time we call isServicePlayable. But this might probably slow down zapping, + #That's why I decided to use a timer + self.sessionPinTimer = eTimer() + self.sessionPinTimer.callback.append(self.resetSessionPin) - def addBlacklistService(self, service): - self.blacklist.append(service) - - def setServiceLevel(self, service, level): - self.serviceLevel[service] = level - - def deleteWhitelistService(self, service): - self.whitelist.remove(service) - if self.serviceLevel.has_key(service): - self.serviceLevel.remove(service) + def serviceMethodWrapper(self, service, method, *args): + #This method is used to call all functions that need a service as Parameter: + #It takes either a Service- Reference or a Bouquet- Reference and passes + #Either the service or all services contained in the bouquet to the method given + #That way all other functions do not need to distinguish between service and bouquet. + if "FROM BOUQUET" in service: + method( service , TYPE_BOUQUET , *args ) + servicelist = self.readServicesFromBouquet(service,"C") + for ref in servicelist: + sRef = str(ref[0]) + method( sRef , TYPE_BOUQUETSERVICE , *args ) + else: + ref = ServiceReference(service) + sRef = str(ref) + method( sRef , TYPE_SERVICE , *args ) - def deleteBlacklistService(self, service): - self.blacklist.remove(service) - if self.serviceLevel.has_key(service): - self.serviceLevel.remove(service) + def setServiceLevel(self, service, type, level): + self.serviceLevel[service] = level def isServicePlayable(self, ref, callback): if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True - #print "whitelist:", self.whitelist - #print "blacklist:", self.blacklist - #print "config.ParentalControl.type.value:", config.ParentalControl.type.value - #print "not in whitelist:", (service not in self.whitelist) - #print "checking parental control for service:", ref.toString() + #Check if we already read the whitelists and blacklists. If not: call open + if self.filesOpened == False: + self.open() + #Check if configuration has already been read or if the significant values have changed. + #If true: read the configuration + if self.configInitialized == False or self.storeServicePin != config.ParentalControl.storeservicepin.value or self.storeServicePinCancel != config.ParentalControl.storeservicepincancel.value: + self.getConfigValues() service = ref.toCompareString() - if (config.ParentalControl.type.value == "whitelist" and service not in self.whitelist) or (config.ParentalControl.type.value == "blacklist" and service in self.blacklist): + if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or (config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)): + #Check if the session pin is cached and return the cached value, if it is. + if self.sessionPinCached == True: + #As we can cache successful pin- entries as well as canceled pin- entries, + #We give back the last action + return self.sessionPinCachedValue self.callback = callback - #print "service:", ServiceReference(service).getServiceName() + #Someone started to implement different levels of protection. Seems they were never completed + #I did not throw out this code, although it is of no use at the moment levelNeeded = 0 if self.serviceLevel.has_key(service): levelNeeded = self.serviceLevel[service] @@ -83,103 +116,214 @@ class ParentalControl: return True def protectService(self, service): - #print "protect" - #print "config.ParentalControl.type.value:", config.ParentalControl.type.value - if config.ParentalControl.type.value == "whitelist": - if service in self.whitelist: - self.deleteWhitelistService(service) + if config.ParentalControl.type.value == LIST_WHITELIST: + if self.whitelist.has_key(service): + self.serviceMethodWrapper(service, self.removeServiceFromList, self.whitelist) + #self.deleteWhitelistService(service) else: # blacklist - if service not in self.blacklist: - self.addBlacklistService(service) + if not self.blacklist.has_key(service): + self.serviceMethodWrapper(service, self.addServiceToList, self.blacklist) + #self.addBlacklistService(service) #print "whitelist:", self.whitelist #print "blacklist:", self.blacklist - def unProtectService(self, service): #print "unprotect" #print "config.ParentalControl.type.value:", config.ParentalControl.type.value - if config.ParentalControl.type.value == "whitelist": - if service not in self.whitelist: - self.addWhitelistService(service) + if config.ParentalControl.type.value == LIST_WHITELIST: + if not self.whitelist.has_key(service): + self.serviceMethodWrapper(service, self.addServiceToList, self.whitelist) + #self.addWhitelistService(service) else: # blacklist - if service in self.blacklist: - self.deleteBlacklistService(service) + if self.blacklist.has_key(service): + self.serviceMethodWrapper(service, self.removeServiceFromList, self.blacklist) + #self.deleteBlacklistService(service) #print "whitelist:", self.whitelist #print "blacklist:", self.blacklist def getProtectionLevel(self, service): - if (config.ParentalControl.type.value == "whitelist" and service not in self.whitelist) or (config.ParentalControl.type.value == "blacklist" and service in self.blacklist): + if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or (config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)): if self.serviceLevel.has_key(service): return self.serviceLevel[service] else: return 0 else: return -1 + + def getProtectionType(self, service): + #New method used in ParentalControlList: This method does not only return + #if a service is protected or not, it also returns, why (whitelist or blacklist, service or bouquet) + if self.filesOpened == False: + self.open() + sImage = "" + if (config.ParentalControl.type.value == LIST_WHITELIST): + if self.whitelist.has_key(service): + if TYPE_SERVICE in self.whitelist[service]: + sImage = IMG_WHITESERVICE + else: + sImage = IMG_WHITEBOUQUET + elif (config.ParentalControl.type.value == LIST_BLACKLIST): + if self.blacklist.has_key(service): + if TYPE_SERVICE in self.blacklist[service]: + sImage = IMG_BLACKSERVICE + else: + sImage = IMG_BLACKBOUQUET + bLocked = self.getProtectionLevel(service) != -1 + return (bLocked,sImage) + + def getConfigValues(self): + #Read all values from configuration + self.checkPinInterval = False + self.checkPinIntervalCancel = False + self.checkSessionPin = False + self.checkSessionPinCancel = False + + self.sessionPinCached = False + self.pinIntervalSeconds = 0 + self.pinIntervalSecondsCancel = 0 + + self.storeServicePin = config.ParentalControl.storeservicepin.value + self.storeServicePinCancel = config.ParentalControl.storeservicepincancel.value + + if self.storeServicePin == "never": + pass + elif self.storeServicePin == "standby": + self.checkSessionPin = True + else: + self.checkPinInterval = True + iMinutes = float(self.storeServicePin) + iSeconds = iMinutes*60 + self.pinIntervalSeconds = iSeconds + + if self.storeServicePinCancel == "never": + pass + elif self.storeServicePinCancel == "standby": + self.checkSessionPinCancel = True + else: + self.checkPinIntervalCancel = True + iMinutes = float(self.storeServicePinCancel) + iSeconds = iMinutes*60 + self.pinIntervalSecondsCancel = iSeconds + self.configInitialized = True + # Reset PIN cache on standby: Use StandbyCounter- Config- Callback + config.misc.standbyCounter.addNotifier(self.standbyCounterCallback, initial_call = False) + + def standbyCounterCallback(self, configElement): + self.resetSessionPin() + + def resetSessionPin(self): + #Reset the session pin, stop the timer + self.sessionPinCached = False + self.sessionPinTimer.stop() + + def getCurrentTimeStamp(self): + return time.time() + def getPinList(self): return [ x.value for x in config.ParentalControl.servicepin ] - + def servicePinEntered(self, service, result): -# levelNeeded = 0 - #if self.serviceLevel.has_key(service): - #levelNeeded = self.serviceLevel[service] -# - #print "getPinList():", self.getPinList() - #pinList = self.getPinList()[:levelNeeded + 1] - #print "pinList:", pinList -# -# print "pin entered for service", service, "and pin was", pin - #if pin is not None and int(pin) in pinList: + if result is not None and result: - #print "pin ok, playing service" + #This is the new function of caching the service pin + #save last session and time of last entered pin... + if self.checkSessionPin == True: + self.sessionPinCached = True + self.sessionPinCachedValue = True + if self.checkPinInterval == True: + self.sessionPinCached = True + self.sessionPinCachedValue = True + self.sessionPinTimer.start(self.pinIntervalSeconds*1000,1) self.callback(ref = service) else: + #This is the new function of caching cancelling of service pin if result is not None: Notifications.AddNotification(MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR) - #print "wrong pin entered" + else: + if self.checkSessionPinCancel == True: + self.sessionPinCached = True + self.sessionPinCachedValue = False + if self.checkPinIntervalCancel == True: + self.sessionPinCached = True + self.sessionPinCachedValue = False + self.sessionPinTimer.start(self.pinIntervalSecondsCancel*1000,1) - def saveWhitelist(self): - file = open(resolveFilename(SCOPE_CONFIG, "whitelist"), 'w') - for x in self.whitelist: - file.write(x + "\n") - file.close - - def openWhitelist(self): - self.whitelist = [] - try: - file = open(resolveFilename(SCOPE_CONFIG, "whitelist"), 'r') - lines = file.readlines() - for x in lines: - ref = ServiceReference(x.strip()) - self.whitelist.append(str(ref)) - file.close - except: - pass - - def saveBlacklist(self): - file = open(resolveFilename(SCOPE_CONFIG, "blacklist"), 'w') - for x in self.blacklist: - file.write(x + "\n") + def saveListToFile(self,sWhichList): + #Replaces saveWhiteList and saveBlackList: + #I don't like to have two functions with identical code... + if sWhichList == LIST_BLACKLIST: + vList = self.blacklist + else: + vList = self.whitelist + file = open(resolveFilename(SCOPE_CONFIG, sWhichList), 'w') + for sService,sType in vList.iteritems(): + #Only Services that are selected directly and Bouqets are saved. + #Services that are added by a bouquet are not saved. + #This is the reason for the change in self.whitelist and self.blacklist + if TYPE_SERVICE in sType or TYPE_BOUQUET in sType: + file.write(str(sService) + "\n") file.close - def openBlacklist(self): - self.blacklist = [] + def openListFromFile(self,sWhichList): + #Replaces openWhiteList and openBlackList: + #I don't like to have two functions with identical code... + if sWhichList == LIST_BLACKLIST: + self.blacklist = {} + vList = self.blacklist + else: + self.whitelist = {} + vList = self.whitelist try: - file = open(resolveFilename(SCOPE_CONFIG, "blacklist"), 'r') + file = open(resolveFilename(SCOPE_CONFIG, sWhichList ), 'r') lines = file.readlines() for x in lines: - ref = ServiceReference(x.strip()) - self.blacklist.append(str(ref)) + sPlain = x.strip() + self.serviceMethodWrapper(sPlain, self.addServiceToList, vList) file.close except: pass + + def addServiceToList(self, service, type, vList): + #Replaces addWhitelistService and addBlacklistService + #The lists are not only lists of service references any more. + #They are named lists with the service as key and an array of types as value: + + if vList.has_key(service): + if not type in vList[service]: + vList[service].append(type) + else: + vList[service] = [type] + + def removeServiceFromList(self, service, type, vList): + #Replaces deleteWhitelistService and deleteBlacklistService + if vList.has_key(service): + if type in vList[service]: + vList[service].remove(type) + if not vList[service]: + del vList[service] + if self.serviceLevel.has_key(service): + self.serviceLevel.remove(service) + + def readServicesFromBouquet(self,sBouquetSelection,formatstring): + #This method gives back a list of services for a given bouquet + from enigma import eServiceCenter, eServiceReference + from Screens.ChannelSelection import service_types_tv + serviceHandler = eServiceCenter.getInstance() + refstr = sBouquetSelection + root = eServiceReference(refstr) + list = serviceHandler.list(root) + if list is not None: + services = list.getContent("CN", True) #(servicecomparestring, name) + return services def save(self): - self.saveBlacklist() - self.saveWhitelist() + self.saveListToFile(LIST_BLACKLIST) + self.saveListToFile(LIST_WHITELIST) def open(self): - self.openBlacklist() - self.openWhitelist() + self.openListFromFile(LIST_BLACKLIST) + self.openListFromFile(LIST_WHITELIST) + self.filesOpened = True parentalControl = ParentalControl() diff --git a/lib/python/Components/ParentalControlList.py b/lib/python/Components/ParentalControlList.py index 128e6d3e..797ea391 100644 --- a/lib/python/Components/ParentalControlList.py +++ b/lib/python/Components/ParentalControlList.py @@ -1,19 +1,28 @@ from MenuList import MenuList -from Components.ParentalControl import parentalControl +from Components.ParentalControl import parentalControl, IMG_WHITESERVICE, IMG_WHITEBOUQUET, IMG_BLACKSERVICE, IMG_BLACKBOUQUET from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT from Tools.LoadPixmap import LoadPixmap -lockPicture = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png")) +#Now there is a list of pictures instead of one... +entryPicture = {} -def ParentalControlEntryComponent(service, name, locked = True): +entryPicture[IMG_BLACKSERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png")) +entryPicture[IMG_BLACKBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lockBouquet.png")) +entryPicture[IMG_WHITESERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlock.png")) +entryPicture[IMG_WHITEBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlockBouquet.png")) + +def ParentalControlEntryComponent(service, name, protectionType): + locked = protectionType[0] + sImage = protectionType[1] res = [ (service, name, locked), (eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 50, 0, RT_HALIGN_LEFT, name) ] - if locked: - res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, lockPicture)) + #Changed logic: The image is defined by sImage, not by locked anymore + if sImage != "": + res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, entryPicture[sImage])) return res class ParentalControlList(MenuList): @@ -25,9 +34,11 @@ class ParentalControlList(MenuList): def toggleSelectedLock(self): print "self.l.getCurrentSelection():", self.l.getCurrentSelection() print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex() - self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(self.l.getCurrentSelection()[0][0], self.l.getCurrentSelection()[0][1], not self.l.getCurrentSelection()[0][2]); - if self.l.getCurrentSelection()[0][2]: - parentalControl.protectService(self.l.getCurrentSelection()[0][0]) + curSel = self.l.getCurrentSelection() + if curSel[0][2]: + parentalControl.unProtectService(self.l.getCurrentSelection()[0][0]) else: - parentalControl.unProtectService(self.l.getCurrentSelection()[0][0]) + parentalControl.protectService(self.l.getCurrentSelection()[0][0]) + #Instead of just negating the locked- flag, now I call the getProtectionType every time... + self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0])) self.l.setList(self.list) diff --git a/lib/python/Screens/ParentalControlSetup.py b/lib/python/Screens/ParentalControlSetup.py old mode 100755 new mode 100644 index a123d2d3..2bf4841e --- a/lib/python/Screens/ParentalControlSetup.py +++ b/lib/python/Screens/ParentalControlSetup.py @@ -16,7 +16,7 @@ from operator import itemgetter class ProtectedScreen: def __init__(self): if self.isProtected(): - self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.protectedWithPin()], triesEntry = self.getTriesEntry(), title = self.getPinText(), windowTitle = _("Change pin code"))) + self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.protectedWithPin()], triesEntry = self.getTriesEntry(), title = self.getPinText(), windowTitle = _("Enter pin code"))) def getTriesEntry(self): return config.ParentalControl.retries.setuppin @@ -48,11 +48,11 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): self.list = [] ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry) self.createSetup() - + self["actions"] = NumberActionMap(["SetupActions"], { - "cancel": self.keyCancel, - "save": self.keyCancel + "cancel": self.keyCancel, + "save": self.keyCancel }, -2) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) @@ -63,12 +63,12 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): def isProtected(self): return config.ParentalControl.setuppinactive.value and config.ParentalControl.configured.value - + def createSetup(self): self.editListEntry = None self.changePin = None self.changeSetupPin = None - + self.list = [] self.list.append(getConfigListEntry(_("Enable parental control"), config.ParentalControl.configured)) print "config.ParentalControl.configured.value", config.ParentalControl.configured.value @@ -87,10 +87,19 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): elif config.ParentalControl.mode.value == "simple": self.changePin = getConfigListEntry(_("Change service pin"), NoSave(ConfigNothing())) self.list.append(self.changePin) - #self.list.append(getConfigListEntry(_("Remember service pin"), config.ParentalControl.storeservicepin)) + #Added Option to remember the service pin + self.list.append(getConfigListEntry(_("Remember service pin"), config.ParentalControl.storeservicepin)) + #Added Option to remember the cancellation of service pin entry + self.list.append(getConfigListEntry(_("Remember service pin cancel"), config.ParentalControl.storeservicepincancel)) self.editListEntry = getConfigListEntry(_("Edit services list"), NoSave(ConfigNothing())) self.list.append(self.editListEntry) - + #New funtion: Possibility to add Bouquets to whitelist / blacklist + self.editBouquetListEntry = getConfigListEntry(_("Edit bouquets list"), NoSave(ConfigNothing())) + self.list.append(self.editBouquetListEntry) + #New option to reload service lists (for example if bouquets have changed) + self.reloadLists = getConfigListEntry(_("Reload Black-/Whitelists"), NoSave(ConfigNothing())) + self.list.append(self.reloadLists) + self["config"].list = self.list self["config"].setList(self.list) @@ -98,6 +107,8 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): print "self[\"config\"].l.getCurrentSelection()", self["config"].l.getCurrentSelection() if self["config"].l.getCurrentSelection() == self.editListEntry: self.session.open(ParentalControlEditor) + elif self["config"].l.getCurrentSelection() == self.editBouquetListEntry: + self.session.open(ParentalControlBouquetEditor) elif self["config"].l.getCurrentSelection() == self.changePin: if config.ParentalControl.mode.value == "complex": pass @@ -105,6 +116,8 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): self.session.open(ParentalControlChangePin, config.ParentalControl.servicepin[0], _("service pin")) elif self["config"].l.getCurrentSelection() == self.changeSetupPin: self.session.open(ParentalControlChangePin, config.ParentalControl.setuppin, _("setup pin")) + elif self["config"].l.getCurrentSelection() == self.reloadLists: + parentalControl.open() else: ConfigListScreen.keyRight(self) print "current selection:", self["config"].l.getCurrentSelection() @@ -149,6 +162,7 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): def keyNumberGlobal(self, number): pass + # for summary: def changedEntry(self): for x in self.onChangedEntry: @@ -224,13 +238,13 @@ class ParentalControlEditor(Screen): if not self.servicesList.has_key(key): self.servicesList[key] = [] self.servicesList[key].append(s) - + def chooseLetter(self): print "choose letter" mylist = [] for x in self.servicesList.keys(): if x == chr(SPECIAL_CHAR): - x = ("special characters", x) + x = (_("special characters"), x) else: x = (x, x) mylist.append(x) @@ -242,12 +256,51 @@ class ParentalControlEditor(Screen): if result is not None: print "result:", result self.currentLetter = result[1] - self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionLevel(x[0]) != -1) for x in self.servicesList[result[1]]] + #Replace getProtectionLevel by new getProtectionType + self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionType(x[0])) for x in self.servicesList[result[1]]] self.servicelist.setList(self.list) else: parentalControl.save() self.close() +class ParentalControlBouquetEditor(Screen): + #This new class allows adding complete bouquets to black- and whitelists + #The servicereference that is stored for bouquets is their refstr as listed in bouquets.tv + def __init__(self, session): + Screen.__init__(self, session) + self.skinName = "ParentalControlEditor" + self.list = [] + self.bouquetslist = ParentalControlList(self.list) + self["servicelist"] = self.bouquetslist; + self.readBouquetList() + self.onLayoutFinish.append(self.selectBouquet) + + self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions"], + { + "ok": self.select, + "cancel": self.cancel + }, -1) + + def cancel(self): + parentalControl.save() + self.close() + + def select(self): + self.bouquetslist.toggleSelectedLock() + + def readBouquetList(self): + serviceHandler = eServiceCenter.getInstance() + refstr = '1:134:1:0:0:0:0:0:0:0:FROM BOUQUET \"bouquets.tv\" ORDER BY bouquet' + bouquetroot = eServiceReference(refstr) + self.bouquetlist = {} + list = serviceHandler.list(bouquetroot) + if list is not None: + self.bouquetlist = list.getContent("CN", True) + + def selectBouquet(self): + self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionType(x[0])) for x in self.bouquetlist] + self.bouquetslist.setList(self.list) + class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen): def __init__(self, session, pin, pinname): Screen.__init__(self, session) @@ -264,12 +317,12 @@ class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen): self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2)) self.list.append(getConfigListEntry(_("New pin"), NoSave(self.pin1))) self.list.append(getConfigListEntry(_("Reenter new pin"), NoSave(self.pin2))) - ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry) + ConfigListScreen.__init__(self, self.list) # print "old pin:", pin #if pin.value != "aaaa": #self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.pin.value], title = _("please enter the old pin"), windowTitle = _("Change pin code"))) ProtectedScreen.__init__(self) - + self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions"], { "cancel": self.cancel, -- cgit v1.2.3 From 31037f2bac27fb9a592d63a09e1e9ef2792f8e7e Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 1 Mar 2010 01:47:26 +0100 Subject: fixes bug #381 some small fixes for the parental control functions --- lib/python/Components/ParentalControl.py | 3 +++ lib/python/Screens/ParentalControlSetup.py | 2 ++ 2 files changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py index 4830d20a..9942bca7 100644 --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -318,6 +318,9 @@ class ParentalControl: return services def save(self): + # we need to open the files in case we havent's read them yet + if not self.filesOpened: + self.open() self.saveListToFile(LIST_BLACKLIST) self.saveListToFile(LIST_WHITELIST) diff --git a/lib/python/Screens/ParentalControlSetup.py b/lib/python/Screens/ParentalControlSetup.py index 2bf4841e..eae12da4 100644 --- a/lib/python/Screens/ParentalControlSetup.py +++ b/lib/python/Screens/ParentalControlSetup.py @@ -72,6 +72,8 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): self.list = [] self.list.append(getConfigListEntry(_("Enable parental control"), config.ParentalControl.configured)) print "config.ParentalControl.configured.value", config.ParentalControl.configured.value + self.editBouquetListEntry = -1 + self.reloadLists = -1 if config.ParentalControl.configured.value: #self.list.append(getConfigListEntry(_("Configuration mode"), config.ParentalControl.mode)) self.list.append(getConfigListEntry(_("Protect setup"), config.ParentalControl.setuppinactive)) -- cgit v1.2.3 From f9ebb7117c782cd7687523abc8bdccfe8153290e Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 1 Mar 2010 19:37:57 +0100 Subject: fix no more turning positioner after leave positioner setup in some cases this fixes bug #321 --- lib/dvb/frontend.cpp | 19 +++++++++++++++++-- lib/dvb/frontend.h | 1 + lib/dvb/sec.cpp | 5 +++++ lib/python/Components/TuneTest.py | 5 +++-- .../Plugins/SystemPlugins/PositionerSetup/plugin.py | 2 +- 5 files changed, 27 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index c0263fb4..f85a37fe 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -455,7 +455,7 @@ int eDVBFrontend::PriorityOrder=0; eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate) :m_simulate(simulate), m_enabled(false), m_type(-1), m_dvbid(fe), m_slotid(fe) - ,m_fd(-1), m_need_rotor_workaround(false), m_can_handle_dvbs2(false) + ,m_fd(-1), m_rotor_mode(false), m_need_rotor_workaround(false), m_can_handle_dvbs2(false) ,m_state(stateClosed), m_timeout(0), m_tuneTimer(0) #if HAVE_DVB_API_VERSION < 3 ,m_secfd(-1) @@ -692,7 +692,8 @@ void eDVBFrontend::feEvent(int w) { eDebug("stateLostLock"); state = stateLostLock; - sec_fe->m_data[CSW] = sec_fe->m_data[UCSW] = sec_fe->m_data[TONEBURST] = -1; // reset diseqc + if (!m_rotor_mode) + sec_fe->m_data[CSW] = sec_fe->m_data[UCSW] = sec_fe->m_data[TONEBURST] = -1; // reset diseqc } } if (m_state != state) @@ -2343,6 +2344,20 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) res = -EINVAL; goto tune_error; } + if (m_rotor_mode != feparm.no_rotor_command_on_tune && !feparm.no_rotor_command_on_tune) + { + eDVBFrontend *sec_fe = this; + long tmp = m_data[LINKED_PREV_PTR]; + while (tmp != -1) + { + eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*)tmp; + sec_fe = linked_fe->m_frontend; + sec_fe->getData(LINKED_NEXT_PTR, tmp); + } + eDebug("(fe%d) reset diseqc after leave rotor mode!", m_dvbid); + sec_fe->m_data[CSW] = sec_fe->m_data[UCSW] = sec_fe->m_data[TONEBURST] = sec_fe->m_data[ROTOR_CMD] = sec_fe->m_data[ROTOR_POS] = -1; // reset diseqc + } + m_rotor_mode = feparm.no_rotor_command_on_tune; if (!m_simulate) m_sec->setRotorMoving(m_slotid, false); res=prepare_sat(feparm, timeout); diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index bac27539..4cf05081 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -75,6 +75,7 @@ private: int m_dvbid; int m_slotid; int m_fd; + bool m_rotor_mode; bool m_need_rotor_workaround; bool m_can_handle_dvbs2; char m_filename[128]; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 91246889..44cbe709 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -156,6 +156,11 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite ret = 15000; } + if (sat.no_rotor_command_on_tune && !rotor) { + eSecDebugNoSimulate("no rotor but no_rotor_command_on_tune is set.. ignore lnb %d", idx); + continue; + } + eSecDebugNoSimulate("ret1 %d", ret); if (linked_in_use) diff --git a/lib/python/Components/TuneTest.py b/lib/python/Components/TuneTest.py index f9ab3edb..44b19091 100644 --- a/lib/python/Components/TuneTest.py +++ b/lib/python/Components/TuneTest.py @@ -1,8 +1,9 @@ from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParameters, eDVBResourceManager, eTimer class Tuner: - def __init__(self, frontend): + def __init__(self, frontend, ignore_rotor=False): self.frontend = frontend + self.ignore_rotor = ignore_rotor # transponder = (frequency, symbolrate, polarisation, fec, inversion, orbpos, system, modulation, rolloff, pilot, tsid, onid) # 0 1 2 3 4 5 6 7 8 9 10 11 @@ -21,7 +22,7 @@ class Tuner: parm.rolloff = transponder[8] parm.pilot = transponder[9] feparm = eDVBFrontendParameters() - feparm.setDVBS(parm) + feparm.setDVBS(parm, self.ignore_rotor) self.lastparm = feparm self.frontend.tune(feparm) diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py index fa533c0b..3cc9e751 100644 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py @@ -77,7 +77,7 @@ class PositionerSetup(Screen): self.frontendStatus = { } self.diseqc = Diseqc(self.frontend) - self.tuner = Tuner(self.frontend) + self.tuner = Tuner(self.frontend, True) #True means we dont like that the normal sec stuff sends commands to the rotor! tp = ( cur.get("frequency", 0) / 1000, cur.get("symbol_rate", 0) / 1000, -- cgit v1.2.3 From d963a22ad278d885e2bdf1165bb4addece68b1b4 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 2 Mar 2010 20:05:59 +0100 Subject: lib/service/iservice.h, servicedvb.h, servicedvb.cpp: add possibility to play another timeshift file after eof (not used in e2 yet..) this fixes bug #461 --- lib/service/iservice.h | 1 + lib/service/servicedvb.cpp | 137 +++++++++++++++++++++++++++++++++++---------- lib/service/servicedvb.h | 8 ++- 3 files changed, 112 insertions(+), 34 deletions(-) (limited to 'lib') diff --git a/lib/service/iservice.h b/lib/service/iservice.h index c35313f0..d80733df 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -594,6 +594,7 @@ class iTimeshiftService: public iObject public: virtual RESULT startTimeshift()=0; virtual RESULT stopTimeshift(bool swToLive=true)=0; + virtual RESULT setNextPlaybackFile(const char *fn)=0; // not needed by our internal timeshift.. but external plugin... virtual int isTimeshiftActive()=0; /* this essentially seeks to the relative end of the timeshift buffer */ diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 558bf0c2..e498dd42 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -910,7 +910,7 @@ RESULT eServiceFactoryDVB::lookupService(ePtr &service, const eServ return 0; } -eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *service): +eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *service): m_reference(ref), m_dvb_service(service), m_have_video_pid(0), m_is_paused(0) { m_is_primary = 1; @@ -1021,12 +1021,13 @@ void eDVBServicePlay::serviceEvent(int event) updateTimeshiftPids(); if (!m_timeshift_active) updateDecoder(); - if (m_first_program_info && m_is_pvr) + if (m_first_program_info & 1 && m_is_pvr) { - m_first_program_info = 0; + m_first_program_info &= ~1; seekTo(0); } - m_event((iPlayableService*)this, evUpdatedInfo); + if (!m_timeshift_active) + m_event((iPlayableService*)this, evUpdatedInfo); break; } case eDVBServicePMTHandler::eventPreStart: @@ -1046,17 +1047,85 @@ void eDVBServicePlay::serviceEventTimeshift(int event) switch (event) { case eDVBServicePMTHandler::eventNewProgramInfo: + eDebug("eventNewProgramInfo TS"); if (m_timeshift_active) + { updateDecoder(); + if (m_first_program_info & 2) + { + if (m_slowmotion) + { + eDebug("re-apply slowmotion after timeshift file change"); + m_decoder->setSlowMotion(m_slowmotion); + } + if (m_fastforward) + { + eDebug("re-apply skip %d, ratio %d after timeshift file change", m_skipmode, m_fastforward); + if (m_skipmode) + m_cue->setSkipmode(m_skipmode * 90000); /* convert to 90000 per second */ + if (m_fastforward != 1) + m_decoder->setFastForward(m_fastforward); + else + m_decoder->setTrickmode(); + } + else + seekTo(0); + m_first_program_info &= ~2; + } + m_event((iPlayableService*)this, evUpdatedInfo); + } break; case eDVBServicePMTHandler::eventSOF: - m_event((iPlayableService*)this, evSOF); +#if 0 + if (!m_timeshift_file_next.empty()) + { + eDebug("timeshift SOF, switch to next file"); + m_decoder->pause(); + + m_first_program_info |= 2; + + eServiceReferenceDVB r = (eServiceReferenceDVB&)m_reference; + r.path = m_timeshift_file_next; + + /* free the timeshift service handler, we need the resources */ + m_service_handler_timeshift.free(); + resetTimeshift(1); + + if (m_skipmode < 0) + m_cue->seekTo(0, -1000); + m_service_handler_timeshift.tune(r, 1, m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ + + m_event((iPlayableService*)this, evUser+1); + } + else +#endif + m_event((iPlayableService*)this, evSOF); break; case eDVBServicePMTHandler::eventEOF: if ((!m_is_paused) && (m_skipmode >= 0)) { - eDebug("timeshift EOF, so let's go live"); - switchToLive(); + if (m_timeshift_file_next.empty()) + { + eDebug("timeshift EOF, so let's go live"); + switchToLive(); + } + else + { + eDebug("timeshift EOF, switch to next file"); + + m_first_program_info |= 2; + + eServiceReferenceDVB r = (eServiceReferenceDVB&)m_reference; + r.path = m_timeshift_file_next; + + /* free the timeshift service handler, we need the resources */ + m_service_handler_timeshift.free(); + resetTimeshift(1); + + m_service_handler_timeshift.tune(r, 1, m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ + + m_event((iPlayableService*)this, evUser+1); + } } break; } @@ -2240,38 +2309,32 @@ void eDVBServicePlay::updateTimeshiftPids() } } +RESULT eDVBServicePlay::setNextPlaybackFile(const char *f) +{ + m_timeshift_file_next = f; + return 0; +} + void eDVBServicePlay::switchToLive() { if (!m_timeshift_active) return; - + eDebug("SwitchToLive"); - - m_cue = 0; - m_decoder = 0; - m_decode_demux = 0; - m_teletext_parser = 0; - m_rds_decoder = 0; - m_subtitle_parser = 0; - m_new_dvb_subtitle_page_connection = 0; - m_new_subtitle_page_connection = 0; - m_rds_decoder_event_connection = 0; - m_video_event_connection = 0; + + resetTimeshift(0); + m_is_paused = m_skipmode = m_fastforward = m_slowmotion = 0; /* not supported in live mode */ - /* free the timeshift service handler, we need the resources */ + /* free the timeshift service handler, we need the resources */ m_service_handler_timeshift.free(); - m_timeshift_active = 0; - m_timeshift_changed = 1; updateDecoder(true); } -void eDVBServicePlay::switchToTimeshift() +void eDVBServicePlay::resetTimeshift(int start) { - if (m_timeshift_active) - return; - + m_cue = 0; m_decode_demux = 0; m_decoder = 0; m_teletext_parser = 0; @@ -2281,14 +2344,28 @@ void eDVBServicePlay::switchToTimeshift() m_new_dvb_subtitle_page_connection = 0; m_rds_decoder_event_connection = 0; m_video_event_connection = 0; - - m_timeshift_active = 1; m_timeshift_changed = 1; + m_timeshift_file_next.clear(); + + if (start) + { + m_cue = new eCueSheet(); + m_timeshift_active = 1; + } + else + m_timeshift_active = 0; +} + +void eDVBServicePlay::switchToTimeshift() +{ + if (m_timeshift_active) + return; + + resetTimeshift(1); eServiceReferenceDVB r = (eServiceReferenceDVB&)m_reference; r.path = m_timeshift_file; - m_cue = new eCueSheet(); m_cue->seekTo(0, -1000); m_service_handler_timeshift.tune(r, 1, m_cue, 0, m_dvb_service); /* use the decoder demux for everything */ @@ -2351,8 +2428,6 @@ void eDVBServicePlay::updateDecoder(bool sendSeekableStateChanged) if (!m_decoder) { h.getDecodeDemux(m_decode_demux); - if (m_timeshift_changed) - m_decoder = 0; if (m_decode_demux) { m_decode_demux->getMPEGDecoder(m_decoder, m_is_primary); diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 1262836e..dafaf35d 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -162,6 +162,7 @@ public: RESULT stopTimeshift(bool swToLive=true); int isTimeshiftActive(); RESULT activateTimeshift(); + RESULT setNextPlaybackFile(const char *fn); // iCueSheet PyObject *getCutList(); @@ -213,9 +214,8 @@ private: int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active, m_timeshift_changed; int m_first_program_info; - std::string m_timeshift_file; + std::string m_timeshift_file, m_timeshift_file_next; int m_timeshift_fd; - ePtr m_decode_demux; int m_current_audio_stream; @@ -228,8 +228,10 @@ private: void updateTimeshiftPids(); void switchToLive(); + + void resetTimeshift(int start); void switchToTimeshift(); - + void updateDecoder(bool sendSeekableStateChanged=false); int m_skipmode; -- cgit v1.2.3 From b9078822ea1ab5a65389532b3f34c2a26e4660bb Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 4 Mar 2010 00:19:21 +0100 Subject: fixes bug #460 allow setting a timer end time for zapping timers zapping timers with no end time set end right after the zapping timer was started now, so no conflicts with other timers occur that the user doesn't expect --- lib/python/Components/TimerList.py | 10 ++++++++-- lib/python/Screens/TimerEntry.py | 23 +++++++++++++---------- 2 files changed, 21 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/TimerList.py b/lib/python/Components/TimerList.py index 2a7405df..30097c96 100755 --- a/lib/python/Components/TimerList.py +++ b/lib/python/Components/TimerList.py @@ -33,12 +33,18 @@ class TimerList(HTMLComponent, GUIComponent, object): count += 1 flags = flags >> 1 if timer.justplay: - res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s "+ _("(ZAP)")) % (FuzzyTime(timer.begin)[1])))) + if timer.end - timer.begin < 4: # rounding differences + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s "+ _("(ZAP)")) % (FuzzyTime(timer.begin)[1])))) + else: + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s ... %s (%d " + _("mins") + ") ") % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)) + _("(ZAP)"))) else: res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") % (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)))) else: if timer.justplay: - res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s " + _("(ZAP)")) % (FuzzyTime(timer.begin))))) + if timer.end - timer.begin < 4: + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s " + _("(ZAP)")) % (FuzzyTime(timer.begin))))) + else: + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s ... %s (%d " + _("mins") + ") ") % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:] + ((timer.end - timer.begin) / 60,))) + _("(ZAP)"))) else: res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width-150, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, repeatedtext + (("%s, %s ... %s (%d " + _("mins") + ")") % (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:] + ((timer.end - timer.begin) / 60,))))) diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index b231b568..64fa9f19 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -106,10 +106,11 @@ class TimerEntry(Screen, ConfigListScreen): self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)]) self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))]) - + self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400) self.timerentry_starttime = ConfigClock(default = self.timer.begin) self.timerentry_endtime = ConfigClock(default = self.timer.end) + self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))]) default = self.timer.dirname or defaultMoviePath() tmp = config.movielist.videodirs.value @@ -172,11 +173,14 @@ class TimerEntry(Screen, ConfigListScreen): self.entryStartTime = getConfigListEntry(_("StartTime"), self.timerentry_starttime) self.list.append(self.entryStartTime) - if self.timerentry_justplay.value != "zap": - self.entryEndTime = getConfigListEntry(_("EndTime"), self.timerentry_endtime) + + self.entryShowEndTime = getConfigListEntry(_("Set End Time"), self.timerentry_showendtime) + if self.timerentry_justplay.value == "zap": + self.list.append(self.entryShowEndTime) + self.entryEndTime = getConfigListEntry(_("EndTime"), self.timerentry_endtime) + if self.timerentry_justplay.value != "zap" or self.timerentry_showendtime.value: self.list.append(self.entryEndTime) - else: - self.entryEndTime = None + self.channelEntry = getConfigListEntry(_("Channel"), self.timerentry_service) self.list.append(self.channelEntry) @@ -194,11 +198,7 @@ class TimerEntry(Screen, ConfigListScreen): def newConfig(self): print "newConfig", self["config"].getCurrent() - if self["config"].getCurrent() == self.timerTypeEntry: - self.createSetup("config") - if self["config"].getCurrent() == self.timerJustplayEntry: - self.createSetup("config") - if self["config"].getCurrent() == self.frequencyEntry: + if self["config"].getCurrent() in (self.timerTypeEntry, self.timerJustplayEntry, self.frequencyEntry, self.entryShowEndTime): self.createSetup("config") def keyLeft(self): @@ -268,6 +268,9 @@ class TimerEntry(Screen, ConfigListScreen): self.timer.name = self.timerentry_name.value self.timer.description = self.timerentry_description.value self.timer.justplay = self.timerentry_justplay.value == "zap" + if self.timerentry_justplay.value == "zap": + if not self.timerentry_showendtime.value: + self.timerentry_endtime.value = self.timerentry_starttime.value self.timer.resetRepeated() self.timer.afterEvent = { "nothing": AFTEREVENT.NONE, -- cgit v1.2.3 From eaa0a63f8e532f9af46a621196dc6b49279f1c13 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 6 Mar 2010 11:20:10 +0100 Subject: lib/dvb/sec.cpp: fix no more working tune to dvb-s2 transponders when the cable is not directly connected to -s2 tuner --- lib/dvb/sec.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 8b6bc491..0e3e7e0a 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -189,6 +189,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite else ret += 10; } + eSecDebugNoSimulate("ret3 %d", ret); } else // current fe is dependent of another tuner ... (so this fe can't turn the rotor!) { @@ -200,12 +201,8 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite ret = 0; } } - eSecDebugNoSimulate("ret3 %d", ret); + eSecDebugNoSimulate("ret4 %d", ret); } - else if (!direct_connected) - ret = 0; - - eSecDebugNoSimulate("ret4 %d", ret); if (ret && rotor && rotor_pos != -1) ret -= abs(rotor_pos-sat.orbital_position); -- cgit v1.2.3 From 678d4adc636ce6effe3e4c7442dd1b19e868e570 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 13:33:36 +0100 Subject: fixes bug #465 don't install sub directory files --- lib/python/Plugins/Extensions/DVDPlayer/Makefile.am | 1 - lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am | 5 +++++ lib/python/Plugins/Extensions/SocketMMI/Makefile.am | 1 - lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am index d1a995ca..71ea7142 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am @@ -4,7 +4,6 @@ SUBDIRS = src meta installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer install_PYTHON = \ - src/servicedvd.so \ __init__.py \ plugin.py \ keymap.xml \ diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am index 774871e8..27c751cf 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am @@ -2,6 +2,11 @@ OBJS := servicedvd.cpp -include $(OBJS:.cpp=.d) +installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer + +install_PYTHON = \ + servicedvd.so + servicedvd.so: $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \ -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,servicedvd.so -o servicedvd.so \ diff --git a/lib/python/Plugins/Extensions/SocketMMI/Makefile.am b/lib/python/Plugins/Extensions/SocketMMI/Makefile.am index 808d8520..2af2c39b 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/Makefile.am +++ b/lib/python/Plugins/Extensions/SocketMMI/Makefile.am @@ -3,7 +3,6 @@ SUBDIRS = src meta installdir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI install_PYTHON = \ - src/socketmmi.so \ __init__.py \ plugin.py \ SocketMMI.py diff --git a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am index ad97d672..8e80e183 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am +++ b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am @@ -2,6 +2,11 @@ OBJS = socket_mmi.cpp -include $(OBJS:.cpp=.d) +installdir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI + +install_PYTHON = \ + socketmmi.so + socketmmi.so: socket_mmi.cpp socket_mmi.h $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \ -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,socketmmi.so -o socketmmi.so \ -- cgit v1.2.3 From a35c57a736086abaef5a82e2e117a12e3a79b273 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 15:40:35 +0100 Subject: refs bug #429 remove some absolute paths --- lib/python/Components/Harddisk.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index 03f574f3..e8e612a4 100755 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -166,7 +166,7 @@ class Harddisk: lines = mounts.readlines() mounts.close() - cmd = "/bin/umount" + cmd = "umount" for line in lines: parts = line.strip().split(" ") @@ -177,12 +177,12 @@ class Harddisk: return (res >> 8) def createPartition(self): - cmd = 'printf "0,\n;\n;\n;\ny\n" | /sbin/sfdisk -f ' + self.disk_path + cmd = 'printf "0,\n;\n;\n;\ny\n" | sfdisk -f ' + self.disk_path res = system(cmd) return (res >> 8) def mkfs(self): - cmd = "/sbin/mkfs.ext3 " + cmd = "mkfs.ext3 " if self.diskSize() > 4 * 1024: cmd += "-T largefile " cmd += "-m0 -O dir_index " + self.partitionPath("1") @@ -202,7 +202,7 @@ class Harddisk: for line in lines: parts = line.strip().split(" ") if path.realpath(parts[0]) == self.partitionPath("1"): - cmd = "/bin/mount -t ext3 " + parts[0] + cmd = "mount -t ext3 " + parts[0] res = system(cmd) break @@ -218,7 +218,7 @@ class Harddisk: def fsck(self): # We autocorrect any failures # TODO: we could check if the fs is actually ext3 - cmd = "/sbin/fsck.ext3 -f -p " + self.partitionPath("1") + cmd = "fsck.ext3 -f -p " + self.partitionPath("1") res = system(cmd) return (res >> 8) @@ -226,7 +226,7 @@ class Harddisk: part = self.partitionPath(n) if access(part, 0): - cmd = '/bin/dd bs=512 count=3 if=/dev/zero of=' + part + cmd = 'dd bs=512 count=3 if=/dev/zero of=' + part res = system(cmd) else: res = 0 -- cgit v1.2.3 From bb4afcfbede3c7e04bc6c9213818cc5d9a60887c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 16:16:28 +0100 Subject: refs bug #429 use PATH variable to determine, if an executable file exists instead of just parsing the command string for a leading / --- lib/python/Components/Task.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index df94f8a6..86bd233e 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -370,12 +370,14 @@ class DiskspacePrecondition(Condition): class ToolExistsPrecondition(Condition): def check(self, task): import os - if task.cmd[0]=='/': - realpath = task.cmd - else: - realpath = task.cwd + '/' + task.cmd - self.realpath = realpath - return os.access(realpath, os.X_OK) + + self.realpath = task.cmd + path = os.environ.get('PATH', '').split(os.pathsep) + absolutes = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file = task.cmd: os.path.join(directory, file), path)) + if len(absolutes) > 0: + self.realpath = task.cmd[0] + return True + return False def getErrorMessage(self, task): return _("A required tool (%s) was not found.") % (self.realpath) -- cgit v1.2.3 From 46987d3de4111d3ccdbfe615b9f3f9f489941b23 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 16:18:50 +0100 Subject: fixes bug #429 remove some absolute paths --- lib/python/Components/Network.py | 2 +- lib/python/Plugins/Extensions/DVDBurn/Process.py | 36 ++++++++++++------------ 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index 29491cb0..b9da48d8 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -14,7 +14,7 @@ class Network: self.NetworkState = 0 self.DnsState = 0 self.nameservers = [] - self.ethtool_bin = "/usr/sbin/ethtool" + self.ethtool_bin = "ethtool" self.container = eConsoleAppContainer() self.Console = Console() self.LinkConsole = Console() diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 642a898d..f7f44db6 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -5,7 +5,7 @@ from Screens.MessageBox import MessageBox class png2yuvTask(Task): def __init__(self, job, inputfile, outputfile): Task.__init__(self, job, "Creating menu video") - self.setTool("/usr/bin/png2yuv") + self.setTool("png2yuv") self.args += ["-n1", "-Ip", "-f25", "-j", inputfile] self.dumpFile = outputfile self.weighting = 15 @@ -21,7 +21,7 @@ class png2yuvTask(Task): class mpeg2encTask(Task): def __init__(self, job, inputfile, outputfile): Task.__init__(self, job, "Encoding menu video") - self.setTool("/usr/bin/mpeg2enc") + self.setTool("mpeg2enc") self.args += ["-f8", "-np", "-a2", "-o", outputfile] self.inputFile = inputfile self.weighting = 25 @@ -36,7 +36,7 @@ class mpeg2encTask(Task): class spumuxTask(Task): def __init__(self, job, xmlfile, inputfile, outputfile): Task.__init__(self, job, "Muxing buttons into menu") - self.setTool("/usr/bin/spumux") + self.setTool("spumux") self.args += [xmlfile] self.inputFile = inputfile self.dumpFile = outputfile @@ -54,7 +54,7 @@ class spumuxTask(Task): class MakeFifoNode(Task): def __init__(self, job, number): Task.__init__(self, job, "Make FIFO nodes") - self.setTool("/bin/mknod") + self.setTool("mknod") nodename = self.job.workspace + "/dvd_title_%d" % number + ".mpg" self.args += [nodename, "p"] self.weighting = 10 @@ -62,14 +62,14 @@ class MakeFifoNode(Task): class LinkTS(Task): def __init__(self, job, sourcefile, link_name): Task.__init__(self, job, "Creating symlink for source titles") - self.setTool("/bin/ln") + self.setTool("ln") self.args += ["-s", sourcefile, link_name] self.weighting = 10 class CopyMeta(Task): def __init__(self, job, sourcefile): Task.__init__(self, job, "Copy title meta files") - self.setTool("/bin/cp") + self.setTool("cp") from os import listdir path, filename = sourcefile.rstrip("/").rsplit("/",1) tsfiles = listdir(path) @@ -84,7 +84,7 @@ class DemuxTask(Task): Task.__init__(self, job, "Demux video into ES") title = job.project.titles[job.i] self.global_preconditions.append(DiskspacePrecondition(title.estimatedDiskspace)) - self.setTool("/usr/bin/projectx") + self.setTool("projectx") self.args += [inputfile, "-demux", "-out", self.job.workspace ] self.end = 300 self.prog_state = 0 @@ -194,7 +194,7 @@ class MplexTask(Task): self.weighting = weighting self.demux_task = demux_task self.postconditions.append(MplexTaskPostcondition()) - self.setTool("/usr/bin/mplex") + self.setTool("mplex") self.args += ["-f8", "-o", outputfile, "-v1"] if inputfiles: self.args += inputfiles @@ -222,7 +222,7 @@ class RemoveESFiles(Task): def __init__(self, job, demux_task): Task.__init__(self, job, "Remove temp. files") self.demux_task = demux_task - self.setTool("/bin/rm") + self.setTool("rm") self.weighting = 10 def prepare(self): @@ -234,7 +234,7 @@ class DVDAuthorTask(Task): def __init__(self, job): Task.__init__(self, job, "Authoring DVD") self.weighting = 20 - self.setTool("/usr/bin/dvdauthor") + self.setTool("dvdauthor") self.CWD = self.job.workspace self.args += ["-x", self.job.workspace+"/dvdauthor.xml"] self.menupreview = job.menupreview @@ -255,7 +255,7 @@ class DVDAuthorTask(Task): class DVDAuthorFinalTask(Task): def __init__(self, job): Task.__init__(self, job, "dvdauthor finalize") - self.setTool("/usr/bin/dvdauthor") + self.setTool("dvdauthor") self.args += ["-T", "-o", self.job.workspace + "/dvd"] class WaitForResidentTasks(Task): @@ -292,7 +292,7 @@ class BurnTaskPostcondition(Condition): class BurnTask(Task): ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_FILETOOLARGE, ERROR_ISOTOOLARGE, ERROR_MINUSRWBUG, ERROR_UNKNOWN = range(10) - def __init__(self, job, extra_args=[], tool="/bin/growisofs"): + def __init__(self, job, extra_args=[], tool="growisofs"): Task.__init__(self, job, job.name) self.weighting = 500 self.end = 120 # 100 for writing, 10 for buffer flush, 10 for closing disc @@ -357,7 +357,7 @@ class BurnTask(Task): class RemoveDVDFolder(Task): def __init__(self, job): Task.__init__(self, job, "Remove temp. files") - self.setTool("/bin/rm") + self.setTool("rm") self.args += ["-rf", self.job.workspace] self.weighting = 10 @@ -882,13 +882,13 @@ class DVDJob(Job): volName = self.project.settings.name.getValue() if output == "dvd": self.name = _("Burn DVD") - tool = "/bin/growisofs" + tool = "growisofs" burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] if self.project.size/(1024*1024) > self.project.MAX_SL: burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": self.name = _("Create DVD-ISO") - tool = "/usr/bin/mkisofs" + tool = "mkisofs" isopathfile = getISOfilename(self.project.settings.isopath.getValue(), volName) burnargs = [ "-o", isopathfile ] burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, self.workspace + "/dvd" ] @@ -920,14 +920,14 @@ class DVDdataJob(Job): output = self.project.settings.output.getValue() volName = self.project.settings.name.getValue() - tool = "/bin/growisofs" + tool = "growisofs" if output == "dvd": self.name = _("Burn DVD") burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] if self.project.size/(1024*1024) > self.project.MAX_SL: burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": - tool = "/usr/bin/mkisofs" + tool = "mkisofs" self.name = _("Create DVD-ISO") isopathfile = getISOfilename(self.project.settings.isopath.getValue(), volName) burnargs = [ "-o", isopathfile ] @@ -959,5 +959,5 @@ class DVDisoJob(Job): if getSize(imagepath)/(1024*1024) > self.project.MAX_SL: burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, imagepath ] - tool = "/bin/growisofs" + tool = "growisofs" BurnTask(self, burnargs, tool) -- cgit v1.2.3 From d0509622a73b8b84edf260599b853cab72903402 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 8 Mar 2010 17:25:37 +0100 Subject: refs bug #429 - allow absolute path names in Task.py but print a warning - search in task.cwd as well --- lib/python/Components/Task.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index 86bd233e..a1e04bce 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -371,12 +371,18 @@ class ToolExistsPrecondition(Condition): def check(self, task): import os - self.realpath = task.cmd - path = os.environ.get('PATH', '').split(os.pathsep) - absolutes = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file = task.cmd: os.path.join(directory, file), path)) - if len(absolutes) > 0: - self.realpath = task.cmd[0] - return True + if task.cmd[0]=='/': + self.realpath = task.cmd + print "[Task.py][ToolExistsPrecondition] WARNING: usage of absolute paths for tasks should be avoided!" + return os.access(self.realpath, os.X_OK) + else: + self.realpath = task.cmd + path = os.environ.get('PATH', '').split(os.pathsep) + path.append(task.cwd + '/') + absolutes = filter(lambda file: os.access(file, os.X_OK), map(lambda directory, file = task.cmd: os.path.join(directory, file), path)) + if len(absolutes) > 0: + self.realpath = task.cmd[0] + return True return False def getErrorMessage(self, task): -- cgit v1.2.3 From f17c083922e7cec7eae5e290227d641e197acb4b Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Mar 2010 11:36:06 +0100 Subject: dont clear when not needed this fixes bug #474 --- lib/gui/elistboxcontent.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index 4b4b58c1..4465d84c 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -514,7 +514,7 @@ void eListboxPythonMultiContent::setSelectionClip(eRect &rect, bool update) m_listbox->entryChanged(m_cursor); } -static void clearRegionHelper(gPainter &painter, eListboxStyle *local_style, const ePoint &offset, ePyObject &pbackColor, bool cursorValid) +static void clearRegionHelper(gPainter &painter, eListboxStyle *local_style, const ePoint &offset, ePyObject &pbackColor, bool cursorValid, bool clear=true) { if (pbackColor) { @@ -536,10 +536,11 @@ static void clearRegionHelper(gPainter &painter, eListboxStyle *local_style, con else if (local_style->m_transparent_background) return; } - painter.clear(); + if (clear) + painter.clear(); } -static void clearRegionSelectedHelper(gPainter &painter, eListboxStyle *local_style, const ePoint &offset, ePyObject &pbackColorSelected, bool cursorValid) +static void clearRegionSelectedHelper(gPainter &painter, eListboxStyle *local_style, const ePoint &offset, ePyObject &pbackColorSelected, bool cursorValid, bool clear=true) { if (pbackColorSelected) { @@ -559,10 +560,11 @@ static void clearRegionSelectedHelper(gPainter &painter, eListboxStyle *local_st return; } } - painter.clear(); + if (clear) + painter.clear(); } -static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *local_style, ePyObject pforeColor, ePyObject pforeColorSelected, ePyObject pbackColor, ePyObject pbackColorSelected, int selected, gRegion &rc, eRect &sel_clip, const ePoint &offset, bool cursorValid) +static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *local_style, ePyObject pforeColor, ePyObject pforeColorSelected, ePyObject pbackColor, ePyObject pbackColorSelected, int selected, gRegion &rc, eRect &sel_clip, const ePoint &offset, bool cursorValid, bool clear=true) { if (selected && sel_clip.valid()) { @@ -571,7 +573,7 @@ static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *l { painter.clip(part); style.setStyle(painter, eWindowStyle::styleListboxNormal); - clearRegionHelper(painter, local_style, offset, pbackColor, cursorValid); + clearRegionHelper(painter, local_style, offset, pbackColor, cursorValid, clear); painter.clippop(); selected = 0; } @@ -580,7 +582,7 @@ static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *l { painter.clip(part); style.setStyle(painter, eWindowStyle::styleListboxSelected); - clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected, cursorValid); + clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected, cursorValid, clear); painter.clippop(); selected = 1; } @@ -588,14 +590,14 @@ static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *l else if (selected) { style.setStyle(painter, eWindowStyle::styleListboxSelected); - clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected, cursorValid); + clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected, cursorValid, clear); if (local_style && local_style->m_selection) painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST); } else { style.setStyle(painter, eWindowStyle::styleListboxNormal); - clearRegionHelper(painter, local_style, offset, pbackColor, cursorValid); + clearRegionHelper(painter, local_style, offset, pbackColor, cursorValid, clear); } if (selected) @@ -818,7 +820,8 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c { gRegion rc(rect); - clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip, offset, cursorValid); + bool mustClear = (selected && pbackColorSelected) || (!selected && pbackColor); + clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip, offset, cursorValid, mustClear); } painter.setFont(m_font[fnt]); @@ -921,7 +924,8 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c { gRegion rc(rect); - clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip, offset, cursorValid); + bool mustClear = (selected && pbackColorSelected) || (!selected && pbackColor); + clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip, offset, cursorValid, mustClear); } // border @@ -995,7 +999,8 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c { gRegion rc(rect); - clearRegion(painter, style, local_style, ePyObject(), ePyObject(), pbackColor, pbackColorSelected, selected, rc, sel_clip, offset, cursorValid); + bool mustClear = (selected && pbackColorSelected) || (!selected && pbackColor); + clearRegion(painter, style, local_style, ePyObject(), ePyObject(), pbackColor, pbackColorSelected, selected, rc, sel_clip, offset, cursorValid, mustClear); } painter.blit(pixmap, rect.topLeft(), rect, (type == TYPE_PIXMAP_ALPHATEST) ? gPainter::BT_ALPHATEST : (type == TYPE_PIXMAP_ALPHABLEND) ? gPainter::BT_ALPHABLEND : 0); -- cgit v1.2.3 From a6f88303d6efb4e6669a6a491bec4cf3e751337a Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 11 Mar 2010 13:54:33 +0100 Subject: lib/python/Plugins/Extensions/DVDPlayer/plugin.py: smaller fontsize for "DVD Player" text in LCD/Oled display --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 6e4d9cc6..e092e82f 100755 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -93,7 +93,7 @@ class DVDSummary(Screen): Name - + Position -- cgit v1.2.3 From bb61a8a6ff402b248d1af83d138996259fb4641f Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 11 Mar 2010 14:29:43 +0100 Subject: refs bug #429 change "mkisofs" to "genisoimage" since it is only a link to genisoimage in oe 1.5 and the link is'n set in oe 1.6 --- lib/python/Plugins/Extensions/DVDBurn/Process.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index f7f44db6..b64541b6 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -888,7 +888,7 @@ class DVDJob(Job): burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": self.name = _("Create DVD-ISO") - tool = "mkisofs" + tool = "genisoimage" isopathfile = getISOfilename(self.project.settings.isopath.getValue(), volName) burnargs = [ "-o", isopathfile ] burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, self.workspace + "/dvd" ] @@ -927,7 +927,7 @@ class DVDdataJob(Job): if self.project.size/(1024*1024) > self.project.MAX_SL: burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": - tool = "mkisofs" + tool = "genisoimage" self.name = _("Create DVD-ISO") isopathfile = getISOfilename(self.project.settings.isopath.getValue(), volName) burnargs = [ "-o", isopathfile ] -- cgit v1.2.3 From 72bc8cf59d2f2192bcf1491758169a77b106190a Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 16 Feb 2010 14:53:12 +0100 Subject: fixes bug #445 show diseqc settings in NimSelection --- data/skin_default.xml | 6 +++--- lib/python/Screens/Satconfig.py | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/data/skin_default.xml b/data/skin_default.xml index 56d53dc3..0114349b 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -626,14 +626,14 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - + {"template": [ MultiContentEntryText(pos = (10, 5), size = (360, 30), flags = RT_HALIGN_LEFT, text = 1), # index 1 is the nim name, - MultiContentEntryText(pos = (50, 30), size = (320, 30), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings, + MultiContentEntryText(pos = (50, 30), size = (320, 50), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings, ], "fonts": [gFont("Regular", 20), gFont("Regular", 15)], - "itemHeight": 70 + "itemHeight": 80 } diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 047bde23..647307d0 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -498,17 +498,25 @@ class NimSelection(Screen): text = _("nothing connected") elif nimConfig.configMode.value == "simple": if nimConfig.diseqcMode.value in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): - text = _("Sats") + ": " + text = {"single": _("Single"), "toneburst_a_b": _("Toneburst A/B"), "diseqc_a_b": _("DiSEqC A/B"), "diseqc_a_b_c_d": _("DiSEqC A/B/C/D")}[nimConfig.diseqcMode.value] + "\n" + text += _("Sats") + ": " + satnames = [] if nimConfig.diseqcA.orbital_position != 3601: - text += nimmanager.getSatName(int(nimConfig.diseqcA.value)) + satnames.append(nimmanager.getSatName(int(nimConfig.diseqcA.value))) if nimConfig.diseqcMode.value in ("toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): if nimConfig.diseqcB.orbital_position != 3601: - text += "," + nimmanager.getSatName(int(nimConfig.diseqcB.value)) + satnames.append(nimmanager.getSatName(int(nimConfig.diseqcB.value))) if nimConfig.diseqcMode.value == "diseqc_a_b_c_d": if nimConfig.diseqcC.orbital_position != 3601: - text += "," + nimmanager.getSatName(int(nimConfig.diseqcC.value)) + satnames.append(nimmanager.getSatName(int(nimConfig.diseqcC.value))) if nimConfig.diseqcD.orbital_position != 3601: - text += "," + nimmanager.getSatName(int(nimConfig.diseqcD.value)) + satnames.append(nimmanager.getSatName(int(nimConfig.diseqcD.value))) + if len(satnames) <= 2: + text += ", ".join(satnames) + elif len(satnames) > 2: + # we need a newline here, since multi content lists don't support automtic line wrapping + text += ", ".join(satnames[:2]) + ",\n" + text += " " + ", ".join(satnames[2:]) elif nimConfig.diseqcMode.value == "positioner": text = _("Positioner") + ":" if nimConfig.positionerMode.value == "usals": -- cgit v1.2.3 From 83c9fa8a8b23dd75ac7941955d4528d9b9b64cfe Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 13 Mar 2010 14:13:20 +0100 Subject: fixes bug #342 change action map help text for long info button press --- lib/python/Screens/InfoBarGenerics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 87631086..b3bcc4a0 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -487,7 +487,7 @@ class InfoBarEPG: self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", { "showEventInfo": (self.openEventView, _("show EPG...")), - "showEventInfoPlugin": (self.showEventInfoPlugins, _("show single service EPG...")), + "showEventInfoPlugin": (self.showEventInfoPlugins, _("list of EPG views...")), "showInfobarOrEpgWhenInfobarAlreadyVisible": self.showEventInfoWhenNotVisible, }) -- cgit v1.2.3 From 9f8056cd2f459c5221e4af6e37b75bc671f14e8d Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 13 Mar 2010 14:57:54 +0100 Subject: fixes bug #343 change "nothing connected" to "not configured" to avoid confusion --- lib/python/Screens/Satconfig.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 647307d0..7ba3a134 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -58,7 +58,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): def createConfigMode(self): if self.nim.isCompatible("DVB-S"): - choices = { "nothing": _("nothing connected"), + choices = { "nothing": _("not configured"), "simple": _("simple"), "advanced": _("advanced")} #if len(nimmanager.getNimListOfType(nimmanager.getNimType(self.slotid), exception = x)) > 0: @@ -495,7 +495,7 @@ class NimSelection(Screen): "satposdepends": _("second cable of motorized LNB") } [nimConfig.configMode.value] text += " " + _("Tuner") + " " + ["A", "B", "C", "D"][int(nimConfig.connectedTo.value)] elif nimConfig.configMode.value == "nothing": - text = _("nothing connected") + text = _("not configured") elif nimConfig.configMode.value == "simple": if nimConfig.diseqcMode.value in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): text = {"single": _("Single"), "toneburst_a_b": _("Toneburst A/B"), "diseqc_a_b": _("DiSEqC A/B"), "diseqc_a_b_c_d": _("DiSEqC A/B/C/D")}[nimConfig.diseqcMode.value] + "\n" -- cgit v1.2.3 From bc40d49c3f56137b65986cca012e6792ad1fdc33 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 15 Mar 2010 11:17:48 +0100 Subject: use glib function to escape file uri in mediaplayer --- lib/service/servicemp3.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index ccc5fbaf..0b2ac9d4 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -303,11 +303,11 @@ eServiceMP3::eServiceMP3(eServiceReference ref) if ( ret == -1 ) // this is a "REAL" VCD uri = g_strdup_printf ("vcd://"); else - uri = g_strdup_printf ("file://%s", filename); + uri = g_filename_to_uri(filename, NULL, NULL); } else - uri = g_strdup_printf ("file://%s", filename); + uri = g_filename_to_uri(filename, NULL, NULL); eDebug("eServiceMP3::playbin2 uri=%s", uri); @@ -341,9 +341,8 @@ eServiceMP3::eServiceMP3(eServiceReference ref) struct stat buffer; if (stat(srt_filename, &buffer) == 0) { - std::string suburi = "file://" + (std::string)srt_filename; - eDebug("eServiceMP3::subtitle uri: %s",suburi.c_str()); - g_object_set (G_OBJECT (m_gst_playbin), "suburi", suburi.c_str(), NULL); + eDebug("eServiceMP3::subtitle uri: %s", g_filename_to_uri(srt_filename, NULL, NULL)); + g_object_set (G_OBJECT (m_gst_playbin), "suburi", g_filename_to_uri(srt_filename, NULL, NULL), NULL); subtitleStream subs; subs.type = stSRT; subs.language_code = std::string("und"); -- cgit v1.2.3 From 20894cf99fd0ab6ecd6e3cf0aebc5b02c4193903 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 15 Mar 2010 12:14:19 +0100 Subject: [DVDBurn] allow burning of recordings that are currently playing in the background, fixes bug 367 --- lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py index 61152e8a..06ed1bab 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py @@ -52,6 +52,8 @@ class TitleCutter(CutListEditor): CutListEditor.grabFrame(self) def exit(self): + if self.t.VideoType == -1: + self.getPMTInfo() self.checkAndGrabThumb() self.session.nav.stopService() self.close(self.cut_list[:]) -- cgit v1.2.3 From fd6a97a1e97091b733add33b46ba746a467b21fa Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 17 Mar 2010 18:18:10 +0100 Subject: update blacklist to detect transponders with duplicate tsid/onid combinations add possibility to add a /etc/enigma2/scan_tp_valid_check.py to add more tsid/onid valid rules this fixes bug #413 --- lib/dvb/scan.cpp | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++----- lib/dvb/scan.h | 2 ++ 2 files changed, 92 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index fd29617a..b37aa714 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #define SCAN_eDebug(x...) do { if (m_scan_debug) eDebug(x); } while(0) @@ -23,37 +24,118 @@ eDVBScan::eDVBScan(iDVBChannel *channel, bool usePAT, bool debug) :m_channel(channel), m_channel_state(iDVBChannel::state_idle) ,m_ready(0), m_ready_all(usePAT ? (readySDT|readyPAT) : readySDT) ,m_pmt_running(false), m_abort_current_pmt(false), m_flags(0) - ,m_usePAT(usePAT), m_scan_debug(debug) + ,m_usePAT(usePAT), m_scan_debug(debug), m_show_add_tsid_onid_check_failed_msg(true) { if (m_channel->getDemux(m_demux)) SCAN_eDebug("scan: failed to allocate demux!"); m_channel->connectStateChange(slot(*this, &eDVBScan::stateChange), m_stateChanged_connection); + FILE *f = fopen("/etc/enigma2/scan_tp_valid_check.py", "r"); + if (f) + { + char code[16384]; + size_t rd = fread(code, 1, 16383, f); + if (rd) + { + code[rd]=0; + m_additional_tsid_onid_check_func = Py_CompileString(code, "/etc/enigma2/scan_tp_valid_check.py", Py_file_input); + } + fclose(f); + } } eDVBScan::~eDVBScan() { + if (m_additional_tsid_onid_check_func) + Py_DECREF(m_additional_tsid_onid_check_func); } int eDVBScan::isValidONIDTSID(int orbital_position, eOriginalNetworkID onid, eTransportStreamID tsid) { + int ret; switch (onid.get()) { case 0: case 0x1111: - return 0; + ret=0; + break; case 0x13E: // workaround for 11258H and 11470V on hotbird with same ONID/TSID (0x13E/0x578) - return orbital_position != 130 || tsid != 0x578; + ret = orbital_position != 130 || tsid != 0x578; + break; case 1: - return orbital_position == 192; + ret = orbital_position == 192; + break; case 0x00B1: - return tsid != 0x00B0; + ret = tsid != 0x00B0; + break; case 0x00eb: - return tsid != 0x4321; + ret = tsid != 0x4321; + break; case 0x0002: - return abs(orbital_position-282) < 6; + ret = abs(orbital_position-282) < 6 && tsid != 2019; + // 12070H and 10936V have same tsid/onid.. but even the same services are provided + break; + case 0x2000: + ret = tsid != 0x1000; + break; + case 0x5E: // Sirius 4.8E 12322V and 12226H + ret = abs(orbital_position-48) < 3 && tsid != 1; + break; + case 10100: // Eutelsat W7 36.0E 11644V and 11652V + ret = orbital_position != 360 || tsid != 10187; + break; + case 42: // Tuerksat 42.0E + ret = orbital_position != 420 || ( + tsid != 8 && // 11830V 12729V + tsid != 5 && // 12679V 12685H + tsid != 2 && // 11096V 12015H + tsid != 55); // 11996V 11716V + break; + case 100: // Intelsat 10 68.5E 3808V 3796V 4012V, Amos 4.0W 10723V 11571H + ret = (orbital_position != 685 && orbital_position != 3560) || tsid != 1; + break; + case 70: // Thor 0.8W 11862H 12341V + ret = abs(orbital_position-3592) < 3 && tsid != 46; + break; + case 32: // NSS 806 (40.5W) 4059R, 3774L + ret = orbital_position != 3195 || tsid != 21; + break; default: - return onid.get() < 0xFF00; + ret = onid.get() < 0xFF00; + break; + } + if (ret && m_additional_tsid_onid_check_func) + { + bool failed = true; + ePyObject dict = PyDict_New(); + extern void PutToDict(ePyObject &, const char *, long); + PyDict_SetItemString(dict, "__builtins__", PyEval_GetBuiltins()); + PutToDict(dict, "orbpos", orbital_position); + PutToDict(dict, "tsid", tsid.get()); + PutToDict(dict, "onid", onid.get()); + ePyObject r = PyEval_EvalCode((PyCodeObject*)(PyObject*)m_additional_tsid_onid_check_func, dict, dict); + if (r) + { + ePyObject o = PyDict_GetItemString(dict, "ret"); + if (o) + { + if (PyInt_Check(o)) + { + ret = PyInt_AsLong(o); + failed = false; + } + } + Py_DECREF(r); + } + if (failed && m_show_add_tsid_onid_check_failed_msg) + { + eDebug("execing /etc/enigma2/scan_tp_valid_check failed!\n" + "usable global variables in scan_tp_valid_check.py are 'orbpos', 'tsid', 'onid'\n" + "the return value must be stored in a global var named 'ret'"); + m_show_add_tsid_onid_check_failed_msg=false; + } + Py_DECREF(dict); } + return ret; } eDVBNamespace eDVBScan::buildNamespace(eOriginalNetworkID onid, eTransportStreamID tsid, unsigned long hash) diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index 2f3ac34a..8f64abe5 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -92,6 +92,8 @@ class eDVBScan: public Object, public iObject int m_flags; bool m_usePAT; bool m_scan_debug; + ePyObject m_additional_tsid_onid_check_func; + bool m_show_add_tsid_onid_check_failed_msg; public: eDVBScan(iDVBChannel *channel, bool usePAT=true, bool debug=true ); ~eDVBScan(); -- cgit v1.2.3 From 4d01a8b971e7631cf999d4773891cce657b9aa27 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 24 Mar 2010 11:29:50 +0100 Subject: add possibility to separately set fan voltage and fan pwm for standby and normal run when a recording starts in standby switch to normal mode and vice versa this fixes bug #430 (thx to Dr.Best) --- lib/python/Components/FanControl.py | 43 ++++++++++++++++++---- .../Plugins/SystemPlugins/TempFanControl/plugin.py | 22 +++++++---- 2 files changed, 50 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py index cee0523e..a993c396 100644 --- a/lib/python/Components/FanControl.py +++ b/lib/python/Components/FanControl.py @@ -3,6 +3,9 @@ import os from Components.config import config, ConfigSubList, ConfigSubsection, ConfigSlider from Tools.BoundFunction import boundFunction +import NavigationInstance +from enigma import iRecordableService + class FanControl: # ATM there's only support for one fan def __init__(self): @@ -13,18 +16,42 @@ class FanControl: self.createConfig() config.misc.standbyCounter.addNotifier(self.standbyCounterChanged, initial_call = False) - def leaveStandby(self): + def setVoltage_PWM(self): for fanid in range(self.getFanCount()): cfg = self.getConfig(fanid) self.setVoltage(fanid, cfg.vlt.value) self.setPWM(fanid, cfg.pwm.value) + print "[FanControl]: setting fan values: fanid = %d, voltage = %d, pwm = %d" % (fanid, cfg.vlt.value, cfg.pwm.value) + + def setVoltage_PWM_Standby(self): + for fanid in range(self.getFanCount()): + cfg = self.getConfig(fanid) + self.setVoltage(fanid, cfg.vlt_standby.value) + self.setPWM(fanid, cfg.pwm_standby.value) + print "[FanControl]: setting fan values (standby mode): fanid = %d, voltage = %d, pwm = %d" % (fanid, cfg.vlt_standby.value, cfg.pwm_standby.value) + + def getRecordEvent(self, recservice, event): + recordings = len(NavigationInstance.instance.getRecordings()) + if event == iRecordableService.evEnd: + if recordings == 0: + self.setVoltage_PWM_Standby() + elif event == iRecordableService.evStart: + if recordings == 1: + self.setVoltage_PWM() + + def leaveStandby(self): + NavigationInstance.instance.record_event.remove(self.getRecordEvent) + recordings = NavigationInstance.instance.getRecordings() + if not recordings: + self.setVoltage_PWM() def standbyCounterChanged(self, configElement): from Screens.Standby import inStandby inStandby.onClose.append(self.leaveStandby) - for fanid in range(self.getFanCount()): - self.setVoltage(fanid, 0) - self.setPWM(fanid, 0) + recordings = NavigationInstance.instance.getRecordings() + NavigationInstance.instance.record_event.append(self.getRecordEvent) + if not recordings: + self.setVoltage_PWM_Standby() def createConfig(self): def setVlt(fancontrol, fanid, configElement): @@ -35,12 +62,14 @@ class FanControl: config.fans = ConfigSubList() for fanid in range(self.getFanCount()): fan = ConfigSubsection() - fan.vlt = ConfigSlider(default = 16, increment = 5, limits = (0, 255)) + fan.vlt = ConfigSlider(default = 15, increment = 5, limits = (0, 255)) fan.pwm = ConfigSlider(default = 0, increment = 5, limits = (0, 255)) + fan.vlt_standby = ConfigSlider(default = 5, increment = 5, limits = (0, 255)) + fan.pwm_standby = ConfigSlider(default = 0, increment = 5, limits = (0, 255)) fan.vlt.addNotifier(boundFunction(setVlt, self, fanid)) fan.pwm.addNotifier(boundFunction(setPWM, self, fanid)) config.fans.append(fan) - + def getConfig(self, fanid): return config.fans[fanid] @@ -85,4 +114,4 @@ class FanControl: f.write("%x" % value) f.close() -fancontrol = FanControl() \ No newline at end of file +fancontrol = FanControl() diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 38e343f9..c8af9cdd 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -12,7 +12,7 @@ from Components.FanControl import fancontrol class TempFanControl(Screen, ConfigListScreen): skin = """ - + @@ -22,7 +22,7 @@ class TempFanControl(Screen, ConfigListScreen): - + @@ -90,7 +90,7 @@ class TempFanControl(Screen, ConfigListScreen): """ - + def __init__(self, session, args = None): Screen.__init__(self, session) @@ -125,6 +125,9 @@ class TempFanControl(Screen, ConfigListScreen): for count in range(fancontrol.getFanCount()): self.list.append(getConfigListEntry(_("Fan %d Voltage") % (count + 1), fancontrol.getConfig(count).vlt)) self.list.append(getConfigListEntry(_("Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm)) + self.list.append(getConfigListEntry(_("Standby Fan %d Voltage") % (count + 1), fancontrol.getConfig(count).vlt_standby)) + self.list.append(getConfigListEntry(_("Standby Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm_standby)) + ConfigListScreen.__init__(self, self.list, session = self.session) #self["config"].list = self.list #self["config"].setList(self.list) @@ -136,28 +139,31 @@ class TempFanControl(Screen, ConfigListScreen): "red": self.revert, "green": self.save }, -1) - + def save(self): for count in range(fancontrol.getFanCount()): fancontrol.getConfig(count).vlt.save() fancontrol.getConfig(count).pwm.save() + fancontrol.getConfig(count).vlt_standby.save() + fancontrol.getConfig(count).pwm_standby.save() self.close() - + def revert(self): for count in range(fancontrol.getFanCount()): fancontrol.getConfig(count).vlt.load() fancontrol.getConfig(count).pwm.load() + fancontrol.getConfig(count).vlt_standby.load() + fancontrol.getConfig(count).pwm_standby.load() self.close() - + def main(session, **kwargs): session.open(TempFanControl) def startMenu(menuid): if menuid != "system": return [] - return [(_("Temperature and Fan control"), main, "tempfancontrol", 80)] def Plugins(**kwargs): return PluginDescriptor(name = "Temperature and Fan control", description = _("Temperature and Fan control"), where = PluginDescriptor.WHERE_MENU, fnc = startMenu) - \ No newline at end of file + -- cgit v1.2.3 From 1398385cff4a4fc4d770afa1e9d1f6d560431b23 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 24 Mar 2010 15:17:39 +0100 Subject: add support for event progressbar per service in channelselection default this is disabled.. you can enable it in the Usage config this fixes bug #486 (patch by Dr.Best) --- data/setup.xml | 1 + data/skin_default/Makefile.am | 1 + data/skin_default/celserviceeventprogressbar.png | Bin 0 -> 1056 bytes lib/python/Components/ServiceList.py | 29 ++++++++-- lib/python/Components/UsageConfig.py | 2 + lib/service/listboxservice.cpp | 65 ++++++++++++++++++++--- lib/service/listboxservice.h | 6 +++ 7 files changed, 93 insertions(+), 11 deletions(-) create mode 100644 data/skin_default/celserviceeventprogressbar.png mode change 100755 => 100644 lib/python/Components/ServiceList.py (limited to 'lib') diff --git a/data/setup.xml b/data/setup.xml index 92bbc0f1..705eaf33 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -34,6 +34,7 @@ config.usage.on_short_powerpress config.usage.infobar_timeout config.usage.output_12V + config.usage.show_event_progress_in_servicelist config.usage.show_infobar_on_zap config.usage.show_infobar_on_skip config.usage.show_infobar_on_event_change diff --git a/data/skin_default/Makefile.am b/data/skin_default/Makefile.am index 85bb800d..6038c2e9 100755 --- a/data/skin_default/Makefile.am +++ b/data/skin_default/Makefile.am @@ -23,6 +23,7 @@ dist_install_DATA = \ b_tl.png \ b_t.png \ b_tr.png \ + celserviceeventprogressbar.png \ div-h.png \ div-v.png \ epg_more.png \ diff --git a/data/skin_default/celserviceeventprogressbar.png b/data/skin_default/celserviceeventprogressbar.png new file mode 100644 index 00000000..7bf5c658 Binary files /dev/null and b/data/skin_default/celserviceeventprogressbar.png differ diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py old mode 100755 new mode 100644 index 6095812a..3452e27d --- a/lib/python/Components/ServiceList.py +++ b/lib/python/Components/ServiceList.py @@ -7,6 +7,8 @@ from Tools.LoadPixmap import LoadPixmap from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN +from Components.config import config + class ServiceList(HTMLComponent, GUIComponent): MODE_NORMAL = 0 MODE_FAVOURITES = 1 @@ -62,6 +64,18 @@ class ServiceList(HTMLComponent, GUIComponent): self.l.setColor(eListboxServiceContent.markedBackgroundSelected, parseColor(value)) elif attrib == "foregroundColorServiceNotAvail": self.l.setColor(eListboxServiceContent.serviceNotAvail, parseColor(value)) + elif attrib == "colorEventProgressbar": + self.l.setColor(eListboxServiceContent.serviceEventProgressbarColor, parseColor(value)) + elif attrib == "colorEventProgressbarSelected": + self.l.setColor(eListboxServiceContent.serviceEventProgressbarColorSelected, parseColor(value)) + elif attrib == "colorEventProgressbarBorder": + self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColor, parseColor(value)) + elif attrib == "colorEventProgressbarBorderSelected": + self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColorSelected, parseColor(value)) + elif attrib == "picServiceEventProgressbar": + pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, value)) + if pic: + self.l.setPixmap(self.l.picServiceEventProgressbar, pic) elif attrib == "serviceItemHeight": self.ItemHeight = int(value) elif attrib == "serviceNameFont": @@ -213,17 +227,24 @@ class ServiceList(HTMLComponent, GUIComponent): def setMode(self, mode): self.mode = mode + self.l.setItemHeight(self.ItemHeight) + self.l.setVisualMode(eListboxServiceContent.visModeComplex) if mode == self.MODE_NORMAL: - self.l.setItemHeight(self.ItemHeight) - self.l.setVisualMode(eListboxServiceContent.visModeComplex) + if config.usage.show_event_progress_in_servicelist.value: + self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 52, self.ItemHeight)) + else: + self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementPosition(self.l.celServiceName, eRect(0, 0, self.instance.size().width(), self.ItemHeight)) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) else: - self.l.setItemHeight(self.ItemHeight) - self.l.setVisualMode(eListboxServiceContent.visModeComplex) + if config.usage.show_event_progress_in_servicelist.value: + self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(60, 0, 52, self.ItemHeight)) + else: + self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(60, 0, 0, 0)) self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont) self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, 50, self.ItemHeight)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementPosition(self.l.celServiceName, eRect(60, 0, self.instance.size().width()-60, self.ItemHeight)) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) + diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 21478e90..b86c1a13 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -68,6 +68,8 @@ def InitUsageConfig(): ("4", "DVB-T/-C/-S"), ("5", "DVB-T/-S/-C") ]) + config.usage.show_event_progress_in_servicelist = ConfigYesNo(default = False) + config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False) config.usage.show_message_when_recording_starts = ConfigYesNo(default = True) diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index 05aaf731..faee1ee6 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -526,7 +526,9 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const ePtr service_info; m_service_center->info(*m_cursor, service_info); eServiceReference ref = *m_cursor; - bool isPlayable = !(ref.flags & eServiceReference::isDirectory || ref.flags & eServiceReference::isMarker); + bool isMarker = ref.flags & eServiceReference::isMarker; + bool isPlayable = !(ref.flags & eServiceReference::isDirectory || isMarker); + ePtr evt; if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore)) { @@ -539,7 +541,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const if (selected && local_style && local_style->m_selection) painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST); - int xoffset=0; // used as offset when painting the folder/marker symbol + int xoffset=0; // used as offset when painting the folder/marker symbol or the serviceevent progress for (int e = 0; e < celElements; ++e) { @@ -583,8 +585,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const } case celServiceInfo: { - ePtr evt; - if ( isPlayable && service_info && !service_info->getEvent(*m_cursor, evt) ) + if ( isPlayable && evt ) { std::string name = evt->getEventName(); if (!name.length()) @@ -608,9 +609,9 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const { eRect bbox = para->getBoundBox(); int name_width = bbox.width()+8; - m_element_position[celServiceInfo].setLeft(area.left()+name_width); + m_element_position[celServiceInfo].setLeft(area.left()+name_width+xoffs); m_element_position[celServiceInfo].setTop(area.top()); - m_element_position[celServiceInfo].setWidth(area.width()-name_width); + m_element_position[celServiceInfo].setWidth(area.width()-(name_width+xoffs)); m_element_position[celServiceInfo].setHeight(area.height()); } @@ -678,8 +679,58 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const painter.clippop(); } } + else if (e == celServiceEventProgressbar) + { + int p = celServiceEventProgressbar; + eRect area = m_element_position[p]; + if (area.width() > 0 && (isPlayable || isMarker)) + { + + if ( isPlayable && service_info && !service_info->getEvent(*m_cursor, evt) ) + { + if (!selected && m_color_set[serviceEventProgressbarBorderColor]) + painter.setForegroundColor(m_color[serviceEventProgressbarBorderColor]); + else if (selected && m_color_set[serviceEventProgressbarBorderColorSelected]) + painter.setForegroundColor(m_color[serviceEventProgressbarBorderColorSelected]); + + int border = 1; + int progressH = 6; + int progressX = area.left() + offset.x(); + int progressW = area.width() - 2 * border; + int progressT = offset.y() + (m_itemsize.height() - progressH - 2*border) / 2; + + // paint progressbar frame + painter.fill(eRect(progressX, progressT, area.width(), border)); + painter.fill(eRect(progressX, progressT + border, border, progressH)); + painter.fill(eRect(progressX, progressT + progressH + border, area.width(), border)); + painter.fill(eRect(progressX + area.width() - border, progressT + border, border, progressH)); + + // calculate value + time_t now = time(0); + int value = progressW * (now - evt->getBeginTime()) / evt->getDuration(); + + eRect tmp = eRect(progressX + border, progressT + border, value, progressH); + ePtr &pixmap = m_pixmaps[picServiceEventProgressbar]; + if (pixmap) + { + area.moveBy(offset); + painter.clip(area); + painter.blit(pixmap, ePoint(progressX + border, progressT + border), tmp, gPainter::BT_ALPHATEST); + painter.clippop(); + } + else + { + if (!selected && m_color_set[serviceEventProgressbarColor]) + painter.setForegroundColor(m_color[serviceEventProgressbarColor]); + else if (selected && m_color_set[serviceEventProgressbarColorSelected]) + painter.setForegroundColor(m_color[serviceEventProgressbarColorSelected]); + painter.fill(tmp); + } + } + xoffset = area.width() + 10; + } + } } - if (selected && (!local_style || !local_style->m_selection)) style.drawFrame(painter, eRect(offset, m_itemsize), eWindowStyle::frameListboxEntry); } diff --git a/lib/service/listboxservice.h b/lib/service/listboxservice.h index 5228a2f2..982d7e14 100644 --- a/lib/service/listboxservice.h +++ b/lib/service/listboxservice.h @@ -49,6 +49,7 @@ public: celServiceNumber, celMarkerPixmap, celFolderPixmap, + celServiceEventProgressbar, celServiceName, celServiceTypePixmap, celServiceInfo, // "now" event @@ -62,6 +63,7 @@ public: picServiceGroup, picFolder, picMarker, + picServiceEventProgressbar, picElements }; @@ -84,6 +86,10 @@ public: markedBackground, markedBackgroundSelected, serviceNotAvail, + serviceEventProgressbarColor, + serviceEventProgressbarColorSelected, + serviceEventProgressbarBorderColor, + serviceEventProgressbarBorderColorSelected, colorElements }; -- cgit v1.2.3 From 1b1d9c764bbc0dbbeafbe45c1b2c6f5a91942704 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 24 Mar 2010 15:38:19 +0100 Subject: lib/service/listboxservice.cpp: fix no more visible event descriptions in channelselection since event progress support --- lib/service/listboxservice.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index faee1ee6..9de88c14 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -585,7 +585,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const } case celServiceInfo: { - if ( isPlayable && evt ) + if ( isPlayable && (evt || !service_info->getEvent(*m_cursor, evt)) ) { std::string name = evt->getEventName(); if (!name.length()) @@ -685,7 +685,6 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const eRect area = m_element_position[p]; if (area.width() > 0 && (isPlayable || isMarker)) { - if ( isPlayable && service_info && !service_info->getEvent(*m_cursor, evt) ) { if (!selected && m_color_set[serviceEventProgressbarBorderColor]) -- cgit v1.2.3 From ecb8af1618dc7f2b2be41ca2bd1667aa693d777a Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 24 Mar 2010 20:54:42 +0100 Subject: lib/service/listboxservice.cpp: small fix --- lib/service/listboxservice.cpp | 92 +++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 45 deletions(-) (limited to 'lib') diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index 9de88c14..f8ac0ff2 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -528,6 +528,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const eServiceReference ref = *m_cursor; bool isMarker = ref.flags & eServiceReference::isMarker; bool isPlayable = !(ref.flags & eServiceReference::isDirectory || isMarker); + bool paintProgress = false; ePtr evt; if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore)) @@ -585,7 +586,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const } case celServiceInfo: { - if ( isPlayable && (evt || !service_info->getEvent(*m_cursor, evt)) ) + if ( isPlayable && !service_info->getEvent(*m_cursor, evt) ) { std::string name = evt->getEventName(); if (!name.length()) @@ -681,59 +682,60 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const } else if (e == celServiceEventProgressbar) { - int p = celServiceEventProgressbar; - eRect area = m_element_position[p]; + eRect area = m_element_position[celServiceEventProgressbar]; if (area.width() > 0 && (isPlayable || isMarker)) { - if ( isPlayable && service_info && !service_info->getEvent(*m_cursor, evt) ) - { - if (!selected && m_color_set[serviceEventProgressbarBorderColor]) - painter.setForegroundColor(m_color[serviceEventProgressbarBorderColor]); - else if (selected && m_color_set[serviceEventProgressbarBorderColorSelected]) - painter.setForegroundColor(m_color[serviceEventProgressbarBorderColorSelected]); - - int border = 1; - int progressH = 6; - int progressX = area.left() + offset.x(); - int progressW = area.width() - 2 * border; - int progressT = offset.y() + (m_itemsize.height() - progressH - 2*border) / 2; - - // paint progressbar frame - painter.fill(eRect(progressX, progressT, area.width(), border)); - painter.fill(eRect(progressX, progressT + border, border, progressH)); - painter.fill(eRect(progressX, progressT + progressH + border, area.width(), border)); - painter.fill(eRect(progressX + area.width() - border, progressT + border, border, progressH)); - - // calculate value - time_t now = time(0); - int value = progressW * (now - evt->getBeginTime()) / evt->getDuration(); - - eRect tmp = eRect(progressX + border, progressT + border, value, progressH); - ePtr &pixmap = m_pixmaps[picServiceEventProgressbar]; - if (pixmap) - { - area.moveBy(offset); - painter.clip(area); - painter.blit(pixmap, ePoint(progressX + border, progressT + border), tmp, gPainter::BT_ALPHATEST); - painter.clippop(); - } - else - { - if (!selected && m_color_set[serviceEventProgressbarColor]) - painter.setForegroundColor(m_color[serviceEventProgressbarColor]); - else if (selected && m_color_set[serviceEventProgressbarColorSelected]) - painter.setForegroundColor(m_color[serviceEventProgressbarColorSelected]); - painter.fill(tmp); - } - } + // we schedule it to paint it as last element.. so we dont need to reset fore/background color + paintProgress = isPlayable; xoffset = area.width() + 10; } } } if (selected && (!local_style || !local_style->m_selection)) style.drawFrame(painter, eRect(offset, m_itemsize), eWindowStyle::frameListboxEntry); + if (paintProgress && evt) + { + eRect area = m_element_position[celServiceEventProgressbar]; + if (!selected && m_color_set[serviceEventProgressbarBorderColor]) + painter.setForegroundColor(m_color[serviceEventProgressbarBorderColor]); + else if (selected && m_color_set[serviceEventProgressbarBorderColorSelected]) + painter.setForegroundColor(m_color[serviceEventProgressbarBorderColorSelected]); + + int border = 1; + int progressH = 6; + int progressX = area.left() + offset.x(); + int progressW = area.width() - 2 * border; + int progressT = offset.y() + (m_itemsize.height() - progressH - 2*border) / 2; + + // paint progressbar frame + painter.fill(eRect(progressX, progressT, area.width(), border)); + painter.fill(eRect(progressX, progressT + border, border, progressH)); + painter.fill(eRect(progressX, progressT + progressH + border, area.width(), border)); + painter.fill(eRect(progressX + area.width() - border, progressT + border, border, progressH)); + + // calculate value + time_t now = time(0); + int value = progressW * (now - evt->getBeginTime()) / evt->getDuration(); + + eRect tmp = eRect(progressX + border, progressT + border, value, progressH); + ePtr &pixmap = m_pixmaps[picServiceEventProgressbar]; + if (pixmap) + { + area.moveBy(offset); + painter.clip(area); + painter.blit(pixmap, ePoint(progressX + border, progressT + border), tmp, gPainter::BT_ALPHATEST); + painter.clippop(); + } + else + { + if (!selected && m_color_set[serviceEventProgressbarColor]) + painter.setForegroundColor(m_color[serviceEventProgressbarColor]); + else if (selected && m_color_set[serviceEventProgressbarColorSelected]) + painter.setForegroundColor(m_color[serviceEventProgressbarColorSelected]); + painter.fill(tmp); + } + } } - painter.clippop(); } -- cgit v1.2.3 From 0b41d21e11a9aa7f70f6e148490cc26a03d7d4d7 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 24 Mar 2010 20:59:55 +0100 Subject: make channel selection service description color configurable this fixes bug #487 (patch by Dr.Best) --- lib/python/Components/ServiceList.py | 4 ++++ lib/service/listboxservice.cpp | 10 ++++++++++ lib/service/listboxservice.h | 2 ++ 3 files changed, 16 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py index 3452e27d..cd055a82 100644 --- a/lib/python/Components/ServiceList.py +++ b/lib/python/Components/ServiceList.py @@ -72,6 +72,10 @@ class ServiceList(HTMLComponent, GUIComponent): self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColor, parseColor(value)) elif attrib == "colorEventProgressbarBorderSelected": self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColorSelected, parseColor(value)) + elif attrib == "colorServiceDescription": + self.l.setColor(eListboxServiceContent.serviceDescriptionColor, parseColor(value)) + elif attrib == "colorServiceDescriptionSelected": + self.l.setColor(eListboxServiceContent.serviceDescriptionColorSelected, parseColor(value)) elif attrib == "picServiceEventProgressbar": pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, value)) if pic: diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index f8ac0ff2..cc8c32b5 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -531,12 +531,15 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const bool paintProgress = false; ePtr evt; + bool serviceAvail = true; + if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore)) { if (m_color_set[serviceNotAvail]) painter.setForegroundColor(m_color[serviceNotAvail]); else painter.setForegroundColor(gRGB(0xbbbbbb)); + serviceAvail = false; } if (selected && local_style && local_style->m_selection) @@ -592,6 +595,13 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const if (!name.length()) continue; text = '(' + evt->getEventName() + ')'; + if (serviceAvail) + { + if (!selected && m_color_set[serviceDescriptionColor]) + painter.setForegroundColor(m_color[serviceDescriptionColor]); + else if (selected && m_color_set[serviceDescriptionColorSelected]) + painter.setForegroundColor(m_color[serviceDescriptionColorSelected]); + } } else continue; diff --git a/lib/service/listboxservice.h b/lib/service/listboxservice.h index 982d7e14..589afba6 100644 --- a/lib/service/listboxservice.h +++ b/lib/service/listboxservice.h @@ -90,6 +90,8 @@ public: serviceEventProgressbarColorSelected, serviceEventProgressbarBorderColor, serviceEventProgressbarBorderColorSelected, + serviceDescriptionColor, + serviceDescriptionColorSelected, colorElements }; -- cgit v1.2.3 From 4e9abcf682b3aa8ff8ddf2fcb63e6d9f329f72fa Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 29 Mar 2010 12:16:38 +0200 Subject: ChannelSelection.py: fix typo --- lib/python/Screens/ChannelSelection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 4ca6fa39..0895c9c2 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -449,7 +449,7 @@ class ChannelSelectionEdit: if mutableAlternatives: mutableAlternatives.setListName(name) if mutableAlternatives.addService(cur_service.ref): - print "add", cur_service.toString(), "to new alternatives failed" + print "add", cur_service.ref.toString(), "to new alternatives failed" mutableAlternatives.flushChanges() self.servicelist.addService(new_ref.ref, True) self.servicelist.removeCurrent() -- cgit v1.2.3 From a031db45bbf074b66ee62da2d5ecad8785b5b156 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 29 Mar 2010 19:02:03 +0200 Subject: lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.h/cpp: add support for autoresolution plugins (needs new libdreamdvd) this fixes bug #302 --- .../Extensions/DVDPlayer/src/servicedvd.cpp | 47 +++++++++++++++++++--- .../Plugins/Extensions/DVDPlayer/src/servicedvd.h | 2 + 2 files changed, 43 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 0372c497..2ba53927 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -85,12 +85,9 @@ RESULT eServiceFactoryDVD::offlineOperations(const eServiceReference &, ePtr Date: Mon, 29 Mar 2010 22:44:29 +0200 Subject: show timeshift state widget even in state play this fixes bug #332 --- lib/python/Screens/InfoBarGenerics.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index b3bcc4a0..1c577eec 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1111,15 +1111,21 @@ class InfoBarPVRState: self.pvrStateDialog.hide() else: self._mayShow() - class InfoBarTimeshiftState(InfoBarPVRState): def __init__(self): InfoBarPVRState.__init__(self, screen=TimeshiftState, force_show = True) + self.__hideTimer = eTimer() + self.__hideTimer.callback.append(self.__hideTimeshiftState) def _mayShow(self): - if self.execing and self.timeshift_enabled and self.seekstate != self.SEEK_STATE_PLAY: + if self.execing and self.timeshift_enabled: self.pvrStateDialog.show() + if self.seekstate == self.SEEK_STATE_PLAY and not self.shown: + self.__hideTimer.start(5*1000, True) + + def __hideTimeshiftState(self): + self.pvrStateDialog.hide() class InfoBarShowMovies: -- cgit v1.2.3 From 5b48886f30532694e2bad8d5cc839b607293423d Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 30 Mar 2010 10:43:54 +0200 Subject: * disable PluginManagers ipkg update on e2 start, better do it when needed. This fixes #494 --- lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 4dbe7f70..4917855f 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -420,7 +420,7 @@ class PluginManager(Screen, DreamInfoHandler): def getUpdateInfos(self): self.setState('update') - iSoftwareTools.getUpdates(self.getUpdateInfosCB) + iSoftwareTools.startSoftwareTools(self.getUpdateInfosCB) def getUpdateInfosCB(self, retval = None): if retval is not None: @@ -429,9 +429,10 @@ class PluginManager(Screen, DreamInfoHandler): self["status"].setText(_("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")) else: self["status"].setText(_("There are no updates available.")) + self.rebuildList() elif retval is False: + self.setState('error') self["status"].setText(_("No network connection available.")) - self.rebuildList() def rebuildList(self, retval = None): if self.currentSelectedTag is None: @@ -1701,15 +1702,11 @@ def startSetup(menuid): return [ ] return [(_("Software management"), UpgradeMain, "software_manager", 50)] -def autostart(reason, **kwargs): - if reason is True: - iSoftwareTools.startSoftwareTools() def Plugins(path, **kwargs): global plugin_path plugin_path = path list = [ - PluginDescriptor(where = [PluginDescriptor.WHERE_NETWORKCONFIG_READ], fnc = autostart), PluginDescriptor(name=_("Software management"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) ] -- cgit v1.2.3 From 10f34153609f572dd6ff389fcd8362d420c4a4f5 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 30 Mar 2010 13:05:37 +0200 Subject: refs bug #485 start cxd1978 tool if such a tuner is used --- lib/python/Screens/ScanSetup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 1dbc1505..960b7f10 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -176,7 +176,11 @@ class CableTransponderSearchSupport: self.cable_search_container.appClosed.append(self.cableTransponderSearchClosed) self.cable_search_container.dataAvail.append(self.getCableTransponderData) cableConfig = config.Nims[nim_idx].cable - cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus " + tunername = nimmanager.getNimName(nim_idx) + if tunername == "CXD1981": + cmd = "cxd1978 --init --scan --verbose --wakeup --inv 2 --bus " + else: + cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus " #FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000 if nim_idx < 2: cmd += str(nim_idx) -- cgit v1.2.3 From aa7e54fc4db217a7732f208af6f3e5a2e0bd6773 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 15:37:07 +0200 Subject: [DVDBurn] usability improvements: title list layout, bottom info area, consistency of user interface, implement restoring of saved collections from xml (fixes #316) --- .../Plugins/Extensions/DVDBurn/DVDProject.py | 102 +++++++++++++------- lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py | 28 ++++-- .../Plugins/Extensions/DVDBurn/ProjectSettings.py | 23 +++-- .../Plugins/Extensions/DVDBurn/TitleCutter.py | 20 ++++ lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 105 +++++++++++++-------- .../Plugins/Extensions/DVDBurn/TitleProperties.py | 13 ++- 6 files changed, 201 insertions(+), 90 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py index 83672460..7f755db4 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py @@ -1,5 +1,7 @@ from Tools.Directories import fileExists from Components.config import config, ConfigSubsection, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigSubList +import DVDTitle +import xml.dom.minidom class ConfigColor(ConfigSequence): def __init__(self, default = [128,128,128]): @@ -10,7 +12,10 @@ class ConfigFilename(ConfigText): ConfigText.__init__(self, default = "", fixed_size = True, visible_width = False) def getMulti(self, selected): - filename = (self.text.rstrip("/").rsplit("/",1))[1].encode("utf-8")[:40] + " " + if self.text == "": + return ("mtext"[1-selected:], "", 0) + cut_len = min(len(self.text),40) + filename = (self.text.rstrip("/").rsplit("/",1))[1].encode("utf-8")[:cut_len] + " " if self.allmarked: mark = range(0, len(filename)) else: @@ -34,10 +39,11 @@ class DVDProject: self.settings.vmgm = ConfigFilename() self.filekeys = ["vmgm", "isopath", "menutemplate"] self.menutemplate = MenuTemplate() + self.error = "" + self.session = None def addService(self, service): - import DVDTitle - title = DVDTitle.DVDTitle() + title = DVDTitle.DVDTitle(self) title.addService(service) self.titles.append(title) return title @@ -100,47 +106,78 @@ class DVDProject: return ret def loadProject(self, filename): - import xml.dom.minidom - try: + #try: if not fileExists(filename): self.error = "xml file not found!" - raise AttributeError - else: - self.error = "" + #raise AttributeError file = open(filename, "r") data = file.read().decode("utf-8").replace('&',"&").encode("ascii",'xmlcharrefreplace') file.close() projectfiledom = xml.dom.minidom.parseString(data) - for project in projectfiledom.childNodes[0].childNodes: - if project.nodeType == xml.dom.minidom.Element.nodeType: - if project.tagName == 'settings': - i = 0 - if project.attributes.length < len(self.settings.dict())-1: - self.error = "project attributes missing" - raise AttributeError - while i < project.attributes.length: - item = project.attributes.item(i) - key = item.name.encode("utf-8") - try: - val = eval(item.nodeValue) - except (NameError, SyntaxError): - val = item.nodeValue.encode("utf-8") - try: - self.settings.dict()[key].setValue(val) - except (KeyError): - self.error = "unknown attribute '%s'" % (key) - raise AttributeError - i += 1 + for node in projectfiledom.childNodes[0].childNodes: + print "node:", node + if node.nodeType == xml.dom.minidom.Element.nodeType: + if node.tagName == 'settings': + self.xmlAttributesToConfig(node, self.settings) + elif node.tagName == 'titles': + self.xmlGetTitleNodeRecursive(node) + for key in self.filekeys: val = self.settings.dict()[key].getValue() if not fileExists(val): self.error += "\n%s '%s' not found" % (key, val) - if len(self.error): - raise AttributeError + #except AttributeError: + #print "loadProject AttributeError", self.error + #self.error += (" in project '%s'") % (filename) + #return False + return True + + def xmlAttributesToConfig(self, node, config): + try: + i = 0 + #if node.attributes.length < len(config.dict())-1: + #self.error = "project attributes missing" + #raise AttributeError + while i < node.attributes.length: + item = node.attributes.item(i) + key = item.name.encode("utf-8") + try: + val = eval(item.nodeValue) + except (NameError, SyntaxError): + val = item.nodeValue.encode("utf-8") + try: + print "config[%s].setValue(%s)" % (key, val) + config.dict()[key].setValue(val) + except (KeyError): + self.error = "unknown attribute '%s'" % (key) + print "KeyError", self.error + raise AttributeError + i += 1 except AttributeError: - self.error += (" in project '%s'") % (filename) + self.error += (" XML attribute error '%s'") % node.toxml() return False - return True + + def xmlGetTitleNodeRecursive(self, node, title_idx = -1): + print "[xmlGetTitleNodeRecursive]", title_idx, node + print node.childNodes + for subnode in node.childNodes: + print "xmlGetTitleNodeRecursive subnode:", subnode + if subnode.nodeType == xml.dom.minidom.Element.nodeType: + if subnode.tagName == 'title': + title_idx += 1 + title = DVDTitle.DVDTitle(self) + self.titles.append(title) + self.xmlGetTitleNodeRecursive(subnode, title_idx) + if subnode.tagName == 'path': + print "path:", subnode.firstChild.data + filename = subnode.firstChild.data + self.titles[title_idx].addFile(filename.encode("utf-8")) + if subnode.tagName == 'properties': + self.xmlAttributesToConfig(node, self.titles[title_idx].properties) + if subnode.tagName == 'audiotracks': + self.xmlGetTitleNodeRecursive(subnode, title_idx) + if subnode.tagName == 'audiotrack': + print "audiotrack...", subnode.toxml() def getSize(self): totalsize = 0 @@ -187,6 +224,7 @@ class MenuTemplate(DVDProject): self.filekeys = ["menubg", "menuaudio", "fontface_headline", "fontface_title", "fontface_subtitle"] from TitleProperties import languageChoices self.settings.menulang = ConfigSelection(choices = languageChoices.choices, default=languageChoices.choices[1][0]) + self.error = "" def loadTemplate(self, filename): ret = DVDProject.loadProject(self, filename) diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py index 660005e6..6dff00d6 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py @@ -1,4 +1,5 @@ from Components.config import config, ConfigSubsection, ConfigSubList, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigYesNo +import TitleCutter class ConfigFixedText(ConfigText): def __init__(self, text, visible_width=60): @@ -7,17 +8,17 @@ class ConfigFixedText(ConfigText): pass class DVDTitle: - def __init__(self): + def __init__(self, project): self.properties = ConfigSubsection() self.properties.menutitle = ConfigText(fixed_size = False, visible_width = 80) self.properties.menusubtitle = ConfigText(fixed_size = False, visible_width = 80) - self.DVBname = _("Title") - self.DVBdescr = _("Description") - self.DVBchannel = _("Channel") self.properties.aspect = ConfigSelection(choices = [("4:3", _("4:3")), ("16:9", _("16:9"))]) self.properties.widescreen = ConfigSelection(choices = [("nopanscan", "nopanscan"), ("noletterbox", "noletterbox")]) self.properties.autochapter = ConfigInteger(default = 0, limits = (0, 60)) self.properties.audiotracks = ConfigSubList() + self.DVBname = _("Title") + self.DVBdescr = _("Description") + self.DVBchannel = _("Channel") self.cuesheet = [ ] self.source = None self.filesize = 0 @@ -27,6 +28,8 @@ class DVDTitle: self.chaptermarks = [ ] self.timeCreate = None self.VideoType = -1 + self.project = project + self.length = 0 def addService(self, service): from os import path @@ -36,7 +39,7 @@ class DVDTitle: self.source = service serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(service) - sDescr = info and " " + info.getInfoString(service, iServiceInformation.sDescription) or "" + sDescr = info and info.getInfoString(service, iServiceInformation.sDescription) or "" self.DVBdescr = sDescr sTimeCreate = info.getInfo(service, iServiceInformation.sTimeCreate) if sTimeCreate > 1: @@ -49,9 +52,20 @@ class DVDTitle: self.filesize = path.getsize(self.inputfile) self.estimatedDiskspace = self.filesize self.length = info.getLength(service) + + def addFile(self, filename): + from enigma import eServiceReference + ref = eServiceReference(1, 0, filename) + self.addService(ref) + self.project.session.openWithCallback(self.titleEditDone, TitleCutter.CutlistReader, self) + + def titleEditDone(self, cutlist): + self.initDVDmenuText(len(self.project.titles)) + self.cuesheet = cutlist + self.produceFinalCuesheet() - def initDVDmenuText(self, project, track): - s = project.menutemplate.settings + def initDVDmenuText(self, track): + s = self.project.menutemplate.settings self.properties.menutitle.setValue(self.formatDVDmenuText(s.titleformat.getValue(), track)) self.properties.menusubtitle.setValue(self.formatDVDmenuText(s.subtitleformat.getValue(), track)) diff --git a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py index a1c38842..39d7277e 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py +++ b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py @@ -92,10 +92,10 @@ class ProjectSettings(Screen,ConfigListScreen): - - - - + + + + @@ -233,10 +233,19 @@ class ProjectSettings(Screen,ConfigListScreen): else: self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) elif scope == "project": - if self.project.loadProject(path): - self.initConfigList() + self.path = path + print "len(self.titles)", len(self.project.titles) + if len(self.project.titles): + self.session.openWithCallback(self.askLoadCB, MessageBox,text = _("Your current collection will get lost!") + "\n" + _("Do you want to restore your settings?"), type = MessageBox.TYPE_YESNO) else: - self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + self.askLoadCB(True) elif scope: configRef.setValue(path) self.initConfigList() + + def askLoadCB(self, answer): + if answer is not None and answer: + if self.project.loadProject(self.path): + self.initConfigList() + else: + self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) \ No newline at end of file diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py index 06ed1bab..a52fad9f 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py @@ -59,8 +59,28 @@ class TitleCutter(CutListEditor): self.close(self.cut_list[:]) class CutlistReader(TitleCutter): + skin = """ + + + + + + + {"template": [ + MultiContentEntryText(text = 1), + MultiContentEntryText(text = 2) + ], + "fonts": [gFont("Regular", 18)], + "itemHeight": 20 + } + + + + """ + def __init__(self, session, t): TitleCutter.__init__(self, session, t) + self.skin = CutlistReader.skin def getPMTInfo(self): TitleCutter.getPMTInfo(self) diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index dbc988b1..35a95d52 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -16,33 +16,40 @@ from Tools.Directories import resolveFilename, SCOPE_PLUGINS class TitleList(Screen, HelpableScreen): skin = """ - + - - - - + + + + - - + + {"template": [ MultiContentEntryText(pos = (0, 0), size = (420, 20), font = 0, flags = RT_HALIGN_LEFT, text = 1), # index 1 Title, MultiContentEntryText(pos = (0, 20), size = (328, 17), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 description, - MultiContentEntryText(pos = (420, 6), size = (120, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 3), # index 3 begin time, - MultiContentEntryText(pos = (328, 20), size = (154, 17), font = 1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 channel, - MultiContentEntryText(pos = (482, 20), size = (58, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # index 4 channel, + MultiContentEntryText(pos = (418, 6), size = (120, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 3), # index 3 channel, + MultiContentEntryText(pos = (326, 20), size = (154, 17), font = 1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 begin time, + MultiContentEntryText(pos = (480, 20), size = (58, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # index 5 duration, ], "fonts": [gFont("Regular", 20), gFont("Regular", 14)], "itemHeight": 37 } - - + + + + + + + + + """ def __init__(self, session, project = None): @@ -75,17 +82,19 @@ class TitleList(Screen, HelpableScreen): self["title_label"] = StaticText() self["error_label"] = StaticText() - self["space_label"] = StaticText() - self["space_bar"] = Progress() + self["space_label_single"] = StaticText() + self["space_label_dual"] = StaticText() + self["hint"] = StaticText(_("Advanced Options")) + self["medium"] = StaticText() + self["space_bar_single"] = Progress() + self["space_bar_dual"] = Progress() + self["titles"] = List([]) + self.previous_size = 0 if project is not None: self.project = project else: self.newProject() - - self["titles"] = List([]) - self.updateTitleList() - self.previous_size = 0 self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): @@ -107,15 +116,16 @@ class TitleList(Screen, HelpableScreen): j = self.backgroundJob menu.append(("%s: %s (%d%%)" % (j.getStatustext(), j.name, int(100*j.progress/float(j.end))), self.showBackgroundJob)) menu.append((_("DVD media toolbox"), self.toolbox)) - menu.append((_("Preview menu"), self.previewMenu)) if self.project.settings.output.getValue() == "dvd": if len(self["titles"].list): menu.append((_("Burn DVD"), self.burnProject)) elif self.project.settings.output.getValue() == "iso": menu.append((_("Create DVD-ISO"), self.burnProject)) menu.append((_("Burn existing image to DVD"), self.selectImage)) - menu.append((_("Edit chapters of current title"), self.editTitle)) - menu.append((_("Reset and renumerate title names"), self.resetTitles)) + if len(self["titles"].list): + menu.append((_("Preview menu"), self.previewMenu)) + menu.append((_("Edit chapters of current title"), self.editTitle)) + menu.append((_("Reset and renumerate title names"), self.resetTitles)) menu.append((_("Exit"), self.leave)) self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu) @@ -149,9 +159,9 @@ class TitleList(Screen, HelpableScreen): - - - + + + @@ -197,7 +207,7 @@ class TitleList(Screen, HelpableScreen): self.close(current) self.session.openWithCallback(self.selectedSource, DVDMovieSelection) - def selectedSource(self, source): + def selectedSource(self, source = None): if source is None: return None if not source.getPath().endswith(".ts"): @@ -228,7 +238,7 @@ class TitleList(Screen, HelpableScreen): def settingsCB(self, update=True): if not update: return - self["title_label"].text = _("Table of content for collection") + " \"" + self.project.settings.name.getValue() + "\":" + self.updateTitleList() def loadTemplate(self): filename = resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/DreamboxDVD.ddvdp.xml" @@ -281,9 +291,11 @@ class TitleList(Screen, HelpableScreen): if len(list): self["key_red"].text = _("Remove title") self["key_yellow"].text = _("Title properties") + self["title_label"].text = _("Table of content for collection") + " \"" + self.project.settings.name.getValue() + "\":" else: self["key_red"].text = "" self["key_yellow"].text = "" + self["title_label"].text = _("Please add titles to the compilation") def updateSize(self): size = self.project.size/(1024*1024) @@ -292,20 +304,29 @@ class TitleList(Screen, HelpableScreen): print "updateSize:", size, "MAX_DL:", MAX_DL, "MAX_SL:", MAX_SL if size > MAX_DL: percent = 100 * size / float(MAX_DL) - self["space_label"].text = "%d MB - " % size + _("exceeds dual layer medium!") + " (%.2f%% " % (100-percent) + _("free") + ")" - self["space_bar"].value = int(percent) + self["space_label_dual"].text = "%d MB (%.2f%%)" % (size, percent) + self["space_bar_dual"].value = int(percent) + self["space_bar_single"].value = 100 + self["space_label_single"].text = "" + self["medium"].text = _("exceeds dual layer medium!") if self.previous_size < MAX_DL: self.session.open(MessageBox,text = _("exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) elif size > MAX_SL: percent = 100 * size / float(MAX_DL) - self["space_label"].text = "%d MB " % size + _("of a DUAL layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" - self["space_bar"].value = int(percent) + self["space_label_dual"].text = "%d MB (%.2f%%)" % (size, percent) + self["space_bar_dual"].value = int(percent) + self["space_bar_single"].value = 100 + self["space_label_single"].text = "" + self["medium"].text = _("required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free") if self.previous_size < MAX_SL: - self.session.open(MessageBox,text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), type = MessageBox.TYPE_INFO) + self.session.open(MessageBox, text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), timeout = 10, type = MessageBox.TYPE_INFO) elif size < MAX_SL: percent = 100 * size / float(MAX_SL) - self["space_label"].text = "%d MB " % size + _("of a SINGLE layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" - self["space_bar"].value = int(percent) + self["space_label_single"].text = "%d MB (%.2f%%)" % (size, percent) + self["space_bar_single"].value = int(percent) + self["space_bar_dual"].value = 0 + self["space_label_dual"].text = "" + self["medium"].text = _("required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free") self.previous_size = size def getCurrentTitle(self): @@ -323,9 +344,7 @@ class TitleList(Screen, HelpableScreen): def titleEditDone(self, cutlist): t = self.current_edit_title - t.initDVDmenuText(self.project,len(self.project.titles)) - t.cuesheet = cutlist - t.produceFinalCuesheet() + t.titleEditDone(cutlist) if t.VideoType != 0: self.session.openWithCallback(self.DVDformatCB,MessageBox,text = _("The DVD standard doesn't support H.264 (HDTV) video streams. Do you want to create a Dreambox format data DVD (which will not play in stand-alone DVD players) instead?"), type = MessageBox.TYPE_YESNO) else: @@ -335,7 +354,7 @@ class TitleList(Screen, HelpableScreen): count = 0 for title in self.project.titles: count += 1 - title.initDVDmenuText(self.project,count) + title.initDVDmenuText(count) self.updateTitleList() def DVDformatCB(self, answer): @@ -346,5 +365,13 @@ class TitleList(Screen, HelpableScreen): else: self.removeTitle(t) - def leave(self): - self.close() + def leave(self, close = False): + if not len(self["titles"].list) or close: + self.close() + else: + self.session.openWithCallback(self.exitCB, MessageBox,text = _("Your current collection will get lost!") + "\n" + _("Do you really want to exit?"), type = MessageBox.TYPE_YESNO) + + def exitCB(self, answer): + print "exitCB", answer + if answer is not None and answer: + self.close() \ No newline at end of file diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py index 0a664eba..956f054d 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py @@ -21,10 +21,12 @@ class TitleProperties(Screen,ConfigListScreen): + - - - + + + + @@ -38,7 +40,8 @@ class TitleProperties(Screen,ConfigListScreen): self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) - self["key_blue"] = StaticText(_("Edit Title")) + self["key_yellow"] = StaticText(_("Edit Title")) + self["key_blue"] = StaticText() self["serviceinfo"] = StaticText() self["thumbnail"] = Pixmap() @@ -57,7 +60,7 @@ class TitleProperties(Screen,ConfigListScreen): { "green": self.exit, "red": self.cancel, - "blue": self.editTitle, + "yellow": self.editTitle, "cancel": self.cancel, "ok": self.ok, }, -2) -- cgit v1.2.3 From 58630f7b0de796e3589d2c1eaeb3e9d531d60d37 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 16:58:54 +0200 Subject: save supposed afterEvent config in class Job member (fixes #394 DVDBurn shutdown not being executed) --- lib/python/Components/Task.py | 1 + lib/python/Screens/TaskView.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index a1e04bce..2e4e757d 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -16,6 +16,7 @@ class Job(object): self.end = 100 self.__progress = 0 self.weightScale = 1 + self.afterEvent = None self.state_changed = CList() diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index eb926ca3..9907e2fb 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -7,7 +7,7 @@ import Screens.Standby from Tools import Notifications class JobView(InfoBarNotifications, Screen, ConfigListScreen): - def __init__(self, session, job, parent=None, cancelable = True, backgroundable = True, afterEvent = 0): + def __init__(self, session, job, parent=None, cancelable = True, backgroundable = True): from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress from Components.Sources.Boolean import Boolean @@ -43,19 +43,20 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): "ok": self.ok, }, -2) - self.afterevents = [ "nothing", "standby", "deepstandby", "close" ] self.settings = ConfigSubsection() if SystemInfo["DeepstandbySupport"]: shutdownString = _("go to deep standby") else: shutdownString = _("shut down") - self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", shutdownString)], default = self.afterevents[afterEvent]) + self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", shutdownString)], default = self.job.afterEvent or "nothing") + self.job.afterEvent = self.settings.afterEvent.getValue() self.setupList() self.state_changed() def setupList(self): self["config"].setList( [ getConfigListEntry(_("After event"), self.settings.afterEvent) ]) - + self.job.afterEvent = self.settings.afterEvent.getValue() + def keyLeft(self): ConfigListScreen.keyLeft(self) self.setupList() -- cgit v1.2.3 From 525b031d2b8401750293fde4e334dfc8a5193517 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 17:49:15 +0200 Subject: add transfer bps to service interface (requires touching enigma_python.i) --- lib/python/Components/Converter/ServiceInfo.py | 4 ++++ lib/service/iservice.h | 2 ++ 2 files changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py index 5014fde6..fa3518ce 100644 --- a/lib/python/Components/Converter/ServiceInfo.py +++ b/lib/python/Components/Converter/ServiceInfo.py @@ -19,6 +19,7 @@ class ServiceInfo(Converter, object): ONID = 13 SID = 14 FRAMERATE = 15 + TRANSFERBPS = 16 def __init__(self, type): @@ -40,6 +41,7 @@ class ServiceInfo(Converter, object): "OnId": (self.ONID, (iPlayableService.evUpdatedInfo,)), "Sid": (self.SID, (iPlayableService.evUpdatedInfo,)), "Framerate": (self.FRAMERATE, (iPlayableService.evVideoSizeChanged,iPlayableService.evUpdatedInfo,)), + "TransferBPS": (self.TRANSFERBPS, (iPlayableService.evUpdatedInfo,)), }[type] def getServiceInfoString(self, info, what, convert = lambda x: "%d" % x): @@ -112,6 +114,8 @@ class ServiceInfo(Converter, object): return self.getServiceInfoString(info, iServiceInformation.sSID) elif self.type == self.FRAMERATE: return self.getServiceInfoString(info, iServiceInformation.sFrameRate, lambda x: "%d fps" % ((x+500)/1000)) + elif self.type == self.TRANSFERBPS: + return self.getServiceInfoString(info, iServiceInformation.sTransferBPS, lambda x: "%d kB/s" % (x/1024)) return "" text = property(getText) diff --git a/lib/service/iservice.h b/lib/service/iservice.h index d80733df..2ba7cb46 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -356,6 +356,8 @@ public: sTagCRC, sTagChannelMode, + sTransferBPS, + sUser = 0x100 }; enum { -- cgit v1.2.3 From 54e03fa5099bfe1862dd8fd83761c64ce17d555b Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 30 Mar 2010 18:25:06 +0200 Subject: fixes bug #436 some improvements to the multi tuner type switching --- lib/dvb/frontend.cpp | 7 ++++++ lib/dvb/frontend.h | 1 + lib/dvb/idvb.h | 1 + lib/python/Components/NimManager.py | 46 +++++++++++++++++++++++++++---------- lib/python/Screens/Satconfig.py | 2 +- 5 files changed, 44 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index f85a37fe..8216eea0 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -483,6 +483,13 @@ eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate) closeFrontend(); } +void eDVBFrontend::reopenFrontend() +{ + closeFrontend(); + m_type = -1; + openFrontend(); +} + int eDVBFrontend::openFrontend() { if (m_state != stateClosed) diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index 4cf05081..bc31755c 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -146,6 +146,7 @@ public: static void setTypePriorityOrder(int val) { PriorityOrder = val; } static int getTypePriorityOrder() { return PriorityOrder; } + void reopenFrontend(); int openFrontend(); int closeFrontend(bool force=false); const char *getDescription() const { return m_description; } diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 4ef7efad..a3e87e35 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -459,6 +459,7 @@ class iDVBFrontend: public iDVBFrontend_ENUMS, public iObject public: virtual RESULT getFrontendType(int &SWIG_OUTPUT)=0; virtual RESULT tune(const iDVBFrontendParameters &where)=0; + virtual void reopenFrontend()=0; #ifndef SWIG virtual RESULT connectStateChange(const Slot1 &stateChange, ePtr &connection)=0; #endif diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 6650c717..6af4c52c 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1,4 +1,5 @@ from Tools.HardwareInfo import HardwareInfo +from Tools.BoundFunction import boundFunction from config import config, ConfigSubsection, ConfigSelection, ConfigFloat, \ ConfigSatlist, ConfigYesNo, ConfigInteger, ConfigSubList, ConfigNothing, \ @@ -13,6 +14,7 @@ from enigma import eDVBSatelliteEquipmentControl as secClass, \ from time import localtime, mktime from datetime import datetime +from Tools.BoundFunction import boundFunction def getConfigSatlist(orbpos, satlist): default_orbpos = None @@ -687,6 +689,9 @@ class NimManager: def getNimDescription(self, slotid): return self.nim_slots[slotid].friendly_full_description + + def getNimName(self, slotid): + return self.nim_slots[slotid].description def getNimListOfType(self, type, exception = -1): # returns a list of indexes for NIMs compatible to the given type, except for 'exception' @@ -962,12 +967,18 @@ def InitSecParams(): # the configElement should be only visible when diseqc 1.2 is disabled def InitNimManager(nimmgr): - InitSecParams() hw = HardwareInfo() + addNimConfig = False + try: + config.Nims + except: + addNimConfig = True - config.Nims = ConfigSubList() - for x in range(len(nimmgr.nim_slots)): - config.Nims.append(ConfigSubsection()) + if addNimConfig: + InitSecParams() + config.Nims = ConfigSubList() + for x in range(len(nimmgr.nim_slots)): + config.Nims.append(ConfigSubsection()) lnb_choices = { "universal_lnb": _("Universal LNB"), @@ -1243,27 +1254,38 @@ def InitNimManager(nimmgr): if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2': open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value) - def tunerTypeChanged(configElement): + def tunerTypeChanged(nimmgr, configElement): fe_id = configElement.fe_id + print "tunerTypeChanged feid %d to mode %s" % (fe_id, configElement.value) open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value) - + frontend = eDVBResourceManager.getInstance().allocateRawChannel(fe_id).getFrontend() + frontend.reopenFrontend() + nimmgr.enumerateNIMs() + empty_slots = 0 for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] - if slot.isMultiType(): + addMultiType = False + try: + nim.multiType + except: + addMultiType = True + if slot.isMultiType() and addMultiType: typeList = [] - value = None for id in slot.getMultiTypeList().keys(): type = slot.getMultiTypeList()[id] typeList.append((id, type)) - if type == slot.getType(): - value = id nim.multiType = ConfigSelection(typeList, "0") - nim.multiType.value = value + nim.multiType.fe_id = x - empty_slots - nim.multiType.addNotifier(tunerTypeChanged) + nim.multiType.addNotifier(boundFunction(tunerTypeChanged, nimmgr)) + empty_slots = 0 + for slot in nimmgr.nim_slots: + x = slot.slot + nim = config.Nims[x] + if slot.isCompatible("DVB-S"): nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7") nim.toneAmplitude.fe_id = x - empty_slots diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 7ba3a134..87d65e54 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -208,11 +208,11 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \ self.uncommittedDiseqcCommand, self.cableScanType, self.multiType) if self["config"].getCurrent() == self.multiType: - nimmanager.enumerateNIMs() from Components.NimManager import InitNimManager InitNimManager(nimmanager) self.nim = nimmanager.nim_slots[self.slotid] self.nimConfig = self.nim.config + for x in checkList: if self["config"].getCurrent() == x: self.createSetup() -- cgit v1.2.3 From c15fe7a4031395509b94140764a79adc5ac678da Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 17:40:35 +0200 Subject: [DVDBurn] use multicolor lable for required medium type (add #316) --- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index 35a95d52..ac60906b 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -11,6 +11,7 @@ from Components.Sources.List import List from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress from Components.MultiContent import MultiContentEntryText +from Components.Label import MultiColorLabel from enigma import gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT from Tools.Directories import resolveFilename, SCOPE_PLUGINS @@ -44,7 +45,7 @@ class TitleList(Screen, HelpableScreen): - + @@ -85,7 +86,7 @@ class TitleList(Screen, HelpableScreen): self["space_label_single"] = StaticText() self["space_label_dual"] = StaticText() self["hint"] = StaticText(_("Advanced Options")) - self["medium"] = StaticText() + self["medium_label"] = MultiColorLabel() self["space_bar_single"] = Progress() self["space_bar_dual"] = Progress() @@ -308,7 +309,8 @@ class TitleList(Screen, HelpableScreen): self["space_bar_dual"].value = int(percent) self["space_bar_single"].value = 100 self["space_label_single"].text = "" - self["medium"].text = _("exceeds dual layer medium!") + self["medium_label"].setText(_("exceeds dual layer medium!")) + self["medium_label"].setForegroundColorNum(2) if self.previous_size < MAX_DL: self.session.open(MessageBox,text = _("exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) elif size > MAX_SL: @@ -317,7 +319,8 @@ class TitleList(Screen, HelpableScreen): self["space_bar_dual"].value = int(percent) self["space_bar_single"].value = 100 self["space_label_single"].text = "" - self["medium"].text = _("required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free") + self["medium_label"].setText(_("required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free")) + self["medium_label"].setForegroundColorNum(1) if self.previous_size < MAX_SL: self.session.open(MessageBox, text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), timeout = 10, type = MessageBox.TYPE_INFO) elif size < MAX_SL: @@ -326,7 +329,8 @@ class TitleList(Screen, HelpableScreen): self["space_bar_single"].value = int(percent) self["space_bar_dual"].value = 0 self["space_label_dual"].text = "" - self["medium"].text = _("required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free") + self["medium_label"].setText(_("required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free")) + self["medium_label"].setForegroundColorNum(0) self.previous_size = size def getCurrentTitle(self): -- cgit v1.2.3 From 469203620ff992decefb8942a79eb4ebfacf32d1 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 30 Mar 2010 17:18:07 +0200 Subject: [DVDBurn] remove "..." at menu entry string --- lib/python/Plugins/Extensions/DVDBurn/plugin.py | 2 +- po/de.po | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDBurn/plugin.py b/lib/python/Plugins/Extensions/DVDBurn/plugin.py index 45f438da..bd856b47 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/plugin.py +++ b/lib/python/Plugins/Extensions/DVDBurn/plugin.py @@ -12,6 +12,6 @@ def main_add(session, service, **kwargs): dvdburn.selectedSource(service) def Plugins(**kwargs): - descr = _("Burn to DVD...") + descr = _("Burn to DVD") return [PluginDescriptor(name="DVD Burn", description=descr, where = PluginDescriptor.WHERE_MOVIELIST, fnc=main_add, icon="dvdburn.png"), PluginDescriptor(name="DVD Burn", description=descr, where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main, icon="dvdburn.png") ] diff --git a/po/de.po b/po/de.po index 90170425..4de23c16 100755 --- a/po/de.po +++ b/po/de.po @@ -725,8 +725,8 @@ msgstr "Brenne DVD" msgid "Burn existing image to DVD" msgstr "Vorhandenes Image auf DVD brennen" -msgid "Burn to DVD..." -msgstr "Auf DVD brennen..." +msgid "Burn to DVD" +msgstr "Auf DVD brennen" msgid "Bus: " msgstr "Bus:" -- cgit v1.2.3 From 04d23246dd5c88df949d523e0c149be8070a0a96 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 1 Feb 2010 23:30:36 +0100 Subject: fix screen layout, add configuration restore wizard code in flasher and fix crash when trying to use wizard with no .nfo file present, fixes bug #394 --- .../Plugins/SystemPlugins/NFIFlash/flasher.py | 84 ++++++++++++++++++---- 1 file changed, 71 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py index 860efc02..8986560b 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -63,10 +63,10 @@ class NFIFlash(Screen): - - - - + + + + @@ -95,6 +95,7 @@ class NFIFlash(Screen): { "green": self.ok, "yellow": self.reboot, + "blue": self.runWizard, "ok": self.ok, "left": self.left, "right": self.right, @@ -109,6 +110,43 @@ class NFIFlash(Screen): self.md5sum = "" self.job = None self.box = HardwareInfo().get_device_name() + self.configuration_restorable = None + self.wizard_mode = False + from enigma import eTimer + self.delayTimer = eTimer() + self.delayTimer.callback.append(self.runWizard) + self.delayTimer.start(50,1) + + def check_for_wizard(self): + if self["filelist"].getCurrentDirectory() is not None and fileExists(self["filelist"].getCurrentDirectory()+"wizard.nfo"): + self["key_blue"].text = _("USB stick wizard") + return True + else: + self["key_blue"].text = "" + return False + + def runWizard(self): + if not self.check_for_wizard(): + self.wizard_mode = False + return + wizardcontent = open(self["filelist"].getCurrentDirectory()+"/wizard.nfo", "r").readlines() + nfifile = None + for line in wizardcontent: + line = line.strip() + if line.startswith("image: "): + nfifile = self["filelist"].getCurrentDirectory()+line[7:] + if line.startswith("configuration: "): + backupfile = self["filelist"].getCurrentDirectory()+line[15:] + if fileExists(backupfile): + print "wizard configuration:", backupfile + self.configuration_restorable = backupfile + else: + self.configuration_restorable = None + if nfifile and fileExists(nfifile): + self.wizard_mode = True + print "wizard image:", nfifile + self.check_for_NFO(nfifile) + self.queryFlash() def closeCB(self): if ( self.job is None or self.job.status is not self.job.IN_PROGRESS ) and not self.no_autostart: @@ -133,12 +171,16 @@ class NFIFlash(Screen): self["filelist"].pageUp() self.check_for_NFO() - def check_for_NFO(self): + def check_for_NFO(self, nfifile=None): self.session.summary.setText(self["filelist"].getFilename()) - if self["filelist"].getFilename() is None: - return - if self["filelist"].getCurrentDirectory() is not None: - self.nfifile = self["filelist"].getCurrentDirectory()+self["filelist"].getFilename() + if nfifile is None: + self.session.summary.setText(self["filelist"].getFilename()) + if self["filelist"].getFilename() is None: + return + if self["filelist"].getCurrentDirectory() is not None: + self.nfifile = self["filelist"].getCurrentDirectory()+self["filelist"].getFilename() + else: + self.nfifile = nfifile if self.nfifile.upper().endswith(".NFI"): self["key_green"].text = _("Flash") @@ -152,7 +194,7 @@ class NFIFlash(Screen): else: self.md5sum = "" else: - self["infolabel"].text = _("No details for this image file") + ":\n" + self["filelist"].getFilename() + self["infolabel"].text = _("No details for this image file") + (self["filelist"].getFilename() or "") self.md5sum = "" else: self["infolabel"].text = "" @@ -164,6 +206,7 @@ class NFIFlash(Screen): self["filelist"].descent() self.session.summary.setText(self["filelist"].getFilename()) self.check_for_NFO() + self.check_for_wizard() else: self.queryFlash() @@ -192,7 +235,10 @@ class NFIFlash(Screen): def md5finished(self, retval): if retval==0: - self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO) + if self.wizard_mode: + self.session.openWithCallback(self.queryCB, MessageBox, _("Shall the USB stick wizard proceed and program the image file %s into flash memory?" % self.nfifile.rsplit('/',1)[-1]), MessageBox.TYPE_YESNO) + else: + self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO) else: self.session.openWithCallback(self.queryCB, MessageBox, _("The md5sum validation failed, the file may be corrupted! Are you sure that you want to burn this image to flash memory? You are doing this at your own risk!"), MessageBox.TYPE_YESNO) @@ -201,6 +247,7 @@ class NFIFlash(Screen): self.createJob() else: self["statusbar"].text = _("Please select .NFI flash image file from medium") + self.wizard_mode = False def createJob(self): self.job = Job("Image flashing job") @@ -240,6 +287,8 @@ class NFIFlash(Screen): elif j.status == j.FINISHED: self["statusbar"].text = _("Writing NFI image file to flash completed") self.session.summary.setText(_("NFI image flashing completed. Press Yellow to Reboot!")) + if self.wizard_mode: + self.restoreConfiguration() self["key_yellow"].text = _("Reboot") elif j.status == j.FAILED: @@ -250,10 +299,19 @@ class NFIFlash(Screen): print "[jobcb] %s %s %s" % (jobref, fasel, blubber) self["key_green"].text = _("Flash") - def reboot(self): + def reboot(self, ret=None): if self.job.status == self.job.FINISHED: self["statusbar"].text = ("rebooting...") TryQuitMainloop(self.session,2) - + + def restoreConfiguration(self): + if self.configuration_restorable: + from Screens.Console import Console + cmdlist = [ "mount /dev/mtdblock/3 /mnt/realroot -t jffs2", "tar -xzvf " + self.configuration_restorable + " -C /mnt/realroot/" ] + self.session.open(Console, title = "Restore running", cmdlist = cmdlist, finishedCallback = self.restore_finished, closeOnSuccess = True) + + def restore_finished(self): + self.session.openWithCallback(self.reboot, MessageBox, _("USB stick wizard finished. Your dreambox will now restart with your new image!"), MessageBox.TYPE_INFO) + def createSummary(self): return NFISummary -- cgit v1.2.3 From 16e2662171701ce64bf2e789168e8cee54dc8588 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 31 Mar 2010 15:26:23 +0200 Subject: [DVDBurn] fix up title list layout and change some more strings (add #316) --- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 20 ++++++++++---------- po/de.po | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index ac60906b..2cbeb633 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -31,11 +31,11 @@ class TitleList(Screen, HelpableScreen): {"template": [ - MultiContentEntryText(pos = (0, 0), size = (420, 20), font = 0, flags = RT_HALIGN_LEFT, text = 1), # index 1 Title, - MultiContentEntryText(pos = (0, 20), size = (328, 17), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 description, - MultiContentEntryText(pos = (418, 6), size = (120, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 3), # index 3 channel, - MultiContentEntryText(pos = (326, 20), size = (154, 17), font = 1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 begin time, - MultiContentEntryText(pos = (480, 20), size = (58, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # index 5 duration, + MultiContentEntryText(pos = (0, 0), size = (360, 20), font = 0, flags = RT_HALIGN_LEFT, text = 1), # index 1 Title, + MultiContentEntryText(pos = (0, 20), size = (360, 17), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 description, + MultiContentEntryText(pos = (366, 6), size = (152, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 3), # index 3 channel, + MultiContentEntryText(pos = (366, 20), size = (102, 17), font = 1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 begin time, + MultiContentEntryText(pos = (470, 20), size = (48, 20), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # index 5 duration, ], "fonts": [gFont("Regular", 20), gFont("Regular", 14)], "itemHeight": 37 @@ -296,7 +296,7 @@ class TitleList(Screen, HelpableScreen): else: self["key_red"].text = "" self["key_yellow"].text = "" - self["title_label"].text = _("Please add titles to the compilation") + self["title_label"].text = _("Please add titles to the compilation.") def updateSize(self): size = self.project.size/(1024*1024) @@ -309,17 +309,17 @@ class TitleList(Screen, HelpableScreen): self["space_bar_dual"].value = int(percent) self["space_bar_single"].value = 100 self["space_label_single"].text = "" - self["medium_label"].setText(_("exceeds dual layer medium!")) + self["medium_label"].setText(_("Exceeds dual layer medium!")) self["medium_label"].setForegroundColorNum(2) if self.previous_size < MAX_DL: - self.session.open(MessageBox,text = _("exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) + self.session.open(MessageBox,text = _("Exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) elif size > MAX_SL: percent = 100 * size / float(MAX_DL) self["space_label_dual"].text = "%d MB (%.2f%%)" % (size, percent) self["space_bar_dual"].value = int(percent) self["space_bar_single"].value = 100 self["space_label_single"].text = "" - self["medium_label"].setText(_("required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free")) + self["medium_label"].setText(_("Required medium type:") + " " + _("DUAL LAYER DVD") + ", %d MB " % (MAX_DL - size) + _("free")) self["medium_label"].setForegroundColorNum(1) if self.previous_size < MAX_SL: self.session.open(MessageBox, text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), timeout = 10, type = MessageBox.TYPE_INFO) @@ -329,7 +329,7 @@ class TitleList(Screen, HelpableScreen): self["space_bar_single"].value = int(percent) self["space_bar_dual"].value = 0 self["space_label_dual"].text = "" - self["medium_label"].setText(_("required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free")) + self["medium_label"].setText(_("Required medium type:") + " " + _("SINGLE LAYER DVD") + ", %d MB " % (MAX_SL - size) + _("free")) self["medium_label"].setForegroundColorNum(0) self.previous_size = size diff --git a/po/de.po b/po/de.po index 4de23c16..b83d5597 100755 --- a/po/de.po +++ b/po/de.po @@ -2957,7 +2957,7 @@ msgid "Process" msgstr "Aktivitätsanzeige" msgid "Properties of current title" -msgstr "Eigenschaften des ausgewählten Titels" +msgstr "Details zum ausgewählten Titel" msgid "Protect services" msgstr "Kanäle schützen" @@ -4173,7 +4173,7 @@ msgid "Title" msgstr "Titel" msgid "Title properties" -msgstr "Titeleigensch." +msgstr "Titeldetails" msgid "Titleset mode" msgstr "Titleset" @@ -5191,8 +5191,8 @@ msgstr "Versteckte Netzwerk SSID eingeben" msgid "equal to" msgstr "Gleich wie" -msgid "exceeds dual layer medium!" -msgstr "übersteigt Größe eines Dual-Layer-Mediums!" +msgid "Exceeds dual layer medium!" +msgstr "Übersteigt die Größe eines Dual-Layer-Mediums!" msgid "exit DVD player or return to file browser" msgstr "DVD Player verlassen oder zurück zum Dateimanager" @@ -5541,7 +5541,7 @@ msgstr "Wiederholung der Wiedergabeliste" msgid "repeated" msgstr "wiederholend" -msgid "required medium type:" +msgid "Required medium type:" msgstr "Benötigte Rohlingsorte:" msgid "rewind to the previous chapter" -- cgit v1.2.3 From 6c69f8d469e17ce1f07775574526b76a2edf60c8 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 31 Mar 2010 23:24:18 +0200 Subject: fixes bug #436 (again) multi tuner support: add a magic sleep(1) to workaround strange behaviour write a magic 0 into /sys/module/dvb_core/parameters/dvb_shutdown_timeout --- lib/dvb/frontend.cpp | 2 +- lib/dvb/idvb.h | 1 + lib/python/Components/NimManager.py | 12 +++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 8216eea0..bc3a88da 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -485,7 +485,7 @@ eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate) void eDVBFrontend::reopenFrontend() { - closeFrontend(); + sleep(1); m_type = -1; openFrontend(); } diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index a3e87e35..d20829bf 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -459,6 +459,7 @@ class iDVBFrontend: public iDVBFrontend_ENUMS, public iObject public: virtual RESULT getFrontendType(int &SWIG_OUTPUT)=0; virtual RESULT tune(const iDVBFrontendParameters &where)=0; + virtual int closeFrontend(bool force = false)=0; virtual void reopenFrontend()=0; #ifndef SWIG virtual RESULT connectStateChange(const Slot1 &stateChange, ePtr &connection)=0; diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 6af4c52c..c68e9404 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1257,9 +1257,19 @@ def InitNimManager(nimmgr): def tunerTypeChanged(nimmgr, configElement): fe_id = configElement.fe_id print "tunerTypeChanged feid %d to mode %s" % (fe_id, configElement.value) - open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value) + try: + oldvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline() + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0") + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" frontend = eDVBResourceManager.getInstance().allocateRawChannel(fe_id).getFrontend() + frontend.closeFrontend() + open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value) frontend.reopenFrontend() + try: + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(oldvalue) + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" nimmgr.enumerateNIMs() empty_slots = 0 -- cgit v1.2.3 From 3ba3cde02a677e536283fb8cf126f0f80d6c77b9 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 31 Mar 2010 23:48:38 +0200 Subject: fixes bug #436 write a magic 0 into /sys/module/dvb_core/parameters/dvb_shutdown_timeout before doing a service scan and restore the old value afterwards --- lib/python/Screens/ServiceScan.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/ServiceScan.py b/lib/python/Screens/ServiceScan.py index 6ee35b84..1fd32e06 100644 --- a/lib/python/Screens/ServiceScan.py +++ b/lib/python/Screens/ServiceScan.py @@ -32,10 +32,25 @@ class ServiceScan(Screen): def ok(self): print "ok" if self["scan"].isDone(): + self.resetTimeout() self.close() def cancel(self): + self.resetTimeout() self.close() + + def setTimeout(self): + try: + self.oldtimeoutvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline() + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0") + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" + + def resetTimeout(self): + try: + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(self.oldtimeoutvalue) + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" def __init__(self, session, scanList): Screen.__init__(self, session) @@ -58,7 +73,9 @@ class ServiceScan(Screen): "ok": self.ok, "cancel": self.cancel }) - + + self.setTimeout() + self.onFirstExecBegin.append(self.doServiceScan) def doServiceScan(self): -- cgit v1.2.3 From 1e9d8bf4069337885f178c148a4069ba3e12b8b4 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 1 Apr 2010 00:22:03 +0200 Subject: refs bug #485 use --bus 2 as parameter on dm500hd for scan --- lib/python/Screens/ScanSetup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 960b7f10..869bec3c 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -8,6 +8,7 @@ from Components.ConfigList import ConfigListScreen from Components.NimManager import nimmanager, getConfigSatlist from Components.Label import Label from Tools.Directories import resolveFilename, SCOPE_DEFAULTPARTITIONMOUNTDIR, SCOPE_DEFAULTDIR, SCOPE_DEFAULTPARTITION +from Tools.HardwareInfo import HardwareInfo from Screens.MessageBox import MessageBox from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, \ eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, \ @@ -183,7 +184,10 @@ class CableTransponderSearchSupport: cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus " #FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000 if nim_idx < 2: - cmd += str(nim_idx) + if HardwareInfo().get_device_name() == "dm500hd": + cmd += "2" + else: + cmd += str(nim_idx) else: if nim_idx == 2: cmd += "2" # first nim socket on DM8000 use /dev/i2c/2 -- cgit v1.2.3 From d5664b69fd79e1a5b5e179d817829ee97112713b Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 2 Apr 2010 18:39:04 +0200 Subject: refs bug #436 set/reset dvb_shutdown_timeout at a different position --- lib/python/Screens/ScanSetup.py | 15 +++++++++++++++ lib/python/Screens/ServiceScan.py | 19 +------------------ 2 files changed, 16 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 869bec3c..f4828088 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -114,6 +114,7 @@ class CableTransponderSearchSupport: def cableTransponderSearchSessionClosed(self, *val): print "cableTransponderSearchSessionClosed, val", val + self.resetTimeout() self.cable_search_container.appClosed.remove(self.cableTransponderSearchClosed) self.cable_search_container.dataAvail.remove(self.getCableTransponderData) self.cable_search_container = None @@ -161,6 +162,19 @@ class CableTransponderSearchSupport: tmpstr += " kHz " tmpstr += data[0] self.cable_search_session["text"].setText(tmpstr) + + def setTimeout(self): + try: + self.oldtimeoutvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline() + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0") + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" + + def resetTimeout(self): + try: + open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(self.oldtimeoutvalue) + except: + print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" def startCableTransponderSearch(self, nim_idx): if not self.tryGetRawFrontend(nim_idx): @@ -251,6 +265,7 @@ class CableTransponderSearchSupport: self.cable_search_container.execute(cmd) tmpstr = _("Try to find used transponders in cable network.. please wait...") tmpstr += "\n\n..." + self.setTimeout() self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO) class DefaultSatLists(DefaultWizard): diff --git a/lib/python/Screens/ServiceScan.py b/lib/python/Screens/ServiceScan.py index 1fd32e06..df427f99 100644 --- a/lib/python/Screens/ServiceScan.py +++ b/lib/python/Screens/ServiceScan.py @@ -32,26 +32,11 @@ class ServiceScan(Screen): def ok(self): print "ok" if self["scan"].isDone(): - self.resetTimeout() self.close() def cancel(self): - self.resetTimeout() self.close() - def setTimeout(self): - try: - self.oldtimeoutvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline() - open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0") - except: - print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" - - def resetTimeout(self): - try: - open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(self.oldtimeoutvalue) - except: - print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available" - def __init__(self, session, scanList): Screen.__init__(self, session) @@ -73,9 +58,7 @@ class ServiceScan(Screen): "ok": self.ok, "cancel": self.cancel }) - - self.setTimeout() - + self.onFirstExecBegin.append(self.doServiceScan) def doServiceScan(self): -- cgit v1.2.3 From b10d0e67edef01beaae1504ddffa691fe69eec4a Mon Sep 17 00:00:00 2001 From: acid-burn Date: Mon, 5 Apr 2010 21:24:13 +0200 Subject: Softwaremanager: * notify if updatefeed is not available and also verify HardwarePrerequisites. Fixes #503 --- .../SystemPlugins/SoftwareManager/SoftwareTools.py | 22 ++++++++++++++++++++++ .../SystemPlugins/SoftwareManager/plugin.py | 18 +++++++++--------- 2 files changed, 31 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index e8cf6dc2..a7c88c95 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -7,6 +7,7 @@ from Components.Sources.List import List from Components.Ipkg import IpkgComponent from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_METADIR +from Tools.HardwareInfo import HardwareInfo from time import time @@ -78,9 +79,12 @@ class SoftwareTools(DreamInfoHandler): def ipkgCallback(self, event, param): if event == IpkgComponent.EVENT_ERROR: SoftwareTools.list_updating = False + if self.NotifierCallback is not None: + self.NotifierCallback(False) elif event == IpkgComponent.EVENT_DONE: if SoftwareTools.list_updating: self.startIpkgListAvailable() + #print event, "-", param pass def startIpkgListAvailable(self, callback = None): @@ -164,6 +168,14 @@ class SoftwareTools(DreamInfoHandler): l = len(tokens) version = l > 1 and tokens[1].strip() or "" SoftwareTools.installed_packetlist[name] = version + for package in self.packagesIndexlist[:]: + if not self.verifyPrerequisites(package[0]["prerequisites"]): + self.packagesIndexlist.remove(package) + for package in self.packagesIndexlist[:]: + attributes = package[0]["attributes"] + if attributes.has_key("packagetype"): + if attributes["packagetype"] == "internal": + self.packagesIndexlist.remove(package) if callback is None: self.countUpdates() else: @@ -228,4 +240,14 @@ class SoftwareTools(DreamInfoHandler): for name in self.UpdateConsole.appContainers.keys(): self.UpdateConsole.kill(name) + def verifyPrerequisites(self, prerequisites): + if prerequisites.has_key("hardware"): + hardware_found = False + for hardware in prerequisites["hardware"]: + if hardware == self.hardware_info.device_name: + hardware_found = True + if not hardware_found: + return False + return True + iSoftwareTools = SoftwareTools() \ No newline at end of file diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 4917855f..1e0ed4d5 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -307,8 +307,8 @@ class PluginManager(Screen, DreamInfoHandler): {"templates": {"default": (51,[ - MultiContentEntryText(pos = (30, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (30, 25), size = (470, 24), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description + MultiContentEntryText(pos = (0, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (0, 25), size = (470, 24), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description MultiContentEntryPixmapAlphaTest(pos = (475, 0), size = (48, 48), png = 5), # index 5 is the status pixmap MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 6), # index 6 is the div pixmap ]), @@ -405,18 +405,15 @@ class PluginManager(Screen, DreamInfoHandler): if status == 'update': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) self.statuslist.append(( _("Updating software catalog"), '', _("Searching for available updates. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) elif status == 'sync': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) elif status == 'error': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) + self["list"].style = "default" + self['list'].setList(self.statuslist) + def getUpdateInfos(self): self.setState('update') @@ -432,7 +429,10 @@ class PluginManager(Screen, DreamInfoHandler): self.rebuildList() elif retval is False: self.setState('error') - self["status"].setText(_("No network connection available.")) + if iSoftwareTools.NetworkConnectionAvailable: + self["status"].setText(_("Updatefeed not available.")) + else: + self["status"].setText(_("No network connection available.")) def rebuildList(self, retval = None): if self.currentSelectedTag is None: -- cgit v1.2.3 From 4b510799c728bca6d85823978d693c41d34bdc53 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Mon, 5 Apr 2010 22:26:29 +0200 Subject: Softwaremanager: *add missing define. refs #503 --- lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index a7c88c95..d4653cca 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -30,6 +30,7 @@ class SoftwareTools(DreamInfoHandler): self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion, language = self.language) self.directory = resolveFilename(SCOPE_METADIR) + self.hardware_info = HardwareInfo() self.list = List([]) self.NotifierCallback = None self.Console = Console() -- cgit v1.2.3 From 4007630dac238cccbfddd2ededa484f8fb14eb7c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 9 Apr 2010 15:21:13 +0200 Subject: fixes bug #467 add tpm interface to enigma 2 introduce a demo plugin for tpm usage in plugins to validate running on dream multimedia hardware to be used in plugins (see doc/TPM for further information) --- configure.ac | 1 + doc/TPM | 24 +++ lib/base/Makefile.am | 2 +- lib/base/etpm.cpp | 161 +++++++++++++++++++++ lib/base/etpm.h | 46 ++++++ lib/python/Plugins/DemoPlugins/Makefile.am | 6 +- lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am | 5 + lib/python/Plugins/DemoPlugins/TPMDemo/README | 1 + lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py | 82 +++++++++++ lib/python/Plugins/Makefile.am | 1 + lib/python/enigma_python.i | 2 + 11 files changed, 328 insertions(+), 3 deletions(-) create mode 100644 doc/TPM create mode 100644 lib/base/etpm.cpp create mode 100644 lib/base/etpm.h create mode 100644 lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am create mode 100644 lib/python/Plugins/DemoPlugins/TPMDemo/README create mode 100644 lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py (limited to 'lib') diff --git a/configure.ac b/configure.ac index d1b1d279..05c3a8eb 100755 --- a/configure.ac +++ b/configure.ac @@ -118,6 +118,7 @@ lib/python/Components/Sources/Makefile lib/python/Screens/Makefile lib/python/Plugins/Makefile lib/python/Plugins/DemoPlugins/Makefile +lib/python/Plugins/DemoPlugins/TPMDemo/Makefile lib/python/Plugins/DemoPlugins/TestPlugin/Makefile lib/python/Plugins/Extensions/CutListEditor/Makefile lib/python/Plugins/Extensions/CutListEditor/meta/Makefile diff --git a/doc/TPM b/doc/TPM new file mode 100644 index 00000000..2b2b2062 --- /dev/null +++ b/doc/TPM @@ -0,0 +1,24 @@ +If you'd like to write your own plugins and honor the efforts, Dream Multimedia +puts into developing Enigma 2, you can protect your plugin against execution +on Non-Dream Multimedia Hardware by implementing a TPM (Trusted Platform Module) +check into your plugin. +For ease of use we provide a demo plugin in lib/python/Plugins/DemoPlugins/TPMDemo. + +The main TPM check is implemented into the "main" function. You need to provide +this code yourself in your plugin. So copy&paste the code into your own as well +as the needed functions +- bin2long +- long2bin +- rsa_pub1024 +- decrypt_block +- validate_cert +- read_random +Importing the functions from somewhere else would spoil the security model. So +you need to provide the code with your plugin. + +You can either use the given method using the main function (which will run the +TPM check each time the plugin is called) or directly use it in the +Plugins(**kwargs) function and not return the Plugins-list if the TPM check failes +(which will prevent the plugin from showing up at all). You can also implement +a warning message for all possible TPM failure scenarios. + \ No newline at end of file diff --git a/lib/base/Makefile.am b/lib/base/Makefile.am index 6ea9d03f..05085632 100644 --- a/lib/base/Makefile.am +++ b/lib/base/Makefile.am @@ -8,5 +8,5 @@ libenigma_base_a_SOURCES = \ init.cpp message.cpp thread.cpp \ smartptr.cpp estring.cpp connection.cpp \ filepush.cpp encoding.cpp console.cpp rawfile.cpp \ - nconfig.cpp ioprio.cpp + nconfig.cpp ioprio.cpp etpm.cpp diff --git a/lib/base/etpm.cpp b/lib/base/etpm.cpp new file mode 100644 index 00000000..f1ac07ba --- /dev/null +++ b/lib/base/etpm.cpp @@ -0,0 +1,161 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DEFINE_REF(eTPM); + +eTPM::eTPM() +{ + struct sockaddr_un addr; + unsigned char buf[8]; + unsigned int tag, len; + unsigned char *val; + + level2_cert_read = level3_cert_read = false; + + addr.sun_family = AF_UNIX; + strcpy(addr.sun_path, TPMD_SOCKET); + + fd = socket(PF_UNIX, SOCK_STREAM, 0); + if (fd < 0) { + eDebug("[eTPM] socket error"); + return; + } + + if (connect(fd, (const struct sockaddr *)&addr, SUN_LEN(&addr)) < 0) { + eDebug("[eTPM] connect error"); + return; + } + + buf[0] = TPMD_DT_LEVEL2_CERT; + buf[1] = TPMD_DT_LEVEL3_CERT; + if (!send_cmd(TPMD_CMD_GET_DATA, buf, 2)) + { + return; + } + + val = (unsigned char*)recv_cmd(&tag, &len); + if (val == NULL) + { + return; + } + + parse_data(val, len); + free(val); +} + +eTPM::~eTPM() +{ + +} + +bool eTPM::send_cmd(enum tpmd_cmd cmd, const void *data, unsigned int len) +{ + unsigned char buf[len + 4]; + + buf[0] = (cmd >> 8) & 0xff; + buf[1] = (cmd >> 0) & 0xff; + buf[2] = (len >> 8) & 0xff; + buf[3] = (len >> 0) & 0xff; + memcpy(&buf[4], data, len); + + if (write(fd, buf, sizeof(buf)) != (ssize_t)sizeof(buf)) { + fprintf(stderr, "%s: incomplete write\n", __func__); + return false; + } + + return true; +} + +void* eTPM::recv_cmd(unsigned int *tag, unsigned int *len) +{ + unsigned char buf[4]; + void *val; + + if (read(fd, buf, 4) != 4) { + fprintf(stderr, "%s: incomplete read\n", __func__); + return NULL; + } + + *tag = (buf[0] << 8) | buf[1]; + *len = (buf[2] << 8) | buf[3]; + + val = malloc(*len); + if (val == NULL) + return NULL; + + if (read(fd, val, *len) != (ssize_t)*len) { + fprintf(stderr, "%s: incomplete read\n", __func__); + free(val); + return NULL; + } + + return val; +} + +void eTPM::parse_data(const unsigned char *data, unsigned int datalen) +{ + unsigned int i, j; + unsigned int tag; + unsigned int len; + const unsigned char *val; + + for (i = 0; i < datalen; i += len) { + tag = data[i++]; + len = data[i++]; + val = &data[i]; + + switch (tag) { + case TPMD_DT_LEVEL2_CERT: + if (len != 210) + break; + memcpy(level2_cert, val, 210); + level2_cert_read = true; + break; + case TPMD_DT_LEVEL3_CERT: + if (len != 210) + break; + memcpy(level3_cert, val, 210); + level3_cert_read = true; + break; + } + } +} + +PyObject *eTPM::getCert(cert_type type) +{ + if (type == TPMD_DT_LEVEL2_CERT && level2_cert_read) + return PyBuffer_FromMemory(level2_cert, 210); + else if (type == TPMD_DT_LEVEL3_CERT && level3_cert_read) + return PyBuffer_FromMemory(level3_cert, 210); + return Py_None; + +} + +PyObject *eTPM::challenge(PyObject* rnd) +{ + if (PyString_Check(rnd) && PyString_Size(rnd) == 8) + { + char* buf = PyString_AsString(rnd); + if (!send_cmd(TPMD_CMD_COMPUTE_SIGNATURE, buf, 8)) + return Py_None; + + unsigned int tag, len; + unsigned char *val = (unsigned char*)recv_cmd(&tag, &len); + + if (tag != TPMD_CMD_COMPUTE_SIGNATURE) + return Py_None; + + return PyBuffer_FromMemory(val, len); + } + else + return Py_None; +} diff --git a/lib/base/etpm.h b/lib/base/etpm.h new file mode 100644 index 00000000..3728249b --- /dev/null +++ b/lib/base/etpm.h @@ -0,0 +1,46 @@ +#ifndef __lib_base_etpm_h +#define __lib_base_etpm_h + +#include +#include + +#ifndef SWIG +#define TPMD_SOCKET "/var/run/tpmd_socket" +#endif + +class eTPM: public Object, public iObject +{ + DECLARE_REF(eTPM); +#ifndef SWIG + int fd; + unsigned char level2_cert[210]; + unsigned char level3_cert[210]; + bool level2_cert_read; + bool level3_cert_read; + + enum tpmd_cmd { + TPMD_CMD_RESERVED = 0x0000, + TPMD_CMD_GET_DATA = 0x0001, + TPMD_CMD_APDU = 0x0002, + TPMD_CMD_COMPUTE_SIGNATURE = 0x0003, + TPMD_CMD_APP_CERT = 0x0004, + }; + + bool send_cmd(enum tpmd_cmd cmd, const void *data, unsigned int len); + void *recv_cmd(unsigned int *tag, unsigned int *len); + void parse_data(const unsigned char *data, unsigned int datalen); + +#endif +public: + eTPM(); + ~eTPM(); + + enum cert_type { + TPMD_DT_LEVEL2_CERT = 0x04, + TPMD_DT_LEVEL3_CERT = 0x05 + }; + PyObject *getCert(cert_type type); + PyObject *challenge(PyObject *rnd); +}; + +#endif // __lib_base_etpm_h diff --git a/lib/python/Plugins/DemoPlugins/Makefile.am b/lib/python/Plugins/DemoPlugins/Makefile.am index aace17cc..9e16bfc1 100755 --- a/lib/python/Plugins/DemoPlugins/Makefile.am +++ b/lib/python/Plugins/DemoPlugins/Makefile.am @@ -1,6 +1,8 @@ installdir = $(pkglibdir)/python/Plugins/DemoPlugins -SUBDIRS = TestPlugin +SUBDIRS = TestPlugin TPMDemo install_PYTHON = \ - __init__.py \ No newline at end of file + __init__.py + + \ No newline at end of file diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am new file mode 100644 index 00000000..3ccca98e --- /dev/null +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am @@ -0,0 +1,5 @@ +installdir = $(LIBDIR)/enigma2/python/Plugins/DemoPlugins/TPMDemo + +install_PYTHON = \ + __init__.py \ + plugin.py diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/README b/lib/python/Plugins/DemoPlugins/TPMDemo/README new file mode 100644 index 00000000..89a972aa --- /dev/null +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/README @@ -0,0 +1 @@ +Please read enigma2/doc/TPM for further instructions on how to integrate this into your own plugins. \ No newline at end of file diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py new file mode 100644 index 00000000..dafb2837 --- /dev/null +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py @@ -0,0 +1,82 @@ +from Screens.Screen import Screen +from Plugins.Plugin import PluginDescriptor +from enigma import eTPM +import sha + +def bin2long(s): + return reduce( lambda x,y:(x<<8L)+y, map(ord, s)) + +def long2bin(l): + res = "" + for byte in range(128): + res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff) + return res + +def rsa_pub1024(src, mod): + return long2bin(pow(bin2long(src), 65537, bin2long(mod))) + +def decrypt_block(src, mod): + if len(src) != 128 and len(src) != 202: + return None + dest = rsa_pub1024(src[:128], mod) + hash = sha.new(dest[1:107]) + if len(src) == 202: + hash.update(src[131:192]) + result = hash.digest() + if result == dest[107:127]: + return dest + return None + +def validate_cert(cert, key): + buf = decrypt_block(cert[8:], key) + if buf is None: + return None + return buf[36:107] + cert[139:196] + +def read_random(): + try: + fd = open("/dev/urandom", "r") + buf = fd.read(8) + fd.close() + return buf + except: + return None + +def main(session, **kwargs): + rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + + etpm = eTPM() + l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) + if l2cert is None: + print "l2cert not found" + return + + l2key = validate_cert(l2cert, rootkey) + if l2key is None: + print "l2cert invalid" + return + + l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) + if l3cert is None: + print "l3cert not found (can be fixed by running the genuine dreambox plugin and running the offered update)" + return + + l3key = validate_cert(l3cert, l2key) + if l3key is None: + print "l3cert invalid" + return + + rnd = read_random() + if rnd is None: + print "random error" + return + val = etpm.challenge(rnd) + result = decrypt_block(val, l3key) + if result[80:88] == rnd: + print "successfully finished the tpm test" + # would start your plugin here + +def Plugins(**kwargs): + return [PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main), + PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), icon = "plugin.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main)] + \ No newline at end of file diff --git a/lib/python/Plugins/Makefile.am b/lib/python/Plugins/Makefile.am index f0435036..79d2b0b6 100644 --- a/lib/python/Plugins/Makefile.am +++ b/lib/python/Plugins/Makefile.am @@ -4,3 +4,4 @@ SUBDIRS = Extensions SystemPlugins DemoPlugins install_PYTHON = \ __init__.py Plugin.py + diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 2fec2ff1..19fb9254 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -39,6 +39,7 @@ is usually caused by not marking PSignals as immutable. #include #include #include +#include #include #include #include @@ -157,6 +158,7 @@ typedef long time_t; %immutable ePythonMessagePump::recv_msg; %immutable eDVBLocalTimeHandler::m_timeUpdated; %include +%include %include %include %include -- cgit v1.2.3 From 31addde4d83dfbbaf273bc48a1f0783dc476a30f Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 9 Apr 2010 19:10:52 +0200 Subject: refs bug #467 add __init__.py in TPMDemo plugin --- lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py (limited to 'lib') diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py b/lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From b8d09c6e14ce43b375fcb5006444551713b42a7c Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 9 Apr 2010 20:40:28 +0200 Subject: refs bug #467 whitelist dm7025 from tpm test and add beta warning to the documentation --- doc/TPM | 5 +- lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py | 63 +++++++++++++----------- 2 files changed, 37 insertions(+), 31 deletions(-) (limited to 'lib') diff --git a/doc/TPM b/doc/TPM index 2b2b2062..20c02300 100644 --- a/doc/TPM +++ b/doc/TPM @@ -1,3 +1,6 @@ +The TPM check is currently to be considered a beta version. So please expect +code changes in the future. + If you'd like to write your own plugins and honor the efforts, Dream Multimedia puts into developing Enigma 2, you can protect your plugin against execution on Non-Dream Multimedia Hardware by implementing a TPM (Trusted Platform Module) @@ -21,4 +24,4 @@ TPM check each time the plugin is called) or directly use it in the Plugins(**kwargs) function and not return the Plugins-list if the TPM check failes (which will prevent the plugin from showing up at all). You can also implement a warning message for all possible TPM failure scenarios. - \ No newline at end of file + diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py index dafb2837..0be09ccf 100644 --- a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py @@ -1,5 +1,6 @@ from Screens.Screen import Screen from Plugins.Plugin import PluginDescriptor +from Tools.HardwareInfo import HardwareInfo from enigma import eTPM import sha @@ -43,38 +44,40 @@ def read_random(): return None def main(session, **kwargs): - rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + device = HardwareInfo().get_device_name() + if device != "dm7025": + rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + + etpm = eTPM() + l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) + if l2cert is None: + print "l2cert not found" + return - etpm = eTPM() - l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) - if l2cert is None: - print "l2cert not found" - return - - l2key = validate_cert(l2cert, rootkey) - if l2key is None: - print "l2cert invalid" - return - - l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) - if l3cert is None: - print "l3cert not found (can be fixed by running the genuine dreambox plugin and running the offered update)" - return - - l3key = validate_cert(l3cert, l2key) - if l3key is None: - print "l3cert invalid" - return - - rnd = read_random() - if rnd is None: - print "random error" - return - val = etpm.challenge(rnd) - result = decrypt_block(val, l3key) - if result[80:88] == rnd: + l2key = validate_cert(l2cert, rootkey) + if l2key is None: + print "l2cert invalid" + return + + l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) + if l3cert is None: + print "l3cert not found (can be fixed by running the genuine dreambox plugin and running the offered update)" + return + + l3key = validate_cert(l3cert, l2key) + if l3key is None: + print "l3cert invalid" + return + + rnd = read_random() + if rnd is None: + print "random error" + return + val = etpm.challenge(rnd) + result = decrypt_block(val, l3key) + if device == "dm7025" or result[80:88] == rnd: print "successfully finished the tpm test" - # would start your plugin here + # would start your plugin here def Plugins(**kwargs): return [PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main), -- cgit v1.2.3 From cdf6f671e3089e8269ce3dd0dd20dbc4878b898a Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 9 Apr 2010 20:49:15 +0200 Subject: refs bug #467 read proc device instead of using internal methods --- lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py index 0be09ccf..2c078d35 100644 --- a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py @@ -1,6 +1,5 @@ from Screens.Screen import Screen from Plugins.Plugin import PluginDescriptor -from Tools.HardwareInfo import HardwareInfo from enigma import eTPM import sha @@ -44,7 +43,10 @@ def read_random(): return None def main(session, **kwargs): - device = HardwareInfo().get_device_name() + try: + device = open("/proc/stb/info/model", "r").readline().strip() + except: + device = "" if device != "dm7025": rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] -- cgit v1.2.3 From 9ef36b8496f187930ff526565546343e503617ab Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 12 Apr 2010 10:59:33 +0200 Subject: lib/base/etpm.cpp: use instead of --- lib/base/etpm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/base/etpm.cpp b/lib/base/etpm.cpp index f1ac07ba..c2642724 100644 --- a/lib/base/etpm.cpp +++ b/lib/base/etpm.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -103,7 +103,7 @@ void* eTPM::recv_cmd(unsigned int *tag, unsigned int *len) void eTPM::parse_data(const unsigned char *data, unsigned int datalen) { - unsigned int i, j; + unsigned int i; unsigned int tag; unsigned int len; const unsigned char *val; -- cgit v1.2.3 From 6f71e3512f6112d2523901860c603c03fd6e6ccd Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 13 Apr 2010 00:03:38 +0200 Subject: lib/gui/elistboxcontent.cpp: fix compiler warning --- lib/gui/elistboxcontent.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index 4465d84c..b9e71df8 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -49,7 +49,8 @@ int iListboxContent::currentCursorSelectable() DEFINE_REF(eListboxPythonStringContent); -eListboxPythonStringContent::eListboxPythonStringContent(): m_itemheight(25), m_cursor(0) +eListboxPythonStringContent::eListboxPythonStringContent() + :m_cursor(0), m_itemheight(25) { } @@ -81,7 +82,7 @@ int eListboxPythonStringContent::cursorMove(int count) int eListboxPythonStringContent::cursorValid() { - return ((unsigned int)m_cursor) < size(); + return m_cursor < size(); } int eListboxPythonStringContent::cursorSet(int n) -- cgit v1.2.3 From 1401e6b972efb009c2a7602e41abe6c1c809a63e Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 13 Apr 2010 00:16:15 +0200 Subject: lib/base/etpm.h,cpp: simplify and cleanup code --- lib/base/etpm.cpp | 63 ++++++++++++++++++++++++++++++++----------------------- lib/base/etpm.h | 18 +++++++--------- 2 files changed, 45 insertions(+), 36 deletions(-) (limited to 'lib') diff --git a/lib/base/etpm.cpp b/lib/base/etpm.cpp index c2642724..9a443e0a 100644 --- a/lib/base/etpm.cpp +++ b/lib/base/etpm.cpp @@ -8,15 +8,16 @@ #include #include #include -#include +#include -DEFINE_REF(eTPM); +#include "etpm.h" eTPM::eTPM() { struct sockaddr_un addr; unsigned char buf[8]; - unsigned int tag, len; + unsigned int tag; + size_t len; unsigned char *val; level2_cert_read = level3_cert_read = false; @@ -25,12 +26,14 @@ eTPM::eTPM() strcpy(addr.sun_path, TPMD_SOCKET); fd = socket(PF_UNIX, SOCK_STREAM, 0); - if (fd < 0) { + if (fd < 0) + { eDebug("[eTPM] socket error"); return; } - if (connect(fd, (const struct sockaddr *)&addr, SUN_LEN(&addr)) < 0) { + if (connect(fd, (const struct sockaddr *)&addr, SUN_LEN(&addr)) < 0) + { eDebug("[eTPM] connect error"); return; } @@ -57,7 +60,7 @@ eTPM::~eTPM() } -bool eTPM::send_cmd(enum tpmd_cmd cmd, const void *data, unsigned int len) +bool eTPM::send_cmd(enum tpmd_cmd cmd, const void *data, size_t len) { unsigned char buf[len + 4]; @@ -67,7 +70,8 @@ bool eTPM::send_cmd(enum tpmd_cmd cmd, const void *data, unsigned int len) buf[3] = (len >> 0) & 0xff; memcpy(&buf[4], data, len); - if (write(fd, buf, sizeof(buf)) != (ssize_t)sizeof(buf)) { + if (write(fd, buf, sizeof(buf)) != (ssize_t)sizeof(buf)) + { fprintf(stderr, "%s: incomplete write\n", __func__); return false; } @@ -75,12 +79,13 @@ bool eTPM::send_cmd(enum tpmd_cmd cmd, const void *data, unsigned int len) return true; } -void* eTPM::recv_cmd(unsigned int *tag, unsigned int *len) +void* eTPM::recv_cmd(unsigned int *tag, size_t *len) { unsigned char buf[4]; void *val; - if (read(fd, buf, 4) != 4) { + if (read(fd, buf, 4) != 4) + { fprintf(stderr, "%s: incomplete read\n", __func__); return NULL; } @@ -92,7 +97,13 @@ void* eTPM::recv_cmd(unsigned int *tag, unsigned int *len) if (val == NULL) return NULL; - if (read(fd, val, *len) != (ssize_t)*len) { + ssize_t rd = read(fd, val, *len); + if (rd < 0) + { + perror("eTPM::recv_cmd read"); + free(val); + } + else if ((size_t)rd != *len) { fprintf(stderr, "%s: incomplete read\n", __func__); free(val); return NULL; @@ -101,7 +112,7 @@ void* eTPM::recv_cmd(unsigned int *tag, unsigned int *len) return val; } -void eTPM::parse_data(const unsigned char *data, unsigned int datalen) +void eTPM::parse_data(const unsigned char *data, size_t datalen) { unsigned int i; unsigned int tag; @@ -130,32 +141,32 @@ void eTPM::parse_data(const unsigned char *data, unsigned int datalen) } } -PyObject *eTPM::getCert(cert_type type) +std::string eTPM::getCert(cert_type type) { if (type == TPMD_DT_LEVEL2_CERT && level2_cert_read) - return PyBuffer_FromMemory(level2_cert, 210); + return std::string((char*)level2_cert, 210); else if (type == TPMD_DT_LEVEL3_CERT && level3_cert_read) - return PyBuffer_FromMemory(level3_cert, 210); - return Py_None; - + return std::string((char*)level3_cert, 210); + return ""; } -PyObject *eTPM::challenge(PyObject* rnd) +std::string eTPM::challenge(std::string rnd) { - if (PyString_Check(rnd) && PyString_Size(rnd) == 8) + if (rnd.length() == 8) { - char* buf = PyString_AsString(rnd); - if (!send_cmd(TPMD_CMD_COMPUTE_SIGNATURE, buf, 8)) - return Py_None; + if (!send_cmd(TPMD_CMD_COMPUTE_SIGNATURE, rnd.c_str(), 8)) + return ""; - unsigned int tag, len; + unsigned int tag; + size_t len; unsigned char *val = (unsigned char*)recv_cmd(&tag, &len); if (tag != TPMD_CMD_COMPUTE_SIGNATURE) - return Py_None; + return ""; - return PyBuffer_FromMemory(val, len); + std::string ret((char*)val, len); + free(val); + return ret; } - else - return Py_None; + return ""; } diff --git a/lib/base/etpm.h b/lib/base/etpm.h index 3728249b..c9e52140 100644 --- a/lib/base/etpm.h +++ b/lib/base/etpm.h @@ -1,16 +1,14 @@ #ifndef __lib_base_etpm_h #define __lib_base_etpm_h -#include -#include - #ifndef SWIG #define TPMD_SOCKET "/var/run/tpmd_socket" #endif -class eTPM: public Object, public iObject +#include + +class eTPM { - DECLARE_REF(eTPM); #ifndef SWIG int fd; unsigned char level2_cert[210]; @@ -26,9 +24,9 @@ class eTPM: public Object, public iObject TPMD_CMD_APP_CERT = 0x0004, }; - bool send_cmd(enum tpmd_cmd cmd, const void *data, unsigned int len); - void *recv_cmd(unsigned int *tag, unsigned int *len); - void parse_data(const unsigned char *data, unsigned int datalen); + bool send_cmd(enum tpmd_cmd cmd, const void *data, size_t len); + void *recv_cmd(unsigned int *tag, size_t *len); + void parse_data(const unsigned char *data, size_t datalen); #endif public: @@ -39,8 +37,8 @@ public: TPMD_DT_LEVEL2_CERT = 0x04, TPMD_DT_LEVEL3_CERT = 0x05 }; - PyObject *getCert(cert_type type); - PyObject *challenge(PyObject *rnd); + std::string getCert(cert_type type); + std::string challenge(std::string rnd); }; #endif // __lib_base_etpm_h -- cgit v1.2.3 From 2b2953574912796d7d7878f6523614ee3164fdb9 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 15 Apr 2010 00:42:04 +0200 Subject: add possibility to reserve a demux from python (via rawChannel) --- lib/dvb/dvb.cpp | 12 ++++++++++++ lib/dvb/dvb.h | 1 + lib/dvb/idvb.h | 1 + 3 files changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 17712dde..836851c5 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -1657,6 +1657,18 @@ void eDVBChannel::SDTready(int result) m_SDT = 0; } +int eDVBChannel::reserveDemux() +{ + ePtr dmx; + if (!getDemux(dmx, 0)) + { + uint8_t id; + if (!dmx->getCADemuxID(id)) + return id; + } + return -1; +} + RESULT eDVBChannel::requestTsidOnid(ePyObject callback) { if (PyCallable_Check(callback)) diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index 7b320006..405bd557 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -268,6 +268,7 @@ public: int getUseCount() { return m_use_count; } RESULT requestTsidOnid(ePyObject callback); + int reserveDemux(); private: ePtr m_frontend; ePtr m_demux, m_decoder_demux; diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index d20829bf..996d7909 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -508,6 +508,7 @@ public: /* direct frontend access for raw channels and/or status inquiries. */ virtual SWIG_VOID(RESULT) getFrontend(ePtr &SWIG_OUTPUT)=0; virtual RESULT requestTsidOnid(SWIG_PYOBJECT(ePyObject) callback) { return -1; } + virtual int reserveDemux() { return -1; } #ifndef SWIG enum { -- cgit v1.2.3 From eabe6b3063866f8e32eb2aed0131d5de498f1c8c Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 20 Apr 2010 20:42:12 +0200 Subject: lib/gdi/lcd.cpp: new oled_brightness path is now /proc/stb/lcd/... this fixes bug #514 --- lib/gdi/lcd.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/gdi/lcd.cpp b/lib/gdi/lcd.cpp index ecc19b53..0908d890 100644 --- a/lib/gdi/lcd.cpp +++ b/lib/gdi/lcd.cpp @@ -49,7 +49,9 @@ eDBoxLCD::eDBoxLCD(): eLCD(eSize(132, 64)) lcdfd = open("/dev/dbox/oled0", O_RDWR); if (lcdfd < 0) { - FILE *f=fopen("/proc/stb/fp/oled_brightness", "w"); + FILE *f=fopen("/proc/stb/lcd/oled_brightness", "w"); + if (!f) + f = fopen("/proc/stb/fp/oled_brightness", "w"); if (f) { is_oled = 2; @@ -102,11 +104,13 @@ int eDBoxLCD::setLCDContrast(int contrast) int eDBoxLCD::setLCDBrightness(int brightness) { eDebug("setLCDBrightness %d", brightness); - FILE *f=fopen("/proc/stb/fp/oled_brightness", "w"); + FILE *f=fopen("/proc/stb/lcd/oled_brightness", "w"); + if (!f) + f = fopen("/proc/stb/fp/oled_brightness", "w"); if (f) { if (fprintf(f, "%d", brightness) == 0) - eDebug("write /proc/stb/fp/oled_brightness failed!! (%m)"); + eDebug("write /proc/stb/lcd/oled_brightness failed!! (%m)"); fclose(f); } else -- cgit v1.2.3 From 56f2ffeb0301567710eb8f08a92a73ce67a40ef5 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 29 Apr 2010 18:29:07 +0200 Subject: dm800se support --- data/defaults/Dream/Makefile.am | 2 ++ data/defaults/Dream/dm800se.info | 26 ++++++++++++++++++++++ data/defaults/Dream/settings.800se | 1 + lib/dvb/dvb.cpp | 4 +++- lib/dvb/dvb.h | 2 +- .../SystemPlugins/Videomode/VideoHardware.py | 4 ++-- .../Plugins/SystemPlugins/Videomode/VideoWizard.py | 4 ++-- 7 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 data/defaults/Dream/dm800se.info create mode 100644 data/defaults/Dream/settings.800se (limited to 'lib') diff --git a/data/defaults/Dream/Makefile.am b/data/defaults/Dream/Makefile.am index 31ba1c69..cda55835 100644 --- a/data/defaults/Dream/Makefile.am +++ b/data/defaults/Dream/Makefile.am @@ -4,10 +4,12 @@ installdir = $(pkgdatadir)/defaults/Dream dist_install_DATA = \ bouquets.tv \ + dm800se.info \ dm500hd.info \ dm7025.info \ dm8000.info \ dm800.info \ + settings.800se \ settings.500hd \ settings.7025 \ settings.800 \ diff --git a/data/defaults/Dream/dm800se.info b/data/defaults/Dream/dm800se.info new file mode 100644 index 00000000..6974b120 --- /dev/null +++ b/data/defaults/Dream/dm800se.info @@ -0,0 +1,26 @@ + + + + + + + + Dream Multimedia GmbH + Dream Multimedia Default + + + + + + + + + + + + diff --git a/data/defaults/Dream/settings.800se b/data/defaults/Dream/settings.800se new file mode 100644 index 00000000..ae2963bb --- /dev/null +++ b/data/defaults/Dream/settings.800se @@ -0,0 +1 @@ +config.misc.rcused=1 \ No newline at end of file diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 836851c5..40d44186 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -96,6 +96,8 @@ eDVBResourceManager::eDVBResourceManager() m_boxtype = DM800; else if (!strncmp(tmp, "dm500hd\n", rd)) m_boxtype = DM500HD; + else if (!strncmp(tmp, "dm800se\n", rd)) + m_boxtype = DM800SE; else { eDebug("boxtype detection via /proc/stb/info not possible... use fallback via demux count!\n"); if (m_demux.size() == 3) @@ -455,7 +457,7 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr unused; - if (m_boxtype == DM800 || m_boxtype == DM500HD) // dm800 / 500hd + if (m_boxtype == DM800 || m_boxtype == DM500HD || m_boxtype == DM800SE) // dm800 / 500hd { cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux for (; i != m_demux.end(); ++i, ++n) diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index 405bd557..fb925807 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -135,7 +135,7 @@ class eDVBResourceManager: public iObject, public Object DECLARE_REF(eDVBResourceManager); int avail, busy; - enum { DM7025, DM800, DM500HD, DM8000 }; + enum { DM7025, DM800, DM500HD, DM800SE, DM8000 }; int m_boxtype; diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index e3b902f0..59c50476 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -239,9 +239,9 @@ class VideoHardware: portlist = self.getPortList() for port in portlist: descr = port - if descr == 'DVI' and hw_type == 'dm500hd': + if descr == 'DVI' and hw_type in ('dm500hd', 'dm800se'): descr = 'HDMI' - elif descr == 'DVI-PC' and hw_type == 'dm500hd': + elif descr == 'DVI-PC' and hw_type in ('dm500hd', 'dm800se'): descr = 'HDMI-PC' lst.append((port, descr)) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 15f4d516..3c76685e 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -82,7 +82,7 @@ class VideoWizard(WizardLanguage, Rc): for port in self.hw.getPortList(): if self.hw.isPortUsed(port): descr = port - if descr == 'DVI' and hw_type == 'dm500hd': + if descr == 'DVI' and hw_type in ('dm500hd', 'dm800se'): descr = 'HDMI' if port != "DVI-PC": list.append((descr,port)) @@ -100,7 +100,7 @@ class VideoWizard(WizardLanguage, Rc): self.inputSelect(self.selection) if self["portpic"].instance is not None: picname = self.selection - if picname == "DVI" and HardwareInfo().get_device_name() == "dm500hd": + if picname == "DVI" and HardwareInfo().get_device_name() in ("dm500hd", "dm800se"): picname = "HDMI" self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + picname + ".png")) -- cgit v1.2.3 From eea0d8e99edec859a7535966b880b49bd0bba85a Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 5 May 2010 01:16:17 +0200 Subject: lib/gdi/font.cpp: call libfribidi for single lines on multi line texts to prevent top/bottom reordering this fixes bug #300 --- lib/gdi/font.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index dfac144c..2fd9fb69 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -595,22 +595,59 @@ int eTextPara::renderString(const char *string, int rflags) shape(uc_shape, uc_string); // now do the usual logical->visual reordering -#ifdef HAVE_FRIBIDI + int size=uc_shape.size(); +#ifdef HAVE_FRIBIDI FriBidiCharType dir=FRIBIDI_TYPE_ON; + int lines=1; + int pos=0, spos=0; + uc_visual.resize(size); + // gaaanz lahm, aber anders geht das leider nicht, sorry. + FriBidiChar array[size], target[size]; + std::copy(uc_shape.begin(), uc_shape.end(), array); + + bool line_open = false; + while(pos < size) { - int size=uc_shape.size(); - uc_visual.resize(size); - // gaaanz lahm, aber anders geht das leider nicht, sorry. - FriBidiChar array[size], target[size]; - std::copy(uc_shape.begin(), uc_shape.end(), array); - fribidi_log2vis(array, size, &dir, target, 0, 0, 0); - uc_visual.assign(target, target+size); + int incr=1; + bool line_end = false; + if (!line_open) + line_open = true; + switch((unsigned long)array[pos]) + { + case '\\': + if (pos+1 == size || (unsigned long)array[pos+1] != 'n') + break; + ++incr; + case 0x8A: + case 0xE08A: + case '\n': + line_end = true; + default: + break; + } + if (line_end || pos+incr >= size) { + int len = pos - spos; + if (len) + fribidi_log2vis(array+spos, len, &dir, target+spos, 0, 0, 0); + target[pos] = array[pos]; + if (incr > 1) + target[pos+1] = array[pos+1]; + spos = pos+incr; + ++lines; + line_open = false; + } + pos += incr; } + + if (lines < 2) + fribidi_log2vis(array, size, &dir, target, 0, 0, 0); + + uc_visual.assign(target, target+size); #else uc_visual=uc_shape; #endif - glyphs.reserve(uc_visual.size()); + glyphs.reserve(size); int nextflags = 0; -- cgit v1.2.3 From 720812b388b0c6cb14a175957ff4017ea8af07e2 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 5 May 2010 16:00:27 +0200 Subject: set subtitle-sink gstreamer caps (fixed #506, requires gst-plugin-playbin_0.10.28-r7.1) --- lib/service/servicemp3.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 0b2ac9d4..50b02efd 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -328,6 +328,7 @@ eServiceMP3::eServiceMP3(eServiceReference ref) else { m_subs_to_pull_handler_id = g_signal_connect (subsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this); + g_object_set (G_OBJECT (subsink), "caps", gst_caps_from_string("text/x-plain; text/x-pango-markup"), NULL); g_object_set (G_OBJECT (m_gst_playbin), "text-sink", subsink, NULL); } -- cgit v1.2.3 From 995cb7dd936b2ec22ea414182a227ed8b2da867c Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 6 May 2010 14:24:22 +0200 Subject: Network.py,NetworkSetup.py,skin_default.xml: * Introduce new unified naming for network interfaces. * Redesign NetworkadapterSelection Screen. * small cleanups. Refs #137 , Fixes #418 --- data/skin_default.xml | 14 +++- data/skin_default/icons/Makefile.am | 6 ++ data/skin_default/icons/network_wired-active.png | Bin 0 -> 2771 bytes data/skin_default/icons/network_wired-inactive.png | Bin 0 -> 2745 bytes data/skin_default/icons/network_wired.png | Bin 0 -> 2477 bytes .../skin_default/icons/network_wireless-active.png | Bin 0 -> 2821 bytes .../icons/network_wireless-inactive.png | Bin 0 -> 2745 bytes data/skin_default/icons/network_wireless.png | Bin 0 -> 2539 bytes lib/python/Components/Network.py | 51 ++++++++++-- lib/python/Screens/NetworkSetup.py | 90 ++++++++++++--------- 10 files changed, 114 insertions(+), 47 deletions(-) mode change 100644 => 100755 data/skin_default/icons/Makefile.am create mode 100755 data/skin_default/icons/network_wired-active.png create mode 100755 data/skin_default/icons/network_wired-inactive.png create mode 100755 data/skin_default/icons/network_wired.png create mode 100755 data/skin_default/icons/network_wireless-active.png create mode 100755 data/skin_default/icons/network_wireless-inactive.png create mode 100755 data/skin_default/icons/network_wireless.png (limited to 'lib') diff --git a/data/skin_default.xml b/data/skin_default.xml index 0114349b..497d33ac 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -577,7 +577,19 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - + + + {"template": [ + MultiContentEntryText(pos = (85, 6), size = (440, 28), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1), # index 1 is the interfacename + MultiContentEntryText(pos = (85, 43), size = (440, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_BOTTOM, text = 2), # index 2 is the description + MultiContentEntryPixmapAlphaTest(pos = (2, 8), size = (54, 54), png = 3), # index 3 is the interface pixmap + MultiContentEntryPixmapAlphaTest(pos = (63, 46), size = (15, 16), png = 4), # index 4 is the default pixmap + ], + "fonts": [gFont("Regular", 28),gFont("Regular", 20)], + "itemHeight": 70 + } + + diff --git a/data/skin_default/icons/Makefile.am b/data/skin_default/icons/Makefile.am old mode 100644 new mode 100755 index 8e2052b0..088556a6 --- a/data/skin_default/icons/Makefile.am +++ b/data/skin_default/icons/Makefile.am @@ -34,6 +34,12 @@ dist_install_DATA = \ lock.png \ marker.png \ mp_buttons.png \ + network_wired.png \ + network_wired-active.png \ + network_wired-inactive.png \ + network_wireless.png \ + network_wireless-active.png \ + network_wireless-inactive.png \ plugin.png \ rass_logo.png \ rass_page1.png \ diff --git a/data/skin_default/icons/network_wired-active.png b/data/skin_default/icons/network_wired-active.png new file mode 100755 index 00000000..d8efc9c8 Binary files /dev/null and b/data/skin_default/icons/network_wired-active.png differ diff --git a/data/skin_default/icons/network_wired-inactive.png b/data/skin_default/icons/network_wired-inactive.png new file mode 100755 index 00000000..18f2c70f Binary files /dev/null and b/data/skin_default/icons/network_wired-inactive.png differ diff --git a/data/skin_default/icons/network_wired.png b/data/skin_default/icons/network_wired.png new file mode 100755 index 00000000..db695ad5 Binary files /dev/null and b/data/skin_default/icons/network_wired.png differ diff --git a/data/skin_default/icons/network_wireless-active.png b/data/skin_default/icons/network_wireless-active.png new file mode 100755 index 00000000..07a21874 Binary files /dev/null and b/data/skin_default/icons/network_wireless-active.png differ diff --git a/data/skin_default/icons/network_wireless-inactive.png b/data/skin_default/icons/network_wireless-inactive.png new file mode 100755 index 00000000..5bd69f9d Binary files /dev/null and b/data/skin_default/icons/network_wireless-inactive.png differ diff --git a/data/skin_default/icons/network_wireless.png b/data/skin_default/icons/network_wireless.png new file mode 100755 index 00000000..629a05a6 Binary files /dev/null and b/data/skin_default/icons/network_wireless.png differ diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index b9da48d8..e8a3d459 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -26,6 +26,9 @@ class Network: self.DnsConsole = Console() self.PingConsole = Console() self.config_ready = None + self.friendlyNames = {} + self.lan_interfaces = [] + self.wlan_interfaces = [] self.getInterfaces() def onRemoteRootFS(self): @@ -309,13 +312,47 @@ class Network: return len(self.ifaces) def getFriendlyAdapterName(self, x): - # maybe this needs to be replaced by an external list. - friendlyNames = { - "eth0": _("Integrated Ethernet"), - "wlan0": _("Wireless"), - "ath0": _("Integrated Wireless") - } - return friendlyNames.get(x, x) # when we have no friendly name, use adapter name + if x in self.friendlyNames.keys(): + return self.friendlyNames.get(x, x) + else: + self.friendlyNames[x] = self.getFriendlyAdapterNaming(x) + return self.friendlyNames.get(x, x) # when we have no friendly name, use adapter name + + def getFriendlyAdapterNaming(self, iface): + if iface.startswith('eth'): + if iface not in self.lan_interfaces and len(self.lan_interfaces) == 0: + self.lan_interfaces.append(iface) + return _("LAN connection") + elif iface not in self.lan_interfaces and len(self.lan_interfaces) >= 1: + self.lan_interfaces.append(iface) + return _("LAN connection") + " " + str(len(self.lan_interfaces)) + else: + if iface not in self.wlan_interfaces and len(self.wlan_interfaces) == 0: + self.wlan_interfaces.append(iface) + return _("WLAN connection") + elif iface not in self.wlan_interfaces and len(self.wlan_interfaces) >= 1: + self.wlan_interfaces.append(iface) + return _("WLAN connection") + " " + str(len(self.wlan_interfaces)) + + def getFriendlyAdapterDescription(self, iface): + if iface == 'eth0': + return _("Internal LAN adapter.") + else: + classdir = "/sys/class/net/" + iface + "/device/" + driverdir = "/sys/class/net/" + iface + "/device/driver/" + if os_path.exists(classdir): + files = listdir(classdir) + if 'driver' in files: + if os_path.realpath(driverdir).endswith('ath_pci'): + return _("Atheros")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('zd1211b'): + return _("Zydas")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('rt73'): + return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + else: + return _("Unknown network adapter.") + else: + return _("Unknown network adapter.") def getAdapterName(self, iface): return iface diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index c0037f81..2e33ac3b 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -7,6 +7,7 @@ from Screens.HelpMenu import HelpableScreen from Components.Network import iNetwork from Components.Sources.StaticText import StaticText from Components.Sources.Boolean import Boolean +from Components.Sources.List import List from Components.Label import Label,MultiColorLabel from Components.Pixmap import Pixmap,MultiPixmap from Components.MenuList import MenuList @@ -23,32 +24,6 @@ from os import path as os_path, system as os_system, unlink from re import compile as re_compile, search as re_search -class InterfaceList(MenuList): - def __init__(self, list, enableWrapAround=False): - MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) - self.l.setFont(0, gFont("Regular", 20)) - self.l.setItemHeight(30) - -def InterfaceEntryComponent(index,name,default,active ): - res = [ - (index), - MultiContentEntryText(pos=(80, 5), size=(430, 25), font=0, text=name) - ] - num_configured_if = len(iNetwork.getConfiguredAdapters()) - if num_configured_if >= 2: - if default is True: - png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue.png")) - if default is False: - png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue_off.png")) - res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(25, 25), png = png)) - if active is True: - png2 = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png")) - if active is False: - png2 = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_error.png")) - res.append(MultiContentEntryPixmapAlphaTest(pos=(40, 1), size=(25, 25), png = png2)) - return res - - class NetworkAdapterSelection(Screen,HelpableScreen): def __init__(self, session): Screen.__init__(self, session) @@ -91,13 +66,49 @@ class NetworkAdapterSelection(Screen,HelpableScreen): }) self.list = [] - self["list"] = InterfaceList(self.list) + self["list"] = List(self.list) self.updateList() if len(self.adapters) == 1: self.onFirstExecBegin.append(self.okbuttonClick) self.onClose.append(self.cleanup) + def buildInterfaceList(self,iface,name,default,active ): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + defaultpng = None + activepng = None + description = None + interfacepng = None + + if iface in iNetwork.lan_interfaces: + if active is True: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wired-active.png")) + elif active is False: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wired-inactive.png")) + else: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wired.png")) + elif iface in iNetwork.wlan_interfaces: + if active is True: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wireless-active.png")) + elif active is False: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wireless-inactive.png")) + else: + interfacepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/network_wireless.png")) + + num_configured_if = len(iNetwork.getConfiguredAdapters()) + if num_configured_if >= 2: + if default is True: + defaultpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue.png")) + elif default is False: + defaultpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue_off.png")) + if active is True: + activepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png")) + elif active is False: + activepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_error.png")) + + description = iNetwork.getFriendlyAdapterDescription(iface) + + return((iface, name, description, interfacepng, defaultpng, activepng, divpng)) def updateList(self): self.list = [] @@ -122,7 +133,7 @@ class NetworkAdapterSelection(Screen,HelpableScreen): default_gw = result if len(self.adapters) == 0: # no interface available => display only eth0 - self.list.append(InterfaceEntryComponent("eth0",iNetwork.getFriendlyAdapterName('eth0'),True,True )) + self.list.append(self.buildInterfaceList("eth0",iNetwork.getFriendlyAdapterName('eth0'),True,True )) else: for x in self.adapters: if x[1] == default_gw: @@ -133,11 +144,11 @@ class NetworkAdapterSelection(Screen,HelpableScreen): active_int = True else: active_int = False - self.list.append(InterfaceEntryComponent(index = x[1],name = _(x[0]),default=default_int,active=active_int )) + self.list.append(self.buildInterfaceList(x[1],_(x[0]),default_int,active_int )) if os_path.exists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml")): self["key_blue"].setText(_("NetworkWizard")) - self["list"].l.setList(self.list) + self["list"].setList(self.list) def setDefaultInterface(self): selection = self["list"].getCurrent() @@ -253,7 +264,7 @@ class NameserverSetup(Screen, ConfigListScreen, HelpableScreen): self.list = [] ConfigListScreen.__init__(self, self.list) self.createSetup() - + def createConfig(self): self.nameservers = iNetwork.getNameserverList() self.nameserverEntries = [ NoSave(ConfigIP(default=nameserver)) for nameserver in self.nameservers] @@ -412,7 +423,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.wsconfig = None self.default = None - if self.iface == "wlan0" or self.iface == "ath0" : + if self.iface in iNetwork.wlan_interfaces: from Plugins.SystemPlugins.WirelessLan.Wlan import wpaSupplicant,Wlan self.w = Wlan(self.iface) self.ws = wpaSupplicant() @@ -535,7 +546,7 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self.createSetup() if self["config"].getCurrent() == self.gatewayEntry: self.createSetup() - if self.iface == "wlan0" or self.iface == "ath0" : + if self.iface in iNetwork.wlan_interfaces: if self["config"].getCurrent() == self.wlanSSID: self.createSetup() if self["config"].getCurrent() == self.encryptionEnabled: @@ -731,7 +742,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def ok(self): self.cleanup() if self["menulist"].getCurrent()[1] == 'edit': - if self.iface == 'wlan0' or self.iface == 'ath0': + if self.iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless @@ -817,7 +828,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if self["menulist"].getCurrent()[1] == 'dns': self["description"].setText(_("Edit the Nameserver configuration of your Dreambox.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'scanwlan': - self["description"].setText(_("Scan your network for wireless Access Points and connect to them using your selected wireless device.\n" ) + self.oktext ) + self["description"].setText(_("Scan your network for wireless access points and connect to them using your selected wireless device.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'wlanstatus': self["description"].setText(_("Shows the state of your wireless LAN connection.\n" ) + self.oktext ) if self["menulist"].getCurrent()[1] == 'lanrestart': @@ -834,7 +845,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface)) self["Statustext"].setText(_("Link:")) - if self.iface == 'wlan0' or self.iface == 'ath0': + if self.iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus except: @@ -884,7 +895,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def AdapterSetupClosed(self, *ret): if ret is not None and len(ret): - if ret[0] == 'ok' and (self.iface == 'wlan0' or self.iface == 'ath0') and iNetwork.getAdapterAttribute(self.iface, "up") is True: + if ret[0] == 'ok' and (self.iface in iNetwork.wlan_interfaces) and iNetwork.getAdapterAttribute(self.iface, "up") is True: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless @@ -1263,6 +1274,7 @@ class NetworkAdapterTest(Screen): self.nextStepTimer.stop() def layoutFinished(self): + self.setTitle(_("Network test: ") + iNetwork.getFriendlyAdapterName(self.iface) ) self["shortcutsyellow"].setEnabled(False) self["AdapterInfo_OK"].hide() self["NetworkInfo_Check"].hide() @@ -1282,7 +1294,7 @@ class NetworkAdapterTest(Screen): self["AdapterInfo_Text"] = MultiColorLabel(_("Show Info")) self["AdapterInfo_OK"] = Pixmap() - if self.iface == 'wlan0' or self.iface == 'ath0': + if self.iface in iNetwork.wlan_interfaces: self["Networktext"] = MultiColorLabel(_("Wireless Network")) else: self["Networktext"] = MultiColorLabel(_("Local Network")) @@ -1321,7 +1333,7 @@ class NetworkAdapterTest(Screen): self["InfoText"] = Label() def getLinkState(self,iface): - if iface == 'wlan0' or iface == 'ath0': + if iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status except: -- cgit v1.2.3 From 85e468fa62411c066f23d64de384711aa2b35fa8 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 7 May 2010 12:49:48 +0200 Subject: mytest.py: load bouquets before parental control init and remove strange hack in parental control this fixes bug #532 --- lib/python/Components/ParentalControl.py | 11 +---------- mytest.py | 6 ++++-- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py index 9942bca7..63b5ccfb 100644 --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -55,11 +55,10 @@ def InitParentalControl(): class ParentalControl: def __init__(self): #Do not call open on init, because bouquets are not ready at that moment -# self.open() + self.open() self.serviceLevel = {} #Instead: Use Flags to see, if we already initialized config and called open self.configInitialized = False - self.filesOpened = False #This is the timer that is used to see, if the time for caching the pin is over #Of course we could also work without a timer and compare the times every #time we call isServicePlayable. But this might probably slow down zapping, @@ -89,9 +88,6 @@ class ParentalControl: def isServicePlayable(self, ref, callback): if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value: return True - #Check if we already read the whitelists and blacklists. If not: call open - if self.filesOpened == False: - self.open() #Check if configuration has already been read or if the significant values have changed. #If true: read the configuration if self.configInitialized == False or self.storeServicePin != config.ParentalControl.storeservicepin.value or self.storeServicePinCancel != config.ParentalControl.storeservicepincancel.value: @@ -153,8 +149,6 @@ class ParentalControl: def getProtectionType(self, service): #New method used in ParentalControlList: This method does not only return #if a service is protected or not, it also returns, why (whitelist or blacklist, service or bouquet) - if self.filesOpened == False: - self.open() sImage = "" if (config.ParentalControl.type.value == LIST_WHITELIST): if self.whitelist.has_key(service): @@ -319,14 +313,11 @@ class ParentalControl: def save(self): # we need to open the files in case we havent's read them yet - if not self.filesOpened: - self.open() self.saveListToFile(LIST_BLACKLIST) self.saveListToFile(LIST_WHITELIST) def open(self): self.openListFromFile(LIST_BLACKLIST) self.openListFromFile(LIST_WHITELIST) - self.filesOpened = True parentalControl = ParentalControl() diff --git a/mytest.py b/mytest.py index 4b687e05..a3cfb5a2 100755 --- a/mytest.py +++ b/mytest.py @@ -30,6 +30,9 @@ from Screens.SimpleSummary import SimpleSummary from sys import stdout, exc_info +profile("Bouquets") +eDVBDB.getInstance().reloadBouquets() + profile("ParentalControl") from Components.ParentalControl import InitParentalControl InitParentalControl() @@ -45,8 +48,7 @@ from Tools.Directories import InitFallbackFiles, resolveFilename, SCOPE_PLUGINS, from Components.config import config, configfile, ConfigText, ConfigYesNo, ConfigInteger, NoSave InitFallbackFiles() -profile("ReloadProfiles") -eDVBDB.getInstance().reloadBouquets() +profile("config.misc") config.misc.radiopic = ConfigText(default = resolveFilename(SCOPE_CURRENT_SKIN, "radio.mvi")) config.misc.isNextRecordTimerAfterEventActionAuto = ConfigYesNo(default=False) -- cgit v1.2.3 From 621f11e7e5dcf0253cf29028cc511329c6347c37 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 May 2010 11:14:01 +0200 Subject: lib/python/Screens/Satconfig.py: fixed crash on satconfig close in some conditions (thx to adenin) this fixes bug #533 --- lib/python/Screens/Satconfig.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 87d65e54..749c09db 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -360,7 +360,6 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): new_configured_sats = nimmanager.getConfiguredSats() self.unconfed_sats = old_configured_sats - new_configured_sats self.satpos_to_remove = None - self.restoreService(_("Zap back to service before tuner setup?")) self.deleteConfirmed((None, "no")) def deleteConfirmed(self, confirmed): @@ -390,7 +389,9 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): if confirmed[1] == "yestoall" or confirmed[1] == "notoall": self.deleteConfirmed(confirmed) break - + else: + self.restoreService(_("Zap back to service before tuner setup?")) + def __init__(self, session, slotid): Screen.__init__(self, session) self.list = [ ] -- cgit v1.2.3 From 414208c929faa0fc56f9c21c0df572dc0b13d3fe Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 May 2010 13:15:38 +0200 Subject: lib/gdi/font.cpp: try to fix wrong reordering of some characters --- lib/gdi/font.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index 2fd9fb69..1d3c34da 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -597,8 +597,7 @@ int eTextPara::renderString(const char *string, int rflags) // now do the usual logical->visual reordering int size=uc_shape.size(); #ifdef HAVE_FRIBIDI - FriBidiCharType dir=FRIBIDI_TYPE_ON; - int lines=1; + bool mustRealign=false; int pos=0, spos=0; uc_visual.resize(size); // gaaanz lahm, aber anders geht das leider nicht, sorry. @@ -625,23 +624,25 @@ int eTextPara::renderString(const char *string, int rflags) default: break; } - if (line_end || pos+incr >= size) { + if (line_end || pos+incr >= size) + { int len = pos - spos; if (len) + { + FriBidiCharType dir=FRIBIDI_TYPE_ON; fribidi_log2vis(array+spos, len, &dir, target+spos, 0, 0, 0); + if (!mustRealign && dir&FRIBIDI_MASK_RTL) + mustRealign = true; + } target[pos] = array[pos]; if (incr > 1) target[pos+1] = array[pos+1]; spos = pos+incr; - ++lines; line_open = false; } pos += incr; } - if (lines < 2) - fribidi_log2vis(array, size, &dir, target, 0, 0, 0); - uc_visual.assign(target, target+size); #else uc_visual=uc_shape; @@ -740,7 +741,7 @@ nprint: isprintable=0; bboxValid=false; calc_bbox(); #ifdef HAVE_FRIBIDI - if (dir & FRIBIDI_MASK_RTL) + if (mustRealign) realign(dirRight); #endif return 0; -- cgit v1.2.3 From 71f4f597f7e929d2d3bbc726ed84b97b055113f8 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 May 2010 18:42:25 +0200 Subject: Revert "lib/gdi/font.cpp: try to fix wrong reordering of some characters" its not working okay.. we need a better fix This reverts commit 414208c929faa0fc56f9c21c0df572dc0b13d3fe. --- lib/gdi/font.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index 1d3c34da..2fd9fb69 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -597,7 +597,8 @@ int eTextPara::renderString(const char *string, int rflags) // now do the usual logical->visual reordering int size=uc_shape.size(); #ifdef HAVE_FRIBIDI - bool mustRealign=false; + FriBidiCharType dir=FRIBIDI_TYPE_ON; + int lines=1; int pos=0, spos=0; uc_visual.resize(size); // gaaanz lahm, aber anders geht das leider nicht, sorry. @@ -624,25 +625,23 @@ int eTextPara::renderString(const char *string, int rflags) default: break; } - if (line_end || pos+incr >= size) - { + if (line_end || pos+incr >= size) { int len = pos - spos; if (len) - { - FriBidiCharType dir=FRIBIDI_TYPE_ON; fribidi_log2vis(array+spos, len, &dir, target+spos, 0, 0, 0); - if (!mustRealign && dir&FRIBIDI_MASK_RTL) - mustRealign = true; - } target[pos] = array[pos]; if (incr > 1) target[pos+1] = array[pos+1]; spos = pos+incr; + ++lines; line_open = false; } pos += incr; } + if (lines < 2) + fribidi_log2vis(array, size, &dir, target, 0, 0, 0); + uc_visual.assign(target, target+size); #else uc_visual=uc_shape; @@ -741,7 +740,7 @@ nprint: isprintable=0; bboxValid=false; calc_bbox(); #ifdef HAVE_FRIBIDI - if (mustRealign) + if (dir & FRIBIDI_MASK_RTL) realign(dirRight); #endif return 0; -- cgit v1.2.3 From da28efe46384a6e23a91e8cb7db726f176bed409 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 May 2010 18:42:56 +0200 Subject: Revert "lib/gdi/font.cpp: call libfribidi for single lines on multi line texts to prevent top/bottom reordering" This reverts commit eea0d8e99edec859a7535966b880b49bd0bba85a. This was not working.. so we revert it --- lib/gdi/font.cpp | 55 +++++++++---------------------------------------------- 1 file changed, 9 insertions(+), 46 deletions(-) (limited to 'lib') diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index 2fd9fb69..dfac144c 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -595,59 +595,22 @@ int eTextPara::renderString(const char *string, int rflags) shape(uc_shape, uc_string); // now do the usual logical->visual reordering - int size=uc_shape.size(); -#ifdef HAVE_FRIBIDI +#ifdef HAVE_FRIBIDI FriBidiCharType dir=FRIBIDI_TYPE_ON; - int lines=1; - int pos=0, spos=0; - uc_visual.resize(size); - // gaaanz lahm, aber anders geht das leider nicht, sorry. - FriBidiChar array[size], target[size]; - std::copy(uc_shape.begin(), uc_shape.end(), array); - - bool line_open = false; - while(pos < size) { - int incr=1; - bool line_end = false; - if (!line_open) - line_open = true; - switch((unsigned long)array[pos]) - { - case '\\': - if (pos+1 == size || (unsigned long)array[pos+1] != 'n') - break; - ++incr; - case 0x8A: - case 0xE08A: - case '\n': - line_end = true; - default: - break; - } - if (line_end || pos+incr >= size) { - int len = pos - spos; - if (len) - fribidi_log2vis(array+spos, len, &dir, target+spos, 0, 0, 0); - target[pos] = array[pos]; - if (incr > 1) - target[pos+1] = array[pos+1]; - spos = pos+incr; - ++lines; - line_open = false; - } - pos += incr; - } - - if (lines < 2) + int size=uc_shape.size(); + uc_visual.resize(size); + // gaaanz lahm, aber anders geht das leider nicht, sorry. + FriBidiChar array[size], target[size]; + std::copy(uc_shape.begin(), uc_shape.end(), array); fribidi_log2vis(array, size, &dir, target, 0, 0, 0); - - uc_visual.assign(target, target+size); + uc_visual.assign(target, target+size); + } #else uc_visual=uc_shape; #endif - glyphs.reserve(size); + glyphs.reserve(uc_visual.size()); int nextflags = 0; -- cgit v1.2.3 From 9a23857fd9c6b3dd6a989d865974df96e9fe1828 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 8 May 2010 19:01:53 +0200 Subject: lib/gdi/font.h/cpp: another try to fix top/bottom reordering for arabic language --- lib/gdi/font.cpp | 60 +++++++++++++++++++++++++++++++++++++++++--------------- lib/gdi/font.h | 13 +++++++++--- 2 files changed, 54 insertions(+), 19 deletions(-) (limited to 'lib') diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index dfac144c..f27a8f77 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -341,6 +341,8 @@ int eTextPara::appendGlyph(Font *current_font, FT_Face current_face, FT_UInt gly i->x-=offset.x(); i->y-=offset.y(); i->bbox.moveBy(-offset.x(), -offset.y()); + --lineChars.back(); + ++charCount; } while (i-- != glyphs.rbegin()); // rearrange them into the next line cursor+=ePoint(linelength, 0); // put the cursor after that line } else @@ -378,6 +380,7 @@ int eTextPara::appendGlyph(Font *current_font, FT_Face current_face, FT_UInt gly ng.glyph_index = glyphIndex; ng.flags = flags; glyphs.push_back(ng); + ++charCount; /* when we have a SHY, don't xadvance. It will either be the last in the line (when used for breaking), or not displayed. */ if (!(flags & GS_SOFTHYPHEN)) @@ -425,7 +428,13 @@ void eTextPara::newLine(int flags) cursor.setX(left); previous=0; int linegap=current_face->size->metrics.height-(current_face->size->metrics.ascender+current_face->size->metrics.descender); + + lineOffsets.push_back(cursor.y()); + lineChars.push_back(charCount); + charCount=0; + cursor+=ePoint(0, (current_face->size->metrics.ascender+current_face->size->metrics.descender+linegap)>>6); + if (maximum.height()visual reordering -#ifdef HAVE_FRIBIDI + int size=uc_shape.size(); +#ifdef HAVE_FRIBIDI FriBidiCharType dir=FRIBIDI_TYPE_ON; - { - int size=uc_shape.size(); - uc_visual.resize(size); - // gaaanz lahm, aber anders geht das leider nicht, sorry. - FriBidiChar array[size], target[size]; - std::copy(uc_shape.begin(), uc_shape.end(), array); - fribidi_log2vis(array, size, &dir, target, 0, 0, 0); - uc_visual.assign(target, target+size); - } + uc_visual.resize(size); + // gaaanz lahm, aber anders geht das leider nicht, sorry. + FriBidiChar array[size], target[size]; + std::copy(uc_shape.begin(), uc_shape.end(), array); + fribidi_log2vis(array, size, &dir, target, 0, 0, 0); + uc_visual.assign(target, target+size); #else uc_visual=uc_shape; #endif - glyphs.reserve(uc_visual.size()); + glyphs.reserve(size); int nextflags = 0; @@ -704,8 +711,19 @@ nprint: isprintable=0; calc_bbox(); #ifdef HAVE_FRIBIDI if (dir & FRIBIDI_MASK_RTL) + { realign(dirRight); + doTopBottomReordering=true; + } #endif + + if (charCount) + { + lineOffsets.push_back(cursor.y()); + lineChars.push_back(charCount); + charCount=0; + } + return 0; } @@ -796,11 +814,21 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons gRegion clip = dc.getClip() & area; int buffer_stride=surface->stride; - + for (unsigned int c = 0; c < clip.rects.size(); ++c) { - for (glyphString::iterator i(glyphs.begin()); i != glyphs.end(); ++i) + std::list::reverse_iterator line_offs_it(lineOffsets.rbegin()); + std::list::iterator line_chars_it(lineChars.begin()); + int line_offs=0; + int line_chars=0; + for (glyphString::iterator i(glyphs.begin()); i != glyphs.end(); ++i, --line_chars) { + while(!line_chars) + { + line_offs = *(line_offs_it++); + line_chars = *(line_chars_it++); + } + if (i->flags & GS_SOFTHYPHEN) continue; @@ -813,13 +841,13 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons lookup8 = lookup8_invert; lookup32 = lookup32_invert; } - + static FTC_SBit glyph_bitmap; if (fontRenderClass::instance->getGlyphBitmap(&i->font->font, i->glyph_index, &glyph_bitmap)) continue; int rx=i->x+glyph_bitmap->left + offset.x(); - int ry=i->y-glyph_bitmap->top + offset.y(); - + int ry=(doTopBottomReordering ? line_offs : i->y) - glyph_bitmap->top + offset.y(); + __u8 *d=(__u8*)(surface->data)+buffer_stride*ry+rx*surface->bypp; __u8 *s=glyph_bitmap->buffer; register int sx=glyph_bitmap->width; diff --git a/lib/gdi/font.h b/lib/gdi/font.h index 2643fda2..7dd9f89a 100644 --- a/lib/gdi/font.h +++ b/lib/gdi/font.h @@ -14,6 +14,7 @@ typedef FTC_ImageTypeRec FTC_Image_Desc; typedef FTC_SBitCache FTC_SBit_Cache; #endif #include +#include #include #include @@ -113,6 +114,10 @@ class eTextPara: public iObject eSize maximum; int left; glyphString glyphs; + std::list lineOffsets; + std::list lineChars; + int charCount; + bool doTopBottomReordering; int appendGlyph(Font *current_font, FT_Face current_face, FT_UInt glyphIndex, int flags, int rflags); void newLine(int flags); @@ -120,10 +125,12 @@ class eTextPara: public iObject eRect boundBox; void calc_bbox(); int bboxValid; + void clear(); public: eTextPara(eRect area, ePoint start=ePoint(-1, -1)) - : current_font(0), replacement_font(0), current_face(0), replacement_face(0), - area(area), cursor(start), maximum(0, 0), left(start.x()), bboxValid(0) + :current_font(0), replacement_font(0), current_face(0), replacement_face(0) + ,area(area), cursor(start), maximum(0, 0), left(start.x()), charCount(0) + ,doTopBottomReordering(false), bboxValid(0) { } virtual ~eTextPara(); @@ -134,7 +141,7 @@ public: void setFont(const gFont *font); int renderString(const char *string, int flags=0); - void clear(); + void blit(gDC &dc, const ePoint &offset, const gRGB &background, const gRGB &foreground); -- cgit v1.2.3 From b1d12bc36da7d4a124948e4d0a5978c256c146a5 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Sun, 9 May 2010 14:41:08 +0200 Subject: [servicemp3] fix plaintext subtitles (add #506) --- lib/service/servicemp3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 50b02efd..4ecbd76b 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -328,7 +328,7 @@ eServiceMP3::eServiceMP3(eServiceReference ref) else { m_subs_to_pull_handler_id = g_signal_connect (subsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this); - g_object_set (G_OBJECT (subsink), "caps", gst_caps_from_string("text/x-plain; text/x-pango-markup"), NULL); + g_object_set (G_OBJECT (subsink), "caps", gst_caps_from_string("text/plain; text/x-plain; text/x-pango-markup"), NULL); g_object_set (G_OBJECT (m_gst_playbin), "text-sink", subsink, NULL); } -- cgit v1.2.3 From bea4946ae09bcab368696c50031e29c635017585 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 12 May 2010 16:03:30 +0200 Subject: RecordTimer.py,RecordingConfig.py,setup.xml: *add possibility to change the default recording filename composition in expert mode. This allows now to have shorter recording filenames (Date-Name) or longer (DateTime-Channel-Name-Shortdescription) beside the default. This fixes #345 --- RecordTimer.py | 8 ++++++++ data/setup.xml | 1 + lib/python/Components/RecordingConfig.py | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) mode change 100644 => 100755 RecordTimer.py mode change 100644 => 100755 data/setup.xml mode change 100644 => 100755 lib/python/Components/RecordingConfig.py (limited to 'lib') diff --git a/RecordTimer.py b/RecordTimer.py old mode 100644 new mode 100755 index f670417a..04c3ff12 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -129,6 +129,7 @@ class RecordTimerEntry(timer.TimerEntry, object): def calculateFilename(self): service_name = self.service_ref.getServiceName() begin_date = strftime("%Y%m%d %H%M", localtime(self.begin)) + begin_shortdate = strftime("%Y%m%d", localtime(self.begin)) print "begin_date: ", begin_date print "service_name: ", service_name @@ -138,6 +139,13 @@ class RecordTimerEntry(timer.TimerEntry, object): filename = begin_date + " - " + service_name if self.name: filename += " - " + self.name + if config.usage.setup_level.index >= 2: # expert+ + if config.recording.filename_composition.value == "short": + filename = begin_shortdate + " - " + self.name + elif config.recording.filename_composition.value == "long": + filename = begin_date + " - " + service_name + " - " + self.name + " - " + self.description + else: + filename += " - " + self.name # standard if config.recording.ascii_filenames.value: filename = ASCIItranslit.legacyEncode(filename) diff --git a/data/setup.xml b/data/setup.xml old mode 100644 new mode 100755 index 705eaf33..f5dea734 --- a/data/setup.xml +++ b/data/setup.xml @@ -72,6 +72,7 @@ config.usage.pip_zero_button config.usage.alternatives_priority config.recording.ascii_filenames + config.recording.filename_composition config.usage.hdd_standby diff --git a/lib/python/Components/RecordingConfig.py b/lib/python/Components/RecordingConfig.py old mode 100644 new mode 100755 index fe9284d9..40dfb2ca --- a/lib/python/Components/RecordingConfig.py +++ b/lib/python/Components/RecordingConfig.py @@ -1,4 +1,4 @@ -from config import ConfigNumber, ConfigYesNo, ConfigSubsection, config +from config import ConfigNumber, ConfigYesNo, ConfigSubsection, ConfigSelection, config def InitRecordingConfig(): config.recording = ConfigSubsection(); @@ -8,3 +8,7 @@ def InitRecordingConfig(): config.recording.margin_after = ConfigNumber(default=0) config.recording.debug = ConfigYesNo(default = False) config.recording.ascii_filenames = ConfigYesNo(default = False) + config.recording.filename_composition = ConfigSelection(default = "standard", choices = [ + ("standard", _("standard")), + ("short", _("Short filenames")), + ("long", _("Long filenames")) ] ) \ No newline at end of file -- cgit v1.2.3 From 86d0f1d05eea8098b32897eb0cffc18c6a861be1 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 17 May 2010 21:58:45 +0200 Subject: lib/base/ebase.h/cpp: dont crash when try to start eTimers, eSocketNotifiers with no more existing Mainloops (on e2 shutdown) --- lib/base/ebase.cpp | 52 +++++++++++++++++++++++++++++++++------------------- lib/base/ebase.h | 6 ++---- 2 files changed, 35 insertions(+), 23 deletions(-) (limited to 'lib') diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp index 5bafe732..caccb391 100644 --- a/lib/base/ebase.cpp +++ b/lib/base/ebase.cpp @@ -26,8 +26,11 @@ void eSocketNotifier::start() if (state) stop(); - context.addSocketNotifier(this); - state=2; // running but not in poll yet + if (eMainloop::isValid(&context)) + { + context.addSocketNotifier(this); + state=2; // running but not in poll yet + } } void eSocketNotifier::stop() @@ -46,29 +49,35 @@ void eTimer::start(long msek, bool singleShot) if (bActive) stop(); - bActive = true; - bSingleShot = singleShot; - interval = msek; - clock_gettime(CLOCK_MONOTONIC, &nextActivation); -// eDebug("this = %p\nnow sec = %d, nsec = %d\nadd %d msec", this, nextActivation.tv_sec, nextActivation.tv_nsec, msek); - nextActivation += (msek<0 ? 0 : msek); -// eDebug("next Activation sec = %d, nsec = %d", nextActivation.tv_sec, nextActivation.tv_nsec ); - context.addTimer(this); + if (eMainloop::isValid(&context)) + { + bActive = true; + bSingleShot = singleShot; + interval = msek; + clock_gettime(CLOCK_MONOTONIC, &nextActivation); +// eDebug("this = %p\nnow sec = %d, nsec = %d\nadd %d msec", this, nextActivation.tv_sec, nextActivation.tv_nsec, msek); + nextActivation += (msek<0 ? 0 : msek); +// eDebug("next Activation sec = %d, nsec = %d", nextActivation.tv_sec, nextActivation.tv_nsec ); + context.addTimer(this); + } } -void eTimer::startLongTimer( int seconds ) +void eTimer::startLongTimer(int seconds) { if (bActive) stop(); - bActive = bSingleShot = true; - interval = 0; - clock_gettime(CLOCK_MONOTONIC, &nextActivation); -// eDebug("this = %p\nnow sec = %d, nsec = %d\nadd %d sec", this, nextActivation.tv_sec, nextActivation.tv_nsec, seconds); - if ( seconds > 0 ) - nextActivation.tv_sec += seconds; -// eDebug("next Activation sec = %d, nsec = %d", nextActivation.tv_sec, nextActivation.tv_nsec ); - context.addTimer(this); + if (eMainloop::isValid(&context)) + { + bActive = bSingleShot = true; + interval = 0; + clock_gettime(CLOCK_MONOTONIC, &nextActivation); +// eDebug("this = %p\nnow sec = %d, nsec = %d\nadd %d sec", this, nextActivation.tv_sec, nextActivation.tv_nsec, seconds); + if ( seconds > 0 ) + nextActivation.tv_sec += seconds; +// eDebug("next Activation sec = %d, nsec = %d", nextActivation.tv_sec, nextActivation.tv_nsec ); + context.addTimer(this); + } } void eTimer::stop() @@ -114,6 +123,11 @@ void eTimer::activate() // Internal Funktion... called from eApplication // mainloop ePtrList eMainloop::existing_loops; +bool eMainloop::isValid(eMainloop *ml) +{ + return std::find(existing_loops.begin(), existing_loops.end(), ml) != existing_loops.end(); +} + eMainloop::~eMainloop() { existing_loops.remove(this); diff --git a/lib/base/ebase.h b/lib/base/ebase.h index c69133f6..f6fc07d3 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -205,11 +205,9 @@ class eMainloop void removeSocketNotifier(eSocketNotifier *sn); void addTimer(eTimer* e); void removeTimer(eTimer* e); -public: -#ifndef SWIG static ePtrList existing_loops; -#endif - + static bool isValid(eMainloop *); +public: eMainloop() :app_quit_now(0),loop_level(0),retval(0), m_is_idle(0), m_idle_count(0), m_inActivate(0), m_interrupt_requested(0) { -- cgit v1.2.3 From f5a64721338ea4cb821c024d27903ab127737fcd Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 17 May 2010 21:57:52 +0200 Subject: lib/base/eptrlist.h: fix tabs --- lib/base/eptrlist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/base/eptrlist.h b/lib/base/eptrlist.h index 75123053..0da46daa 100644 --- a/lib/base/eptrlist.h +++ b/lib/base/eptrlist.h @@ -164,7 +164,7 @@ public: // returns a pointer to this new vector ( the reserved memory must deletet from the receiver !! ) std::vector* v=new std::vector(); v->reserve( std::list::size() ); - for ( std_list_T_iterator it( std::list::begin() ); it != std::list::end(); it++) + for ( std_list_T_iterator it( std::list::begin() ); it != std::list::end(); it++) v->push_back( **it ); return v; -- cgit v1.2.3 From 66fa5d4c7880ccd770b5e4d9b6794769a69e78eb Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 26 May 2010 13:50:46 +0200 Subject: add new multicontent TYPE_PROGRESS_PIXMAP this fixes bug #539 --- lib/gui/elistboxcontent.cpp | 66 ++++++++++++++++++++++++++++++++------------- lib/gui/elistboxcontent.h | 2 +- 2 files changed, 49 insertions(+), 19 deletions(-) (limited to 'lib') diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index b9e71df8..7bb84c3d 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -856,6 +856,10 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c } break; } + case TYPE_PROGRESS_PIXMAP: // Progress + /* + (1, x, y, width, height, filled_percent, pixmap [, borderWidth, foreColor, backColor, backColorSelected] ) + */ case TYPE_PROGRESS: // Progress { /* @@ -866,41 +870,55 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c pwidth = PyTuple_GET_ITEM(item, 3), pheight = PyTuple_GET_ITEM(item, 4), pfilled_perc = PyTuple_GET_ITEM(item, 5), - pborderWidth, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected; - - if (!(px && py && pwidth && pheight && pfilled_perc)) + ppixmap, pborderWidth, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected; + int idx = 6; + if (type == TYPE_PROGRESS) { - eDebug("eListboxPythonMultiContent received too small tuple (must be (TYPE_PROGRESS, x, y, width, height, filled percent [,border width, foreColor, backColor, backColorSelected]))"); - goto error_out; + if (!(px && py && pwidth && pheight && pfilled_perc)) + { + eDebug("eListboxPythonMultiContent received too small tuple (must be (TYPE_PROGRESS, x, y, width, height, filled percent [,border width, foreColor, backColor, backColorSelected]))"); + goto error_out; + } + } + else + { + ppixmap = PyTuple_GET_ITEM(item, idx++); + if (ppixmap == Py_None) + continue; + if (!(px && py && pwidth && pheight && pfilled_perc, ppixmap)) + { + eDebug("eListboxPythonMultiContent received too small tuple (must be (TYPE_PROGRESS_PIXMAP, x, y, width, height, filled percent, pixmap, [,border width, foreColor, backColor, backColorSelected]))"); + goto error_out; + } } - if (size > 6) + if (size > idx) { - pborderWidth = PyTuple_GET_ITEM(item, 6); + pborderWidth = PyTuple_GET_ITEM(item, idx++); if (pborderWidth == Py_None) pborderWidth = ePyObject(); } - if (size > 7) + if (size > idx) { - pforeColor = PyTuple_GET_ITEM(item, 7); + pforeColor = PyTuple_GET_ITEM(item, idx++); if (pforeColor == Py_None) pforeColor = ePyObject(); } - if (size > 8) + if (size > idx) { - pforeColorSelected = PyTuple_GET_ITEM(item, 8); + pforeColorSelected = PyTuple_GET_ITEM(item, idx++); if (pforeColorSelected == Py_None) pforeColorSelected=ePyObject(); } - if (size > 9) + if (size > idx) { - pbackColor = PyTuple_GET_ITEM(item, 9); + pbackColor = PyTuple_GET_ITEM(item, idx++); if (pbackColor == Py_None) pbackColor=ePyObject(); } - if (size > 10) + if (size > idx) { - pbackColorSelected = PyTuple_GET_ITEM(item, 10); + pbackColorSelected = PyTuple_GET_ITEM(item, idx++); if (pbackColorSelected == Py_None) pbackColorSelected=ePyObject(); } @@ -942,12 +960,24 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c rect.setRect(x+width-bwidth, y+bwidth, bwidth, height-bwidth); painter.fill(rect); - // progress rect.setRect(x+bwidth, y+bwidth, (width-bwidth*2) * filled / 100, height-bwidth*2); - painter.fill(rect); - painter.clippop(); + // progress + if (ppixmap) + { + ePtr pixmap; + if (SwigFromPython(pixmap, ppixmap)) + { + eDebug("eListboxPythonMultiContent (Pixmap) get pixmap failed"); + painter.clippop(); + continue; + } + painter.blit(pixmap, rect.topLeft(), rect, 0); + } + else + painter.fill(rect); + painter.clippop(); break; } case TYPE_PIXMAP_ALPHABLEND: diff --git a/lib/gui/elistboxcontent.h b/lib/gui/elistboxcontent.h index d3d2a089..2649c097 100644 --- a/lib/gui/elistboxcontent.h +++ b/lib/gui/elistboxcontent.h @@ -69,7 +69,7 @@ class eListboxPythonMultiContent: public eListboxPythonStringContent public: eListboxPythonMultiContent(); ~eListboxPythonMultiContent(); - enum { TYPE_TEXT, TYPE_PROGRESS, TYPE_PIXMAP, TYPE_PIXMAP_ALPHATEST, TYPE_PIXMAP_ALPHABLEND }; + enum { TYPE_TEXT, TYPE_PROGRESS, TYPE_PIXMAP, TYPE_PIXMAP_ALPHATEST, TYPE_PIXMAP_ALPHABLEND, TYPE_PROGRESS_PIXMAP }; void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected); int currentCursorSelectable(); void setList(SWIG_PYOBJECT(ePyObject) list); -- cgit v1.2.3 From 4040d03e343303420653659c8d0f49322e2fe721 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 26 May 2010 14:21:56 +0200 Subject: lib/python/Screens/Standby.py: ignore global actions in standby (i.e. mute/volume) this fixes bug #538 --- lib/python/Screens/Standby.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py index 406b87cb..1a7ebbd1 100644 --- a/lib/python/Screens/Standby.py +++ b/lib/python/Screens/Standby.py @@ -3,6 +3,7 @@ from Components.ActionMap import ActionMap from Components.config import config from Components.AVSwitch import AVSwitch from Components.SystemInfo import SystemInfo +from GlobalActions import globalActionMap from enigma import eDVBVolumecontrol inStandby = None @@ -41,6 +42,8 @@ class Standby(Screen): "power": self.Power }, -1) + globalActionMap.setEnabled(False) + #mute adc self.setMute() @@ -72,6 +75,7 @@ class Standby(Screen): elif self.paused_service: self.paused_service.unPauseService() self.session.screen["Standby"].boolean = False + globalActionMap.setEnabled(True) def __onFirstExecBegin(self): global inStandby -- cgit v1.2.3 From 276d3d52d86a1b1701b42b998dd658374431d3b8 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 25 May 2010 10:43:10 +0200 Subject: experimentally merge audio + subtitle streams selection dialogs into one --- data/menu.xml | 1 - data/skin_default.xml | 47 +++++- lib/python/Screens/AudioSelection.py | 308 ++++++++++++++++++++++++++++++++++ lib/python/Screens/InfoBarGenerics.py | 125 +------------- lib/python/Screens/Makefile.am | 6 +- lib/python/Screens/Subtitles.py | 103 ------------ 6 files changed, 359 insertions(+), 231 deletions(-) create mode 100644 lib/python/Screens/AudioSelection.py delete mode 100644 lib/python/Screens/Subtitles.py (limited to 'lib') diff --git a/data/menu.xml b/data/menu.xml index b437fbc7..0d874718 100755 --- a/data/menu.xml +++ b/data/menu.xml @@ -17,7 +17,6 @@ self.openSetup("network")--> - self.session.scart.VCRSbChanged(3) diff --git a/data/skin_default.xml b/data/skin_default.xml index 0114349b..396515e9 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -62,8 +62,47 @@ - - + + + + + + + + + + + + + + + + + + + + + {"templates": + {"default": (25, [ + MultiContentEntryText(pos = (0, 0), size = (35, 25), font = 0, flags = RT_HALIGN_LEFT, text = 1), # key, + MultiContentEntryText(pos = (40, 0), size = (55, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, + MultiContentEntryText(pos = (100, 0), size = (80, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, + MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, + MultiContentEntryText(pos = (340, 4), size = (60, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, + ], True, "showNever"), + "notselected": (25, [ + MultiContentEntryText(pos = (0, 0), size = (35, 25), font = 0, flags = RT_HALIGN_LEFT, text = 1), # key, + MultiContentEntryText(pos = (40, 0), size = (55, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, + MultiContentEntryText(pos = (100, 0), size = (80, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, + MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, + MultiContentEntryText(pos = (340, 4), size = (60, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, + ], False, "showNever") + }, + "fonts": [gFont("Regular", 20), gFont("Regular", 16)], + "itemHeight": 25 + } + + @@ -935,9 +974,9 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - + diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py new file mode 100644 index 00000000..b97c25b2 --- /dev/null +++ b/lib/python/Screens/AudioSelection.py @@ -0,0 +1,308 @@ +from Screen import Screen +from Components.ServiceEventTracker import ServiceEventTracker +from Components.ActionMap import ActionMap +from Components.ConfigList import ConfigListScreen +from Components.ChoiceList import ChoiceList, ChoiceEntryComponent +from Components.config import config, ConfigSubsection, getConfigListEntry, ConfigNothing, ConfigSelection, ConfigOnOff +from Components.MultiContent import MultiContentEntryText +from Components.Sources.List import List +from Components.Sources.Boolean import Boolean +from Components.SystemInfo import SystemInfo + +from enigma import iPlayableService + +from Tools.ISO639 import LanguageCodes +from Tools.BoundFunction import boundFunction +FOCUS_CONFIG, FOCUS_STREAMS = range(2) + +class AudioSelection(Screen, ConfigListScreen): + def __init__(self, session, infobar=None): + Screen.__init__(self, session) + + self["streams"] = List([]) + self["key_red"] = Boolean(False) + self["key_green"] = Boolean(False) + self["key_yellow"] = Boolean(True) + self["key_blue"] = Boolean(False) + + ConfigListScreen.__init__(self, []) + self.infobar = infobar or self.session.infobar + + self.__event_tracker = ServiceEventTracker(screen=self, eventmap= + { + iPlayableService.evUpdatedInfo: self.__updatedInfo + }) + self.cached_subtitle_checked = False + self.__selected_subtitle = None + + self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions"], + { + "red": self.keyRed, + "green": self.keyGreen, + "yellow": self.keyYellow, + "blue": self.keyBlue, + "ok": self.keyOk, + "cancel": self.cancel, + "up": self.keyUp, + "down": self.keyDown, + }, -3) + + self.settings = ConfigSubsection() + choicelist = [("audio",_("audio tracks")), ("subtitles",_("Subtitles"))] + self.settings.menupage = ConfigSelection(choices = choicelist) + self.settings.menupage.addNotifier(self.fillList) + self.onLayoutFinish.append(self.__layoutFinished) + + def __layoutFinished(self): + self["config"].instance.setSelectionEnable(False) + self.focus = FOCUS_STREAMS + + def fillList(self, arg=None): + streams = [] + conflist = [] + selectedidx = 0 + + service = self.session.nav.getCurrentService() + self.audioTracks = audio = service and service.audioTracks() + n = audio and audio.getNumberOfTracks() or 0 + + if self.settings.menupage.getValue() == "audio": + self.setTitle(_("Select audio track")) + if SystemInfo["CanDownmixAC3"]: + print "config.av.downmix_ac3.value=", config.av.downmix_ac3.value + self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value) + self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False) + conflist.append(getConfigListEntry(_("AC3 downmix"), self.settings.downmix)) + self["key_red"] = Boolean(True) + + if n > 0: + self.audioChannel = service.audioChannel() + print "self.audioChannel.getCurrentChannel()", self.audioChannel.getCurrentChannel() + choicelist = [("0",_("left")), ("1",_("stereo")), ("2", _("right"))] + self.settings.channelmode = ConfigSelection(choices = choicelist, default = str(self.audioChannel.getCurrentChannel())) + self.settings.channelmode.addNotifier(self.changeMode, initial_call = False) + conflist.append(getConfigListEntry(_("Channel"), self.settings.channelmode)) + self["key_green"] = Boolean(True) + + selectedAudio = self.audioTracks.getCurrentTrack() + print "selectedAudio:", selectedAudio + + for x in range(n): + number = str(x) + i = audio.getTrackInfo(x) + languages = i.getLanguage().split('/') + description = i.getDescription() or _("") + selected = "" + language = "" + + if selectedAudio == x: + selected = _("Running") + selectedidx = x + + cnt = 0 + for lang in languages: + if cnt: + language += ' / ' + if LanguageCodes.has_key(lang): + language += LanguageCodes[lang][0] + elif lang == "und": + _("") + else: + language += lang + cnt += 1 + + streams.append((x, "", number, description, language, selected)) + + #if hasattr(self, "runPlugin"): + #class PluginCaller: + #def __init__(self, fnc, *args): + #self.fnc = fnc + #self.args = args + #def __call__(self, *args, **kwargs): + #self.fnc(*self.args) + + #Plugins = [ (p.name, PluginCaller(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] + + #for p in Plugins: + #selection += 1 + #flist.append((p[0], "CALLFUNC", p[1])) + #if availableKeys: + #usedKeys.append(availableKeys[0]) + #del availableKeys[0] + #else: + #usedKeys.append("") + else: + streams = [(None, "", "", _("none"), "")] + + elif self.settings.menupage.getValue() == "subtitles": + self.setTitle(_("Subtitle selection")) + + self.settings.dummy = ConfigNothing() + conflist.append(getConfigListEntry("", self.settings.dummy)) + conflist.append(getConfigListEntry("", self.settings.dummy)) + + if self.subtitlesEnabled(): + sel = self.infobar.selected_subtitle + else: + sel = None + + idx = 0 + + subtitlelist = self.getSubtitleList() + + if len(subtitlelist): + for x in subtitlelist: + number = str(x[1]) + description = "?" + language = _("") + selected = "" + + if sel and x[:4] == sel[:4]: + selected = _("Running") + selectedidx = idx + + if x[4] != "und": + if LanguageCodes.has_key(x[4]): + language = LanguageCodes[x[4]][0] + else: + language = x[4] + + if x[0] == 0: + description = "DVB" + number = "%x" % (x[1]) + + elif x[0] == 1: + description = "TTX" + number = "%x%02x" % (x[3],x[2]) + + elif x[0] == 2: + types = (" UTF-8 text "," SSA / AAS "," .SRT file ") + description = types[x[2]] + + streams.append((x, "", number, description, language, selected)) + idx += 1 + + else: + streams = [(None, "", "", _("none"), "")] + + conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) + self["config"].list = conflist + self["config"].l.setList(conflist) + + self["streams"].list = streams + self["streams"].setIndex(selectedidx) + + def __updatedInfo(self): + self.fillList() + + def getSubtitleList(self): + s = self.infobar and self.infobar.getCurrentServiceSubtitle() + l = s and s.getSubtitleList() or [ ] + return l + + def subtitlesEnabled(self): + return self.infobar.subtitles_enabled + + def enableSubtitle(self, subtitles): + print "[enableSubtitle]", subtitles + if self.infobar.selected_subtitle != subtitles: + self.infobar.subtitles_enabled = False + self.infobar.selected_subtitle = subtitles + if subtitles: + self.infobar.subtitles_enabled = True + + def changeAC3Downmix(self, downmix): + print "changeAC3Downmix config.av.downmix_ac3.value=", config.av.downmix_ac3.value, downmix.getValue() + if downmix.getValue() == True: + config.av.downmix_ac3.value = True + else: + config.av.downmix_ac3.value = False + config.av.downmix_ac3.save() + + def changeMode(self, mode): + print "changeMode", mode, mode.getValue() + if mode is not None: + self.audioChannel.selectChannel(int(mode.getValue())) + + def changeAudio(self, audio): + print "changeAudio", audio, "self.session.nav.getCurrentService().audioTracks().getNumberOfTracks():", self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() + track = int(audio) + if isinstance(track, int): + if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > track: + self.audioTracks.selectTrack(track) + + def keyLeft(self): + if self.focus == FOCUS_CONFIG: + ConfigListScreen.keyLeft(self) + elif self.focus == FOCUS_STREAMS: + self["streams"].setIndex(0) + + def keyRight(self): + if self.focus == FOCUS_CONFIG: + ConfigListScreen.keyRight(self) + elif self.focus == FOCUS_STREAMS and self["streams"].count(): + self["streams"].setIndex(self["streams"].count()-1) + + def keyRed(self): + self.colorkey(0) + + def keyGreen(self): + self.colorkey(1) + + def keyYellow(self): + self.colorkey(2) + + def keyBlue(self): + pass + + def colorkey(self, idx): + self["config"].setCurrentIndex(idx) + ConfigListScreen.keyRight(self) + + def keyUp(self): + print "[keyUp]", self["streams"].getIndex() + if self.focus == FOCUS_CONFIG: + self["config"].instance.moveSelection(self["config"].instance.moveUp) + elif self.focus == FOCUS_STREAMS: + if self["streams"].getIndex() == 0: + self["config"].instance.setSelectionEnable(True) + self["streams"].style = "notselected" + self["config"].setCurrentIndex(len(self["config"].getList())-1) + self.focus = FOCUS_CONFIG + else: + self["streams"].selectPrevious() + + def keyDown(self): + print "[keyDown]", self["config"].getCurrentIndex(), len(self["config"].getList())-1 + if self.focus == FOCUS_CONFIG: + if self["config"].getCurrentIndex() < len(self["config"].getList())-1: + self["config"].instance.moveSelection(self["config"].instance.moveDown) + else: + self["config"].instance.setSelectionEnable(False) + self["streams"].style = "default" + self.focus = FOCUS_STREAMS + elif self.focus == FOCUS_STREAMS: + self["streams"].selectNext() + + def keyOk(self): + print "[keyok]", self["streams"].list, self["streams"].getCurrent() + if self.focus == FOCUS_STREAMS and self["streams"].list: + cur = self["streams"].getCurrent() + if self.settings.menupage.getValue() == "audio" and cur[0]: + self.changeAudio(cur[2]) + self.__updatedInfo() + if self.settings.menupage.getValue() == "subtitles" and cur[0]: + if self.infobar.selected_subtitle == cur[0]: + self.enableSubtitle(None) + selectedidx = self["streams"].getIndex() + self.__updatedInfo() + self["streams"].setIndex(selectedidx) + else: + self.enableSubtitle(cur[0]) + self.__updatedInfo() + #self.close() + elif self.focus == FOCUS_CONFIG: + self.keyRight() + + def cancel(self): + self.close() diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 1c577eec..6fa89112 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1673,126 +1673,11 @@ class InfoBarAudioSelection: }) def audioSelection(self): - service = self.session.nav.getCurrentService() - self.audioTracks = audio = service and service.audioTracks() - n = audio and audio.getNumberOfTracks() or 0 - tlist = [] - if n > 0: - self.audioChannel = service.audioChannel() - - idx = 0 - while idx < n: - cnt = 0 - i = audio.getTrackInfo(idx) - languages = i.getLanguage().split('/') - description = i.getDescription() - language = "" - - for lang in languages: - if cnt: - language += ' / ' - if LanguageCodes.has_key(lang): - language += LanguageCodes[lang][0] - else: - language += lang - cnt += 1 - - if len(description): - description += " (" + language + ")" - else: - description = language - - tlist.append((description, idx)) - idx += 1 - - tlist.sort(key=lambda x: x[0]) - - selectedAudio = self.audioTracks.getCurrentTrack() - - selection = 0 - - for x in tlist: - if x[1] != selectedAudio: - selection += 1 - else: - break - - availableKeys = [] - usedKeys = [] - - if SystemInfo["CanDownmixAC3"]: - flist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix), - ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")] - usedKeys.extend(["red", "green"]) - availableKeys.extend(["yellow", "blue"]) - selection += 2 - else: - flist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")] - usedKeys.extend(["red"]) - availableKeys.extend(["green", "yellow", "blue"]) - selection += 1 - - if hasattr(self, "runPlugin"): - class PluginCaller: - def __init__(self, fnc, *args): - self.fnc = fnc - self.args = args - def __call__(self, *args, **kwargs): - self.fnc(*self.args) - - Plugins = [ (p.name, PluginCaller(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] - - for p in Plugins: - selection += 1 - flist.append((p[0], "CALLFUNC", p[1])) - if availableKeys: - usedKeys.append(availableKeys[0]) - del availableKeys[0] - else: - usedKeys.append("") - - flist.append(("--", "")) - usedKeys.append("") - selection += 1 - - keys = usedKeys + [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ] + [""] * n - self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = flist + tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection") - else: - del self.audioTracks - - def changeAC3Downmix(self, arg): - choicelist = self.session.current_dialog["list"] - list = choicelist.list - t = list[0][1] - list[0][1]=(t[0], t[1], t[2], t[3], t[4], t[5], t[6], - _("AC3 downmix") + " - " + (_("On"), _("Off"))[config.av.downmix_ac3.value and 1 or 0]) - choicelist.setList(list) - if config.av.downmix_ac3.value: - config.av.downmix_ac3.value = False - else: - config.av.downmix_ac3.value = True - config.av.downmix_ac3.save() - - def audioSelected(self, audio): - if audio is not None: - if isinstance(audio[1], str): - if audio[1] == "mode": - keys = ["red", "green", "yellow"] - selection = self.audioChannel.getCurrentChannel() - tlist = ((_("left"), 0), (_("stereo"), 1), (_("right"), 2)) - self.session.openWithCallback(self.modeSelected, ChoiceBox, title=_("Select audio mode"), list = tlist, selection = selection, keys = keys, skin_name ="AudioModeSelection") - else: - del self.audioChannel - if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > audio[1]: - self.audioTracks.selectTrack(audio[1]) - else: - del self.audioChannel - del self.audioTracks - - def modeSelected(self, mode): - if mode is not None: - self.audioChannel.selectChannel(mode[1]) - del self.audioChannel + from Screens.AudioSelection import AudioSelection + self.session.openWithCallback(self.audioSelected, AudioSelection, infobar=self) + + def audioSelected(self, ret=None): + print "[infobar::audioSelected]", ret class InfoBarSubserviceSelection: def __init__(self): diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index d96b491e..5cec5127 100755 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -1,13 +1,13 @@ installdir = $(pkglibdir)/python/Screens install_PYTHON = \ - ChannelSelection.py ClockDisplay.py ConfigMenu.py InfoBar.py Menu.py \ - MessageBox.py Screen.py ServiceScan.py TimerEdit.py \ + AudioSelection.py ChannelSelection.py ClockDisplay.py ConfigMenu.py InfoBar.py \ + Menu.py MessageBox.py Screen.py ServiceScan.py TimerEdit.py \ MovieSelection.py Setup.py About.py HarddiskSetup.py FixedMenu.py \ Satconfig.py ScanSetup.py NetworkSetup.py Ci.py TimerEntry.py Volume.py \ EpgSelection.py EventView.py Mute.py Standby.py ServiceInfo.py \ InfoBarGenerics.py HelpMenu.py Wizard.py __init__.py \ - Dish.py LanguageSelection.py StartWizard.py PiPSetup.py Subtitles.py \ + Dish.py LanguageSelection.py StartWizard.py PiPSetup.py \ TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \ Console.py InputBox.py ChoiceBox.py SimpleSummary.py \ TimerSelection.py PictureInPicture.py TimeDateInput.py \ diff --git a/lib/python/Screens/Subtitles.py b/lib/python/Screens/Subtitles.py deleted file mode 100644 index 9ba7e0a5..00000000 --- a/lib/python/Screens/Subtitles.py +++ /dev/null @@ -1,103 +0,0 @@ -from Screen import Screen -from Components.ServiceEventTracker import ServiceEventTracker -from Components.ActionMap import ActionMap -from Components.ConfigList import ConfigListScreen -from Components.config import config, getConfigListEntry, ConfigNothing -from enigma import iPlayableService - -from Tools.ISO639 import LanguageCodes - -class Subtitles(Screen, ConfigListScreen): - def __init__(self, session, infobar=None): - Screen.__init__(self, session) - - self["actions"] = ActionMap(["SetupActions"], - { - "ok": self.ok, - "cancel": self.cancel, - }, -2) - - self.list = [] - ConfigListScreen.__init__(self, self.list) - self.infobar = infobar or self.session.infobar - self.fillList() - - self.__event_tracker = ServiceEventTracker(screen=self, eventmap= - { - iPlayableService.evUpdatedInfo: self.__updatedInfo - }) - self.cached_subtitle_checked = False - self.__selected_subtitle = None - - def fillList(self): - list = self.list - del list[:] - print "self.list", list - if self.subtitlesEnabled(): - list.append(getConfigListEntry(_("Disable Subtitles"), ConfigNothing(), None)) - sel = self.infobar.selected_subtitle - else: - sel = None - for x in self.getSubtitleList(): - if sel and sel[:4] == x[:4]: #ignore Language code in compare - text = _("Running") - else: - text = _("Enable") - if x[0] == 0: - if LanguageCodes.has_key(x[4]): - list.append(getConfigListEntry(text+" DVB "+LanguageCodes[x[4]][0], ConfigNothing(), x)) - else: - list.append(getConfigListEntry(text+" DVB "+x[4], ConfigNothing(), x)) - elif x[0] == 1: - if x[4] == 'und': #undefined - list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2]), ConfigNothing(), x)) - else: - if LanguageCodes.has_key(x[4]): - list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+LanguageCodes[x[4]][0], ConfigNothing(), x)) - else: - list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+x[4], ConfigNothing(), x)) - elif x[0] == 2: - types = (" UTF-8 text "," SSA / AAS "," .SRT file ") - if x[4] == 'und': #undefined - list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d" % x[1], ConfigNothing(), x)) - else: - if LanguageCodes.has_key(x[4]): - list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles") + ' ' + LanguageCodes[x[4]][0], ConfigNothing(), x)) - else: - list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d " % x[1] +x[4], ConfigNothing(), x)) -# return _("Disable subtitles") - self["config"].list = list - self["config"].l.setList(list) - - def __updatedInfo(self): - self.fillList() - - def getSubtitleList(self): - s = self.infobar and self.infobar.getCurrentServiceSubtitle() - l = s and s.getSubtitleList() or [ ] - return l - - def subtitlesEnabled(self): - return self.infobar.subtitles_enabled - - def enableSubtitle(self, subtitles): - if self.infobar.selected_subtitle != subtitles: - self.infobar.subtitles_enabled = False - self.infobar.selected_subtitle = subtitles - if subtitles: - self.infobar.subtitles_enabled = True - - def keyLeft(self): - ConfigListScreen.keyLeft(self) - - def keyRight(self): - ConfigListScreen.keyRight(self) - - def ok(self): - if self.list: - cur = self["config"].getCurrent() - self.enableSubtitle(cur[2]) - self.close(1) - - def cancel(self): - self.close() -- cgit v1.2.3 From 96a165cdc48c3bdec6e0570186fa7843975db950 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 25 May 2010 13:39:16 +0200 Subject: allow switching to stream 0 --- lib/python/Screens/AudioSelection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index b97c25b2..a11127cb 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -288,10 +288,10 @@ class AudioSelection(Screen, ConfigListScreen): print "[keyok]", self["streams"].list, self["streams"].getCurrent() if self.focus == FOCUS_STREAMS and self["streams"].list: cur = self["streams"].getCurrent() - if self.settings.menupage.getValue() == "audio" and cur[0]: + if self.settings.menupage.getValue() == "audio" and cur[0] is not None: self.changeAudio(cur[2]) self.__updatedInfo() - if self.settings.menupage.getValue() == "subtitles" and cur[0]: + if self.settings.menupage.getValue() == "subtitles" and cur[0] is not None: if self.infobar.selected_subtitle == cur[0]: self.enableSubtitle(None) selectedidx = self["streams"].getIndex() -- cgit v1.2.3 From 9529d3ec43c9d81811dd5efa4c998821df90c9b5 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 26 May 2010 11:33:11 +0200 Subject: fix empty streams list crash, correctly show/hide color key buttons, re-implement plugin-hook for blue key, fix possible exit crash --- lib/python/Screens/AudioSelection.py | 87 +++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 35 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index a11127cb..2cae1de9 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -73,7 +73,7 @@ class AudioSelection(Screen, ConfigListScreen): self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value) self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False) conflist.append(getConfigListEntry(_("AC3 downmix"), self.settings.downmix)) - self["key_red"] = Boolean(True) + self["key_red"].setBoolean(True) if n > 0: self.audioChannel = service.audioChannel() @@ -82,7 +82,7 @@ class AudioSelection(Screen, ConfigListScreen): self.settings.channelmode = ConfigSelection(choices = choicelist, default = str(self.audioChannel.getCurrentChannel())) self.settings.channelmode.addNotifier(self.changeMode, initial_call = False) conflist.append(getConfigListEntry(_("Channel"), self.settings.channelmode)) - self["key_green"] = Boolean(True) + self["key_green"].setBoolean(True) selectedAudio = self.audioTracks.getCurrentTrack() print "selectedAudio:", selectedAudio @@ -113,33 +113,17 @@ class AudioSelection(Screen, ConfigListScreen): streams.append((x, "", number, description, language, selected)) - #if hasattr(self, "runPlugin"): - #class PluginCaller: - #def __init__(self, fnc, *args): - #self.fnc = fnc - #self.args = args - #def __call__(self, *args, **kwargs): - #self.fnc(*self.args) - - #Plugins = [ (p.name, PluginCaller(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] - - #for p in Plugins: - #selection += 1 - #flist.append((p[0], "CALLFUNC", p[1])) - #if availableKeys: - #usedKeys.append(availableKeys[0]) - #del availableKeys[0] - #else: - #usedKeys.append("") else: - streams = [(None, "", "", _("none"), "")] + streams = [] elif self.settings.menupage.getValue() == "subtitles": self.setTitle(_("Subtitle selection")) self.settings.dummy = ConfigNothing() conflist.append(getConfigListEntry("", self.settings.dummy)) + self["key_red"].setBoolean(False) conflist.append(getConfigListEntry("", self.settings.dummy)) + self["key_green"].setBoolean(False) if self.subtitlesEnabled(): sel = self.infobar.selected_subtitle @@ -149,7 +133,7 @@ class AudioSelection(Screen, ConfigListScreen): idx = 0 subtitlelist = self.getSubtitleList() - + if len(subtitlelist): for x in subtitlelist: number = str(x[1]) @@ -183,14 +167,39 @@ class AudioSelection(Screen, ConfigListScreen): idx += 1 else: - streams = [(None, "", "", _("none"), "")] + streams = [] conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) + + from Components.PluginComponent import plugins + from Plugins.Plugin import PluginDescriptor + + if hasattr(self.infobar, "runPlugin"): + class PluginCaller: + def __init__(self, fnc, *args): + self.fnc = fnc + self.args = args + def __call__(self, *args, **kwargs): + self.fnc(*self.args) + + Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] + + print "Plugins", Plugins + + self.settings.dummy = ConfigNothing() + if len(Plugins): + self["key_blue"].setBoolean(True) + conflist.append(getConfigListEntry(Plugins[0][0], self.settings.dummy)) + self.plugincallfunc = Plugins[0][1] + self["config"].list = conflist self["config"].l.setList(conflist) + print "setting self[streams].list:", streams self["streams"].list = streams + print "setting self[streams].setIndex:", selectedidx self["streams"].setIndex(selectedidx) + print "debug1" def __updatedInfo(self): self.fillList() @@ -237,27 +246,35 @@ class AudioSelection(Screen, ConfigListScreen): elif self.focus == FOCUS_STREAMS: self["streams"].setIndex(0) - def keyRight(self): - if self.focus == FOCUS_CONFIG: - ConfigListScreen.keyRight(self) - elif self.focus == FOCUS_STREAMS and self["streams"].count(): + def keyRight(self, config = False): + if config or self.focus == FOCUS_CONFIG: + if self["config"].getCurrentIndex() < 3: + ConfigListScreen.keyRight(self) + elif hasattr(self, "plugincallfunc"): + self.plugincallfunc() + if self.focus == FOCUS_STREAMS and self["streams"].count(): self["streams"].setIndex(self["streams"].count()-1) def keyRed(self): - self.colorkey(0) + if self["key_red"].getBoolean(): + self.colorkey(0) def keyGreen(self): - self.colorkey(1) + if self["key_green"].getBoolean(): + self.colorkey(1) def keyYellow(self): - self.colorkey(2) - + if self["key_yellow"].getBoolean(): + self.colorkey(2) + def keyBlue(self): - pass - + if self["key_blue"].getBoolean(): + print "colorkey(3)" + self.colorkey(3) + def colorkey(self, idx): self["config"].setCurrentIndex(idx) - ConfigListScreen.keyRight(self) + self.keyRight(True) def keyUp(self): print "[keyUp]", self["streams"].getIndex() @@ -305,4 +322,4 @@ class AudioSelection(Screen, ConfigListScreen): self.keyRight() def cancel(self): - self.close() + self.close(0) -- cgit v1.2.3 From 1c8a3aefeb8063526084bc7a24913d2c1f17d1e6 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 1 Jun 2010 00:29:09 +0200 Subject: lib/base/ebase.cpp: remove unneeded code --- lib/base/ebase.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'lib') diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp index caccb391..c84f28b8 100644 --- a/lib/base/ebase.cpp +++ b/lib/base/ebase.cpp @@ -243,14 +243,9 @@ int eMainloop::processOneEvent(unsigned int twisted_timeout, PyObject **res, ePy if (this == eApp) { - gOpcode op; - op.dc = 0; - op.opcode = gOpcode::flush; - gRC::getInstance()->submit(op); Py_BEGIN_ALLOW_THREADS ret = ::poll(pfd, fdcount, poll_timeout); Py_END_ALLOW_THREADS - } else ret = ::poll(pfd, fdcount, poll_timeout); -- cgit v1.2.3 From 18e9562c55f0ee01ccc74d48018fd6b67f20f19c Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 4 Jun 2010 14:50:01 +0200 Subject: lib/gui/elistboxcontent.cpp: dont crash on non selectable entries --- lib/gui/elistboxcontent.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index 7bb84c3d..43fbc594 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -343,7 +343,6 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style, if (PyTuple_Check(item)) { /* handle left part. get item from tuple, convert to string, display. */ - text = PyTuple_GET_ITEM(item, 0); text = PyObject_Str(text); /* creates a new object - old object was borrowed! */ const char *string = (text && PyString_Check(text)) ? PyString_AsString(text) : ""; @@ -357,7 +356,9 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style, int value_alignment_left = !*string; /* now, handle the value. get 2nd part from tuple*/ - value = PyTuple_GET_ITEM(item, 1); + if (PyTuple_Size(item) >= 2) // when no 2nd entry is in tuple this is a non selectable entry without config part + value = PyTuple_GET_ITEM(item, 1); + if (value) { ePyObject args = PyTuple_New(1); @@ -468,7 +469,7 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style, } } /* type is borrowed */ - } else + } else if (value) eWarning("eListboxPythonConfigContent: second value of tuple is not a tuple."); if (value) Py_DECREF(value); -- cgit v1.2.3 From 05b454322d04bc7fa35e5a05fcdebba7fa8e942a Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 2 Jun 2010 15:03:52 +0200 Subject: Extend AudioSelection width, fix mediaplayer subtitle selection key --- data/skin_default.xml | 24 +++++++++--------- .../Plugins/Extensions/MediaPlayer/plugin.py | 8 +++--- lib/python/Screens/AudioSelection.py | 29 ++++++++++++++-------- 3 files changed, 35 insertions(+), 26 deletions(-) (limited to 'lib') diff --git a/data/skin_default.xml b/data/skin_default.xml index 9fb2fc27..ea0e29f2 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -62,8 +62,8 @@ - - + + @@ -78,24 +78,24 @@ - + - + {"templates": {"default": (25, [ MultiContentEntryText(pos = (0, 0), size = (35, 25), font = 0, flags = RT_HALIGN_LEFT, text = 1), # key, - MultiContentEntryText(pos = (40, 0), size = (55, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, - MultiContentEntryText(pos = (100, 0), size = (80, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, - MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, - MultiContentEntryText(pos = (340, 4), size = (60, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, + MultiContentEntryText(pos = (40, 0), size = (60, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, + MultiContentEntryText(pos = (110, 0), size = (120, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, + MultiContentEntryText(pos = (240, 0), size = (210, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, + MultiContentEntryText(pos = (460, 4), size = (80, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, ], True, "showNever"), "notselected": (25, [ MultiContentEntryText(pos = (0, 0), size = (35, 25), font = 0, flags = RT_HALIGN_LEFT, text = 1), # key, - MultiContentEntryText(pos = (40, 0), size = (55, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, - MultiContentEntryText(pos = (100, 0), size = (80, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, - MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, - MultiContentEntryText(pos = (340, 4), size = (60, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, + MultiContentEntryText(pos = (40, 0), size = (60, 25), font = 0, flags = RT_HALIGN_LEFT, text = 2), # number, + MultiContentEntryText(pos = (110, 0), size = (120, 25), font = 0, flags = RT_HALIGN_LEFT, text = 3), # description, + MultiContentEntryText(pos = (240, 0), size = (210, 25), font = 0, flags = RT_HALIGN_LEFT, text = 4), # language, + MultiContentEntryText(pos = (460, 4), size = (80, 25), font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection, ], False, "showNever") }, "fonts": [gFont("Regular", 20), gFont("Regular", 16)], diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 0fc78fb1..15806e8c 100755 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -901,11 +901,11 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB def unPauseService(self): self.setSeekState(self.SEEK_STATE_PLAY) - + def subtitleSelection(self): - from Screens.Subtitles import Subtitles - self.session.open(Subtitles, self) - + from Screens.AudioSelection import SubtitleSelection + self.session.open(SubtitleSelection, self) + def hotplugCB(self, dev, media_state): if dev == harddiskmanager.getCD(): if media_state == "1": diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index 2cae1de9..2dd6ad90 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -14,9 +14,10 @@ from enigma import iPlayableService from Tools.ISO639 import LanguageCodes from Tools.BoundFunction import boundFunction FOCUS_CONFIG, FOCUS_STREAMS = range(2) +[PAGE_AUDIO, PAGE_SUBTITLES] = ["audio", "subtitles"] class AudioSelection(Screen, ConfigListScreen): - def __init__(self, session, infobar=None): + def __init__(self, session, infobar=None, page=PAGE_AUDIO): Screen.__init__(self, session) self["streams"] = List([]) @@ -48,8 +49,8 @@ class AudioSelection(Screen, ConfigListScreen): }, -3) self.settings = ConfigSubsection() - choicelist = [("audio",_("audio tracks")), ("subtitles",_("Subtitles"))] - self.settings.menupage = ConfigSelection(choices = choicelist) + choicelist = [(PAGE_AUDIO,_("audio tracks")), (PAGE_SUBTITLES,_("Subtitles"))] + self.settings.menupage = ConfigSelection(choices = choicelist, default=page) self.settings.menupage.addNotifier(self.fillList) self.onLayoutFinish.append(self.__layoutFinished) @@ -66,7 +67,7 @@ class AudioSelection(Screen, ConfigListScreen): self.audioTracks = audio = service and service.audioTracks() n = audio and audio.getNumberOfTracks() or 0 - if self.settings.menupage.getValue() == "audio": + if self.settings.menupage.getValue() == PAGE_AUDIO: self.setTitle(_("Select audio track")) if SystemInfo["CanDownmixAC3"]: print "config.av.downmix_ac3.value=", config.av.downmix_ac3.value @@ -115,8 +116,11 @@ class AudioSelection(Screen, ConfigListScreen): else: streams = [] + self.settings.dummy = ConfigNothing() + conflist.append(getConfigListEntry("", self.settings.dummy)) + self["key_green"].setBoolean(False) - elif self.settings.menupage.getValue() == "subtitles": + elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) self.settings.dummy = ConfigNothing() @@ -158,9 +162,9 @@ class AudioSelection(Screen, ConfigListScreen): elif x[0] == 1: description = "TTX" number = "%x%02x" % (x[3],x[2]) - + elif x[0] == 2: - types = (" UTF-8 text "," SSA / AAS "," .SRT file ") + types = ("UTF-8 text","SSA / AAS",".SRT file") description = types[x[2]] streams.append((x, "", number, description, language, selected)) @@ -252,7 +256,7 @@ class AudioSelection(Screen, ConfigListScreen): ConfigListScreen.keyRight(self) elif hasattr(self, "plugincallfunc"): self.plugincallfunc() - if self.focus == FOCUS_STREAMS and self["streams"].count(): + if self.focus == FOCUS_STREAMS and self["streams"].count() and config == False: self["streams"].setIndex(self["streams"].count()-1) def keyRed(self): @@ -305,10 +309,10 @@ class AudioSelection(Screen, ConfigListScreen): print "[keyok]", self["streams"].list, self["streams"].getCurrent() if self.focus == FOCUS_STREAMS and self["streams"].list: cur = self["streams"].getCurrent() - if self.settings.menupage.getValue() == "audio" and cur[0] is not None: + if self.settings.menupage.getValue() == PAGE_AUDIO and cur[0] is not None: self.changeAudio(cur[2]) self.__updatedInfo() - if self.settings.menupage.getValue() == "subtitles" and cur[0] is not None: + if self.settings.menupage.getValue() == PAGE_SUBTITLES and cur[0] is not None: if self.infobar.selected_subtitle == cur[0]: self.enableSubtitle(None) selectedidx = self["streams"].getIndex() @@ -323,3 +327,8 @@ class AudioSelection(Screen, ConfigListScreen): def cancel(self): self.close(0) + +class SubtitleSelection(AudioSelection): + def __init__(self, session, infobar=None): + AudioSelection.__init__(self, session, infobar, page=PAGE_SUBTITLES) + self.skinName = ["AudioSelection"] -- cgit v1.2.3 From 68c456f12b1e72cf982997d4d528281734021a85 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 4 Jun 2010 15:17:40 +0200 Subject: make empty conflist entries unselectable and change some debug output --- lib/python/Screens/AudioSelection.py | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index 2dd6ad90..bacc00c1 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -70,7 +70,6 @@ class AudioSelection(Screen, ConfigListScreen): if self.settings.menupage.getValue() == PAGE_AUDIO: self.setTitle(_("Select audio track")) if SystemInfo["CanDownmixAC3"]: - print "config.av.downmix_ac3.value=", config.av.downmix_ac3.value self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value) self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False) conflist.append(getConfigListEntry(_("AC3 downmix"), self.settings.downmix)) @@ -78,16 +77,12 @@ class AudioSelection(Screen, ConfigListScreen): if n > 0: self.audioChannel = service.audioChannel() - print "self.audioChannel.getCurrentChannel()", self.audioChannel.getCurrentChannel() choicelist = [("0",_("left")), ("1",_("stereo")), ("2", _("right"))] self.settings.channelmode = ConfigSelection(choices = choicelist, default = str(self.audioChannel.getCurrentChannel())) self.settings.channelmode.addNotifier(self.changeMode, initial_call = False) conflist.append(getConfigListEntry(_("Channel"), self.settings.channelmode)) self["key_green"].setBoolean(True) - selectedAudio = self.audioTracks.getCurrentTrack() - print "selectedAudio:", selectedAudio - for x in range(n): number = str(x) i = audio.getTrackInfo(x) @@ -116,17 +111,14 @@ class AudioSelection(Screen, ConfigListScreen): else: streams = [] - self.settings.dummy = ConfigNothing() - conflist.append(getConfigListEntry("", self.settings.dummy)) + conflist.append(('',)) self["key_green"].setBoolean(False) elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) - - self.settings.dummy = ConfigNothing() - conflist.append(getConfigListEntry("", self.settings.dummy)) + conflist.append(('',)) + conflist.append(('',)) self["key_red"].setBoolean(False) - conflist.append(getConfigListEntry("", self.settings.dummy)) self["key_green"].setBoolean(False) if self.subtitlesEnabled(): @@ -187,23 +179,19 @@ class AudioSelection(Screen, ConfigListScreen): self.fnc(*self.args) Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] - - print "Plugins", Plugins - self.settings.dummy = ConfigNothing() if len(Plugins): self["key_blue"].setBoolean(True) - conflist.append(getConfigListEntry(Plugins[0][0], self.settings.dummy)) + conflist.append(getConfigListEntry(Plugins[0][0], ConfigNothing())) self.plugincallfunc = Plugins[0][1] + if len(Plugins) > 1: + print "these plugins are installed but not displayed in the dialog box:", Plugins[1:] self["config"].list = conflist self["config"].l.setList(conflist) - print "setting self[streams].list:", streams self["streams"].list = streams - print "setting self[streams].setIndex:", selectedidx self["streams"].setIndex(selectedidx) - print "debug1" def __updatedInfo(self): self.fillList() @@ -217,7 +205,6 @@ class AudioSelection(Screen, ConfigListScreen): return self.infobar.subtitles_enabled def enableSubtitle(self, subtitles): - print "[enableSubtitle]", subtitles if self.infobar.selected_subtitle != subtitles: self.infobar.subtitles_enabled = False self.infobar.selected_subtitle = subtitles @@ -225,7 +212,6 @@ class AudioSelection(Screen, ConfigListScreen): self.infobar.subtitles_enabled = True def changeAC3Downmix(self, downmix): - print "changeAC3Downmix config.av.downmix_ac3.value=", config.av.downmix_ac3.value, downmix.getValue() if downmix.getValue() == True: config.av.downmix_ac3.value = True else: @@ -233,12 +219,10 @@ class AudioSelection(Screen, ConfigListScreen): config.av.downmix_ac3.save() def changeMode(self, mode): - print "changeMode", mode, mode.getValue() if mode is not None: self.audioChannel.selectChannel(int(mode.getValue())) def changeAudio(self, audio): - print "changeAudio", audio, "self.session.nav.getCurrentService().audioTracks().getNumberOfTracks():", self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() track = int(audio) if isinstance(track, int): if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > track: @@ -273,7 +257,6 @@ class AudioSelection(Screen, ConfigListScreen): def keyBlue(self): if self["key_blue"].getBoolean(): - print "colorkey(3)" self.colorkey(3) def colorkey(self, idx): @@ -281,7 +264,6 @@ class AudioSelection(Screen, ConfigListScreen): self.keyRight(True) def keyUp(self): - print "[keyUp]", self["streams"].getIndex() if self.focus == FOCUS_CONFIG: self["config"].instance.moveSelection(self["config"].instance.moveUp) elif self.focus == FOCUS_STREAMS: @@ -294,7 +276,6 @@ class AudioSelection(Screen, ConfigListScreen): self["streams"].selectPrevious() def keyDown(self): - print "[keyDown]", self["config"].getCurrentIndex(), len(self["config"].getList())-1 if self.focus == FOCUS_CONFIG: if self["config"].getCurrentIndex() < len(self["config"].getList())-1: self["config"].instance.moveSelection(self["config"].instance.moveDown) @@ -306,7 +287,6 @@ class AudioSelection(Screen, ConfigListScreen): self["streams"].selectNext() def keyOk(self): - print "[keyok]", self["streams"].list, self["streams"].getCurrent() if self.focus == FOCUS_STREAMS and self["streams"].list: cur = self["streams"].getCurrent() if self.settings.menupage.getValue() == PAGE_AUDIO and cur[0] is not None: -- cgit v1.2.3 From 6667d88310f66513676c842afe91a2e13dadefaa Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 8 Jun 2010 13:36:59 +0200 Subject: fix compiler warnings --- lib/base/ebase.cpp | 2 +- lib/base/estring.cpp | 2 +- lib/gdi/region.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp index c84f28b8..700cce36 100644 --- a/lib/base/ebase.cpp +++ b/lib/base/ebase.cpp @@ -165,7 +165,7 @@ void eMainloop::removeSocketNotifier(eSocketNotifier *sn) return; } for (i = notifiers.begin(); i != notifiers.end(); ++i) - eDebug("fd=%d, sn=%d", i->second->getFD(), (void*)i->second); + eDebug("fd=%d, sn=%p", i->second->getFD(), (void*)i->second); eFatal("removed socket notifier which is not present, fd=%d", fd); } diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp index e7dc2bec..f2ac7325 100644 --- a/lib/base/estring.cpp +++ b/lib/base/estring.cpp @@ -424,7 +424,7 @@ std::string convertDVBUTF8(const unsigned char *data, int len, int table, int ts break; } - bool useTwoCharMapping = !table || tsidonid && encodingHandler.getTransponderUseTwoCharMapping(tsidonid); + bool useTwoCharMapping = !table || (tsidonid && encodingHandler.getTransponderUseTwoCharMapping(tsidonid)); if (useTwoCharMapping && table == 5) { // i hope this dont break other transponders which realy use ISO8859-5 and two char byte mapping... // eDebug("Cyfra / Cyfrowy Polsat HACK... override given ISO8859-5 with ISO6397"); diff --git a/lib/gdi/region.cpp b/lib/gdi/region.cpp index 1208c97e..73d9ac2d 100644 --- a/lib/gdi/region.cpp +++ b/lib/gdi/region.cpp @@ -428,7 +428,7 @@ void gRegion::moveBy(ePoint offset) void gRegion::scale(int x_n, int x_d, int y_n, int y_d) { - int i; + unsigned int i; for (i=0; i Date: Tue, 8 Jun 2010 14:28:29 +0200 Subject: update unicable stuff (by adenin) --- data/Makefile.am | 3 +- data/unicable.xml | 172 ++++++++++++++++++++++++++++++++++ lib/dvb/frontend.cpp | 91 +++++++++--------- lib/dvb/frontend.h | 8 +- lib/dvb/idvb.h | 5 +- lib/dvb/sec.cpp | 82 +++++++++++++--- lib/dvb/sec.h | 13 ++- lib/python/Components/NimManager.py | 182 ++++++++++++++++++++++++------------ lib/python/Components/config.py | 3 +- lib/python/Screens/Satconfig.py | 15 ++- 10 files changed, 444 insertions(+), 130 deletions(-) create mode 100644 data/unicable.xml (limited to 'lib') diff --git a/data/Makefile.am b/data/Makefile.am index 67f2ad25..fcc29a8d 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -14,4 +14,5 @@ dist_pkgdata_DATA = \ skin_default.xml \ skin.xml \ startwizard.xml \ - tutorialwizard.xml + tutorialwizard.xml \ + unicable.xml diff --git a/data/unicable.xml b/data/unicable.xml new file mode 100644 index 00000000..33951d7f --- /dev/null +++ b/data/unicable.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index bc3a88da..bd8f0028 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -582,7 +582,7 @@ int eDVBFrontend::openFrontend() return 0; } -int eDVBFrontend::closeFrontend(bool force) +int eDVBFrontend::closeFrontend(bool force, bool no_delayed) { if (!force && m_data[CUR_VOLTAGE] != -1 && m_data[CUR_VOLTAGE] != iDVBFrontend::voltageOff) { @@ -605,11 +605,34 @@ int eDVBFrontend::closeFrontend(bool force) eDebugNoSimulate("close frontend %d", m_dvbid); if (m_data[SATCR] != -1) { - turnOffSatCR(m_data[SATCR]); + if (!no_delayed) + { + m_sec->prepareTurnOffSatCR(*this, m_data[SATCR]); + m_tuneTimer->start(0, true); + if(!m_tuneTimer->isActive()) + { + int timeout=0; + eDebug("[turnOffSatCR] no mainloop"); + while(true) + { + timeout = tuneLoopInt(); + if (timeout == -1) + break; + usleep(timeout*1000); // blockierendes wait.. eTimer gibts ja nicht mehr + } + } + else + eDebug("[turnOffSatCR] running mainloop"); + return 0; + } + else + m_data[ROTOR_CMD] = -1; } + setTone(iDVBFrontend::toneOff); setVoltage(iDVBFrontend::voltageOff); m_tuneTimer->stop(); + if (m_sec && !m_simulate) m_sec->setRotorMoving(m_slotid, false); if (!::close(m_fd)) @@ -1486,9 +1509,14 @@ bool eDVBFrontend::setSecSequencePos(int steps) return true; } -void eDVBFrontend::tuneLoop() // called by m_tuneTimer +void eDVBFrontend::tuneLoop() +{ + tuneLoopInt(); +} + +int eDVBFrontend::tuneLoopInt() // called by m_tuneTimer { - int delay=0; + int delay=-1; eDVBFrontend *sec_fe = this; eDVBRegisteredFrontend *regFE = 0; long tmp = m_data[LINKED_PREV_PTR]; @@ -1518,6 +1546,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer { long *sec_fe_data = sec_fe->m_data; // eDebugNoSimulate("tuneLoop %d\n", m_sec_sequence.current()->cmd); + delay = 0; switch (m_sec_sequence.current()->cmd) { case eSecCommand::SLEEP: @@ -1844,6 +1873,13 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer ++m_sec_sequence.current(); break; } + case eSecCommand::DELAYED_CLOSE_FRONTEND: + { + eDebugNoSimulate("[SEC] delayed close frontend"); + closeFrontend(false, true); + ++m_sec_sequence.current(); + break; + } default: eDebugNoSimulate("[SEC] unhandled sec command %d", ++m_sec_sequence.current()->cmd); @@ -1856,6 +1892,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer regFE->dec_use(); if (m_simulate && m_sec_sequence.current() != m_sec_sequence.end()) tuneLoop(); + return delay; } void eDVBFrontend::setFrontend(bool recvEvents) @@ -2591,9 +2628,12 @@ RESULT eDVBFrontend::setSEC(iDVBSatelliteEquipmentControl *sec) return 0; } -RESULT eDVBFrontend::setSecSequence(const eSecCommandList &list) +RESULT eDVBFrontend::setSecSequence(eSecCommandList &list) { - m_sec_sequence = list; + if (m_data[SATCR] != -1 && m_sec_sequence.current() != m_sec_sequence.end()) + m_sec_sequence.push_back(list); + else + m_sec_sequence = list; return 0; } @@ -2670,42 +2710,3 @@ arg_error: "eDVBFrontend::setSlotInfo must get a tuple with first param slotid, second param slot description and third param enabled boolean"); return false; } - -RESULT eDVBFrontend::turnOffSatCR(int satcr) -{ - eSecCommandList sec_sequence; - // check if voltage is disabled - eSecCommand::pair compare; - compare.steps = +9; //nothing to do - compare.voltage = iDVBFrontend::voltageOff; - sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50 ) ); - - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18_5) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 250) ); - - eDVBDiseqcCommand diseqc; - memset(diseqc.data, 0, MAX_DISEQC_LENGTH); - diseqc.len = 5; - diseqc.data[0] = 0xE0; - diseqc.data[1] = 0x10; - diseqc.data[2] = 0x5A; - diseqc.data[3] = satcr << 5; - diseqc.data[4] = 0x00; - - sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50+20+14*diseqc.len) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); - setSecSequence(sec_sequence); - return 0; -} - -RESULT eDVBFrontend::ScanSatCR() -{ - setFrontend(); - usleep(20000); - setTone(iDVBFrontend::toneOff); - return 0; -} diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index bc31755c..bef4a18f 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -110,6 +110,7 @@ private: void feEvent(int); void timeout(); void tuneLoop(); // called by m_tuneTimer + int tuneLoopInt(); void setFrontend(bool recvEvents=true); bool setSecSequencePos(int steps); static int PriorityOrder; @@ -130,7 +131,7 @@ public: RESULT sendDiseqc(const eDVBDiseqcCommand &diseqc); RESULT sendToneburst(int burst); RESULT setSEC(iDVBSatelliteEquipmentControl *sec); - RESULT setSecSequence(const eSecCommandList &list); + RESULT setSecSequence(eSecCommandList &list); RESULT getData(int num, long &data); RESULT setData(int num, long val); @@ -148,12 +149,9 @@ public: void reopenFrontend(); int openFrontend(); - int closeFrontend(bool force=false); + int closeFrontend(bool force=false, bool no_delayed=false); const char *getDescription() const { return m_description; } bool is_simulate() const { return m_simulate; } - - RESULT turnOffSatCR(int satcr); - RESULT ScanSatCR(); }; #endif // SWIG diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 996d7909..f1217a6a 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -459,7 +459,7 @@ class iDVBFrontend: public iDVBFrontend_ENUMS, public iObject public: virtual RESULT getFrontendType(int &SWIG_OUTPUT)=0; virtual RESULT tune(const iDVBFrontendParameters &where)=0; - virtual int closeFrontend(bool force = false)=0; + virtual int closeFrontend(bool force = false, bool no_delayed = false)=0; virtual void reopenFrontend()=0; #ifndef SWIG virtual RESULT connectStateChange(const Slot1 &stateChange, ePtr &connection)=0; @@ -471,7 +471,7 @@ public: virtual RESULT sendToneburst(int burst)=0; #ifndef SWIG virtual RESULT setSEC(iDVBSatelliteEquipmentControl *sec)=0; - virtual RESULT setSecSequence(const eSecCommandList &list)=0; + virtual RESULT setSecSequence(eSecCommandList &list)=0; #endif virtual int readFrontendData(int type)=0; virtual void getFrontendStatus(SWIG_PYOBJECT(ePyObject) dest)=0; @@ -491,6 +491,7 @@ class iDVBSatelliteEquipmentControl: public iObject { public: virtual RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int frontend_id, unsigned int timeout)=0; + virtual void prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr)=0; virtual int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *fe, int frontend_id, int *highest_score_lnb=0)=0; virtual void setRotorMoving(int slotid, bool)=0; }; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 0e3e7e0a..58fc5e39 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -108,6 +108,9 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite { bool rotor=false; eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx]; + bool is_unicable = lnb_param.SatCR_idx != -1; + bool is_unicable_position_switch = lnb_param.SatCR_positions > 1; + if ( lnb_param.m_slot_mask & slot_id ) // lnb for correct tuner? { int ret = 0; @@ -163,7 +166,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite eSecDebugNoSimulate("ret1 %d", ret); - if (linked_in_use) + if (linked_in_use && !is_unicable) { // compare tuner data if ( (csw != linked_csw) || @@ -176,7 +179,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite ret += 15; eSecDebugNoSimulate("ret2 %d", ret); } - else if (satpos_depends_ptr != -1) + else if ((satpos_depends_ptr != -1) && !(is_unicable && is_unicable_position_switch)) { eSecDebugNoSimulate("satpos depends"); eDVBRegisteredFrontend *satpos_depends_to_fe = (eDVBRegisteredFrontend*) satpos_depends_ptr; @@ -209,7 +212,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite eSecDebugNoSimulate("ret5 %d", ret); - if (ret) + if (ret && lnb_param.SatCR_idx != -1) { int lof = sat.frequency > lnb_param.m_lof_threshold ? lnb_param.m_lof_hi : lnb_param.m_lof_lo; @@ -375,8 +378,8 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA { // calc Frequency local = abs(sat.frequency - - ((lof - (lof % 1000)) + ((lof % 1000)>500 ? 1000 : 0)) ); //TODO fr den Mist mal ein Macro schreiben - parm.FREQUENCY = (local - (local % 125)) + ((local % 125)>62 ? 125 : 0); + - lof); + parm.FREQUENCY = ((((local * 2) / 125) + 1) / 2) * 125; frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - parm.FREQUENCY); if ( voltage_mode == eDVBSatelliteSwitchParameters::_14V @@ -396,20 +399,21 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA } else { - unsigned int tmp = abs(sat.frequency - - ((lof - (lof % 1000)) + ((lof % 1000)>500 ? 1000 : 0)) ) + int tmp1 = abs(sat.frequency + -lof) + lnb_param.SatCRvco - 1400000 + lnb_param.guard_offset; - parm.FREQUENCY = (lnb_param.SatCRvco - (tmp % 4000))+((tmp%4000)>2000?4000:0)+lnb_param.guard_offset; - lnb_param.UnicableTuningWord = (((tmp / 4000)+((tmp%4000)>2000?1:0)) + int tmp2 = ((((tmp1 * 2) / 4000) + 1) / 2) * 4000; + parm.FREQUENCY = lnb_param.SatCRvco - (tmp1-tmp2) + lnb_param.guard_offset; + lnb_param.UnicableTuningWord = ((tmp2 / 4000) | ((band & 1) ? 0x400 : 0) //HighLow | ((band & 2) ? 0x800 : 0) //VertHor | ((lnb_param.LNBNum & 1) ? 0 : 0x1000) //Umschaltung LNB1 LNB2 | (lnb_param.SatCR_idx << 13)); //Adresse des SatCR eDebug("[prepare] UnicableTuningWord %#04x",lnb_param.UnicableTuningWord); eDebug("[prepare] guard_offset %d",lnb_param.guard_offset); - frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - ((lnb_param.UnicableTuningWord & 0x3FF) *4000 + 1400000 - lnb_param.SatCRvco + lof)); + frontend.setData(eDVBFrontend::FREQ_OFFSET, (lnb_param.UnicableTuningWord & 0x3FF) *4000 + 1400000 + lof - (2 * (lnb_param.SatCRvco - (tmp1-tmp2))) ); } if (diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0) @@ -743,10 +747,10 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA diseqc.data[3] = RotorCmd; diseqc.data[4] = 0x00; } - if(lnb_param.SatCR_idx == -1) +// if(lnb_param.SatCR_idx == -1) { int mrt = m_params[MOTOR_RUNNING_TIMEOUT]; // in seconds! - if ( rotor_param.m_inputpower_parameters.m_use ) + if ( rotor_param.m_inputpower_parameters.m_use || lnb_param.SatCR_idx == -1) { // use measure rotor input power to detect rotor state bool turn_fast = need_turn_fast(rotor_param.m_inputpower_parameters.m_turning_speed); eSecCommand::rotor cmd; @@ -950,6 +954,40 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA return -1; } +void eDVBSatelliteEquipmentControl::prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr) +{ + eSecCommandList sec_sequence; + + // check if voltage is disabled + eSecCommand::pair compare; + compare.steps = +9; //only close frontend + compare.voltage = iDVBFrontend::voltageOff; + + sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS]) ); + + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18_5) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS]) ); + + eDVBDiseqcCommand diseqc; + memset(diseqc.data, 0, MAX_DISEQC_LENGTH); + diseqc.len = 5; + diseqc.data[0] = 0xE0; + diseqc.data[1] = 0x10; + diseqc.data[2] = 0x5A; + diseqc.data[3] = satcr << 5; + diseqc.data[4] = 0x00; + + sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); + sec_sequence.push_back( eSecCommand(eSecCommand::DELAYED_CLOSE_FRONTEND) ); + + frontend.setSecSequence(sec_sequence); +} + RESULT eDVBSatelliteEquipmentControl::clear() { eSecDebug("eDVBSatelliteEquipmentControl::clear()"); @@ -1254,6 +1292,26 @@ RESULT eDVBSatelliteEquipmentControl::setLNBSatCRvco(int SatCRvco) return -ENOENT; return 0; } + +RESULT eDVBSatelliteEquipmentControl::setLNBSatCRpositions(int SatCR_positions) +{ + eSecDebug("eDVBSatelliteEquipmentControl::setLNBSatCRpositions(%d)", SatCR_positions); + if(SatCR_positions < 1 || SatCR_positions > 2) + return -EPERM; + if ( currentLNBValid() ) + m_lnbs[m_lnbidx].SatCR_positions = SatCR_positions; + else + return -ENOENT; + return 0; +} + +RESULT eDVBSatelliteEquipmentControl::getLNBSatCRpositions() +{ + if ( currentLNBValid() ) + return m_lnbs[m_lnbidx].SatCR_positions; + return -ENOENT; +} + RESULT eDVBSatelliteEquipmentControl::getLNBSatCR() { if ( currentLNBValid() ) diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index c50aee4d..b38671d2 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -25,7 +25,8 @@ public: IF_TONE_GOTO, IF_NOT_TONE_GOTO, START_TUNE_TIMEOUT, SET_ROTOR_MOVING, - SET_ROTOR_STOPPED + SET_ROTOR_STOPPED, + DELAYED_CLOSE_FRONTEND }; int cmd; struct rotor @@ -103,6 +104,11 @@ public: { secSequence.push_back(cmd); } + void push_back(eSecCommandList &list) + { + ASSERT(*this != list); + secSequence.splice(end(), list.secSequence); + } void clear() { secSequence.clear(); @@ -252,6 +258,7 @@ public: #define MAX_SATCR 8 #define MAX_LNBNUM 32 + int SatCR_positions; int SatCR_idx; unsigned int SatCRvco; unsigned int UnicableTuningWord; @@ -311,6 +318,7 @@ public: #ifndef SWIG eDVBSatelliteEquipmentControl(eSmartPtrList &avail_frontends, eSmartPtrList &avail_simulate_frontends); RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int frontend_id, unsigned int tunetimeout); + void prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr); // used for unicable int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *, int frontend_id, int *highest_score_lnb=0); bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); } #endif @@ -346,9 +354,10 @@ public: /* Unicable Specific Parameters */ RESULT setLNBSatCR(int SatCR_idx); RESULT setLNBSatCRvco(int SatCRvco); -// RESULT checkGuardOffset(const eDVBFrontendParametersSatellite &sat); + RESULT setLNBSatCRpositions(int SatCR_positions); RESULT getLNBSatCR(); RESULT getLNBSatCRvco(); + RESULT getLNBSatCRpositions(); /* Satellite Specific Parameters */ RESULT addSatellite(int orbital_position); RESULT setVoltageMode(int mode); diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index c68e9404..663ec16d 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -16,6 +16,9 @@ from time import localtime, mktime from datetime import datetime from Tools.BoundFunction import boundFunction +from Tools import Directories +import xml.etree.cElementTree + def getConfigSatlist(orbpos, satlist): default_orbpos = None for x in satlist: @@ -234,6 +237,20 @@ class SecConfigure: print "sec config completed" def updateAdvanced(self, sec, slotid): + try: + if config.Nims[slotid].advanced.unicableconnected is not None: + if config.Nims[slotid].advanced.unicableconnected.value == True: + config.Nims[slotid].advanced.unicableconnectedTo.save_forced = True + self.linkNIMs(sec, slotid, int(config.Nims[slotid].advanced.unicableconnectedTo.value)) + connto = self.getRoot(slotid, int(config.Nims[slotid].advanced.unicableconnectedTo.value)) + if not self.linked.has_key(connto): + self.linked[connto] = [] + self.linked[connto].append(slotid) + else: + config.Nims[slotid].advanced.unicableconnectedTo.save_forced = False + except: + pass + lnbSat = {} for x in range(1,37): lnbSat[x] = [] @@ -276,24 +293,40 @@ class SecConfigure: sec.setLNBLOFH(10600000) sec.setLNBThreshold(11700000) elif currLnb.lof.value == "unicable": - sec.setLNBLOFL(9750000) - sec.setLNBLOFH(10600000) - sec.setLNBThreshold(11700000) if currLnb.unicable.value == "unicable_user": +#TODO satpositions for satcruser + sec.setLNBLOFL(currLnb.lofl.value * 1000) + sec.setLNBLOFH(currLnb.lofh.value * 1000) + sec.setLNBThreshold(currLnb.threshold.value * 1000) sec.setLNBSatCR(currLnb.satcruser.index) sec.setLNBSatCRvco(currLnb.satcrvcouser[currLnb.satcruser.index].value*1000) + sec.setLNBSatCRpositions(1) #HACK elif currLnb.unicable.value == "unicable_matrix": manufacturer_name = currLnb.unicableMatrixManufacturer.value manufacturer = currLnb.unicableMatrix[manufacturer_name] product_name = manufacturer.product.value sec.setLNBSatCR(manufacturer.scr[product_name].index) sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) + sec.setLNBSatCRpositions(manufacturer.positions[product_name][0].value) + sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) + sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) + sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) + currLnb.unicableMatrixManufacturer.save_forced = True + manufacturer.product.save_forced = True + manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True elif currLnb.unicable.value == "unicable_lnb": manufacturer_name = currLnb.unicableLnbManufacturer.value manufacturer = currLnb.unicableLnb[manufacturer_name] product_name = manufacturer.product.value sec.setLNBSatCR(manufacturer.scr[product_name].index) sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) + sec.setLNBSatCRpositions(manufacturer.positions[product_name][0].value) + sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) + sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) + sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) + currLnb.unicableLnbManufacturer.save_forced = True + manufacturer.product.save_forced = True + manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True elif currLnb.lof.value == "c_band": sec.setLNBLOFL(5150000) sec.setLNBLOFH(5150000) @@ -988,55 +1021,57 @@ def InitNimManager(nimmgr): lnb_choices_default = "universal_lnb" - unicablelnbproducts = { - "Humax": {"150 SCR":("1210","1420","1680","2040")}, - "Inverto": {"IDLP-40UNIQD+S":("1680","1420","2040","1210")}, - "Kathrein": {"UAS481":("1400","1516","1632","1748")}, - "Kreiling": {"KR1440":("1680","1420","2040","1210")}, - "Radix": {"Unicable LNB":("1680","1420","2040","1210")}, - "Wisi": {"OC 05":("1210","1420","1680","2040")}} + unicablelnbproducts = {} + unicablematrixproducts = {} + doc = xml.etree.cElementTree.parse("/usr/share/enigma2/unicable.xml") + root = doc.getroot() + + entry = root.find("lnb") + for manufacturer in entry.getchildren(): + m={} + for product in manufacturer.getchildren(): + scr=[] + lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8") + for i in range(len(lscr)): + scr.append(product.get(lscr[i],"0")) + for i in range(len(lscr)): + if scr[len(lscr)-i-1] == "0": + scr.pop() + else: + break; + lof=[] + lof.append(product.get("positions","1")) + lof.append(product.get("lofl","9750")) + lof.append(product.get("lofh","10600")) + lof.append(product.get("threshold","11700")) + scr.append(tuple(lof)) + m.update({product.get("name"):tuple(scr)}) + unicablelnbproducts.update({manufacturer.get("name"):m}) + + entry = root.find("matrix") + for manufacturer in entry.getchildren(): + m={} + for product in manufacturer.getchildren(): + scr=[] + lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8") + for i in range(len(lscr)): + scr.append(product.get(lscr[i],"0")) + for i in range(len(lscr)): + if scr[len(lscr)-i-1] == "0": + scr.pop() + else: + break; + lof=[] + lof.append(product.get("positions","1")) + lof.append(product.get("lofl","9750")) + lof.append(product.get("lofh","10600")) + lof.append(product.get("threshold","11700")) + scr.append(tuple(lof)) + m.update({product.get("name"):tuple(scr)}) + unicablematrixproducts.update({manufacturer.get("name"):m}) + UnicableLnbManufacturers = unicablelnbproducts.keys() UnicableLnbManufacturers.sort() - - unicablematrixproducts = { - "Ankaro": { - "UCS 51440":("1400","1632","1284","1516"), - "UCS 51820":("1400","1632","1284","1516","1864","2096","1748","1980"), - "UCS 51840":("1400","1632","1284","1516","1864","2096","1748","1980"), - "UCS 52240":("1400","1632"), - "UCS 52420":("1400","1632","1284","1516"), - "UCS 52440":("1400","1632","1284","1516"), - "UCS 91440":("1400","1632","1284","1516"), - "UCS 91820":("1400","1632","1284","1516","1864","2096","1748","1980"), - "UCS 91840":("1400","1632","1284","1516","1864","2096","1748","1980"), - "UCS 92240":("1400","1632"), - "UCS 92420":("1400","1632","1284","1516"), - "UCS 92440":("1400","1632","1284","1516")}, - "DCT Delta": { - "SUM518":("1284","1400","1516","1632","1748","1864","1980","2096"), - "SUM918":("1284","1400","1516","1632","1748","1864","1980","2096"), - "SUM928":("1284","1400","1516","1632","1748","1864","1980","2096")}, - "Inverto": { - "IDLP-UST11O-CUO1O-8PP":("1076","1178","1280","1382","1484","1586","1688","1790")}, - "Kathrein": { - "EXR501":("1400","1516","1632","1748"), - "EXR551":("1400","1516","1632","1748"), - "EXR552":("1400","1516")}, - "ROTEK": { - "EKL2/1":("1400","1516"), - "EKL2/1E":("0","0","1632","1748")}, - "Smart": { - "DPA 51":("1284","1400","1516","1632","1748","1864","1980","2096")}, - "Technisat": { - "TechniRouter 5/1x8 G":("1284","1400","1516","1632","1748","1864","1980","2096"), - "TechniRouter 5/1x8 K":("1284","1400","1516","1632","1748","1864","1980","2096"), - "TechniRouter 5/2x4 G":("1284","1400","1516","1632"), - "TechniRouter 5/2x4 K":("1284","1400","1516","1632")}, - "Telstar": { - "SCR 5/1x8 G":("1284","1400","1516","1632","1748","1864","1980","2096"), - "SCR 5/1x8 K":("1284","1400","1516","1632","1748","1864","1980","2096"), - "SCR 5/2x4 G":("1284","1400","1516","1632"), - "SCR 5/2x4 K":("1284","1400","1516","1632")}} UnicableMatrixManufacturers = unicablematrixproducts.keys() UnicableMatrixManufacturers.sort() @@ -1117,7 +1152,7 @@ def InitNimManager(nimmgr): scrlist = [] vcolist = unicablematrixproducts[y][z] tmp.vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)): + for cnt in range(1,1+len(vcolist)-1): vcofreq = int(vcolist[cnt-1]) if vcofreq == 0: scrlist.append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) @@ -1137,29 +1172,54 @@ def InitNimManager(nimmgr): tmp.product = ConfigSelection(choices = products, default = products[0]) tmp.scr = ConfigSubDict() tmp.vco = ConfigSubDict() + tmp.lofl = ConfigSubDict() + tmp.lofh = ConfigSubDict() + tmp.loft = ConfigSubDict() + tmp.positions = ConfigSubDict() for z in products: scrlist = [] vcolist = unicablelnbproducts[y][z] tmp.vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)): + for cnt in range(1,1+len(vcolist)-1): scrlist.append(("%d" %cnt,"SCR %d" %cnt)) vcofreq = int(vcolist[cnt-1]) tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + + positions = int(vcolist[len(vcolist)-1][0]) + tmp.positions[z] = ConfigSubList() + tmp.positions[z].append(ConfigInteger(default=positions, limits = (positions, positions))) + + lofl = vcolist[len(vcolist)-1][1] + tmp.lofl[z] = ConfigSubList() + tmp.lofl[z].append(ConfigInteger(default=lofl, limits = (lofl, lofl))) + + lofh = int(vcolist[len(vcolist)-1][2]) + tmp.lofh[z] = ConfigSubList() + tmp.lofh[z].append(ConfigInteger(default=lofh, limits = (lofh, lofh))) + + loft = int(vcolist[len(vcolist)-1][3]) + tmp.loft[z] = ConfigSubList() + tmp.loft[z].append(ConfigInteger(default=loft, limits = (loft, loft))) + section.unicableLnb[y] = tmp - + +#TODO satpositions for satcruser section.satcruser = ConfigSelection(advanced_lnb_satcruser_choices, default="1") tmp = ConfigSubList() - tmp.append(ConfigInteger(default=1284, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1400, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1516, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1632, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1748, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1864, limits = (0, 9999))) - tmp.append(ConfigInteger(default=1980, limits = (0, 9999))) - tmp.append(ConfigInteger(default=2096, limits = (0, 9999))) + tmp.append(ConfigInteger(default=1284, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1400, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1516, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1632, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1748, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1864, limits = (950, 2150))) + tmp.append(ConfigInteger(default=1980, limits = (950, 2150))) + tmp.append(ConfigInteger(default=2096, limits = (950, 2150))) section.satcrvcouser = tmp + nim.advanced.unicableconnected = ConfigYesNo(default=False) + nim.advanced.unicableconnectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) + def configDiSEqCModeChanged(configElement): section = configElement.section if configElement.value == "1_2" and isinstance(section.longitude, ConfigNothing): diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 471b59ec..d7506e31 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -29,6 +29,7 @@ from time import localtime, strftime class ConfigElement(object): def __init__(self): self.saved_value = None + self.save_forced = False self.last_value = None self.save_disabled = False self.__notifiers = None @@ -83,7 +84,7 @@ class ConfigElement(object): # you need to override this if str(self.value) doesn't work def save(self): - if self.save_disabled or self.value == self.default: + if self.save_disabled or (self.value == self.default and not self.save_forced): self.saved_value = None else: self.saved_value = self.tostring(self.value) diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 749c09db..44f4251a 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -95,6 +95,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.advancedType = None self.advancedManufacturer = None self.advancedSCR = None + self.advancedConnected = None if self.nim.isMultiType(): multiType = self.nimConfig.multiType @@ -205,7 +206,7 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): checkList = (self.configMode, self.diseqcModeEntry, self.advancedSatsEntry, \ self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry, \ self.advancedLof, self.advancedPowerMeasurement, self.turningSpeed, \ - self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \ + self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, self.advancedConnected, \ self.uncommittedDiseqcCommand, self.cableScanType, self.multiType) if self["config"].getCurrent() == self.multiType: from Components.NimManager import InitNimManager @@ -285,6 +286,18 @@ class NimSetup(Screen, ConfigListScreen, ServiceStopScreen): self.list.append(self.advancedType) self.list.append(self.advancedSCR) self.list.append(getConfigListEntry(_("Frequency"), manufacturer.vco[product_name][manufacturer.scr[product_name].index])) + + choices = [] + connectable = nimmanager.canConnectTo(self.slotid) + for id in connectable: + choices.append((str(id), nimmanager.getNimDescription(id))) + if len(choices): + self.advancedConnected = getConfigListEntry(_("connected"), self.nimConfig.advanced.unicableconnected) + self.list.append(self.advancedConnected) + if self.nimConfig.advanced.unicableconnected.value == True: + self.nimConfig.advanced.unicableconnectedTo.setChoices(choices) + self.list.append(getConfigListEntry(_("Connected to"),self.nimConfig.advanced.unicableconnectedTo)) + else: #kein Unicable self.list.append(getConfigListEntry(_("Voltage mode"), Sat.voltage)) self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage)) -- cgit v1.2.3 From eb97f3d6d7b924d53994729a296f94c5b0c168c6 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 8 Jun 2010 19:49:22 +0200 Subject: NimManager.py: add missing conversion to int --- lib/python/Components/NimManager.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 663ec16d..9520f972 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1040,10 +1040,10 @@ def InitNimManager(nimmgr): else: break; lof=[] - lof.append(product.get("positions","1")) - lof.append(product.get("lofl","9750")) - lof.append(product.get("lofh","10600")) - lof.append(product.get("threshold","11700")) + lof.append(int(product.get("positions",1))) + lof.append(int(product.get("lofl",9750))) + lof.append(int(product.get("lofh",10600))) + lof.append(int(product.get("threshold",11700))) scr.append(tuple(lof)) m.update({product.get("name"):tuple(scr)}) unicablelnbproducts.update({manufacturer.get("name"):m}) @@ -1062,10 +1062,10 @@ def InitNimManager(nimmgr): else: break; lof=[] - lof.append(product.get("positions","1")) - lof.append(product.get("lofl","9750")) - lof.append(product.get("lofh","10600")) - lof.append(product.get("threshold","11700")) + lof.append(int(product.get("positions",1))) + lof.append(int(product.get("lofl",9750))) + lof.append(int(product.get("lofh",10600))) + lof.append(int(product.get("threshold",11700))) scr.append(tuple(lof)) m.update({product.get("name"):tuple(scr)}) unicablematrixproducts.update({manufacturer.get("name"):m}) -- cgit v1.2.3 From e9da6f6390746f0f3e0b88816ea2e0dd30d05009 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 9 Jun 2010 00:47:53 +0200 Subject: lib/dvb/sec.h: use insert instead of splice.. --- lib/dvb/sec.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index b38671d2..5d73bb7b 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -106,8 +106,7 @@ public: } void push_back(eSecCommandList &list) { - ASSERT(*this != list); - secSequence.splice(end(), list.secSequence); + secSequence.insert(end(), list.begin(), list.end()); } void clear() { -- cgit v1.2.3 From ca082734334ea28bc248e619223fbc02f9fc2705 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 9 Jun 2010 02:32:29 +0200 Subject: fix subtitle configlist crash --- lib/python/Components/ConfigList.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index 418a1b67..ffbc69af 100755 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -61,12 +61,13 @@ class ConfigList(HTMLComponent, GUIComponent, object): GUI_WIDGET = eListbox def selectionChanged(self): - if self.current: + if isinstance(self.current,tuple) and len(self.current) == 2: self.current[1].onDeselect(self.session) self.current = self.getCurrent() - if self.current: + if isinstance(self.current,tuple) and len(self.current) == 2: self.current[1].onSelect(self.session) - + else: + return for x in self.onSelectionChanged: x() @@ -75,11 +76,11 @@ class ConfigList(HTMLComponent, GUIComponent, object): instance.setContent(self.l) def preWidgetRemove(self, instance): - if self.current: + if isinstance(self.current,tuple) and len(self.current) == 2: self.current[1].onDeselect(self.session) instance.selectionChanged.get().remove(self.selectionChanged) instance.setContent(None) - + def setList(self, l): self.timer.stop() self.__list = l -- cgit v1.2.3 From 7d841169e08113d2fa20de0605147117c6ed86f0 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 9 Jun 2010 14:18:29 +0200 Subject: fix crash when unicable matrix is selected, cleanup code --- lib/python/Components/NimManager.py | 124 +++++++++++++++--------------------- 1 file changed, 52 insertions(+), 72 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 9520f972..2deb2bf7 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -293,17 +293,9 @@ class SecConfigure: sec.setLNBLOFH(10600000) sec.setLNBThreshold(11700000) elif currLnb.lof.value == "unicable": - if currLnb.unicable.value == "unicable_user": -#TODO satpositions for satcruser - sec.setLNBLOFL(currLnb.lofl.value * 1000) - sec.setLNBLOFH(currLnb.lofh.value * 1000) - sec.setLNBThreshold(currLnb.threshold.value * 1000) - sec.setLNBSatCR(currLnb.satcruser.index) - sec.setLNBSatCRvco(currLnb.satcrvcouser[currLnb.satcruser.index].value*1000) - sec.setLNBSatCRpositions(1) #HACK - elif currLnb.unicable.value == "unicable_matrix": - manufacturer_name = currLnb.unicableMatrixManufacturer.value - manufacturer = currLnb.unicableMatrix[manufacturer_name] + def setupUnicable(configManufacturer, ProductDict): + manufacturer_name = configManufacturer.value + manufacturer = ProductDict[manufacturer_name] product_name = manufacturer.product.value sec.setLNBSatCR(manufacturer.scr[product_name].index) sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) @@ -311,22 +303,22 @@ class SecConfigure: sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) - currLnb.unicableMatrixManufacturer.save_forced = True + configManufacturer.save_forced = True manufacturer.product.save_forced = True manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True + + if currLnb.unicable.value == "unicable_user": +#TODO satpositions for satcruser + sec.setLNBLOFL(currLnb.lofl.value * 1000) + sec.setLNBLOFH(currLnb.lofh.value * 1000) + sec.setLNBThreshold(currLnb.threshold.value * 1000) + sec.setLNBSatCR(currLnb.satcruser.index) + sec.setLNBSatCRvco(currLnb.satcrvcouser[currLnb.satcruser.index].value*1000) + sec.setLNBSatCRpositions(1) #HACK + elif currLnb.unicable.value == "unicable_matrix": + setupUnicable(currLnb.unicableMatrixManufacturer, currLnb.unicableMatrix) elif currLnb.unicable.value == "unicable_lnb": - manufacturer_name = currLnb.unicableLnbManufacturer.value - manufacturer = currLnb.unicableLnb[manufacturer_name] - product_name = manufacturer.product.value - sec.setLNBSatCR(manufacturer.scr[product_name].index) - sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) - sec.setLNBSatCRpositions(manufacturer.positions[product_name][0].value) - sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) - sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) - sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) - currLnb.unicableLnbManufacturer.save_forced = True - manufacturer.product.save_forced = True - manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True + setupUnicable(currLnb.unicableLnbManufacturer, currLnb.unicableLnb) elif currLnb.lof.value == "c_band": sec.setLNBLOFL(5150000) sec.setLNBLOFH(5150000) @@ -1138,72 +1130,60 @@ def InitNimManager(nimmgr): else: section.unicable = ConfigSelection(choices = {"unicable_user": _("User defined")}, default = "unicable_user") - if lnb < 3: - section.unicableMatrix = ConfigSubDict() - section.unicableMatrixManufacturer = ConfigSelection(choices = UnicableMatrixManufacturers, default = UnicableMatrixManufacturers[0]) - for y in unicablematrixproducts: - products = unicablematrixproducts[y].keys() + def fillUnicableConf(sectionDict, unicableproducts, vco_null_check): + for y in unicableproducts: + products = unicableproducts[y].keys() products.sort() tmp = ConfigSubsection() tmp.product = ConfigSelection(choices = products, default = products[0]) tmp.scr = ConfigSubDict() tmp.vco = ConfigSubDict() + tmp.lofl = ConfigSubDict() + tmp.lofh = ConfigSubDict() + tmp.loft = ConfigSubDict() + tmp.positions = ConfigSubDict() for z in products: scrlist = [] - vcolist = unicablematrixproducts[y][z] + vcolist = unicableproducts[y][z] tmp.vco[z] = ConfigSubList() for cnt in range(1,1+len(vcolist)-1): vcofreq = int(vcolist[cnt-1]) - if vcofreq == 0: + if vcofreq == 0 and vco_null_check: scrlist.append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) else: scrlist.append(("%d" %cnt,"SCR %d" %cnt)) tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) - tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) - section.unicableMatrix[y] = tmp + tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + + positions = int(vcolist[len(vcolist)-1][0]) + tmp.positions[z] = ConfigSubList() + tmp.positions[z].append(ConfigInteger(default=positions, limits = (positions, positions))) + + lofl = vcolist[len(vcolist)-1][1] + tmp.lofl[z] = ConfigSubList() + tmp.lofl[z].append(ConfigInteger(default=lofl, limits = (lofl, lofl))) + + lofh = int(vcolist[len(vcolist)-1][2]) + tmp.lofh[z] = ConfigSubList() + tmp.lofh[z].append(ConfigInteger(default=lofh, limits = (lofh, lofh))) + + loft = int(vcolist[len(vcolist)-1][3]) + tmp.loft[z] = ConfigSubList() + tmp.loft[z].append(ConfigInteger(default=loft, limits = (loft, loft))) + sectionDict[y] = tmp + + if lnb < 3: + print "MATRIX" + section.unicableMatrix = ConfigSubDict() + section.unicableMatrixManufacturer = ConfigSelection(UnicableMatrixManufacturers, UnicableMatrixManufacturers[0]) + fillUnicableConf(section.unicableMatrix, unicablematrixproducts, True) if lnb < 2: + print "LNB" section.unicableLnb = ConfigSubDict() section.unicableLnbManufacturer = ConfigSelection(UnicableLnbManufacturers, UnicableLnbManufacturers[0]) - for y in unicablelnbproducts: - products = unicablelnbproducts[y].keys() - products.sort() - tmp = ConfigSubsection() - tmp.product = ConfigSelection(choices = products, default = products[0]) - tmp.scr = ConfigSubDict() - tmp.vco = ConfigSubDict() - tmp.lofl = ConfigSubDict() - tmp.lofh = ConfigSubDict() - tmp.loft = ConfigSubDict() - tmp.positions = ConfigSubDict() - for z in products: - scrlist = [] - vcolist = unicablelnbproducts[y][z] - tmp.vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)-1): - scrlist.append(("%d" %cnt,"SCR %d" %cnt)) - vcofreq = int(vcolist[cnt-1]) - tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) - tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) - - positions = int(vcolist[len(vcolist)-1][0]) - tmp.positions[z] = ConfigSubList() - tmp.positions[z].append(ConfigInteger(default=positions, limits = (positions, positions))) - - lofl = vcolist[len(vcolist)-1][1] - tmp.lofl[z] = ConfigSubList() - tmp.lofl[z].append(ConfigInteger(default=lofl, limits = (lofl, lofl))) - - lofh = int(vcolist[len(vcolist)-1][2]) - tmp.lofh[z] = ConfigSubList() - tmp.lofh[z].append(ConfigInteger(default=lofh, limits = (lofh, lofh))) - - loft = int(vcolist[len(vcolist)-1][3]) - tmp.loft[z] = ConfigSubList() - tmp.loft[z].append(ConfigInteger(default=loft, limits = (loft, loft))) - - section.unicableLnb[y] = tmp - + fillUnicableConf(section.unicableLnb, unicablelnbproducts, False) + #TODO satpositions for satcruser section.satcruser = ConfigSelection(advanced_lnb_satcruser_choices, default="1") tmp = ConfigSubList() -- cgit v1.2.3 From c5083a9479679b0b99a922120115d5690366ecab Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 9 Jun 2010 16:13:22 +0200 Subject: lib/dvb/epgcache.cpp: fix compiler warnings --- lib/dvb/epgcache.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index 48cbfbfd..1e8414c3 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -1457,7 +1457,7 @@ void eEPGCache::channel_data::readData( const __u8 *data) } tidMap &seenSections = this->seenSections[map]; tidMap &calcedSections = this->calcedSections[map]; - if ( state == 1 && calcedSections == seenSections || state > 1 ) + if ( (state == 1 && calcedSections == seenSections) || state > 1 ) { eDebugNoNewLine("[EPGC] "); switch (source) @@ -2562,7 +2562,7 @@ void eEPGCache::PMTready(eDVBServicePMTHandler *pmthandler) { __u8 buffer[10]; (*desc)->writeToBuffer(buffer); - if (!strncmp((unsigned char*)buffer+2, "EPGDATA", 7)) + if (!strncmp((char*)buffer+2, "EPGDATA", 7)) { eServiceReferenceDVB ref; if (!pmthandler->getServiceReference(ref)) @@ -2571,7 +2571,7 @@ void eEPGCache::PMTready(eDVBServicePMTHandler *pmthandler) messages.send(Message(Message::got_mhw2_channel_pid, ref, pid)); } } - else if(!strncmp((unsigned char*)buffer+2, "FICHAS", 6)) + else if(!strncmp((char*)buffer+2, "FICHAS", 6)) { eServiceReferenceDVB ref; if (!pmthandler->getServiceReference(ref)) @@ -2580,7 +2580,7 @@ void eEPGCache::PMTready(eDVBServicePMTHandler *pmthandler) messages.send(Message(Message::got_mhw2_summary_pid, ref, pid)); } } - else if(!strncmp((unsigned char*)buffer+2, "GENEROS", 7)) + else if(!strncmp((char*)buffer+2, "GENEROS", 7)) { eServiceReferenceDVB ref; if (!pmthandler->getServiceReference(ref)) -- cgit v1.2.3 From c43f813b86dda336c496eaf8694227d11bb84780 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 9 Jun 2010 16:14:25 +0200 Subject: sec.h: fix eSecCommandList assignment --- lib/dvb/sec.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 5d73bb7b..ef8b1e0c 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -133,6 +133,12 @@ public: { return secSequence.size(); } + eSecCommandList &operator=(const eSecCommandList &lst) + { + secSequence = lst.secSequence; + cur = begin(); + return *this; + } }; #endif -- cgit v1.2.3 From 655727641a20ce58063bb6e6ca997fdf99cb2f49 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 9 Jun 2010 18:55:53 +0200 Subject: lib/dvb/frontend.cpp: fix compiler warning --- lib/dvb/frontend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index bd8f0028..0081e324 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -1124,7 +1124,7 @@ static void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS & PutToDict(dict, "orbital_position", orb_pos); PutToDict(dict, "polarization", polarization); - switch(parm_u_qpsk_fec_inner) + switch((int)parm_u_qpsk_fec_inner) { case FEC_1_2: tmp = eDVBFrontendParametersSatellite::FEC_1_2; break; case FEC_2_3: tmp = eDVBFrontendParametersSatellite::FEC_2_3; break; -- cgit v1.2.3 From f2b1a7e86c4143b6112a119bd00a2adcc0844b71 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 1 Jun 2010 16:08:32 +0200 Subject: add support for rbg565 color oled --- data/skin.xml | 14 ++++ data/skin_default.xml | 16 +++++ lib/gdi/font.cpp | 86 ++++++++++++++++++---- lib/gdi/glcddc.cpp | 8 +-- lib/gdi/gpixmap.cpp | 193 +++++++++++++++++++++++++++++++++++++++++++++----- lib/gdi/lcd.cpp | 103 +++++++++++++++++++-------- lib/gdi/lcd.h | 6 +- main/enigma.cpp | 8 +-- skin.py | 20 ++++-- 9 files changed, 377 insertions(+), 77 deletions(-) (limited to 'lib') diff --git a/data/skin.xml b/data/skin.xml index 32adb2be..868fbc4b 100755 --- a/data/skin.xml +++ b/data/skin.xml @@ -61,6 +61,20 @@ + + + + + + + + + + + + + + diff --git a/data/skin_default.xml b/data/skin_default.xml index aceafd73..7262f43c 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -1130,6 +1130,22 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) Blink + + + + Name + + + Progress + + + Format:%H:%M + + + config.usage.blinking_display_clock_during_recording,True,CheckSourceBoolean + Blink + + diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index f27a8f77..0d2e958f 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -41,6 +41,8 @@ static pthread_mutex_t ftlock=PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; static FTC_Font cache_current_font=0; #endif +#define RBG565 + struct fntColorCacheKey { gRGB start, end; @@ -766,8 +768,9 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons gColor *lookup8, lookup8_invert[16]; gColor *lookup8_normal=0; + __u16 lookup16_normal[16], lookup16_invert[16], *lookup16; __u32 lookup32_normal[16], lookup32_invert[16], *lookup32; - + if (surface->bpp == 8) { if (surface->clut.data) @@ -781,10 +784,33 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons opcode=0; } else opcode=1; + } else if (surface->bpp == 16) + { + opcode=2; + for (int i=0; i<16; ++i) + { +#define BLEND(y, x, a) (y + (((x-y) * a)>>8)) + + unsigned char dr = background.r, dg = background.g, db = background.b; + int sa = i * 16; + if (sa < 256) + { + dr = BLEND(background.r, foreground.r, sa) & 0xFF; + dg = BLEND(background.g, foreground.g, sa) & 0xFF; + db = BLEND(background.b, foreground.b, sa) & 0xFF; + } +#undef BLEND +#ifdef RBG565 + lookup16_normal[i] = ((dr >> 3) << 11) | ((db >> 2) << 5) | (dg >> 3); +#else + lookup16_normal[i] = ((dr >> 3) << 11) | ((dg >> 2) << 5) | (db >> 3); +#endif + } + for (int i=0; i<16; ++i) + lookup16_invert[i]=lookup16_normal[i^0xF]; } else if (surface->bpp == 32) { opcode=3; - for (int i=0; i<16; ++i) { #define BLEND(y, x, a) (y + (((x-y) * a)>>8)) @@ -809,7 +835,7 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons eWarning("can't render to %dbpp", surface->bpp); return; } - + gRegion area(eRect(0, 0, surface->x, surface->y)); gRegion clip = dc.getClip() & area; @@ -835,10 +861,12 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons if (!(i->flags & GS_INVERT)) { lookup8 = lookup8_normal; + lookup16 = lookup16_normal; lookup32 = lookup32_normal; } else { lookup8 = lookup8_invert; + lookup16 = lookup16_invert; lookup32 = lookup32_invert; } @@ -873,46 +901,76 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons d+=diff*buffer_stride; } if (sx>0) - for (int ay=0; ay>4; if(b) *td++=lookup8[b]; else td++; } - } else if (opcode == 1) // 8bit direct + s+=glyph_bitmap->pitch-sx; + d+=buffer_stride; + } + break; + case 1: // 8bit direct + for (int ay=0; aypitch-sx; + d+=buffer_stride; + } + break; + case 2: // 16bit + for (int ay=0; ay>4; + if(b) + *td++=lookup16[b]; + else + td++; + } + s+=glyph_bitmap->pitch-sx; + d+=buffer_stride; + } + break; + case 3: // 32bit + for (int ay=0; ay>4; if(b) *td++=lookup32[b]; else td++; } + s+=glyph_bitmap->pitch-sx; + d+=buffer_stride; } - s+=glyph_bitmap->pitch-sx; - d+=buffer_stride; + default: + break; } + } } } } diff --git a/lib/gdi/glcddc.cpp b/lib/gdi/glcddc.cpp index 8612c70b..a593cfa3 100644 --- a/lib/gdi/glcddc.cpp +++ b/lib/gdi/glcddc.cpp @@ -14,13 +14,13 @@ gLCDDC::gLCDDC() surface.x=lcd->size().width(); surface.y=lcd->size().height(); - surface.bpp=8; - surface.bypp=1; surface.stride=lcd->stride(); + surface.bypp=surface.stride / surface.x; + surface.bpp=surface.bypp*8; surface.data=lcd->buffer(); - - surface.clut.colors=256; + surface.clut.colors=0; surface.clut.data=0; + m_pixmap = new gPixmap(&surface); } diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index 3e643108..6f93d560 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -4,6 +4,8 @@ #include #include +#define RBG565 + gLookup::gLookup() :size(0), lookup(0) { @@ -154,6 +156,26 @@ void gPixmap::fill(const gRegion ®ion, const gColor &color) { for (int y=area.top(); ydata)+y*surface->stride+area.left(), color.color, area.width()); + } else if (surface->bpp == 16) + { + __u32 icol; + + if (surface->clut.data && color < surface->clut.colors) + icol=(surface->clut.data[color].a<<24)|(surface->clut.data[color].r<<16)|(surface->clut.data[color].g<<8)|(surface->clut.data[color].b); + else + icol=0x10101*color; +#ifdef RBG565 + __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#else + __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; +#endif + for (int y=area.top(); ydata)+y*surface->stride+area.left()*surface->bypp); + int x=area.width(); + while (x--) + *dst++=col; + } } else if (surface->bpp == 32) { __u32 col; @@ -208,18 +230,33 @@ void gPixmap::fill(const gRegion ®ion, const gRGB &color) while (x--) *dst++=col; } + } else if (surface->bpp == 16) + { + __u32 icol = color.argb(); +#ifdef RBG565 + __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#else + __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; +#endif + for (int y=area.top(); ydata)+y*surface->stride+area.left()*surface->bypp); + int x=area.width(); + while (x--) + *dst++=col; + } } else eWarning("couldn't rgbfill %d bpp", surface->bpp); } } -static void blit_8i_to_32(__u32 *dst, __u8 *src, __u32 *pal, int width) +static inline void blit_8i_to_32(__u32 *dst, __u8 *src, __u32 *pal, int width) { while (width--) *dst++=pal[*src++]; } -static void blit_8i_to_32_at(__u32 *dst, __u8 *src, __u32 *pal, int width) +static inline void blit_8i_to_32_at(__u32 *dst, __u8 *src, __u32 *pal, int width) { while (width--) { @@ -232,6 +269,25 @@ static void blit_8i_to_32_at(__u32 *dst, __u8 *src, __u32 *pal, int width) } } +static inline void blit_8i_to_16(__u16 *dst, __u8 *src, __u32 *pal, int width) +{ + while (width--) + *dst++=pal[*src++] & 0xFFFF; +} + +static inline void blit_8i_to_16_at(__u16 *dst, __u8 *src, __u32 *pal, int width) +{ + while (width--) + { + if (!(pal[*src]&0x80000000)) + { + src++; + dst++; + } else + *dst++=pal[*src++] & 0xFFFF; + } +} + /* WARNING, this function is not endian safe! */ static void blit_8i_to_32_ab(__u32 *dst, __u8 *src, __u32 *pal, int width) { @@ -441,6 +497,95 @@ void gPixmap::blit(const gPixmap &src, const eRect &_pos, const gRegion &clip, i srcptr+=src.surface->stride; dstptr+=surface->stride; } + } else if ((surface->bpp == 16) && (src.surface->bpp==8)) + { + __u8 *srcptr=(__u8*)src.surface->data; + __u8 *dstptr=(__u8*)surface->data; // !! + __u32 pal[256]; + + for (int i=0; i<256; ++i) + { + __u32 icol; + if (src.surface->clut.data && (iclut.colors)) + icol=(src.surface->clut.data[i].a<<24)|(src.surface->clut.data[i].r<<16)|(src.surface->clut.data[i].g<<8)|(src.surface->clut.data[i].b); + else + icol=0x010101*i; +#ifdef RBG565 + pal[i]=icol&0xFF000000 | ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#else + pal[i]=icol&0xFF000000 | ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; +#endif + pal[i]^=0xFF000000; + } + + srcptr+=srcarea.left()*src.surface->bypp+srcarea.top()*src.surface->stride; + dstptr+=area.left()*surface->bypp+area.top()*surface->stride; + + if (flag & blitAlphaBlend) + eWarning("ignore unsupported 8bpp -> 16bpp alphablend!"); + + for (int y=0; ystride; + dstptr+=surface->stride; + } + } else if ((surface->bpp == 16) && (src.surface->bpp==32)) + { + __u8 *srcptr=(__u8*)src.surface->data; + __u8 *dstptr=(__u8*)surface->data; + + srcptr+=srcarea.left()+srcarea.top()*src.surface->stride; + dstptr+=area.left()+area.top()*surface->stride; + + if (flag & blitAlphaBlend) + eWarning("ignore unsupported 32bpp -> 16bpp alphablend!"); + + for (int y=0; y> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#else + *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; +#endif + } + } + } else + { + while (width--) + { + __u32 icol = *srcp++; +#ifdef RBG565 + *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#else + *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; +#endif + } + } + srcptr+=src.surface->stride; + dstptr+=surface->stride; + } } else eWarning("cannot blit %dbpp from %dbpp", surface->bpp, src.surface->bpp); } @@ -488,27 +633,36 @@ static inline int sgn(int a) void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color) { __u8 *srf8 = 0; - __u32 *srf32 = 0; + __u16 *srf16 = 0; + __u32 *srf32 = 0; int stride = surface->stride; - + if (clip.rects.empty()) return; - + + __u16 col16; __u32 col = 0; if (surface->bpp == 8) - { srf8 = (__u8*)surface->data; - } else if (surface->bpp == 32) + else { srf32 = (__u32*)surface->data; - if (surface->clut.data && color < surface->clut.colors) col=(surface->clut.data[color].a<<24)|(surface->clut.data[color].r<<16)|(surface->clut.data[color].g<<8)|(surface->clut.data[color].b); else col=0x10101*color; - col^=0xFF000000; + col^=0xFF000000; } - + + if (surface->bpp == 16) + { +#ifdef RBG565 + col16=((col & 0xFF0000) >> 19) << 11 | ((col & 0xFF) >> 2) << 5 | (col & 0xFF00) >> 11; +#else + col16=((col & 0xFF0000) >> 19) << 11 | ((col & 0xFF00) >> 10) << 5 | (col & 0xFF) >> 3; +#endif + } + int xa = start.x(), ya = start.y(), xb = dst.x(), yb = dst.y(); int dx, dy, x, y, s1, s2, e, temp, swap, i; dy=abs(yb-ya); @@ -526,7 +680,7 @@ void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color) } else swap=0; e = 2*dy-dx; - + int lasthit = 0; for(i=1; i<=dx; i++) { @@ -563,20 +717,25 @@ void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color) } while (!clip.rects[a].contains(x, y)); lasthit = a; } - + if (srf8) srf8[y * stride + x] = color; - if (srf32) + else if (srf16) + srf16[y * stride/2 + x] = col16; + else srf32[y * stride/4 + x] = col; fail: while (e>=0) { - if (swap==1) x+=s1; - else y+=s2; + if (swap==1) + x+=s1; + else + y+=s2; e-=2*dx; } - if (swap==1) - y+=s2; + + if (swap==1) + y+=s2; else x+=s1; e+=2*dy; diff --git a/lib/gdi/lcd.cpp b/lib/gdi/lcd.cpp index 0908d890..a953ef0d 100644 --- a/lib/gdi/lcd.cpp +++ b/lib/gdi/lcd.cpp @@ -14,13 +14,19 @@ eDBoxLCD *eDBoxLCD::instance; -eLCD::eLCD(eSize size): res(size) +eLCD::eLCD() { lcdfd = -1; locked=0; - _buffer=new unsigned char[res.height()*res.width()]; - memset(_buffer, 0, res.height()*res.width()); - _stride=res.width(); +} + +void eLCD::setSize(int xres, int yres, int bpp) +{ + res = eSize(xres, yres); + _buffer=new unsigned char[xres * yres * bpp/8]; + memset(_buffer, 0, res.height()*res.width()*bpp/8); + _stride=res.width()*bpp/8; + eDebug("lcd buffer %p %d bytes, stride %d", _buffer, xres*yres*bpp/8, _stride); } eLCD::~eLCD() @@ -42,8 +48,9 @@ void eLCD::unlock() locked=0; } -eDBoxLCD::eDBoxLCD(): eLCD(eSize(132, 64)) +eDBoxLCD::eDBoxLCD() { + int xres=132, yres=64, bpp=8; is_oled = 0; #ifndef NO_LCD lcdfd = open("/dev/dbox/oled0", O_RDWR); @@ -75,13 +82,37 @@ eDBoxLCD::eDBoxLCD(): eLCD(eSize(132, 64)) int i=LCD_MODE_BIN; ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i); inverted=0; + FILE *f = fopen("/proc/stb/lcd/xres", "r"); + if (f) + { + int tmp; + if (fscanf(f, "%x", &tmp) == 1) + xres = tmp; + fclose(f); + f = fopen("/proc/stb/lcd/yres", "r"); + if (f) + { + if (fscanf(f, "%x", &tmp) == 1) + yres = tmp; + fclose(f); + f = fopen("/proc/stb/lcd/bpp", "r"); + if (f) + { + if (fscanf(f, "%x", &tmp) == 1) + bpp = tmp; + fclose(f); + } + } + is_oled = 3; + } } + setSize(xres, yres, bpp); } void eDBoxLCD::setInverted(unsigned char inv) { inverted=inv; - update(); + update(); } int eDBoxLCD::setLCDContrast(int contrast) @@ -145,42 +176,52 @@ eDBoxLCD *eDBoxLCD::getInstance() void eDBoxLCD::update() { - if (!is_oled || is_oled == 2) + if (lcdfd >= 0) { - unsigned char raw[132*8]; - int x, y, yy; - for (y=0; y<8; y++) + if (!is_oled || is_oled == 2) { - for (x=0; x<132; x++) + unsigned char raw[132*8]; + int x, y, yy; + for (y=0; y<8; y++) { - int pix=0; - for (yy=0; yy<8; yy++) + for (x=0; x<132; x++) { - pix|=(_buffer[(y*8+yy)*132+x]>=108)<=108)<= 0) write(lcdfd, raw, 132*8); - } else - { - unsigned char raw[64*64]; - int x, y; - memset(raw, 0, 64*64); - for (y=0; y<64; y++) + } + else if (is_oled == 3) { + FILE *f = fopen("/tmp/bla", "w+"); + if (f) { + fwrite(_buffer, _stride * res.height(), 1, f); + fclose(f); + } + write(lcdfd, _buffer, _stride * res.height()); + } + else { - int pix=0; - for (x=0; x<128 / 2; x++) + unsigned char raw[64*64]; + int x, y; + memset(raw, 0, 64*64); + for (y=0; y<64; y++) { - pix = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4); - if (inverted) - pix = 0xFF - pix; - raw[y*64+x] = pix; + int pix=0; + for (x=0; x<128 / 2; x++) + { + pix = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4); + if (inverted) + pix = 0xFF - pix; + raw[y*64+x] = pix; + } } - } - if (lcdfd >= 0) write(lcdfd, raw, 64*64); + } } } diff --git a/lib/gdi/lcd.h b/lib/gdi/lcd.h index 99f921b5..e7b4c2c4 100644 --- a/lib/gdi/lcd.h +++ b/lib/gdi/lcd.h @@ -13,10 +13,11 @@ class eLCD { #ifdef SWIG - eLCD(eSize size); + eLCD(); ~eLCD(); #else protected: + void setSize(int xres, int yres, int bpp); eSize res; unsigned char *_buffer; int lcdfd; @@ -29,12 +30,11 @@ public: int islocked() { return locked; } bool detected() { return lcdfd >= 0; } #ifndef SWIG - eLCD(eSize size); + eLCD(); virtual ~eLCD(); __u8 *buffer() { return (__u8*)_buffer; } int stride() { return _stride; } eSize size() { return res; } - virtual void update()=0; #endif }; diff --git a/main/enigma.cpp b/main/enigma.cpp index 3f420b4b..b8554d58 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -172,11 +172,11 @@ int main(int argc, char **argv) eTextPara::forceReplacementGlyph(i); eWidgetDesktop dsk(eSize(720, 576)); - eWidgetDesktop dsk_lcd(eSize(132, 64)); - + eWidgetDesktop dsk_lcd(my_lcd_dc->size()); + dsk.setStyleID(0); - dsk_lcd.setStyleID(1); - + dsk_lcd.setStyleID(my_lcd_dc->size().width() == 96 ? 2 : 1); + /* if (double_buffer) { eDebug(" - double buffering found, enable buffered graphics mode."); diff --git a/skin.py b/skin.py index 064fd219..a269b4f1 100755 --- a/skin.py +++ b/skin.py @@ -241,6 +241,8 @@ def applySingleAttribute(guiObject, desktop, attrib, value, scale = ((1,1),(1,1) guiObject.setShadowOffset(parsePosition(value, scale)) elif attrib == 'noWrap': guiObject.setNoWrap(1) + elif attrib == 'id': + pass else: raise SkinError("unsupported attribute " + attrib + "=" + value) except int: @@ -395,12 +397,14 @@ def loadSkinData(desktop): for (path, dom_skin) in skins: loadSingleSkinData(desktop, dom_skin, path) -def lookupScreen(name): +def lookupScreen(name, style_id = None): for (path, skin) in dom_skins: # first, find the corresponding screen element for x in skin.findall("screen"): if x.attrib.get('name', '') == name: - return x, path + screen_style_id = int(x.attrib.get('id', None) or '0') + if style_id is None or screen_style_id == style_id: + return x, path return None, None class additionalWidget: @@ -412,9 +416,11 @@ def readSkin(screen, skin, names, desktop): name = "" % screen.__class__.__name__ + style_id = desktop.getStyleID(); + # try all skins, first existing one have priority for n in names: - myscreen, path = lookupScreen(n) + myscreen, path = lookupScreen(n, style_id) if myscreen is not None: # use this name for debug output name = n @@ -427,7 +433,13 @@ def readSkin(screen, skin, names, desktop): # try uncompiled embedded skin if myscreen is None and getattr(screen, "skin", None): print "Looking for embedded skin" - myscreen = screen.parsedSkin = xml.etree.cElementTree.fromstring(screen.skin) + skin_tuple = screen.skin + if not isinstance(skin_tuple, tuple): + skin_tuple = (skin_tuple,) + for sskin in skin_tuple: + parsedSkin = xml.etree.cElementTree.fromstring(sskin) + if style_id != 2 or parsedSkin.attrib.get('id', 0) == 2: + myscreen = screen.parsedSkin = parsedSkin #assert myscreen is not None, "no skin for screen '" + repr(names) + "' found!" if myscreen is None: -- cgit v1.2.3 From 070618e10cea71d375789b9b95d236ac650660e7 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 1 Jun 2010 18:59:04 +0200 Subject: fix color oled support --- lib/gdi/font.cpp | 17 ++++++++++------- lib/gdi/gpixmap.cpp | 43 ++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 28 deletions(-) (limited to 'lib') diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index 0d2e958f..74cda40e 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -6,6 +6,11 @@ #include #include #include +#include + +#ifndef BYTE_ORDER +#error "no BYTE_ORDER defined!" +#endif // use this for init Freetype... #include @@ -41,8 +46,6 @@ static pthread_mutex_t ftlock=PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; static FTC_Font cache_current_font=0; #endif -#define RBG565 - struct fntColorCacheKey { gRGB start, end; @@ -790,8 +793,7 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons for (int i=0; i<16; ++i) { #define BLEND(y, x, a) (y + (((x-y) * a)>>8)) - - unsigned char dr = background.r, dg = background.g, db = background.b; + unsigned char da = background.a, dr = background.r, dg = background.g, db = background.b; int sa = i * 16; if (sa < 256) { @@ -800,11 +802,12 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons db = BLEND(background.b, foreground.b, sa) & 0xFF; } #undef BLEND -#ifdef RBG565 - lookup16_normal[i] = ((dr >> 3) << 11) | ((db >> 2) << 5) | (dg >> 3); +#if BYTE_ORDER == LITTLE_ENDIAN + lookup16_normal[i] = bswap_16(((db >> 3) << 11) | ((dg >> 2) << 5) | (dr >> 3)); #else - lookup16_normal[i] = ((dr >> 3) << 11) | ((dg >> 2) << 5) | (db >> 3); + lookup16_normal[i] = ((db >> 3) << 11) | ((dg >> 2) << 5) | (dr >> 3); #endif + da ^= 0xFF; } for (int i=0; i<16; ++i) lookup16_invert[i]=lookup16_normal[i^0xF]; diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index 6f93d560..0e8d39ec 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -3,8 +3,11 @@ #include #include #include +#include -#define RBG565 +#ifndef BYTE_ORDER +#error "no BYTE_ORDER defined!" +#endif gLookup::gLookup() :size(0), lookup(0) @@ -164,10 +167,10 @@ void gPixmap::fill(const gRegion ®ion, const gColor &color) icol=(surface->clut.data[color].a<<24)|(surface->clut.data[color].r<<16)|(surface->clut.data[color].g<<8)|(surface->clut.data[color].b); else icol=0x10101*color; -#ifdef RBG565 - __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#if BYTE_ORDER == LITTLE_ENDIAN + __u16 col = bswap_16(((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19); #else - __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; + __u16 col = ((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19; #endif for (int y=area.top(); ybpp == 16) { __u32 icol = color.argb(); -#ifdef RBG565 - __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#if BYTE_ORDER == LITTLE_ENDIAN + __u16 col = bswap_16(((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19); #else - __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; + __u16 col = ((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19; #endif for (int y=area.top(); yclut.data[i].a<<24)|(src.surface->clut.data[i].r<<16)|(src.surface->clut.data[i].g<<8)|(src.surface->clut.data[i].b); else icol=0x010101*i; -#ifdef RBG565 - pal[i]=icol&0xFF000000 | ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#if BYTE_ORDER == LITTLE_ENDIAN + pal[i] = bswap_16(((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19); #else - pal[i]=icol&0xFF000000 | ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; + pal[i] = ((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19; #endif pal[i]^=0xFF000000; } @@ -564,10 +567,10 @@ void gPixmap::blit(const gPixmap &src, const eRect &_pos, const gRegion &clip, i } else { __u32 icol = *srcp++; -#ifdef RBG565 - *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#if BYTE_ORDER == LITTLE_ENDIAN + *dstp++ = bswap_16(((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19); #else - *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; + *dstp++ = ((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19; #endif } } @@ -576,10 +579,10 @@ void gPixmap::blit(const gPixmap &src, const eRect &_pos, const gRegion &clip, i while (width--) { __u32 icol = *srcp++; -#ifdef RBG565 - *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11; +#if BYTE_ORDER == LITTLE_ENDIAN + *dstp++ = bswap_16(((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19); #else - *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3; + *dstp++ = ((icol & 0xFF) >> 3) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF0000) >> 19; #endif } } @@ -655,13 +658,11 @@ void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color) } if (surface->bpp == 16) - { -#ifdef RBG565 - col16=((col & 0xFF0000) >> 19) << 11 | ((col & 0xFF) >> 2) << 5 | (col & 0xFF00) >> 11; +#if BYTE_ORDER == LITTLE_ENDIAN + col16=bswap_16(((col & 0xFF) >> 3) << 11 | ((col & 0xFF00) >> 10) << 5 | (col & 0xFF0000) >> 19); #else - col16=((col & 0xFF0000) >> 19) << 11 | ((col & 0xFF00) >> 10) << 5 | (col & 0xFF) >> 3; + col16=((col & 0xFF) >> 3) << 11 | ((col & 0xFF00) >> 10) << 5 | (col & 0xFF0000) >> 19; #endif - } int xa = start.x(), ya = start.y(), xb = dst.x(), yb = dst.y(); int dx, dy, x, y, s1, s2, e, temp, swap, i; -- cgit v1.2.3 From 1445e37b9d2b2d17009cf2b91c24b895a288a702 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 10 Jun 2010 15:19:12 +0200 Subject: add missing dm800se color oled screens. refs #530 --- data/skin_default.xml | 227 +++++++++++++++------ lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 19 +- .../Plugins/Extensions/MediaPlayer/plugin.py | 11 +- .../Plugins/SystemPlugins/NFIFlash/flasher.py | 14 +- .../Plugins/SystemPlugins/Videomode/VideoWizard.py | 14 +- 5 files changed, 211 insertions(+), 74 deletions(-) mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py (limited to 'lib') diff --git a/data/skin_default.xml b/data/skin_default.xml index 7262f43c..a2bcc6f7 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -203,9 +203,7 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count > 7 and 2 or 3) - - - + @@ -550,10 +548,6 @@ newwidth = wsize[0] self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - - - - @@ -1093,11 +1087,55 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + Name @@ -1110,9 +1148,21 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) Format:%S + + + + + Name + + + Progress + + + Format:%H:%M + - + Name @@ -1146,15 +1196,8 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) Blink - - - - - - - - + Name @@ -1169,18 +1212,89 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) Blink + + + + Name + + + Position + + + Format:%H:%M + + + config.usage.blinking_display_clock_during_recording,True,CheckSourceBoolean + Blink + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + - + Format:%H:%M @@ -1189,37 +1303,18 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) Blink - - - - - - - - - - - - - - - - - - - - - - - - + + + + Format:%H:%M - - + + config.usage.blinking_display_clock_during_recording,True,CheckSourceBoolean + Blink - - + + @@ -1227,19 +1322,29 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - - - - - - + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index e092e82f..64b4ae50 100755 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -88,8 +88,8 @@ class FileBrowser(Screen): self.close(None) class DVDSummary(Screen): - skin = """ - + skin = ( + """ Name @@ -101,7 +101,20 @@ class DVDSummary(Screen): Position - """ + """, + """ + + Name + + + + + Position + + + Position + + """) def __init__(self, session, parent): Screen.__init__(self, session, parent) diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 15806e8c..e4bdba12 100755 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -925,12 +925,17 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.clear_playlist() class MediaPlayerLCDScreen(Screen): - skin = """ - + skin = ( + """ - """ + """, + """ + + + + """) def __init__(self, session, parent): Screen.__init__(self, session) diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py old mode 100644 new mode 100755 index 8986560b..7a0da851 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -39,13 +39,19 @@ class writeNAND(Task): self.output_line = data class NFISummary(Screen): - skin = """ - + skin = ( + """ - - """ + + """, + """ + + + + + """) def __init__(self, session, parent): Screen.__init__(self, session, parent) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py old mode 100644 new mode 100755 index 3c76685e..9b9044ee --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -12,14 +12,22 @@ from Tools.HardwareInfo import HardwareInfo config.misc.showtestcard = ConfigBoolean(default = False) class VideoWizardSummary(WizardSummary): - skin = """ - + skin = ( + """ - """ #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png")) + """, + """ + + + + + + """) + #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png")) def __init__(self, session, parent): WizardSummary.__init__(self, session, parent) -- cgit v1.2.3 From f7f442a1d0845e7dfd923c1d783eb612357f3e94 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 11 Jun 2010 23:05:36 +0200 Subject: don't crash on empty configlist lines --- lib/python/Components/ConfigList.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index ffbc69af..5a02c38d 100755 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -88,7 +88,7 @@ class ConfigList(HTMLComponent, GUIComponent, object): if l is not None: for x in l: - assert isinstance(x[1], ConfigElement), "entry in ConfigList " + str(x[1]) + " must be a ConfigElement" + assert isinstance(x, ConfigElement), "entry in ConfigList " + str(x) + " must be a ConfigElement" def getList(self): return self.__list -- cgit v1.2.3 From 7c42f86e02b3ab79a8d4366d2b74e01e490e46f1 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 14 Jun 2010 12:59:12 +0200 Subject: fix-fix configlist assertion (add #188) --- lib/python/Components/ConfigList.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index 5a02c38d..24f917f7 100755 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -88,7 +88,7 @@ class ConfigList(HTMLComponent, GUIComponent, object): if l is not None: for x in l: - assert isinstance(x, ConfigElement), "entry in ConfigList " + str(x) + " must be a ConfigElement" + assert len(x) < 2 or isinstance(x[1], ConfigElement), "entry in ConfigList " + str(x[1]) + " must be a ConfigElement" def getList(self): return self.__list -- cgit v1.2.3 From 8c3450ff90df7ed4b5eb250000d54a43c54c146e Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 21 Jun 2010 10:20:09 +0200 Subject: set currently running audio + subtitle streams as default selection. on OK keypress, select and close dialog. (add #188) --- lib/python/Screens/AudioSelection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index bacc00c1..a0bfcab9 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -51,12 +51,12 @@ class AudioSelection(Screen, ConfigListScreen): self.settings = ConfigSubsection() choicelist = [(PAGE_AUDIO,_("audio tracks")), (PAGE_SUBTITLES,_("Subtitles"))] self.settings.menupage = ConfigSelection(choices = choicelist, default=page) - self.settings.menupage.addNotifier(self.fillList) self.onLayoutFinish.append(self.__layoutFinished) def __layoutFinished(self): self["config"].instance.setSelectionEnable(False) self.focus = FOCUS_STREAMS + self.settings.menupage.addNotifier(self.fillList) def fillList(self, arg=None): streams = [] @@ -301,7 +301,7 @@ class AudioSelection(Screen, ConfigListScreen): else: self.enableSubtitle(cur[0]) self.__updatedInfo() - #self.close() + self.close(0) elif self.focus == FOCUS_CONFIG: self.keyRight() -- cgit v1.2.3 From baf0a59fa2538724a343aac0082b55d0ac591120 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 28 Jun 2010 18:27:26 +0200 Subject: add support for /proc/stb/frontend/X/lnb_sense --- lib/dvb/frontend.cpp | 8 +++++--- lib/python/Components/NimManager.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 0081e324..fc2d7ec5 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -1458,9 +1458,11 @@ int eDVBFrontend::readInputpower() return 0; int power=m_slotid; // this is needed for read inputpower from the correct tuner ! char proc_name[64]; - sprintf(proc_name, "/proc/stb/fp/lnb_sense%d", m_slotid); - FILE *f=fopen(proc_name, "r"); - if (f) + char proc_name2[64]; + sprintf(proc_name, "/proc/stb/frontend/%d/lnb_sense", m_slotid); + sprintf(proc_name2, "/proc/stb/fp/lnb_sense%d", m_slotid); + FILE *f; + if ((f=fopen(proc_name, "r")) || (f=fopen(proc_name2, "r"))) { if (fscanf(f, "%d", &power) != 1) eDebug("read %s failed!! (%m)", proc_name); diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 2deb2bf7..805be4df 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -1208,7 +1208,7 @@ def InitNimManager(nimmgr): section.latitude = ConfigFloat(default = [50,767], limits = [(0,359),(0,999)]) section.latitudeOrientation = ConfigSelection(latitude_orientation_choices, "north") section.powerMeasurement = ConfigYesNo(default=True) - section.powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100)) + section.powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm7025" and 50 or 15, limits=(0, 100)) section.turningSpeed = ConfigSelection(turning_speed_choices, "fast") section.fastTurningBegin = ConfigDateTime(default=advanced_lnb_fast_turning_btime, formatstring = _("%H:%M"), increment = 600) section.fastTurningEnd = ConfigDateTime(default=advanced_lnb_fast_turning_etime, formatstring = _("%H:%M"), increment = 600) -- cgit v1.2.3 From 035a80e858f539b09e140adb35f92c24787d95d5 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 29 Jun 2010 14:15:08 +0200 Subject: lib/dvb/frontend.cpp: add missing fec_inner for DVBS2 API --- lib/dvb/frontend.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index fc2d7ec5..a1ba8fe5 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -1076,6 +1076,7 @@ static void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS & case FEC_AUTO: tmp = eDVBFrontendParametersSatellite::FEC_Auto; break; default: eDebug("got unsupported FEC from frontend! report as FEC_AUTO!\n"); } + PutToDict(dict, "fec_inner", tmp); switch (p[0].u.data) { -- cgit v1.2.3 From 547a6fbb55113fb70f39adb4ae96699f4f679d03 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 5 Jul 2010 16:12:08 +0200 Subject: add snr calculations for CXD1981 frontend --- lib/dvb/frontend.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index a1ba8fe5..abbb8d29 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -906,6 +906,19 @@ int eDVBFrontend::readFrontendData(int type) } else if (strstr(m_description, "BCM4506") || strstr(m_description, "BCM4505")) ret = (snr * 100) >> 8; + else if (!strcmp(m_description, "CXD1981")) + { + int mse = (~snr) & 0xFF; + switch (parm_u_qam_modulation) { + case QAM_16: + case QAM_64: + case QAM_256: ret = (int)(-950 * log(((double)mse) / 760)); break; + case QAM_32: + case QAM_128: ret = (int)(-875 * log(((double)mse) / 650)); break; + + default: break; + } + } if (type == signalQuality) { -- cgit v1.2.3 From 762f51fe809fd762369b870d44db6e70e1a611e6 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 5 Jul 2010 16:59:47 +0200 Subject: lib/base/console.cpp: fix eConsoleAppContainer write (when called with one string only) --- lib/base/console.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/base/console.cpp b/lib/base/console.cpp index add87066..43f9f61e 100644 --- a/lib/base/console.cpp +++ b/lib/base/console.cpp @@ -516,18 +516,15 @@ eConsolePy_write(eConsolePy* self, PyObject *args) { int len; char *data; - if (PyArg_ParseTuple(args, "si", &data, &len)) - ; - else + int ret = -1; + Py_ssize_t argc = PyTuple_Size(args); + if (argc > 1) + ret = PyArg_ParseTuple(args, "si", &data, &len); + else if (argc == 1) { PyObject *ob; - if (!PyArg_ParseTuple(args, "O", &ob) || !PyString_Check(ob)) - { - PyErr_SetString(PyExc_TypeError, - "1st arg must be a string, optionaly 2nd arg can be the string length"); - return NULL; - } - else + ret = !PyArg_ParseTuple(args, "O", &ob) || !PyString_Check(ob); + if (!ret) { Py_ssize_t length; if (!PyString_AsStringAndSize(ob, &data, &length)) @@ -536,6 +533,12 @@ eConsolePy_write(eConsolePy* self, PyObject *args) len = 0; } } + if (ret) + { + PyErr_SetString(PyExc_TypeError, + "1st arg must be a string, optionaly 2nd arg can be the string length"); + return NULL; + } self->cont->write(data, len); Py_RETURN_NONE; } -- cgit v1.2.3 From b9bd32101fbfb656b021ff74e2aae373ce03e00c Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 6 Jul 2010 15:39:32 +0200 Subject: Screens/Ipkg.py: properly count processed packages. refs #550 --- lib/python/Screens/Ipkg.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/Ipkg.py b/lib/python/Screens/Ipkg.py index 96876336..7f98f3df 100755 --- a/lib/python/Screens/Ipkg.py +++ b/lib/python/Screens/Ipkg.py @@ -25,6 +25,7 @@ class Ipkg(Screen): self.packages = 0 self.error = 0 + self.processed_packages = [] self.activity = 0 self.activityTimer = eTimer() @@ -85,15 +86,21 @@ class Ipkg(Screen): self.slider.setValue(self.sliderPackages[param]) self.package.setText(param) self.status.setText(_("Upgrading")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 elif event == IpkgComponent.EVENT_INSTALL: self.package.setText(param) self.status.setText(_("Installing")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 elif event == IpkgComponent.EVENT_REMOVE: self.package.setText(param) self.status.setText(_("Removing")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 elif event == IpkgComponent.EVENT_CONFIGURING: self.package.setText(param) self.status.setText(_("Configuring")) @@ -103,10 +110,10 @@ class Ipkg(Screen): self.runNextCmd() elif event == IpkgComponent.EVENT_MODIFIED: self.session.openWithCallback( - self.modificationCallback, - MessageBox, - _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) - ) + self.modificationCallback, + MessageBox, + _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) + ) def modificationCallback(self, res): self.ipkg.write(res and "N" or "Y") -- cgit v1.2.3 From cdfd83c94cc6f2aab412cbcd686348d51c7e8869 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 6 Jul 2010 15:41:11 +0200 Subject: Softwaremanager: * properly count processed packages. * make configfile owerwrite question while upgrading configurable over new setupscreen on Menu Button. * show files that will be backed up inside own infoscreen and not inside the menu description. * add possibility to navigate with the remote keys (a-z) inside packagemanager. thx emanuel fixes #550 --- .../SystemPlugins/SoftwareManager/SoftwareTools.py | 124 +++++++-- .../SystemPlugins/SoftwareManager/plugin.py | 302 +++++++++++++++++++-- 2 files changed, 388 insertions(+), 38 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index d4653cca..a29a5e99 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -1,4 +1,5 @@ -from enigma import eConsoleAppContainer +# -*- coding: iso-8859-1 -*- +from enigma import eConsoleAppContainer,eTPM from Components.Console import Console from Components.About import about from Components.DreamInfoHandler import DreamInfoHandler @@ -8,9 +9,49 @@ from Components.Ipkg import IpkgComponent from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_METADIR from Tools.HardwareInfo import HardwareInfo +import sha from time import time +def bin2long(s): + return reduce( lambda x,y:(x<<8L)+y, map(ord, s)) + +def long2bin(l): + res = "" + for byte in range(128): + res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff) + return res + +def rsa_pub1024(src, mod): + return long2bin(pow(bin2long(src), 65537, bin2long(mod))) + +def decrypt_block(src, mod): + if len(src) != 128 and len(src) != 202: + return None + dest = rsa_pub1024(src[:128], mod) + hash = sha.new(dest[1:107]) + if len(src) == 202: + hash.update(src[131:192]) + result = hash.digest() + if result == dest[107:127]: + return dest + return None + +def validate_cert(cert, key): + buf = decrypt_block(cert[8:], key) + if buf is None: + return None + return buf[36:107] + cert[139:196] + +def read_random(): + try: + fd = open("/dev/urandom", "r") + buf = fd.read(8) + fd.close() + return buf + except: + return None + class SoftwareTools(DreamInfoHandler): lastDownloadDate = None NetworkConnectionAvailable = None @@ -58,24 +99,71 @@ class SoftwareTools(DreamInfoHandler): self.getUpdates() def getUpdates(self, callback = None): - if SoftwareTools.NetworkConnectionAvailable == True: - SoftwareTools.lastDownloadDate = time() - if SoftwareTools.list_updating is False and callback is None: - SoftwareTools.list_updating = True - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - elif SoftwareTools.list_updating is False and callback is not None: - SoftwareTools.list_updating = True - self.NotifierCallback = callback - self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) - elif SoftwareTools.list_updating is True and callback is not None: - #update info collecting already in progress - self.NotifierCallback = callback + if SoftwareTools.lastDownloadDate is None: + if self.hardware_info.device_name != "dm7025": + rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + etpm = eTPM() + l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) + if l2cert is None: + return + l2key = validate_cert(l2cert, rootkey) + if l2key is None: + return + l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) + if l3cert is None: + print "please run the genuine dreambox plugin" + return + l3key = validate_cert(l3cert, l2key) + if l3key is None: + return + rnd = read_random() + if rnd is None: + return + val = etpm.challenge(rnd) + result = decrypt_block(val, l3key) + if self.hardware_info.device_name == "dm7025" or result[80:88] == rnd: + if SoftwareTools.NetworkConnectionAvailable == True: + SoftwareTools.lastDownloadDate = time() + if SoftwareTools.list_updating is False and callback is None: + SoftwareTools.list_updating = True + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + elif SoftwareTools.list_updating is False and callback is not None: + SoftwareTools.list_updating = True + self.NotifierCallback = callback + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + elif SoftwareTools.list_updating is True and callback is not None: + self.NotifierCallback = callback + else: + SoftwareTools.list_updating = False + if callback is not None: + callback(False) + elif self.NotifierCallback is not None: + self.NotifierCallback(False) + else: + SoftwareTools.NetworkConnectionAvailable = False + SoftwareTools.list_updating = False + if callback is not None: + callback(False) + elif self.NotifierCallback is not None: + self.NotifierCallback(False) else: - SoftwareTools.list_updating = False - if callback is not None: - callback(False) - elif self.NotifierCallback is not None: - self.NotifierCallback(False) + if SoftwareTools.NetworkConnectionAvailable == True: + SoftwareTools.lastDownloadDate = time() + if SoftwareTools.list_updating is False and callback is None: + SoftwareTools.list_updating = True + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + elif SoftwareTools.list_updating is False and callback is not None: + SoftwareTools.list_updating = True + self.NotifierCallback = callback + self.ipkg.startCmd(IpkgComponent.CMD_UPDATE) + elif SoftwareTools.list_updating is True and callback is not None: + self.NotifierCallback = callback + else: + SoftwareTools.list_updating = False + if callback is not None: + callback(False) + elif self.NotifierCallback is not None: + self.NotifierCallback(False) def ipkgCallback(self, event, param): if event == IpkgComponent.EVENT_ERROR: diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 1e0ed4d5..99837678 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -14,7 +14,8 @@ from Components.MenuList import MenuList from Components.Sources.List import List from Components.Slider import Slider from Components.Harddisk import harddiskmanager -from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations +from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigYesNo, ConfigSelection +from Components.ConfigList import ConfigListScreen from Components.Console import Console from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest from Components.SelectionList import SelectionList @@ -26,7 +27,8 @@ from Components.AVSwitch import AVSwitch from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR from Tools.LoadPixmap import LoadPixmap -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad +from Tools.NumericalTextInput import NumericalTextInput +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad, eRCInput, getPrevAsciiCode from cPickle import dump, load from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK from time import time, gmtime, strftime, localtime @@ -43,6 +45,14 @@ config.plugins.configurationbackup = ConfigSubsection() config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False) config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) +config.plugins.SoftwareManager = ConfigSubsection() +config.plugins.SoftwareManager.overwriteConfigFiles = ConfigSelection( + [ + ("Y", _("Yes, always")), + ("N", _("No, never")), + ("ask", _("Always ask")) + ], "Y") + def write_cache(cache_file, cache_data): #Does a cPickle dump if not os_path.isdir( os_path.dirname(cache_file) ): @@ -109,13 +119,16 @@ class UpdatePluginMenu(Screen): self.menu = args self.list = [] self.oktext = _("\nPress OK on your remote control to continue.") + self.menutext = _("Press MENU on your remote control for additional options.") + self.infotext = _("Press INFO on your remote control for additional information.") self.text = "" self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) if self.menu == 0: + print "building menu entries" self.list.append(("install-extensions", _("Manage extensions"), _("\nManage extensions or plugins for your Dreambox" ) + self.oktext, None)) self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext, None)) self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext, None)) - self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext, None)) + self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext + "\n\n" + self.infotext, None)) self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None)) self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local extensions and install them." ) + self.oktext, None)) for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): @@ -136,7 +149,7 @@ class UpdatePluginMenu(Screen): elif self.menu == 1: self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None)) self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None)) - self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None)) + self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup.") + self.oktext + "\n\n" + self.infotext, None)) if config.usage.setup_level.index >= 2: # expert+ self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None)) self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None)) @@ -156,25 +169,25 @@ class UpdatePluginMenu(Screen): self["menu"] = List(self.list) self["key_red"] = StaticText(_("Close")) - self["status"] = StaticText("") + self["status"] = StaticText(self.menutext) - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions"], + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "MenuActions"], { "ok": self.go, "back": self.close, "red": self.close, + "menu": self.handleMenu, + "showEventInfo": self.handleInfo, }, -1) self.onLayoutFinish.append(self.layoutFinished) self.backuppath = getBackupPath() self.backupfile = getBackupFilename() self.fullbackupfilename = self.backuppath + "/" + self.backupfile self.onShown.append(self.setWindowTitle) - #self.onClose.append(self.cleanup) def layoutFinished(self): idx = 0 self["menu"].index = idx - #self.getUpdateInfos() def setWindowTitle(self): self.setTitle(_("Software management")) @@ -201,9 +214,17 @@ class UpdatePluginMenu(Screen): self.text = _("No network connection available.") self["status"].setText(self.text) + def handleMenu(self): + self.session.open(SoftwareManagerSetup) + + def handleInfo(self): + current = self["menu"].getCurrent() + if current: + currentEntry = current[0] + if currentEntry in ("system-backup","backupfiles"): + self.session.open(SoftwareManagerInfo, mode = "backupinfo") def go(self): - #iNetwork.stopPingConsole() current = self["menu"].getCurrent() if current: currentEntry = current[0] @@ -290,6 +311,185 @@ class UpdatePluginMenu(Screen): self.exe = True self.session.open(RestoreScreen, runRestore = True) +class SoftwareManagerSetup(Screen, ConfigListScreen): + + skin = """ + + + + + + + + + + + + + """ + + def __init__(self, session, skin_path = None): + Screen.__init__(self, session) + self.session = session + self.skin_path = skin_path + if self.skin_path == None: + self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager") + + self.onChangedEntry = [ ] + self.setup_title = _("Software manager setup") + self.overwriteConfigfilesEntry = None + + self.list = [ ] + ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry) + + self["actions"] = ActionMap(["SetupActions"], + { + "cancel": self.keyCancel, + "save": self.apply, + }, -2) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + self["introduction"] = StaticText() + + self.createSetup() + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setTitle(self.setup_title) + + def createSetup(self): + self.list = [ ] + self.overwriteConfigfilesEntry = getConfigListEntry(_("Overwrite configuration files ?"), config.plugins.SoftwareManager.overwriteConfigFiles) + self.list.append(self.overwriteConfigfilesEntry) + self["config"].list = self.list + self["config"].l.setSeperation(400) + self["config"].l.setList(self.list) + if not self.selectionChanged in self["config"].onSelectionChanged: + self["config"].onSelectionChanged.append(self.selectionChanged) + self.selectionChanged() + + def selectionChanged(self): + if self["config"].getCurrent() == self.overwriteConfigfilesEntry: + self["introduction"].setText(_("Overwrite configuration files during software upgrade?")) + else: + self["introduction"].setText("") + + def newConfig(self): + pass + + def keyLeft(self): + ConfigListScreen.keyLeft(self) + + def keyRight(self): + ConfigListScreen.keyRight(self) + + def confirm(self, confirmed): + if not confirmed: + print "not confirmed" + return + else: + self.keySave() + + def apply(self): + self.session.openWithCallback(self.confirm, MessageBox, _("Use this settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + + def cancelConfirm(self, result): + if not result: + return + for x in self["config"].list: + x[1].cancel() + self.close() + + def keyCancel(self): + if self["config"].isChanged(): + self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + else: + self.close() + + # for summary: + def changedEntry(self): + for x in self.onChangedEntry: + x() + self.selectionChanged() + + def getCurrentEntry(self): + return self["config"].getCurrent()[0] + + def getCurrentValue(self): + return str(self["config"].getCurrent()[1].value) + + def createSummary(self): + from Screens.Setup import SetupSummary + return SetupSummary + + +class SoftwareManagerInfo(Screen): + skin = """ + + + + + + + + + + + + {"template": [ + MultiContentEntryText(pos = (5, 0), size = (540, 26), font=0, flags = RT_HALIGN_LEFT | RT_HALIGN_CENTER, text = 0), # index 0 is the name + ], + "fonts": [gFont("Regular", 24),gFont("Regular", 22)], + "itemHeight": 26 + } + + + + + """ + + def __init__(self, session, skin_path = None, mode = None): + Screen.__init__(self, session) + self.session = session + self.mode = mode + self.skin_path = skin_path + if self.skin_path == None: + self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager") + + self["actions"] = ActionMap(["ShortcutActions", "WizardActions"], + { + "back": self.close, + "red": self.close, + }, -2) + + self.list = [] + self["list"] = List(self.list) + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText() + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + self["introduction"] = StaticText() + + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setTitle(_("Softwaremanager information")) + if self.mode is not None: + self.showInfos() + + def showInfos(self): + if self.mode == "backupinfo": + self.list = [] + backupfiles = config.plugins.configurationbackup.backupdirs.value + for entry in backupfiles: + print entry + self.list.append((entry,)) + self['list'].setList(self.list) + class PluginManager(Screen, DreamInfoHandler): @@ -1095,7 +1295,7 @@ class PluginDetails(Screen, DreamInfoHandler): class UpdatePlugin(Screen): skin = """ - + @@ -1115,9 +1315,11 @@ class UpdatePlugin(Screen): self["status"] = self.status self.package = StaticText() self["package"] = self.package + self.oktext = _("Press OK on your remote control to continue.") self.packages = 0 self.error = 0 + self.processed_packages = [] self.activity = 0 self.activityTimer = eTimer() @@ -1151,20 +1353,34 @@ class UpdatePlugin(Screen): self.slider.setValue(self.sliderPackages[param]) self.package.setText(param) self.status.setText(_("Upgrading")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 elif event == IpkgComponent.EVENT_INSTALL: self.package.setText(param) self.status.setText(_("Installing")) - self.packages += 1 + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 + elif event == IpkgComponent.EVENT_REMOVE: + self.package.setText(param) + self.status.setText(_("Removing")) + if not param in self.processed_packages: + self.processed_packages.append(param) + self.packages += 1 elif event == IpkgComponent.EVENT_CONFIGURING: self.package.setText(param) self.status.setText(_("Configuring")) + elif event == IpkgComponent.EVENT_MODIFIED: - self.session.openWithCallback( - self.modificationCallback, - MessageBox, - _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) - ) + if config.plugins.SoftwareManager.overwriteConfigFiles.value in ("N", "Y"): + self.ipkg.write(True and config.plugins.SoftwareManager.overwriteConfigFiles.value) + else: + self.session.openWithCallback( + self.modificationCallback, + MessageBox, + _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) + ) elif event == IpkgComponent.EVENT_ERROR: self.error += 1 elif event == IpkgComponent.EVENT_DONE: @@ -1178,7 +1394,7 @@ class UpdatePlugin(Screen): self.activityslider.setValue(0) self.package.setText("") - self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages) + self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages + "\n\n" + self.oktext) else: self.activityTimer.stop() self.activityslider.setValue(0) @@ -1381,7 +1597,7 @@ class IPKGSource(Screen): self["text"].number(number) -class PacketManager(Screen): +class PacketManager(Screen, NumericalTextInput): skin = """ @@ -1405,15 +1621,29 @@ class PacketManager(Screen): def __init__(self, session, plugin_path, args = None): Screen.__init__(self, session) + NumericalTextInput.__init__(self) self.session = session self.skin_path = plugin_path - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], + self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz') + + self["shortcuts"] = NumberActionMap(["ShortcutActions", "WizardActions", "NumberActions", "InputActions", "InputAsciiActions", "KeyboardInputActions" ], { "ok": self.go, "back": self.exit, "red": self.exit, "green": self.reload, + "gotAsciiCode": self.keyGotAscii, + "1": self.keyNumberGlobal, + "2": self.keyNumberGlobal, + "3": self.keyNumberGlobal, + "4": self.keyNumberGlobal, + "5": self.keyNumberGlobal, + "6": self.keyNumberGlobal, + "7": self.keyNumberGlobal, + "8": self.keyNumberGlobal, + "9": self.keyNumberGlobal, + "0": self.keyNumberGlobal }, -1) self.list = [] @@ -1438,12 +1668,44 @@ class PacketManager(Screen): self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.rebuildList) + rcinput = eRCInput.getInstance() + rcinput.setKeyboardMode(rcinput.kmAscii) + + def keyNumberGlobal(self, val): + key = self.getKey(val) + if key is not None: + keyvalue = key.encode("utf-8") + if len(keyvalue) == 1: + self.setNextIdx(keyvalue[0]) + + def keyGotAscii(self): + keyvalue = unichr(getPrevAsciiCode()).encode("utf-8") + if len(keyvalue) == 1: + self.setNextIdx(keyvalue[0]) + + def setNextIdx(self,char): + if char in ("0", "1", "a"): + self["list"].setIndex(0) + else: + idx = self.getNextIdx(char) + if idx and idx <= self["list"].count: + self["list"].setIndex(idx) + + def getNextIdx(self,char): + idx = 0 + for i in self["list"].list: + if i[0][0] == char: + return idx + idx += 1 + def exit(self): self.ipkg.stop() if self.Console is not None: if len(self.Console.appContainers): for name in self.Console.appContainers.keys(): self.Console.kill(name) + rcinput = eRCInput.getInstance() + rcinput.setKeyboardMode(rcinput.kmNone) self.close() def reload(self): -- cgit v1.2.3 From 1f623d13544bd3d809a44fd9a54f33f91a4ec272 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 8 Jul 2010 11:44:19 +0200 Subject: lib/gdi/lcd.cpp: remove debug code for dm800se color oled --- lib/gdi/lcd.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/gdi/lcd.cpp b/lib/gdi/lcd.cpp index a953ef0d..a7dc22db 100644 --- a/lib/gdi/lcd.cpp +++ b/lib/gdi/lcd.cpp @@ -196,14 +196,8 @@ void eDBoxLCD::update() } write(lcdfd, raw, 132*8); } - else if (is_oled == 3) { - FILE *f = fopen("/tmp/bla", "w+"); - if (f) { - fwrite(_buffer, _stride * res.height(), 1, f); - fclose(f); - } + else if (is_oled == 3) write(lcdfd, _buffer, _stride * res.height()); - } else { unsigned char raw[64*64]; -- cgit v1.2.3 From 9d2867afd1360fe877f1513dad4d1edc6ab5b4f9 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Thu, 8 Jul 2010 12:56:32 +0200 Subject: allow rtspt urls, issue EOF on http streaming timeout (introduces feature #551, requires libsoup-2.4-2.29.5-r0, gst-plugins-good-0.10.23-r7.1 incl. souphttpsource) --- lib/service/servicemp3.cpp | 92 ++++++++++++++++++++++++++++++++++------------ lib/service/servicemp3.h | 4 ++ 2 files changed, 72 insertions(+), 24 deletions(-) (limited to 'lib') diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 4ecbd76b..b34b62f2 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -20,6 +20,8 @@ #include #include +#define HTTP_TIMEOUT 10 + // eServiceFactoryMP3 eServiceFactoryMP3::eServiceFactoryMP3() @@ -218,6 +220,7 @@ eServiceMP3::eServiceMP3(eServiceReference ref) { m_seekTimeout = eTimer::create(eApp); m_subtitle_sync_timer = eTimer::create(eApp); + m_streamingsrc_timeout = 0; m_stream_tags = 0; m_currentAudioStream = -1; m_currentSubtitleStream = 0; @@ -238,63 +241,64 @@ eServiceMP3::eServiceMP3(eServiceReference ref) if (!ext) ext = filename; - sourceStream sourceinfo; - sourceinfo.is_video = FALSE; - sourceinfo.audiotype = atUnknown; + m_sourceinfo.is_video = FALSE; + m_sourceinfo.audiotype = atUnknown; if ( (strcasecmp(ext, ".mpeg") && strcasecmp(ext, ".mpg") && strcasecmp(ext, ".vob") && strcasecmp(ext, ".bin") && strcasecmp(ext, ".dat") ) == 0 ) { - sourceinfo.containertype = ctMPEGPS; - sourceinfo.is_video = TRUE; + m_sourceinfo.containertype = ctMPEGPS; + m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".ts") == 0 ) { - sourceinfo.containertype = ctMPEGTS; - sourceinfo.is_video = TRUE; + m_sourceinfo.containertype = ctMPEGTS; + m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".mkv") == 0 ) { - sourceinfo.containertype = ctMKV; - sourceinfo.is_video = TRUE; + m_sourceinfo.containertype = ctMKV; + m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".avi") == 0 || strcasecmp(ext, ".divx") == 0) { - sourceinfo.containertype = ctAVI; - sourceinfo.is_video = TRUE; + m_sourceinfo.containertype = ctAVI; + m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".mp4") == 0 || strcasecmp(ext, ".mov") == 0 || strcasecmp(ext, ".m4v") == 0) { - sourceinfo.containertype = ctMP4; - sourceinfo.is_video = TRUE; + m_sourceinfo.containertype = ctMP4; + m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".m4a") == 0 ) { - sourceinfo.containertype = ctMP4; - sourceinfo.audiotype = atAAC; + m_sourceinfo.containertype = ctMP4; + m_sourceinfo.audiotype = atAAC; } else if ( strcasecmp(ext, ".mp3") == 0 ) - sourceinfo.audiotype = atMP3; + m_sourceinfo.audiotype = atMP3; else if ( (strncmp(filename, "/autofs/", 8) || strncmp(filename+strlen(filename)-13, "/track-", 7) || strcasecmp(ext, ".wav")) == 0 ) - sourceinfo.containertype = ctCDA; + m_sourceinfo.containertype = ctCDA; if ( strcasecmp(ext, ".dat") == 0 ) { - sourceinfo.containertype = ctVCD; - sourceinfo.is_video = TRUE; + m_sourceinfo.containertype = ctVCD; + m_sourceinfo.is_video = TRUE; } - if ( (strncmp(filename, "http://", 7)) == 0 || (strncmp(filename, "udp://", 6)) == 0 || (strncmp(filename, "rtp://", 6)) == 0 || (strncmp(filename, "https://", 8)) == 0 || (strncmp(filename, "mms://", 6)) == 0 || (strncmp(filename, "rtsp://", 7)) == 0 ) - sourceinfo.is_streaming = TRUE; + if ( (strncmp(filename, "http://", 7)) == 0 || (strncmp(filename, "udp://", 6)) == 0 || (strncmp(filename, "rtp://", 6)) == 0 || (strncmp(filename, "https://", 8)) == 0 || (strncmp(filename, "mms://", 6)) == 0 || (strncmp(filename, "rtsp://", 7)) == 0 || (strncmp(filename, "rtspt://", 7)) == 0 ) + m_sourceinfo.is_streaming = TRUE; gchar *uri; - if ( sourceinfo.is_streaming ) + if ( m_sourceinfo.is_streaming ) { uri = g_strdup_printf ("%s", filename); + m_streamingsrc_timeout = eTimer::create(eApp);; + CONNECT(m_streamingsrc_timeout->timeout, eServiceMP3::sourceTimeout); } - else if ( sourceinfo.containertype == ctCDA ) + else if ( m_sourceinfo.containertype == ctCDA ) { int i_track = atoi(filename+18); uri = g_strdup_printf ("cdda://%i", i_track); } - else if ( sourceinfo.containertype == ctVCD ) + else if ( m_sourceinfo.containertype == ctVCD ) { int fd = open(filename,O_RDONLY); char tmp[128*1024]; @@ -416,6 +420,12 @@ RESULT eServiceMP3::start() return 0; } +void eServiceMP3::sourceTimeout() +{ + eDebug("eServiceMP3::http source timeout! issuing eof..."); + m_event((iPlayableService*)this, evEOF); +} + RESULT eServiceMP3::stop() { ASSERT(m_state != stIdle); @@ -1152,6 +1162,8 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg) } break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: { + if ( m_sourceinfo.is_streaming && m_streamingsrc_timeout ) + m_streamingsrc_timeout->stop(); } break; case GST_STATE_CHANGE_PLAYING_TO_PAUSED: { @@ -1303,6 +1315,7 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg) // g_free (g_type); } m_event((iPlayableService*)this, evUpdatedEventInfo); + break; } case GST_MESSAGE_ELEMENT: { @@ -1351,6 +1364,37 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg) gst_message_parse_buffering(msg, &(m_bufferInfo.bufferPercent)); gst_message_parse_buffering_stats(msg, &mode, &(m_bufferInfo.avgInRate), &(m_bufferInfo.avgOutRate), &(m_bufferInfo.bufferingLeft)); m_event((iPlayableService*)this, evBuffering); + break; + } + case GST_MESSAGE_STREAM_STATUS: + { + GstStreamStatusType type; + GstElement *owner; + gst_message_parse_stream_status (msg, &type, &owner); + if ( type == GST_STREAM_STATUS_TYPE_CREATE && m_sourceinfo.is_streaming ) + { + if ( GST_IS_PAD(source) ) + owner = gst_pad_get_parent_element(GST_PAD(source)); + else if ( GST_IS_ELEMENT(source) ) + owner = GST_ELEMENT(source); + else + owner = 0; + if ( owner ) + { + GstElementFactory *factory = gst_element_get_factory(GST_ELEMENT(owner)); + const gchar *name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory)); + if (!strcmp(name, "souphttpsrc")) + { + m_streamingsrc_timeout->start(HTTP_TIMEOUT*1000, true); + g_object_set (G_OBJECT (owner), "timeout", HTTP_TIMEOUT, NULL); + eDebug("eServiceMP3::GST_STREAM_STATUS_TYPE_CREATE -> setting timeout on %s to %is", name, HTTP_TIMEOUT); + } + + } + if ( GST_IS_PAD(source) ) + gst_object_unref(owner); + } + break; } default: break; diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index 56a068b9..af68bd91 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -211,9 +211,13 @@ private: std::list m_subtitle_pages; ePtr m_subtitle_sync_timer; + + ePtr m_streamingsrc_timeout; void pushSubtitles(); void pullSubtitle(); + void sourceTimeout(); int m_subs_to_pull; + sourceStream m_sourceinfo; eSingleLock m_subs_to_pull_lock; gulong m_subs_to_pull_handler_id; -- cgit v1.2.3 From 113a3f510100f9b8052eae3519e87dee14cc5d07 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Fri, 16 Jul 2010 01:36:14 +0200 Subject: fixes bug #552 add the equal sign to numerical text input onto the 0 rcu button --- lib/python/Tools/NumericalTextInput.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/python/Tools/NumericalTextInput.py b/lib/python/Tools/NumericalTextInput.py index df6a5ea8..da090b13 100644 --- a/lib/python/Tools/NumericalTextInput.py +++ b/lib/python/Tools/NumericalTextInput.py @@ -31,7 +31,7 @@ class NumericalTextInput: return if self.lang == 'de_DE': - self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 + self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0 self.mapping.append (u" 1") # 1 self.mapping.append (u"aäbc2AÄBC") # 2 self.mapping.append (u"def3DEF") # 3 @@ -42,7 +42,7 @@ class NumericalTextInput: self.mapping.append (u"tuüv8TUÜV") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 elif self.lang == 'es_ES': - self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 + self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0 self.mapping.append (u" 1") # 1 self.mapping.append (u"abcáà2ABCÁÀ") # 2 self.mapping.append (u"deéèf3DEFÉÈ") # 3 @@ -53,7 +53,7 @@ class NumericalTextInput: self.mapping.append (u"tuvúù8TUVÚÙ") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 if self.lang in ('sv_SE', 'fi_FI'): - self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 + self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0 self.mapping.append (u" 1") # 1 self.mapping.append (u"abcåä2ABCÅÄ") # 2 self.mapping.append (u"defé3DEFÉ") # 3 @@ -64,7 +64,7 @@ class NumericalTextInput: self.mapping.append (u"tuv8TUV") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 else: - self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 + self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0 self.mapping.append (u" 1") # 1 self.mapping.append (u"abc2ABC") # 2 self.mapping.append (u"def3DEF") # 3 -- cgit v1.2.3 From 675f9d0eeb82577252a68ee263049acc1ff80bcc Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 20 Jul 2010 10:06:11 +0200 Subject: implement configurable http user-agent (fixes #224) --- .../Plugins/Extensions/MediaPlayer/settings.py | 2 ++ lib/service/servicemp3.cpp | 25 ++++++++++++++++++++++ lib/service/servicemp3.h | 2 ++ 3 files changed, 29 insertions(+) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/settings.py b/lib/python/Plugins/Extensions/MediaPlayer/settings.py index 0b95812f..7f42677d 100755 --- a/lib/python/Plugins/Extensions/MediaPlayer/settings.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/settings.py @@ -12,6 +12,8 @@ config.mediaplayer.repeat = ConfigYesNo(default=False) config.mediaplayer.savePlaylistOnExit = ConfigYesNo(default=True) config.mediaplayer.saveDirOnExit = ConfigYesNo(default=False) config.mediaplayer.defaultDir = ConfigDirectory() +config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False) +config.mediaplayer.alternateUserAgent = ConfigText(default="") class DirectoryBrowser(Screen, HelpableScreen): diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index b34b62f2..b50b52d0 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -290,8 +290,20 @@ eServiceMP3::eServiceMP3(eServiceReference ref) if ( m_sourceinfo.is_streaming ) { uri = g_strdup_printf ("%s", filename); +<<<<<<< HEAD m_streamingsrc_timeout = eTimer::create(eApp);; CONNECT(m_streamingsrc_timeout->timeout, eServiceMP3::sourceTimeout); +======= + + std::string config_str; + if( ePythonConfigQuery::getConfigValue("config.mediaplayer.useAlternateUserAgent", config_str) == 0 ) + { + if ( config_str == "True" ) + ePythonConfigQuery::getConfigValue("config.mediaplayer.alternateUserAgent", m_useragent); + } + if ( m_useragent.length() == 0 ) + m_useragent = "Dream Multimedia Dreambox Enigma2 Mediaplayer"; +>>>>>>> b08c138... implement configurable http user-agent (fixes #224) } else if ( m_sourceinfo.containertype == ctCDA ) { @@ -353,6 +365,10 @@ eServiceMP3::eServiceMP3(eServiceReference ref) subs.language_code = std::string("und"); m_subtitleStreams.push_back(subs); } + if ( sourceinfo.is_streaming ) + { + g_signal_connect (G_OBJECT (m_gst_playbin), "notify::source", G_CALLBACK (gstHTTPSourceSetAgent), this); + } } else { m_event((iPlayableService*)this, evUser+12); @@ -1410,6 +1426,15 @@ GstBusSyncReply eServiceMP3::gstBusSyncHandler(GstBus *bus, GstMessage *message, return GST_BUS_PASS; } +void eServiceMP3::gstHTTPSourceSetAgent(GObject *object, GParamSpec *unused, gpointer user_data) +{ + eServiceMP3 *_this = (eServiceMP3*)user_data; + GstElement *source; + g_object_get(_this->m_gst_playbin, "source", &source, NULL); + g_object_set (G_OBJECT (source), "user-agent", _this->m_useragent.c_str(), NULL); + gst_object_unref(source); +} + audiotype_t eServiceMP3::gstCheckAudioPad(GstStructure* structure) { if (!structure) diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index af68bd91..01f7cf7f 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -208,6 +208,7 @@ private: static void gstCBsubtitleAvail(GstElement *element, gpointer user_data); GstPad* gstCreateSubtitleSink(eServiceMP3* _this, subtype_t type); void gstPoll(const int&); + static void gstHTTPSourceSetAgent(GObject *source, GParamSpec *unused, gpointer user_data); std::list m_subtitle_pages; ePtr m_subtitle_sync_timer; @@ -224,6 +225,7 @@ private: RESULT seekToImpl(pts_t to); gint m_aspect, m_width, m_height, m_framerate, m_progressive; + std::string m_useragent; RESULT trickSeek(gdouble ratio); }; #endif -- cgit v1.2.3 From c133a7b7ee3642dac16867449fc94b86b5d8fed5 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 20 Jul 2010 10:11:35 +0200 Subject: merge fix --- lib/service/servicemp3.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib') diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index b50b52d0..dec87a9a 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -290,10 +290,8 @@ eServiceMP3::eServiceMP3(eServiceReference ref) if ( m_sourceinfo.is_streaming ) { uri = g_strdup_printf ("%s", filename); -<<<<<<< HEAD m_streamingsrc_timeout = eTimer::create(eApp);; CONNECT(m_streamingsrc_timeout->timeout, eServiceMP3::sourceTimeout); -======= std::string config_str; if( ePythonConfigQuery::getConfigValue("config.mediaplayer.useAlternateUserAgent", config_str) == 0 ) @@ -303,7 +301,6 @@ eServiceMP3::eServiceMP3(eServiceReference ref) } if ( m_useragent.length() == 0 ) m_useragent = "Dream Multimedia Dreambox Enigma2 Mediaplayer"; ->>>>>>> b08c138... implement configurable http user-agent (fixes #224) } else if ( m_sourceinfo.containertype == ctCDA ) { -- cgit v1.2.3 From 7cbe7598b150011d507a6193146edf75df34d812 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 20 Jul 2010 19:48:48 +0200 Subject: lib/service/servicemp3.cpp: compile fix --- lib/service/servicemp3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index dec87a9a..9c24d4bb 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -362,7 +362,7 @@ eServiceMP3::eServiceMP3(eServiceReference ref) subs.language_code = std::string("und"); m_subtitleStreams.push_back(subs); } - if ( sourceinfo.is_streaming ) + if ( m_sourceinfo.is_streaming ) { g_signal_connect (G_OBJECT (m_gst_playbin), "notify::source", G_CALLBACK (gstHTTPSourceSetAgent), this); } -- cgit v1.2.3 From 1d8bd795e00ace3dde10b2ad5986a0593bc2c234 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 22 Jul 2010 19:37:35 +0200 Subject: fixes bug #556 - fixes adding timers from inside the movie player: the .ts service was added as channel - fixes a small bug in ConfigSelection to allow empty strings inside the ChoicesList --- RecordTimer.py | 5 ++++- ServiceReference.py | 6 ++++++ lib/python/Components/config.py | 2 +- lib/python/Screens/TimerEntry.py | 22 +++++++++++++++++++--- 4 files changed, 30 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/RecordTimer.py b/RecordTimer.py index 1608caaf..def75684 100755 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -102,7 +102,10 @@ class RecordTimerEntry(timer.TimerEntry, object): assert isinstance(serviceref, ServiceReference) - self.service_ref = serviceref + if serviceref.getType() == eServiceReference.idDVB and serviceref.getPath() == "": + self.service_ref = serviceref + else: + self.service_ref = ServiceReference(None) self.eit = eit self.dontSave = False self.name = name diff --git a/ServiceReference.py b/ServiceReference.py index 11e28786..5d11ae77 100644 --- a/ServiceReference.py +++ b/ServiceReference.py @@ -20,3 +20,9 @@ class ServiceReference(eServiceReference): def list(self): return self.serviceHandler.list(self.ref) + + def getType(self): + return self.ref.type + + def getPath(self): + return self.ref.getPath() diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index d7506e31..08dd3745 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -179,7 +179,7 @@ class choicesList(object): # XXX: we might want a better name for this def __list__(self): if self.type == choicesList.LIST_TYPE_LIST: - ret = [not isinstance(x, tuple) and x or x[0] for x in self.choices] + ret = [not isinstance(x, tuple) and x or len(x) > 0 and x[0] or len(x) == 0 and x for x in self.choices] else: ret = self.choices.keys() return ret or [""] diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index 64fa9f19..62faf9bf 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -13,8 +13,9 @@ from Components.UsageConfig import defaultMoviePath from Screens.MovieSelection import getPreferredTagEditor from Screens.LocationBox import MovieLocationBox from Screens.ChoiceBox import ChoiceBox +from Screens.MessageBox import MessageBox from RecordTimer import AFTEREVENT -from enigma import eEPGCache +from enigma import eEPGCache, eServiceReference from time import localtime, mktime, time, strftime from datetime import datetime @@ -245,7 +246,7 @@ class TimerEntry(Screen, ConfigListScreen): self.timerentry_service_ref = ServiceReference(args[0]) self.timerentry_service.setCurrentText(self.timerentry_service_ref.getServiceName()) self["config"].invalidate(self.channelEntry) - + def getTimestamp(self, date, mytime): d = localtime(date) dt = datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1]) @@ -264,7 +265,22 @@ class TimerEntry(Screen, ConfigListScreen): end += 86400 return begin, end - def keyGo(self): + def selectChannelSelector(self, *args): + self.session.openWithCallback( + self.finishedChannelSelectionCorrection, + ChannelSelection.SimpleChannelSelection, + _("Select channel to record from") + ) + + def finishedChannelSelectionCorrection(self, *args): + if args: + self.finishedChannelSelection(*args) + self.keyGo() + + def keyGo(self, result = None): + if self.timerentry_service_ref.getType() != eServiceReference.idDVB or self.timerentry_service_ref.getPath() != "": + self.session.openWithCallback(self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR) + return self.timer.name = self.timerentry_name.value self.timer.description = self.timerentry_description.value self.timer.justplay = self.timerentry_justplay.value == "zap" -- cgit v1.2.3 From fcb00fd6aecf823bafd8455c921c5a4b23a96e95 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 24 Jul 2010 12:33:58 +0200 Subject: refs bug #460 swap bflag and eflag (begin and end flag for timer sanity check) old version: bflag = 1, eflag = -1 that lead to the sort function sorting timers with begin=end wrong: self.nrep_eventlist.extend([(self.newtimer.begin,self.bflag,-1),(self.newtimer.end,self.eflag,-1)]) resulted in (end, eflag) before (begin, bflag) and in a conflict with zapping timers with end=begin (no end time) --- lib/python/Components/TimerSanityCheck.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/TimerSanityCheck.py b/lib/python/Components/TimerSanityCheck.py index 8f48d1ec..b472a19e 100644 --- a/lib/python/Components/TimerSanityCheck.py +++ b/lib/python/Components/TimerSanityCheck.py @@ -12,8 +12,8 @@ class TimerSanityCheck: self.simultimer = [] self.rep_eventlist = [] self.nrep_eventlist = [] - self.bflag = 1 - self.eflag = -1 + self.bflag = -1 + self.eflag = 1 def check(self, ext_timer=1): print "check" -- cgit v1.2.3 From b5c3db5f8af9c6de71a0dadd3cc9e13ead7f06d6 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Sun, 25 Jul 2010 22:35:19 +0200 Subject: Softwaremanager: fix potential crash when trying to delete from empty list. Graphmultiepg: fix typo inside metafile. fixes #563 --- .../Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml | 2 +- .../Plugins/SystemPlugins/SoftwareManager/BackupRestore.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml index a10840da..3e2a3f6e 100755 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml @@ -6,7 +6,7 @@ Dream Multimedia GraphMultiEPG - eenigma2-plugin-extensions-graphmultiepg + enigma2-plugin-extensions-graphmultiepg GraphMultiEPG shows a graphical timeline EPG. GraphMultiEPG shows a graphical timeline EPG.\nShows a nice overview of all running und upcoming tv shows. diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index dcff3ca2..7bd7d7a2 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -251,8 +251,9 @@ class RestoreMenu(Screen): def KeyOk(self): if (self.exe == False) and (self.entry == True): self.sel = self["filelist"].getCurrent() - self.val = self.path + "/" + self.sel - self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n") + self.sel + _("\nSystem will restart after the restore!")) + if self.sel: + self.val = self.path + "/" + self.sel + self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n") + self.sel + _("\nSystem will restart after the restore!")) def keyCancel(self): self.close() @@ -265,8 +266,9 @@ class RestoreMenu(Screen): def deleteFile(self): if (self.exe == False) and (self.entry == True): self.sel = self["filelist"].getCurrent() - self.val = self.path + "/" + self.sel - self.session.openWithCallback(self.startDelete, MessageBox, _("Are you sure you want to delete\nfollowing backup:\n" + self.sel )) + if self.sel: + self.val = self.path + "/" + self.sel + self.session.openWithCallback(self.startDelete, MessageBox, _("Are you sure you want to delete\nfollowing backup:\n" + self.sel )) def startDelete(self, ret = False): if (ret == True): -- cgit v1.2.3 From a4dbb3a4ca8e0926250cbe7be76291448e5e1f56 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Sat, 24 Jul 2010 15:41:58 +0200 Subject: SystemPlugins/WirelessLan: remove outdated flags.py and iwlibs.py. refs #558 --- .../Plugins/SystemPlugins/WirelessLan/Makefile.am | 2 - .../Plugins/SystemPlugins/WirelessLan/flags.py | 104 -- .../Plugins/SystemPlugins/WirelessLan/iwlibs.py | 1114 -------------------- 3 files changed, 1220 deletions(-) delete mode 100755 lib/python/Plugins/SystemPlugins/WirelessLan/flags.py delete mode 100755 lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am b/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am index 2f362379..bdc1a884 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am @@ -4,8 +4,6 @@ SUBDIRS = meta install_PYTHON = \ __init__.py \ - flags.py \ - iwlibs.py \ plugin.py \ Wlan.py diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/flags.py b/lib/python/Plugins/SystemPlugins/WirelessLan/flags.py deleted file mode 100755 index 4435f845..00000000 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/flags.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: ISO-8859-1 -*- -# python-wifi -- a wireless library to access wireless cards via python -# Copyright (C) 2004, 2005, 2006 Rman Joost -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA - -modes = ['Auto', - 'Ad-Hoc', - 'Managed', - 'Master', - 'Repeat', - 'Second', - 'Monitor'] - -IFNAMSIZE = 16 -IW_ESSID_MAX_SIZE = 16 - -KILO = 10**3 -MEGA = 10**6 -GIGA = 10**9 - -# ioctl calls for the Linux/i386 kernel -SIOCIWFIRST = 0x8B00 # FIRST ioctl identifier -SIOCGIFCONF = 0x8912 # ifconf struct -SIOCGIWNAME = 0x8B01 # get name == wireless protocol -SIOCGIWFREQ = 0x8B05 # get channel/frequency -SIOCSIWMODE = 0x8B06 # set the operation mode -SIOCGIWMODE = 0x8B07 # get operation mode -SIOCGIWSENS = 0x8B09 # get sensitivity -SIOCGIWAP = 0x8B15 # get AP MAC address -SIOCSIWSCAN = 0x8B18 # set scanning off -SIOCGIWSCAN = 0x8B19 # get scanning results -SIOCGIWRATE = 0x8B21 # get default bit rate -SIOCGIWRTS = 0x8B23 # get rts/cts threshold -SIOCGIWFRAG = 0x8B25 # get fragmention thrh -SIOCGIWTXPOW = 0x8B27 # get transmit power (dBm) -SIOCGIWRETRY = 0x8B29 # get retry limit -SIOCGIWRANGE = 0x8B0B # range -SIOCGIWSTATS = 0x8B0F # get wireless statistics -SIOCSIWESSID = 0x8B1A # set essid -SIOCGIWESSID = 0x8B1B # get essid -SIOCGIWPOWER = 0x8B2D # get power managment settings -SIOCGIWENCODE = 0x8B2B # get encryption information -SIOCIWLAST = 0x8BFF # LAST ioctl identifier - -# Power management flags -IW_POWER_ON = 0x0000 # No details ... -IW_POWER_TYPE = 0xF000 # Type of parameter -IW_POWER_PERIOD = 0x1000 # Value is a period/duration of -IW_POWER_TIMEOUT = 0x2000 # Value is a timeout -IW_POWER_MODE = 0x0F00 # Power management mode -IW_POWER_MIN = 0x0001 # Value is a minimum -IW_POWER_MAX = 0x0002 # Value is a maximum -IW_POWER_RELATIVE = 0x0004 # Value is not in seconds/ms/us - -# Retry limits -IW_RETRY_TYPE = 0xF000 # Type of parameter - -# encoding stuff -IW_ENCODE_DISABLED = 0x8000 # encoding is disabled -IW_ENCODE_NOKEY = 0x0800 # key is write only, not present - -# constants responsible for scanning -IW_SCAN_MAX_DATA = 4096 - -IW_EV_LCP_LEN = 4 -IW_EV_CHAR_LEN = IW_EV_LCP_LEN + IFNAMSIZE -IW_EV_UINT_LEN = IW_EV_LCP_LEN + 4 -IW_EV_FREQ_LEN = IW_EV_LCP_LEN + 8 -IW_EV_ADDR_LEN = IW_EV_LCP_LEN + 16 -IW_EV_POINT_LEN = IW_EV_LCP_LEN + 4 -IW_EV_PARAM_LEN = IW_EV_LCP_LEN + 8 -IW_EV_QUAL_LEN = IW_EV_LCP_LEN + 4 - -EPERM = 1 -E2BIG = 7 -EAGAIN = 11 - -IWHT_NULL = 0 -IWHT_CHAR = 2 -IWHT_UINT = 4 -IWHT_FREQ = 5 -IWHT_ADDR = 6 -IWHT_POINT = 8 -IWHT_PARAM = 9 -IWHT_QUAL = 10 - -IWEVFIRST = 0x8C00 # FIRST event identifier -IWEVQUAL = 0x8C01 # Quality statistics from scan -IWEVCUSTOM = 0x8C02 # Custom Ascii string from Driver -IWEVLAST = 0x8C0A # LAST event identifier diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py b/lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py deleted file mode 100755 index c5f9c6d2..00000000 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py +++ /dev/null @@ -1,1114 +0,0 @@ -# -*- coding: ISO-8859-1 -*- -# python-wifi -- a wireless library to access wireless cards via python -# Copyright (C) 2004, 2005, 2006 Rman Joost -# -# Contributions from: -# Mike Auty (Iwscanresult, Iwscan) -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA - -from struct import pack as struct_pack, \ - unpack as struct_unpack, \ - calcsize as struct_calcsize - -from array import array -from math import ceil, log10 -from fcntl import ioctl -from socket import AF_INET, SOCK_DGRAM, socket -from time import sleep -from re import compile - -from flags import * - -def getNICnames(): - """ extract wireless device names of /proc/net/wireless - - returns empty list if no devices are present - - >>> getNICnames() - ['eth1', 'wifi0'] - """ - device = compile('[a-z]+[0-9]+') - ifnames = [] - - f = open('/proc/net/wireless', 'r') - data = f.readlines() - for line in data: - try: - ifnames.append(device.search(line).group()) - except AttributeError: - pass - # if we couldn't lookup the devices, try to ask the kernel - if ifnames == []: - ifnames = getConfiguredNICnames() - - return ifnames - -def getConfiguredNICnames(): - """get the *configured* ifnames by a systemcall - - >>> getConfiguredNICnames() - [] - """ - iwstruct = Iwstruct() - ifnames = [] - buff = array('c', '\0'*1024) - caddr_t, length = buff.buffer_info() - s = iwstruct.pack('iP', length, caddr_t) - try: - result = iwstruct._fcntl(SIOCGIFCONF, s) - except IOError, (i, e): - return i, e - - # get the interface names out of the buffer - for i in range(0, 1024, 32): - ifname = buff.tostring()[i:i+32] - ifname = struct_unpack('32s', ifname)[0] - ifname = ifname.split('\0', 1)[0] - if ifname: - # verify if ifnames are really wifi devices - wifi = Wireless(ifname) - result = wifi.getAPaddr() - if result[0] == 0: - ifnames.append(ifname) - - return ifnames - -def makedict(**kwargs): - return kwargs - - -class Wireless(object): - """Access to wireless interfaces""" - - def __init__(self, ifname): - self.sockfd = socket(AF_INET, SOCK_DGRAM) - self.ifname = ifname - self.iwstruct = Iwstruct() - - def getAPaddr(self): - """ returns accesspoint mac address - - >>> from iwlibs import Wireless, getNICnames - >>> ifnames = getNICnames() - >>> ifnames - ['eth1', 'wifi0'] - >>> wifi = Wireless(ifnames[0]) - >>> wifi.getAPaddr() - '00:0D:88:8E:4E:93' - - Test with non-wifi card: - >>> wifi = Wireless('eth0') - >>> wifi.getAPaddr() - (95, 'Operation not supported') - - Test with non-existant card: - >>> wifi = Wireless('eth2') - >>> wifi.getAPaddr() - (19, 'No such device') - """ - buff, s = self.iwstruct.pack_wrq(32) - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWAP, - data=s) - if i > 0: - return result - - return self.iwstruct.getMAC(result) - - def getBitrate(self): - """returns device currently set bit rate - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getBitrate() - '11 Mb/s' - """ - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWRATE) - if i > 0: - return result - iwfreq = Iwfreq(result) - return iwfreq.getBitrate() - - def getBitrates(self): - """returns the number of available bitrates for the device - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> num, rates = wifi.getBitrates() - >>> num == len(rates) - True - """ - range = Iwrange(self.ifname) - if range.errorflag: - return (range.errorflag, range.error) - return (range.num_bitrates, range.bitrates) - - def getChannelInfo(self): - """returns the number of channels and available frequency for - the device - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> num, rates = wifi.getChannelInfo() - >>> num == len(rates) - True - """ - range = Iwrange(self.ifname) - if range.errorflag: - return (range.errorflag, range.error) - return (range.num_channels, range.frequencies) - - def getEssid(self): - """get essid information - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getEssid() - 'romanofski' - """ - essid = "" - buff, s = self.iwstruct.pack_wrq(32) - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWESSID, - data=s) - if i > 0: - return result - str = buff.tostring() - return str.strip('\x00') - - def setEssid(self, essid): - """set essid """ - raise NotImplementedError - if len(essid) > IW_ESSID_MAX_SIZE: - return "essid to big" - buff, s = self.iwstruct.pack_test(essid, 32) - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCSIWESSID, - data=s) - if i > 0: - return result - - def getEncryption(self): - """get encryption information which is probably a string of '*', - 'open', 'private' - - as a normal user, you will get a 'Operation not permitted' - error: - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getEncryption() - (1, 'Operation not permitted') - """ - iwpoint = Iwpoint(self.ifname) - if iwpoint.errorflag: - return (iwpoint.errorflag, iwpoint.error) - return iwpoint.getEncryptionKey() - - def getFragmentation(self): - """returns fragmentation threshold - - It depends on what the driver says. If you have fragmentation - threshold turned on, you'll get an int. If it's turned of - you'll get a string: 'off'. - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getFragmentation() - 'off' - """ - iwparam = Iwparam(self.ifname, SIOCGIWFRAG) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - def getFrequency(self): - """returns currently set frequency of the card - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getFrequency() - '2.417GHz' - """ - i, r = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWFREQ) - if i > 0: - return (i, r) - iwfreq = Iwfreq(r) - return iwfreq.getFrequency() - - - def getMode(self): - """returns currently set operation mode - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getMode() - 'Managed' - """ - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWMODE) - if i > 0: - return result - mode = self.iwstruct.unpack('i', result[:4])[0] - return modes[mode] - - def setMode(self, mode): - """sets the operation mode """ - try: - this_modes = [x.lower() for x in modes] - mode = mode.lower() - wifimode = this_modes.index(mode) - except ValueError: - return "Invalid operation mode!" - - s = self.iwstruct.pack('I', wifimode) - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCSIWMODE, - data=s) - if i > 0: - return result - - def getWirelessName(self): - """ returns wireless name - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getWirelessName() - 'IEEE 802.11-DS' - """ - i, result = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWNAME) - if i > 0: - return result - return result.split('\0')[0] - - def getPowermanagement(self): - """returns power management settings - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getPowermanagement() - 'off' - """ - iwparam = Iwparam(self.ifname, SIOCGIWPOWER) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - - def getRetrylimit(self): - """returns limit retry/lifetime - - man iwconfig: - Most cards have MAC retransmissions, and some allow to set - the behaviour of the retry mechanism. - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getRetrylimit() - 16 - """ - iwparam = Iwparam(self.ifname, SIOCGIWRETRY) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - def getRTS(self): - """returns rts threshold - - returns int, 'auto', 'fixed', 'off' - - man iwconfig: - RTS/CTS adds a handshake before each packet transmission to - make sure that the channel is clear. This adds overhead, but - increases performance in case of hidden nodes or a large - number of active nodes. This parameter sets the size of the - smallest packet for which the node sends RTS; a value equal - to the maximum packet size disable the mechanism. - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getRTS() - 'off' - """ - iwparam = Iwparam(self.ifname, SIOCGIWRTS) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - def getSensitivity(self): - """returns sensitivity information - - man iwconfig: - This is the lowest signal level for which the hardware - attempt packet reception, signals weaker than this are - ignored. This is used to avoid receiving background noise, - so you should set it according to the average noise - level. Positive values are assumed to be the raw value used - by the hardware or a percentage, negative values are - assumed to be dBm. - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getSensitivity() - 'off' - - """ - iwparam = Iwparam(self.ifname, SIOCGIWSENS) - if iwparam.errorflag: - return (iwparam.errorflag, iwparam.error) - return iwparam.getValue() - - def getTXPower(self): - """returns transmit power in dBm - - >>> from iwlibs import Wireless - >>> wifi = Wireless('eth1') - >>> wifi.getTXPower() - '17 dBm' - """ - i, r = self.iwstruct.iw_get_ext(self.ifname, - SIOCGIWTXPOW) - if i > 0: - return (i, r) - iwfreq = Iwfreq(r) - return iwfreq.getTransmitPower() - - def getStatistics(self): - """returns statistics information which can also be found in - /proc/net/wireless - """ - iwstats = Iwstats(self.ifname) - if iwstats.errorflag > 0: - return (iwstats.errorflag, iwstats.error) - return [iwstats.status, iwstats.qual, iwstats.discard, - iwstats.missed_beacon] - - def scan(self): - """returns Iwscanresult objects, after a successful scan""" - iwscan = Iwscan(self.ifname) - return iwscan.scan() - - -class Iwstruct(object): - """basic class to handle iwstruct data """ - - def __init__(self): - self.idx = 0 - self.sockfd = socket(AF_INET, SOCK_DGRAM) - - def parse_data(self, fmt, data): - """ unpacks raw C data """ - size = struct_calcsize(fmt) - idx = self.idx - - str = data[idx:idx + size] - self.idx = idx+size - value = struct_unpack(fmt, str) - - # take care of a tuple like (int, ) - if len(value) == 1: - return value[0] - else: - return value - - def pack(self, fmt, *args): - """ calls struct_pack and returns the result """ - return struct_pack(fmt, *args) - - def pack_wrq(self, buffsize): - """ packs wireless request data for sending it to the kernel """ - # Prepare a buffer - # We need the address of our buffer and the size for it. The - # ioctl itself looks for the pointer to the address in our - # memory and the size of it. - # Dont change the order how the structure is packed!!! - buff = array('c', '\0'*buffsize) - caddr_t, length = buff.buffer_info() - s = struct_pack('Pi', caddr_t, length) - return buff, s - - def pack_test(self, string, buffsize): - """ packs wireless request data for sending it to the kernel """ - buffsize = buffsize - len(string) - buff = array('c', string+'\0'*buffsize) - caddr_t, length = buff.buffer_info() - s = struct_pack('Pii', caddr_t, length, 1) - return buff, s - - def unpack(self, fmt, packed_data): - """ unpacks data with given format """ - return struct_unpack(fmt, packed_data) - - def _fcntl(self, request, args): - return ioctl(self.sockfd.fileno(), request, args) - - def iw_get_ext(self, ifname, request, data=None): - """ read information from ifname """ - # put some additional data behind the interface name - if data is not None: - buff = IFNAMSIZE-len(ifname) - ifreq = ifname + '\0'*buff - ifreq = ifreq + data - else: - ifreq = (ifname + '\0'*32) - - try: - result = self._fcntl(request, ifreq) - except IOError, (i, e): - return i, e - - return (0, result[16:]) - - def getMAC(self, packed_data): - """ extracts mac addr from packed data and returns it as str """ - mac_addr = struct_unpack('xxBBBBBB', packed_data[:8]) - return "%02X:%02X:%02X:%02X:%02X:%02X" % mac_addr - -class Iwparam(object): - """class to hold iwparam data """ - - def __init__(self, ifname, ioctl): - # (i) value, (b) fixed, (b) disabled, (b) flags - self.fmt = "ibbH" - self.value = 0 - self.fixed = 0 - self.disabled = 0 - self.flags = 0 - self.errorflag = 0 - self.error = "" - self.ioctl = ioctl - self.ifname = ifname - self.update() - - def getValue(self): - """returns the value if not disabled """ - - if self.disabled: - return 'off' - if self.flags & IW_RETRY_TYPE == 0: - return self.getRLAttributes() - else: - return self.getPMAttributes() - - def getRLAttributes(self): - """returns a string with attributes determined by self.flags - """ - return self.value - - def getPMAttributes(self): - """returns a string with attributes determined by self.flags - and IW_POWER* - """ - result = "" - - # Modifiers - if self.flags & IW_POWER_MIN == 0: - result = " min" - if self.flags & IW_POWER_MAX == 0: - result = " max" - - # Type - if self.flags & IW_POWER_TIMEOUT == 0: - result = " period:" - else: - result = " timeout:" - # Value with or without units - # IW_POWER_RELATIVE - value is *not* in s/ms/us - if self.flags & IW_POWER_RELATIVE: - result += "%f" %(float(self.value)/MEGA) - else: - if self.value >= MEGA: - result += "%fs" %(float(self.value)/MEGA) - elif self.value >= KILO: - result += "%fms" %(float(self.value)/KILO) - else: - result += "%dus" % self.value - - return result - - def update(self): - iwstruct = Iwstruct() - i, r = iwstruct.iw_get_ext(self.ifname, - self.ioctl) - if i > 0: - self.errorflag = i - self.error = r - self._parse(r) - - def _parse(self, data): - """ unpacks iwparam data """ - iwstruct = Iwstruct() - self.value, self.fixed, self.disabled, self.flags =\ - iwstruct.parse_data(self.fmt, data) - -class Iwfreq(object): - """ class to hold iwfreq data - delegates to Iwstruct class - """ - - def __init__(self, data=None): - self.fmt = "ihbb" - if data is not None: - self.frequency = self.parse(data) - else: - self.frequency = 0 - self.iwstruct = Iwstruct() - - def __getattr__(self, attr): - return getattr(self.iwstruct, attr) - - def parse(self, data): - """ unpacks iwparam""" - - size = struct_calcsize(self.fmt) - m, e, i, pad = struct_unpack(self.fmt, data[:size]) - # XXX well, its not *the* frequency - we need a better name - if e == 0: - return m - else: - return float(m)*10**e - - def getFrequency(self): - """returns Frequency (str) - - data - binary data returned by systemcall (iw_get_ext()) - """ - freq = self.frequency - - if freq >= GIGA: - return "%0.3fGHz" %(freq/GIGA) - - if freq >= MEGA: - return "%0.3fMHZ" %(freq/MEGA) - - if freq >= KILO: - return "%0.3fKHz" %(freq/KILO) - - def getBitrate(self): - """ returns Bitrate in Mbit - - data - binary data returned by systemcall (iw_get_ext()) - """ - bitrate = self.frequency - - if bitrate >= GIGA: - return "%i Gb/s" %(bitrate/GIGA) - - if bitrate >= MEGA: - return "%i Mb/s" %(bitrate/MEGA) - - if bitrate >= KILO: - return "%i Kb/s" %(bitrate/KILO) - - def getTransmitPower(self): - """ returns transmit power in dbm """ - # XXX something flaky is going on with m and e - # eg. m = 50 and e should than be 0, because the number is stored in - # m and don't needs to be recalculated - return "%i dBm" %self.mw2dbm(self.frequency/10) - - def getChannel(self, freq): - """returns channel information given by frequency - - returns None if frequency can't be converted - freq = frequency to convert (int) - iwrange = Iwrange object - """ - - try: - freq = float(freq) - except: - return None - - lut = {} - #13 Channels beginning at 2.412GHz and inreasing by 0,005 GHz steps - for i in range(0,12): - cur = float( 2.412 + ( i * 0.005 ) ) - lut[str(cur)] = i+1 - # Channel 14 need special actions ;) - lut['2.484'] = 14 - - - if str(freq) in lut.keys(): - return lut[str(freq)] - - return None - - - def mw2dbm(self, mwatt): - """ converts mw to dbm(float) """ - return ceil(10.0 * log10(mwatt)) - - def _setFrequency(self, list): - """sets self.frequency by given list - - currently only used by Iwrange - """ - assert len(list) == 4 - m, e, i, pad = list - if e == 0: - self.frequency = m - else: - self.frequency = m #float(m)*10**e - -class Iwstats(object): - """ class to hold iwstat data """ - - def __init__(self, ifname): - # (2B) status, 4B iw_quality, 6i iw_discarded - self.fmt = "2B4B6i" - self.status = 0 - self.qual = Iwquality() - self.discard = {} - self.missed_beacon = 0 - self.ifname = ifname - self.errorflag = 0 - self.error = "" - self.update() - - def update(self): - iwstruct = Iwstruct() - buff, s = iwstruct.pack_wrq(32) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCGIWSTATS, - data=s) - if i > 0: - self.error = result - self.errorflag = i - self._parse(buff.tostring()) - - def _parse(self, data): - """ unpacks iwstruct data """ - struct = Iwstruct() - iwqual = Iwquality() - iwstats_data = struct.parse_data(self.fmt, data) - - self.status = iwstats_data[0:2] - self.qual.quality, self.qual.sl, self.qual.nl,\ - self.qual.flags = iwstats_data[2:6] - nwid, code, frag, retries, flags = iwstats_data[6:11] - self.missed_beacon = iwstats_data[11:12][0] - self.discard = makedict(nwid=nwid, code=code, - fragment=frag, retries=retries, misc=flags) - -class Iwquality(object): - """ class to hold iwquality data """ - - def __init__(self): - self.quality = 0 - self.sl = 0 - self.nl = 0 - self.updated = 0 - self.fmt = "4B" - - def parse(self, data): - """ unpacks iwquality data """ - struct = Iwstruct() - qual, sl, nl, flags = struct.parse_data(self.fmt, data) - - # compute signal and noise level - self.signal_level = sl - self.noise_level = nl - - # asign the other values - self.quality = qual - self.updated = flags - - def setValues(self, list): - """ assigns values given by a list to our attributes """ - attributes = ["quality", "signallevel", "noise_level", - "updated"] - assert len(list) == 4 - - for i in range(len(list)): - setattr(self, attributes[i], list[i]) - - def getSignallevel(self): - """ returns signal level """ - return self.sl-0x100 - - def setSignallevel(self, sl): - """ sets signal level """ - self.sl = sl - signallevel = property(getSignallevel, setSignallevel) - - def getNoiselevel(self): - """ returns noise level """ - return self.nl - 0x100 - - def setNoiselevel(self): - raise NotImplementedError - self.nl = nl - noiselevel = property(getNoiselevel, setNoiselevel) - -class Iwpoint(object): - """ class to hold iwpoint data """ - - def __init__(self, ifname): - self.key = [0,0,0,0] - self.fields = 0 - self.flags = 0 - # (4B) pointer to data, H length, H flags - self.fmt = "4BHH" - self.errorflag = 0 - self.error = "" - self.ifname = ifname - self.update() - - def __getattr__(self, attr): - return getattr(self.iwstruct, attr) - - def update(self): - iwstruct = Iwstruct() - buff, s = iwstruct.pack_wrq(32) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCGIWENCODE, - data=s) - if i > 0: - self.errorflag = i - self.error = result - self._parse(result) - - def getEncryptionKey(self): - """ returns encryption key as '**' or 'off' as str """ - if self.flags & IW_ENCODE_DISABLED != 0: - return 'off' - elif self.flags & IW_ENCODE_NOKEY != 0: - # a key is set, so print it - return '**' * self.fields - - def _parse(self, data): - """ unpacks iwpoint data - """ - iwstruct = Iwstruct() - ptr, ptr, ptr, ptr, self.fields, self.flags =\ - iwstruct.parse_data(self.fmt, data) - self.key = [ptr, ptr, ptr, ptr] - -class Iwrange(object): - """holds iwrange struct """ - IW_MAX_FREQUENCIES = 32 - - def __init__(self, ifname): - self.fmt = "iiihb6ii4B4Bi32i2i2i2i2i3h8h2b2bhi8i2b3h2i2ihB17x"\ - + self.IW_MAX_FREQUENCIES*"ihbb" - - self.ifname = ifname - self.errorflag = 0 - self.error = "" - - # informative stuff - self.throughput = 0 - - # nwid (or domain id) - self.min_nwid = self.max_nwid = 0 - - # frequency for backward compatibility - self.old_num_channels = self.old_num_frequency = self.old_freq = 0 - - # signal level threshold - self.sensitivity = 0 - - # link quality - self.max_qual = Iwquality() - self.avg_qual = Iwquality() - - # rates - self.num_bitrates = 0 - self.bitrates = [] - - # rts threshold - self.min_rts = self.max_rts = 0 - - # fragmention threshold - self.min_frag = self.max_frag = 0 - - # power managment - self.min_pmp = self.max_pmp = 0 - self.min_pmt = self.max_pmt = 0 - self.pmp_flags = self.pmt_flags = self.pm_capa = 0 - - # encoder stuff - self.encoding_size = 0 - self.num_encoding_sizes = self.max_encoding_tokens = 0 - self.encoding_login_index = 0 - - # transmit power - self.txpower_capa = self.num_txpower = self.txpower = 0 - - # wireless extension version info - self.we_vers_compiled = self.we_vers_src = 0 - - # retry limits and lifetime - self.retry_capa = self.retry_flags = self.r_time_flags = 0 - self.min_retry = self.max_retry = 0 - self.min_r_time = self.max_r_time = 0 - - # frequency - self.num_channels = self.num_frequency = 0 - self.frequencies = [] - self.update() - - def update(self): - """updates Iwrange object by a system call to the kernel - and updates internal attributes - """ - iwstruct = Iwstruct() - buff, s = iwstruct.pack_wrq(640) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCGIWRANGE, - data=s) - if i > 0: - self.errorflag = i - self.error = result - data = buff.tostring() - self._parse(data) - - def _parse(self, data): - struct = Iwstruct() - result = struct.parse_data(self.fmt, data) - - # XXX there is maybe a much more elegant way to do this - self.throughput, self.min_nwid, self.max_nwid = result[0:3] - self.old_num_channels, self.old_num_frequency = result[3:5] - self.old_freq = result[5:11] - self.sensitivity = result[11] - self.max_qual.setValues(result[12:16]) - self.avg_qual.setValues(result[16:20]) - self.num_bitrates = result[20] # <- XXX - raw_bitrates = result[21:53] - for rate in raw_bitrates: - iwfreq = Iwfreq() - iwfreq.frequency = rate - br = iwfreq.getBitrate() - if br is not None: - self.bitrates.append(br) - - self.min_rts, self.max_rts = result[53:55] - self.min_frag, self.max_frag = result[55:57] - self.min_pmp, self.max_pmp = result[57:59] - self.min_pmt, self.max_pmt = result[59:61] - self.pmp_flags, self.pmt_flags, self.pm_capa = result[61:64] - self.encoding_size = result[64:72] - self.num_encoding_sizes, self.max_encoding_tokens = result[72:74] - self.encoding_login_index = result[74:76] - self.txpower_capa, self.num_txpower = result[76:78] - self.txpower = result[78:86] - self.we_vers_compiled, self.we_vers_src = result[86:88] - self.retry_capa, self.retry_flags, self.r_time_flags = result[88:91] - self.min_retry, self.max_retry = result[91:93] - self.min_r_time, self.max_r_time = result[93:95] - self.num_channels = result[95] - self.num_frequency = result[96] - freq = result[97:] - - i = self.num_frequency - for x in range(0, len(freq), 4): - iwfreq = Iwfreq() - iwfreq._setFrequency(freq[x:x+4]) - fq = iwfreq.getFrequency() - if fq is not None: - self.frequencies.append(fq) - i -= 1 - if i <= 0: - break - -class Iwscan(object): - """class to handle AP scanning""" - - def __init__(self, ifname): - self.ifname = ifname - self.range = Iwrange(ifname) - self.errorflag = 0 - self.error = "" - self.stream = None - self.aplist = None - - def scan(self, fullscan=True): - """Completes a scan for available access points, - and returns them in Iwscanresult format - - fullscan: If False, data is read from a cache of the last scan - If True, a scan is conducted, and then the data is read - """ - # By default everything is fine, do not wait - result = 1 - if fullscan: - self.setScan() - if self.errorflag > EPERM: - raise RuntimeError, 'setScan failure ' + str(self.errorflag) + " " + str(self.error) - return None - elif self.errorflag < EPERM: - # Permission was NOT denied, therefore we must WAIT to get results - result = 250 - - while (result > 0): - sleep(result/1000) - result = self.getScan() - - if result < 0 or self.errorflag != 0: - raise RuntimeError, 'getScan failure ' + str(self.errorflag) + " " + str(self.error) - - return self.aplist - - - def setScan(self): - """Triggers the scan, if we have permission - """ - iwstruct = Iwstruct() - s = iwstruct.pack('Pii', 0, 0, 0) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCSIWSCAN,s) - if i > 0: - self.errorflag = i - self.error = result - return result - - def getScan(self): - """Retreives results, stored from the most recent scan - Returns 0 if successful, a delay if the data isn't ready yet - or -1 if something really nasty happened - """ - iwstruct = Iwstruct() - i = E2BIG - bufflen = IW_SCAN_MAX_DATA - - # Keep resizing the buffer until it's large enough to hold the scan - while (i == E2BIG): - buff, s = iwstruct.pack_wrq(bufflen) - i, result = iwstruct.iw_get_ext(self.ifname, - SIOCGIWSCAN, - data=s) - if i == E2BIG: - pbuff, newlen = iwstruct.unpack('Pi', s) - if bufflen < newlen: - bufflen = newlen - else: - bufflen = bufflen * 2 - - if i == EAGAIN: - return 100 - if i > 0: - self.errorflag = i - self.error = result - return -1 - - pbuff, reslen = iwstruct.unpack('Pi', s) - if reslen > 0: - # Initialize the stream, and turn it into an enumerator - self.aplist = self._parse(buff.tostring()) - return 0 - - def _parse(self, data): - """Parse the event stream, and return a list of Iwscanresult objects - """ - iwstruct = Iwstruct() - scanresult = None - aplist = [] - - # Run through the stream, until broken - while 1: - # If we're the stream doesn't have enough space left for a header, break - if len(data) < IW_EV_LCP_LEN: - break; - - # Unpack the header - length, cmd = iwstruct.unpack('HH', data[:4]) - # If the header says the following data is shorter than the header, then break - if length < IW_EV_LCP_LEN: - break; - - # Put the events into their respective result data - if cmd == SIOCGIWAP: - if scanresult is not None: - aplist.append(scanresult) - scanresult = Iwscanresult(data[IW_EV_LCP_LEN:length], self.range) - elif scanresult is None: - raise RuntimeError, 'Attempting to add an event without AP data' - else: - scanresult.addEvent(cmd, data[IW_EV_LCP_LEN:length]) - - # We're finished with the preveious event - data = data[length:] - - # Don't forgset the final result - if scanresult.bssid != "00:00:00:00:00:00": - aplist.append(scanresult) - else: - raise RuntimeError, 'Attempting to add an AP without a bssid' - return aplist - -class Iwscanresult(object): - """An object to contain all the events associated with a single scanned AP - """ - - def __init__(self, data, range): - """Initialize the scan result with the access point data""" - self.iwstruct = Iwstruct() - self.range = range - self.bssid = "%02X:%02X:%02X:%02X:%02X:%02X" % struct_unpack('BBBBBB', data[2:8]) - self.essid = None - self.mode = None - self.rate = [] - self.quality = Iwquality() - self.frequency = None - self.encode = None - self.custom = [] - self.protocol = None - - def addEvent(self, cmd, data): - """Attempts to add the data from an event to a scanresult - Only certain data is accept, in which case the result is True - If the event data is invalid, None is returned - If the data is valid but unused, False is returned - """ - if cmd <= SIOCIWLAST: - if cmd < SIOCIWFIRST: - return None - elif cmd >= IWEVFIRST: - if cmd > IWEVLAST: - return None - else: - return None - - if cmd == SIOCGIWESSID: - self.essid = data[4:] - elif cmd == SIOCGIWMODE: - self.mode = modes[self.iwstruct.unpack('i', data[:4])[0]] - elif cmd == SIOCGIWRATE: - # TODO, deal with multiple rates, or at least the highest rate - freqsize = struct_calcsize("ihbb") - while len(data) >= freqsize: - iwfreq = Iwfreq(data) - self.rate.append(iwfreq.getBitrate()) - data = data[freqsize:] - elif cmd == IWEVQUAL: - self.quality.parse(data) - elif cmd == SIOCGIWFREQ: - self.frequency = Iwfreq(data) - elif cmd == SIOCGIWENCODE: - self.encode = data - elif cmd == IWEVCUSTOM: - self.custom.append(data[1:]) - elif cmd == SIOCGIWNAME: - self.protocol = data[:len(data)-2] - else: - #print "Cmd:", cmd - return False - return True \ No newline at end of file -- cgit v1.2.3 From 6be1855d457d28e25917a29f710f2401519d7160 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Sat, 24 Jul 2010 23:14:58 +0200 Subject: Enigma2-Network: update Wlan plugin to support new python-wifi. some fixes and cleanups. refs #558 --- lib/python/Components/About.py | 11 ++ lib/python/Components/Network.py | 54 ++++--- .../SystemPlugins/NetworkWizard/NetworkWizard.py | 2 +- .../Plugins/SystemPlugins/WirelessLan/Wlan.py | 179 ++++++++++----------- .../Plugins/SystemPlugins/WirelessLan/plugin.py | 73 ++++++++- lib/python/Screens/NetworkSetup.py | 68 +++++--- 6 files changed, 251 insertions(+), 136 deletions(-) mode change 100644 => 100755 lib/python/Components/About.py (limited to 'lib') diff --git a/lib/python/Components/About.py b/lib/python/Components/About.py old mode 100644 new mode 100755 index 8e332e33..6b322c9d --- a/lib/python/Components/About.py +++ b/lib/python/Components/About.py @@ -1,5 +1,6 @@ from Tools.Directories import resolveFilename, SCOPE_SYSETC from enigma import getEnigmaVersionString +from os import popen class About: def __init__(self): @@ -43,4 +44,14 @@ class About: def getEnigmaVersionString(self): return getEnigmaVersionString() + def getKernelVersionString(self): + try: + result = popen("uname -r","r").read().strip("\n").split('-') + kernel_version = result[0] + return kernel_version + except: + pass + + return "unknown" + about = About() diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index e8a3d459..e980cb8c 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -4,6 +4,7 @@ from socket import * from enigma import eConsoleAppContainer from Components.Console import Console from Components.PluginComponent import plugins +from Components.About import about from Plugins.Plugin import PluginDescriptor class Network: @@ -349,8 +350,10 @@ class Network: return _("Zydas")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") elif os_path.realpath(driverdir).endswith('rt73'): return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") + elif os_path.realpath(driverdir).endswith('rt73usb'): + return _("Ralink")+ " " + str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") else: - return _("Unknown network adapter.") + return str(os_path.basename(os_path.realpath(driverdir))) + " " + _("WLAN adapter.") else: return _("Unknown network adapter.") @@ -606,24 +609,39 @@ class Network: if callback is not None: callback(True) - def detectWlanModule(self): + def detectWlanModule(self, iface = None): self.wlanmodule = None - rt73_dir = "/sys/bus/usb/drivers/rt73/" - zd1211b_dir = "/sys/bus/usb/drivers/zd1211b/" - madwifi_dir = "/sys/bus/pci/drivers/ath_pci/" - if os_path.exists(madwifi_dir): - files = listdir(madwifi_dir) - if len(files) >= 1: - self.wlanmodule = 'madwifi' - if os_path.exists(rt73_dir): - rtfiles = listdir(rt73_dir) - if len(rtfiles) == 2 or len(rtfiles) == 5: - self.wlanmodule = 'ralink' - if os_path.exists(zd1211b_dir): - zdfiles = listdir(zd1211b_dir) - if len(zdfiles) == 1 or len(zdfiles) == 5: - self.wlanmodule = 'zydas' - return self.wlanmodule + classdir = "/sys/class/net/" + iface + "/device/" + driverdir = "/sys/class/net/" + iface + "/device/driver/" + if os_path.exists(classdir): + classfiles = listdir(classdir) + driver_found = False + nl80211_found = False + for x in classfiles: + if x == 'driver': + driver_found = True + if x.startswith('ieee80211:'): + nl80211_found = True + + if driver_found and nl80211_found: + #print about.getKernelVersionString() + self.wlanmodule = "nl80211" + else: + if driver_found and not nl80211_found: + driverfiles = listdir(driverdir) + if os_path.realpath(driverdir).endswith('ath_pci'): + if len(driverfiles) >= 1: + self.wlanmodule = 'madwifi' + if os_path.realpath(driverdir).endswith('rt73'): + if len(driverfiles) == 2 or len(driverfiles) == 5: + self.wlanmodule = 'ralink' + if os_path.realpath(driverdir).endswith('zd1211b'): + if len(driverfiles) == 1 or len(driverfiles) == 5: + self.wlanmodule = 'zydas' + if self.wlanmodule is None: + self.wlanmodule = "wext" + print 'Using "%s" as wpa-supplicant driver' % (self.wlanmodule) + return self.wlanmodule def calc_netmask(self,nmask): from struct import pack, unpack diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py index a8b34acd..d7e83072 100755 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py @@ -257,7 +257,7 @@ class NetworkWizard(WizardLanguage, Rc): text1 = _("Your Dreambox is now ready to use.\n\nYour internet connection is working now.\n\n") text2 = _('Accesspoint:') + "\t" + str(status[self.selectedInterface]["acesspoint"]) + "\n" text3 = _('SSID:') + "\t" + str(status[self.selectedInterface]["essid"]) + "\n" - text4 = _('Link Quality:') + "\t" + str(status[self.selectedInterface]["quality"])+"%" + "\n" + text4 = _('Link Quality:') + "\t" + str(status[self.selectedInterface]["quality"])+ "\n" text5 = _('Signal Strength:') + "\t" + str(status[self.selectedInterface]["signal"]) + "\n" text6 = _('Bitrate:') + "\t" + str(status[self.selectedInterface]["bitrate"]) + "\n" text7 = _('Encryption:') + " " + str(status[self.selectedInterface]["encryption"]) + "\n" diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py b/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py index 1c1471ce..baefd435 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py @@ -1,7 +1,3 @@ -#from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER -#from Components.MultiContent import MultiContentEntryText -#from Components.GUIComponent import GUIComponent -#from Components.HTMLComponent import HTMLComponent from Components.config import config, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword from Components.Console import Console @@ -10,7 +6,8 @@ from string import maketrans, strip import sys import types from re import compile as re_compile, search as re_search -from iwlibs import getNICnames, Wireless, Iwfreq +from pythonwifi.iwlibs import getNICnames, Wireless, Iwfreq, getWNICnames +from pythonwifi import flags as wififlags list = [] list.append("WEP") @@ -65,38 +62,42 @@ class Wlan: print "self.iface im iwconfigFinished",self.iface callback = extra_args data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False } - #print "result im iwconfigFinished",result for line in result.splitlines(): - #print "line",line line = line.strip() if "ESSID" in line: if "off/any" in line: ssid = _("No Connection") else: - tmpssid=(line[line.index('ESSID')+7:len(line)-1]) - if tmpssid == '': - ssid = _("Hidden networkname") - elif tmpssid ==' ': - ssid = _("Hidden networkname") + if "Nickname" in line: + tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')]) + if tmpssid == '': + ssid = _("Hidden networkname") + elif tmpssid ==' ': + ssid = _("Hidden networkname") + else: + ssid = tmpssid else: - ssid = tmpssid - #print "SSID->",ssid + tmpssid=(line[line.index('ESSID')+7:len(line)-1]) + if tmpssid == '': + ssid = _("Hidden networkname") + elif tmpssid ==' ': + ssid = _("Hidden networkname") + else: + ssid = tmpssid + if ssid is not None: data['essid'] = ssid if 'Frequency' in line: frequency = line[line.index('Frequency')+10 :line.index(' GHz')] - #print "Frequency",frequency if frequency is not None: data['frequency'] = frequency if "Access Point" in line: ap=line[line.index('Access Point')+14:len(line)-1] - #print "AP",ap if ap is not None: data['acesspoint'] = ap if "Bit Rate" in line: br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] - #print "Bitrate",br if br is not None: data['bitrate'] = br if 'Encryption key' in line: @@ -104,7 +105,6 @@ class Wlan: enc = _("Disabled") else: enc = line[line.index('Encryption key')+15 :line.index(' Security')] - #print "Encryption key",enc if enc is not None: data['encryption'] = _("Enabled") if 'Quality' in line: @@ -112,12 +112,10 @@ class Wlan: qual = line[line.index('Quality')+8:line.index('/100')] else: qual = line[line.index('Quality')+8:line.index('Sig')] - #print "Quality",qual if qual is not None: data['quality'] = qual if 'Signal level' in line: - signal = line[line.index('Signal level')+14 :line.index(' dBm')] - #print "Signal level",signal + signal = line[line.index('Signal level')+13 :line.index(' dBm')] if signal is not None: data['signal'] = signal @@ -130,7 +128,6 @@ class Wlan: callback(True,self.wlaniface) def getAdapterAttribute(self, attribute): - print "im getAdapterAttribute" if self.wlaniface.has_key(self.iface): print "self.wlaniface.has_key",self.iface if self.wlaniface[self.iface].has_key(attribute): @@ -142,13 +139,17 @@ class Wlan: def getWirelessInterfaces(self): - iwifaces = None - try: - iwifaces = getNICnames() - except: - print "[Wlan.py] No Wireless Networkcards could be found" - - return iwifaces + device = re_compile('[a-z]{2,}[0-9]*:') + ifnames = [] + + fp = open('/proc/net/wireless', 'r') + for line in fp: + try: + # append matching pattern, without the trailing colon + ifnames.append(device.search(line).group()[:-1]) + except AttributeError: + pass + return ifnames def getNetworkList(self): @@ -156,8 +157,8 @@ class Wlan: ifobj = Wireless(self.iface) # a Wireless NIC Object #Association mappings - stats, quality, discard, missed_beacon = ifobj.getStatistics() - snr = quality.signallevel - quality.noiselevel + #stats, quality, discard, missed_beacon = ifobj.getStatistics() + #snr = quality.signallevel - quality.noiselevel try: scanresults = ifobj.scan() @@ -167,55 +168,47 @@ class Wlan: if scanresults is not None: aps = {} + (num_channels, frequencies) = ifobj.getChannelInfo() + index = 1 for result in scanresults: - bssid = result.bssid - - encryption = map(lambda x: hex(ord(x)), result.encode) - - if encryption[-1] == "0x8": + + if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0: + encryption = False + elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0: encryption = True else: - encryption = False - + encryption = None + + signal = str(result.quality.siglevel-0x100) + " dBm" + quality = "%s/%s" % (result.quality.quality,ifobj.getQualityMax().quality) + extra = [] for element in result.custom: element = element.encode() extra.append( strip(self.asciify(element)) ) - - if result.quality.sl is 0 and len(extra) > 0: - begin = extra[0].find('SignalStrength=')+15 - - done = False - end = begin+1 - - while not done: - if extra[0][begin:end].isdigit(): - end += 1 - else: - done = True - end -= 1 - - signal = extra[0][begin:end] - #print "[Wlan.py] signal is:" + str(signal) + for element in extra: + print element + if 'SignalStrength' in element: + signal = element[element.index('SignalStrength')+15:element.index(',L')] + if 'LinkQuality' in element: + quality = element[element.index('LinkQuality')+12:len(element)] - else: - signal = str(result.quality.sl) - aps[bssid] = { 'active' : True, 'bssid': result.bssid, - 'channel': result.frequency.getChannel(result.frequency.getFrequency()), + 'channel': frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1, 'encrypted': encryption, 'essid': strip(self.asciify(result.essid)), 'iface': self.iface, - 'maxrate' : result.rate[-1], - 'noise' : result.quality.getNoiselevel(), - 'quality' : str(result.quality.quality), - 'signal' : signal, + 'maxrate' : ifobj._formatBitrate(result.rate[-1][-1]), + 'noise' : '',#result.quality.nlevel-0x100, + 'quality' : str(quality), + 'signal' : str(signal), 'custom' : extra, } - print aps[bssid] + #print "GOT APS ENTRY:",aps[bssid] + index = index + 1 return aps @@ -226,12 +219,11 @@ class Wlan: self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))) except: self.channel = 0 - #print ifobj.getStatistics() status = { - 'BSSID': str(ifobj.getAPaddr()), + 'BSSID': str(ifobj.getAPaddr()), #ifobj.getStatistics() 'ESSID': str(ifobj.getEssid()), - 'quality': str(ifobj.getStatistics()[1].quality), - 'signal': str(ifobj.getStatistics()[1].sl), + 'quality': "%s/%s" % (ifobj.getStatistics()[1].quality,ifobj.getQualityMax().quality), + 'signal': str(ifobj.getStatistics()[1].siglevel-0x100) + " dBm", 'bitrate': str(ifobj.getBitrate()), 'channel': str(self.channel), #'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))), @@ -326,7 +318,6 @@ class wpaSupplicant: essid = split[1][1:-1] elif split[0] == 'proto': - print "split[1]",split[1] config.plugins.wlan.encryption.enabled.value = True if split[1] == "WPA" : mode = 'WPA' @@ -354,12 +345,9 @@ class wpaSupplicant: else: config.plugins.wlan.encryption.wepkeytype.value = 'HEX' config.plugins.wlan.encryption.psk.value = split[1] - print "[Wlan.py] Got Encryption: WEP - keytype is: "+config.plugins.wlan.encryption.wepkeytype.value - print "[Wlan.py] Got Encryption: WEP - key0 is: "+config.plugins.wlan.encryption.psk.value elif split[0] == 'psk': config.plugins.wlan.encryption.psk.value = split[1][1:-1] - print "[Wlan.py] Got PSK: "+split[1][1:-1] else: pass @@ -436,24 +424,30 @@ class Status: if "off/any" in line: ssid = _("No Connection") else: - tmpssid=(line[line.index('ESSID')+7:len(line)-1]) - if tmpssid == '': - ssid = _("Hidden networkname") - elif tmpssid ==' ': - ssid = _("Hidden networkname") + if "Nickname" in line: + tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')]) + if tmpssid == '': + ssid = _("Hidden networkname") + elif tmpssid ==' ': + ssid = _("Hidden networkname") + else: + ssid = tmpssid else: - ssid = tmpssid - #print "SSID->",ssid + tmpssid=(line[line.index('ESSID')+7:len(line)-1]) + if tmpssid == '': + ssid = _("Hidden networkname") + elif tmpssid ==' ': + ssid = _("Hidden networkname") + else: + ssid = tmpssid if ssid is not None: data['essid'] = ssid if 'Frequency' in line: frequency = line[line.index('Frequency')+10 :line.index(' GHz')] - #print "Frequency",frequency if frequency is not None: data['frequency'] = frequency if "Access Point" in line: ap=line[line.index('Access Point')+14:len(line)] - #print "AP",ap if ap is not None: data['acesspoint'] = ap if ap == "Not-Associated": @@ -467,7 +461,6 @@ class Status: br += " Mb/s" else: br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] + " Mb/s" - #print "Bitrate",br if br is not None: data['bitrate'] = br if 'Encryption key' in line: @@ -480,28 +473,30 @@ class Status: enc = line[line.index('Encryption key')+15 :line.index(' Security')] if enc is not None: enc = _("Enabled") - #print "Encryption key",enc if enc is not None: data['encryption'] = enc if 'Quality' in line: if "/100" in line: - qual = line[line.index('Quality')+8:line.index('/100')] + #qual = line[line.index('Quality')+8:line.index('/100')] + qual = line[line.index('Quality')+8:line.index(' Signal')] else: qual = line[line.index('Quality')+8:line.index('Sig')] - #print "Quality",qual if qual is not None: data['quality'] = qual if 'Signal level' in line: if "dBm" in line: - signal = line[line.index('Signal level')+14 :line.index(' dBm')] + signal = line[line.index('Signal level')+13 :line.index(' dBm')] signal += " dBm" elif "/100" in line: - signal = line[line.index('Signal level')+13:line.index('/100 Noise')] - signal += "%" + if "Noise" in line: + signal = line[line.index('Signal level')+13:line.index(' Noise')] + else: + signal = line[line.index('Signal level')+13:len(line)] else: - signal = line[line.index('Signal level')+13:line.index(' Noise')] - signal += "%" - #print "Signal level",signal + if "Noise" in line: + signal = line[line.index('Signal level')+13:line.index(' Noise')] + else: + signal = line[line.index('Signal level')+13:len(line)] if signal is not None: data['signal'] = signal @@ -515,12 +510,10 @@ class Status: callback(True,self.wlaniface) def getAdapterAttribute(self, iface, attribute): - print "im getAdapterAttribute" self.iface = iface if self.wlaniface.has_key(self.iface): - print "self.wlaniface.has_key",self.iface if self.wlaniface[self.iface].has_key(attribute): return self.wlaniface[self.iface][attribute] return None -iStatus = Status() \ No newline at end of file +iStatus = Status() diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 2df5814c..28ee363e 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -1,4 +1,4 @@ -from enigma import eTimer +from enigma import eTimer, eTPM from Screens.Screen import Screen from Components.ActionMap import ActionMap, NumberActionMap from Components.Pixmap import Pixmap,MultiPixmap @@ -14,7 +14,9 @@ from Plugins.Plugin import PluginDescriptor from os import system, path as os_path, listdir from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE from Tools.LoadPixmap import LoadPixmap +from Tools.HardwareInfo import HardwareInfo from Wlan import Wlan, wpaSupplicant, iStatus +import sha plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan" @@ -122,7 +124,7 @@ class WlanStatus(Screen): if status is not None: self["BSSID"].setText(status[self.iface]["acesspoint"]) self["ESSID"].setText(status[self.iface]["essid"]) - self["quality"].setText(status[self.iface]["quality"]+"%") + self["quality"].setText(status[self.iface]["quality"]) self["signal"].setText(status[self.iface]["signal"]) self["bitrate"].setText(status[self.iface]["bitrate"]) self["enc"].setText(status[self.iface]["encryption"]) @@ -373,6 +375,45 @@ class WlanScan(Screen): return self.WlanList +def bin2long(s): + return reduce( lambda x,y:(x<<8L)+y, map(ord, s)) + +def long2bin(l): + res = "" + for byte in range(128): + res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff) + return res + +def rsa_pub1024(src, mod): + return long2bin(pow(bin2long(src), 65537, bin2long(mod))) + +def decrypt_block(src, mod): + if len(src) != 128 and len(src) != 202: + return None + dest = rsa_pub1024(src[:128], mod) + hash = sha.new(dest[1:107]) + if len(src) == 202: + hash.update(src[131:192]) + result = hash.digest() + if result == dest[107:127]: + return dest + return None + +def validate_cert(cert, key): + buf = decrypt_block(cert[8:], key) + if buf is None: + return None + return buf[36:107] + cert[139:196] + +def read_random(): + try: + fd = open("/dev/urandom", "r") + buf = fd.read(8) + fd.close() + return buf + except: + return None + def WlanStatusScreenMain(session, iface): session.open(WlanStatus, iface) @@ -387,8 +428,32 @@ def callFunction(iface): def configStrings(iface): - driver = iNetwork.detectWlanModule() - print "Found WLAN-Driver:",driver + hardware_info = HardwareInfo() + if hardware_info.device_name != "dm7025": + rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] + etpm = eTPM() + l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) + if l2cert is None: + return + l2key = validate_cert(l2cert, rootkey) + if l2key is None: + return + l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) + if l3cert is None: + print "better run the genuine dreambox plugin" + return + l3key = validate_cert(l3cert, l2key) + if l3key is None: + return + rnd = read_random() + if rnd is None: + return + val = etpm.challenge(rnd) + result = decrypt_block(val, l3key) + if hardware_info.device_name == "dm7025" or result[80:88] == rnd: + driver = iNetwork.detectWlanModule(iface) + else: + driver = 'dreambox' if driver in ('ralink', 'zydas'): return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate" else: diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index 2e33ac3b..de2fa993 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -745,14 +745,21 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if self.iface in iNetwork.wlan_interfaces: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan - from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless + from pythonwifi.iwlibs import Wireless except ImportError: self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 ) else: ifobj = Wireless(self.iface) # a Wireless NIC Object - self.wlanresponse = ifobj.getStatistics() - if self.wlanresponse[0] != 19: # Wlan Interface found. - self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup,self.iface) + try: + self.wlanresponse = ifobj.getAPaddr() + except IOError: + self.wlanresponse = ifobj.getStatistics() + if self.wlanresponse: + if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported' + self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup,self.iface) + else: + # Display Wlan not available Message + self.showErrorMessage() else: # Display Wlan not available Message self.showErrorMessage() @@ -765,28 +772,42 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if self["menulist"].getCurrent()[1] == 'scanwlan': try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanScan - from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless + from pythonwifi.iwlibs import Wireless except ImportError: self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 ) else: ifobj = Wireless(self.iface) # a Wireless NIC Object - self.wlanresponse = ifobj.getStatistics() - if self.wlanresponse[0] != 19: - self.session.openWithCallback(self.WlanScanClosed, WlanScan, self.iface) + try: + self.wlanresponse = ifobj.getAPaddr() + except IOError: + self.wlanresponse = ifobj.getStatistics() + if self.wlanresponse: + if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported' + self.session.openWithCallback(self.WlanScanClosed, WlanScan, self.iface) + else: + # Display Wlan not available Message + self.showErrorMessage() else: # Display Wlan not available Message self.showErrorMessage() if self["menulist"].getCurrent()[1] == 'wlanstatus': try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus - from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless + from pythonwifi.iwlibs import Wireless except ImportError: self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 ) else: ifobj = Wireless(self.iface) # a Wireless NIC Object - self.wlanresponse = ifobj.getStatistics() - if self.wlanresponse[0] != 19: - self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) + try: + self.wlanresponse = ifobj.getAPaddr() + except IOError: + self.wlanresponse = ifobj.getStatistics() + if self.wlanresponse: + if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported' + self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) + else: + # Display Wlan not available Message + self.showErrorMessage() else: # Display Wlan not available Message self.showErrorMessage() @@ -898,14 +919,21 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if ret[0] == 'ok' and (self.iface in iNetwork.wlan_interfaces) and iNetwork.getAdapterAttribute(self.iface, "up") is True: try: from Plugins.SystemPlugins.WirelessLan.plugin import WlanStatus - from Plugins.SystemPlugins.WirelessLan.iwlibs import Wireless + from pythonwifi.iwlibs import Wireless except ImportError: self.session.open(MessageBox, _("The wireless LAN plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 ) else: ifobj = Wireless(self.iface) # a Wireless NIC Object - self.wlanresponse = ifobj.getStatistics() - if self.wlanresponse[0] != 19: - self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) + try: + self.wlanresponse = ifobj.getAPaddr() + except IOError: + self.wlanresponse = ifobj.getStatistics() + if self.wlanresponse: + if self.wlanresponse[0] not in (19,95): # 19 = 'No such device', 95 = 'Operation not supported' + self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface) + else: + # Display Wlan not available Message + self.showErrorMessage() else: # Display Wlan not available Message self.showErrorMessage() @@ -916,7 +944,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def WlanStatusClosed(self, *ret): if ret is not None and len(ret): - from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus iStatus.stopWlanConsole() self.updateStatusbar() @@ -924,7 +952,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): if ret[0] is not None: self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,ret[0],ret[1]) else: - from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus iStatus.stopWlanConsole() self.updateStatusbar() @@ -1335,7 +1363,7 @@ class NetworkAdapterTest(Screen): def getLinkState(self,iface): if iface in iNetwork.wlan_interfaces: try: - from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus except: self["Network"].setForegroundColorNum(1) self["Network"].setText(_("disconnected")) @@ -1417,7 +1445,7 @@ class NetworkAdapterTest(Screen): iNetwork.stopLinkStateConsole() iNetwork.stopDNSConsole() try: - from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status + from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus except ImportError: pass else: -- cgit v1.2.3 From ba702c42bfa54324396f2ef9c61d0bbe4a8a135b Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Aug 2010 11:06:49 +0200 Subject: lib/python/Components/VolumeControl.py: make the VolumeControl instance global accessible and add a singleton check --- lib/python/Components/VolumeControl.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index 19fb90d7..eef74d0e 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -5,6 +5,8 @@ from Screens.Mute import Mute from GlobalActions import globalActionMap from config import config, ConfigSubsection, ConfigInteger +instance = None + profile("VolumeControl") #TODO .. move this to a own .py file class VolumeControl: @@ -12,10 +14,14 @@ class VolumeControl: a corresponding dialog""" def __init__(self, session): global globalActionMap + global instance globalActionMap.actions["volumeUp"]=self.volUp globalActionMap.actions["volumeDown"]=self.volDown globalActionMap.actions["volumeMute"]=self.volMute + assert not instance, "only one VolumeControl instance is allowed!" + instance = self + config.audio = ConfigSubsection() config.audio.volume = ConfigInteger(default = 100, limits = (0, 100)) -- cgit v1.2.3 From 83ca71426637db994d49662a00f1388ba6394dca Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 5 Aug 2010 11:15:00 +0200 Subject: lib/python/Components/VolumeControl.py: move instance to class --- lib/python/Components/VolumeControl.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index eef74d0e..38102926 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -5,22 +5,20 @@ from Screens.Mute import Mute from GlobalActions import globalActionMap from config import config, ConfigSubsection, ConfigInteger -instance = None - profile("VolumeControl") #TODO .. move this to a own .py file class VolumeControl: + instance = None """Volume control, handles volUp, volDown, volMute actions and display a corresponding dialog""" def __init__(self, session): global globalActionMap - global instance globalActionMap.actions["volumeUp"]=self.volUp globalActionMap.actions["volumeDown"]=self.volDown globalActionMap.actions["volumeMute"]=self.volMute - assert not instance, "only one VolumeControl instance is allowed!" - instance = self + assert not VolumeControl.instance, "only one VolumeControl instance is allowed!" + VolumeControl.instance = self config.audio = ConfigSubsection() config.audio.volume = ConfigInteger(default = 100, limits = (0, 100)) -- cgit v1.2.3 From 91ad4707b3a64d8d166e0c1976977ba85ea29a70 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 10 Aug 2010 13:45:17 +0200 Subject: re-commit new NFIFlash plugin (bug #480) --- .../SystemPlugins/NFIFlash/dm8000_writenand | Bin 71669 -> 0 bytes .../Plugins/SystemPlugins/NFIFlash/downloader.py | 1216 ++++++++++---------- .../Plugins/SystemPlugins/NFIFlash/flasher.py | 324 ++---- .../Plugins/SystemPlugins/NFIFlash/mywritenand | Bin 71626 -> 0 bytes .../Plugins/SystemPlugins/NFIFlash/plugin.py | 23 +- 5 files changed, 747 insertions(+), 816 deletions(-) delete mode 100755 lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand delete mode 100755 lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand b/lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand deleted file mode 100755 index bd02d8fe..00000000 Binary files a/lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand and /dev/null differ diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 6463f179..c0094cc1 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -1,72 +1,209 @@ # -*- coding: utf-8 -*- -from Components.MenuList import MenuList +from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox +from Screens.HelpMenu import HelpableScreen +from Screens.TaskView import JobView +from Components.About import about from Components.ActionMap import ActionMap from Components.Sources.StaticText import StaticText -from Components.Sources.Progress import Progress +from Components.Sources.List import List from Components.Label import Label from Components.FileList import FileList +from Components.MenuList import MenuList from Components.MultiContent import MultiContentEntryText from Components.ScrollLabel import ScrollLabel +from Components.Harddisk import harddiskmanager +from Components.Task import Task, Job, job_manager, Condition from Tools.Directories import fileExists from Tools.HardwareInfo import HardwareInfo -from enigma import eConsoleAppContainer, eListbox, gFont, eListboxPythonMultiContent, \ - RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, eRect, eTimer -from os import system, remove -import re -import urllib from Tools.Downloader import downloadWithProgress +from enigma import eConsoleAppContainer, gFont, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, eTimer +from os import system, path, access, stat, remove, W_OK, R_OK from twisted.web import client from twisted.internet import reactor, defer from twisted.python import failure -from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier - -class UserRequestedCancel(Exception): - pass - -class Feedlist(MenuList): - def __init__(self, list=[], enableWrapAround = False): - MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) - self.l.setFont(0, gFont("Regular", 16)) - self.l.setItemHeight(22) - - def clear(self): - del self.list[:] - self.l.setList(self.list) - - def getNFIname(self): - l = self.l.getCurrentSelection() - return l and l[0][0] - - def getNFIurl(self): - l = self.l.getCurrentSelection() - return l and l[0][1] - - def getNFOname(self): - l = self.l.getCurrentSelection() - return l and l[0][0][:-3]+"nfo" - - def getNFOurl(self): - l = self.l.getCurrentSelection() - return l and l[0][1][:-3]+"nfo" +import re - def isValid(self): - l = self.l.getCurrentSelection() - if not l or l[0] == 0: - return False +class ImageDownloadJob(Job): + def __init__(self, url, filename, device=None, mountpoint="/"): + Job.__init__(self, _("Download .NFI-Files for USB-Flasher")) + if device: + MountTask(self, device, mountpoint) + ImageDownloadTask(self, url, mountpoint+filename) + ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo") + if device: + UmountTask(self, mountpoint) + + def retry(self): + self.tasks[0].args += self.tasks[0].retryargs + Job.retry(self) + +class MountTask(Task): + def __init__(self, job, device, mountpoint): + Task.__init__(self, job, ("mount")) + self.setTool("mount") + self.args += [device, mountpoint, "-orw,sync"] + self.weighting = 1 + + def processOutput(self, data): + print "[MountTask] output:", data + +class UmountTask(Task): + def __init__(self, job, mountpoint): + Task.__init__(self, job, ("mount")) + self.setTool("umount") + self.args += [mountpoint] + self.weighting = 1 + +class DownloaderPostcondition(Condition): + def check(self, task): + return task.returncode == 0 + + def getErrorMessage(self, task): + return self.error_message + +class ImageDownloadTask(Task): + def __init__(self, job, url, path): + Task.__init__(self, job, _("Downloading")) + self.postconditions.append(DownloaderPostcondition()) + self.job = job + self.url = url + self.path = path + self.error_message = "" + self.last_recvbytes = 0 + self.error_message = None + + def run(self, callback): + self.callback = callback + self.download = downloadWithProgress(self.url,self.path) + self.download.addProgress(self.download_progress) + self.download.start().addCallback(self.download_finished).addErrback(self.download_failed) + print "[ImageDownloadTask] downloading", self.url, "to", self.path + + def download_progress(self, recvbytes, totalbytes): + #print "[update_progress] recvbytes=%d, totalbytes=%d" % (recvbytes, totalbytes) + if ( recvbytes - self.last_recvbytes ) > 10000: # anti-flicker + self.progress = int(100*(float(recvbytes)/float(totalbytes))) + self.name = _("Downloading") + ' ' + "%d of %d kBytes" % (recvbytes/1024, totalbytes/1024) + self.last_recvbytes = recvbytes + + def download_failed(self, failure_instance=None, error_message=""): + self.error_message = error_message + if error_message == "" and failure_instance is not None: + self.error_message = failure_instance.getErrorMessage() + print "[download_failed]", self.error_message + Task.processFinished(self, 1) + + def download_finished(self, string=""): + print "[download_finished]", string + Task.processFinished(self, 0) + +class StickWizardJob(Job): + def __init__(self, path): + Job.__init__(self, _("USB stick wizard")) + self.path = path + self.device = path + while self.device[-1:] == "/" or self.device[-1:].isdigit(): + self.device = self.device[:-1] + + box = HardwareInfo().get_device_name() + url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s.tar.bz2" % box + self.downloadfilename = "/tmp/dreambox-nfiflasher-%s.tar.bz2" % box + self.imagefilename = "/tmp/nfiflash_%s.img" % box + #UmountTask(self, device) + PartitionTask(self) + ImageDownloadTask(self, url, self.downloadfilename) + UnpackTask(self) + CopyTask(self) + +class PartitionTaskPostcondition(Condition): + def check(self, task): + return task.returncode == 0 + + def getErrorMessage(self, task): + return { + task.ERROR_BLKRRPART: ("Device or resource busy"), + task.ERROR_UNKNOWN: (task.errormsg) + }[task.error] + +class PartitionTask(Task): + ERROR_UNKNOWN, ERROR_BLKRRPART = range(2) + def __init__(self, job): + Task.__init__(self, job, ("partitioning")) + self.postconditions.append(PartitionTaskPostcondition()) + self.job = job + self.setTool("sfdisk") + self.args += [self.job.device] + self.weighting = 10 + self.initial_input = "0 - 0x6 *\n;\n;\n;\ny" + self.errormsg = "" + + def run(self, callback): + Task.run(self, callback) + + def processOutput(self, data): + print "[PartitionTask] output:", data + if data.startswith("BLKRRPART:"): + self.error = self.ERROR_BLKRRPART else: - return True + self.error = self.ERROR_UNKNOWN + self.errormsg = data + +class UnpackTask(Task): + def __init__(self, job): + Task.__init__(self, job, ("Unpacking USB flasher image...")) + self.job = job + self.setTool("tar") + self.args += ["-xjvf", self.job.downloadfilename] + self.weighting = 80 + self.end = 80 + self.delayTimer = eTimer() + self.delayTimer.callback.append(self.progress_increment) + + def run(self, callback): + Task.run(self, callback) + self.delayTimer.start(1000, False) + + def progress_increment(self): + self.progress += 1 + + def processOutput(self, data): + print "[UnpackTask] output: \'%s\'" % data + self.job.imagefilename = data + + def afterRun(self): + self.delayTimer.callback.remove(self.progress_increment) + +class CopyTask(Task): + def __init__(self, job): + Task.__init__(self, job, ("Copying USB flasher boot image to stick...")) + self.job = job + self.setTool("dd") + self.args += ["if=%s" % self.job.imagefilename, "of=%s1" % self.job.device] + self.weighting = 20 + self.end = 20 + self.delayTimer = eTimer() + self.delayTimer.callback.append(self.progress_increment) + + def run(self, callback): + Task.run(self, callback) + self.delayTimer.start(100, False) + + def progress_increment(self): + self.progress += 1 + + def processOutput(self, data): + print "[CopyTask] output:", data - def moveSelection(self,idx=0): - if self.instance is not None: - self.instance.moveSelectionTo(idx) + def afterRun(self): + self.delayTimer.callback.remove(self.progress_increment) class NFOViewer(Screen): skin = """ - - + + """ def __init__(self, session, nfo): @@ -80,206 +217,37 @@ class NFOViewer(Screen): "ok": self.exit, "cancel": self.exit, "down": self.pageDown, - "up": self.pageUp + "up": self.pageUp }) def pageUp(self): self["changelog"].pageUp() def pageDown(self): self["changelog"].pageDown() - + def exit(self): self.close(False) -class NFIDownload(Screen): - LIST_SOURCE = 1 - LIST_DEST = 2 - skin = """ - - - - - - - - - - - - - - - - - - - - - - """ - - def __init__(self, session, destdir="/tmp/"): - self.skin = NFIDownload.skin - Screen.__init__(self, session) - - self["job_progressbar"] = Progress() - self["job_progresslabel"] = StaticText() - - self["infolabel"] = StaticText() - self["statusbar"] = StaticText() - self["label_top"] = StaticText() - self["label_bottom"] = StaticText() - self["path_bottom"] = StaticText() - - self["key_green"] = StaticText() - self["key_yellow"] = StaticText() - self["key_blue"] = StaticText() - - self["key_red"] = StaticText() - - self["feedlist"] = Feedlist([0,(eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, "feed not available")]) - self["destlist"] = FileList(destdir, showDirectories = True, showFiles = False) - self["destlist"].hide() - - self.download_container = eConsoleAppContainer() - self.nfo = "" - self.nfofile = "" - self.feedhtml = "" - self.focus = None - self.download = None - self.box = HardwareInfo().get_device_name() - self.feed_base = "http://www.dreamboxupdate.com/opendreambox/1.5/%s/images/" % self.box - self.nfi_filter = "" # "release" # only show NFIs containing this string, or all if "" - self.wizard_mode = False - - self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "EPGSelectActions"], - { - "cancel": self.closeCB, - "red": self.closeCB, - "green": self.nfi_download, - "yellow": self.switchList, - "blue": self.askCreateUSBstick, - "prevBouquet": self.switchList, - "nextBouquet": self.switchList, - "ok": self.ok, - "left": self.left, - "right": self.right, - "up": self.up, - "upRepeated": self.up, - "downRepeated": self.down, - "down": self.down - }, -1) - - self.feed_download() - - def downloading(self, state=True): - if state is True: - self["key_red"].text = _("Cancel") - self["key_green"].text = "" - self["key_yellow"].text = "" - self["key_blue"].text = "" - else: - self.download = None - self["key_red"].text = _("Exit") - if self["feedlist"].isValid(): - self["key_green"].text = (_("Download")) - if self.focus is self.LIST_SOURCE: - self["key_yellow"].text = (_("Change dir.")) - else: - self["key_yellow"].text = (_("Select image")) - self["key_blue"].text = (_("USB stick wizard")) - - def switchList(self,to_where=None): - if self.download or not self["feedlist"].isValid(): - return - - self["job_progressbar"].value = 0 - self["job_progresslabel"].text = "" - - if to_where is None: - if self.focus is self.LIST_SOURCE: - to_where = self.LIST_DEST - if self.focus is self.LIST_DEST: - to_where = self.LIST_SOURCE - - if to_where is self.LIST_DEST: - self.focus = self.LIST_DEST - self["statusbar"].text = _("Please select target directory or medium") - self["label_top"].text = _("choose destination directory")+":" - self["feedlist"].hide() - self["destlist"].show() - self["label_bottom"].text = _("Selected source image")+":" - self["path_bottom"].text = str(self["feedlist"].getNFIname()) - self["key_yellow"].text = (_("Select image")) - - elif to_where is self.LIST_SOURCE: - self.focus = self.LIST_SOURCE - self["statusbar"].text = _("Please choose .NFI image file from feed server to download") - self["label_top"].text = _("select image from server")+":" - self["feedlist"].show() - self["destlist"].hide() - self["label_bottom"].text = _("Destination directory")+":" - self["path_bottom"].text = str(self["destlist"].getCurrentDirectory()) - self["key_yellow"].text = (_("Change dir.")) - - def up(self): - if self.download: - return - if self.focus is self.LIST_SOURCE: - self["feedlist"].up() - self.nfo_download() - if self.focus is self.LIST_DEST: - self["destlist"].up() - - def down(self): - if self.download: - return - if self.focus is self.LIST_SOURCE: - self["feedlist"].down() - self.nfo_download() - if self.focus is self.LIST_DEST: - self["destlist"].down() - - def left(self): - if self.download: - return - if self.focus is self.LIST_SOURCE: - self["feedlist"].pageUp() - self.nfo_download() - if self.focus is self.LIST_DEST: - self["destlist"].pageUp() - - def right(self): - if self.download: - return - if self.focus is self.LIST_SOURCE: - self["feedlist"].pageDown() - self.nfo_download() - if self.focus is self.LIST_DEST: - self["destlist"].pageDown() - - def ok(self): - if self.focus is self.LIST_SOURCE and self.nfo: - self.session.open(NFOViewer, self.nfo) - if self.download: - return - if self.focus is self.LIST_DEST: - if self["destlist"].canDescent(): - self["destlist"].descent() - - def feed_download(self): - self.downloading(True) - self.download = self.feed_download - client.getPage(self.feed_base).addCallback(self.feed_finished).addErrback(self.feed_failed) +class feedDownloader: + def __init__(self, feed_base, box, OE_vers): + print "[feedDownloader::init] feed_base=%s, box=%s" % (feed_base, box) + self.feed_base = feed_base + self.OE_vers = OE_vers + self.box = box + + def getList(self, callback, errback): + self.urlbase = "%s/%s/%s/images/" % (self.feed_base, self.OE_vers, self.box) + print "[getList]", self.urlbase + self.callback = callback + self.errback = errback + client.getPage(self.urlbase).addCallback(self.feed_finished).addErrback(self.feed_failed) def feed_failed(self, failure_instance): - print "[feed_failed] " + str(failure_instance) - self["infolabel"].text = _("Could not connect to Dreambox .NFI Image Feed Server:") + "\n" + failure_instance.getErrorMessage() + "\n\n" + _("Please check your network settings!") - self.downloading(False) + print "[feed_failed]", str(failure_instance) + self.errback(failure_instance.getErrorMessage()) def feed_finished(self, feedhtml): - print "[feed_finished] " + str(feedhtml) - self.downloading(False) + print "[feed_finished]" fileresultmask = re.compile(".*?)[\'\"]>(?P.*?.nfi)", re.DOTALL) searchresults = fileresultmask.finditer(feedhtml) fileresultlist = [] @@ -287,378 +255,472 @@ class NFIDownload(Screen): for x in searchresults: url = x.group("url") if url[0:7] != "http://": - url = self.feed_base + x.group("url") + url = self.urlbase + x.group("url") name = x.group("name") - if name.find(self.nfi_filter) > -1: - entry = [[name, url],(eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, name)] - print "adding to feedlist: " + str(entry) - fileresultlist.append(entry) - else: - print "NOT adding to feedlist: " + name - self["feedlist"].l.setList(fileresultlist) - self["feedlist"].moveSelection(0) + entry = (name, url) + fileresultlist.append(entry) + self.callback(fileresultlist, self.OE_vers) - if len(fileresultlist) > 0: - self.switchList(self.LIST_SOURCE) - self.nfo_download() - else: - self["infolabel"].text = _("Cannot parse feed directory") - - def nfo_download(self): - print "[check_for_NFO]" - if self["feedlist"].isValid(): - print "nfiname: " + self["feedlist"].getNFIname() - self["job_progressbar"].value = 0 - self["job_progresslabel"].text = "" - if self["feedlist"].getNFIurl() is None: - self["key_green"].text = "" - return - self["key_green"].text = _("Download") - nfourl = self["feedlist"].getNFOurl() - print "downloading " + nfourl - self.download = self.nfo_download - self.downloading(True) - client.getPage(nfourl).addCallback(self.nfo_finished).addErrback(self.nfo_failed) - self["statusbar"].text = ("Downloading image description...") +class DeviceBrowser(Screen, HelpableScreen): + skin = """ + + + + + + + + """ - def nfo_failed(self, failure_instance): - print "[nfo_failed] " + str(failure_instance) - self["infolabel"].text = _("No details for this image file") + "\n" + self["feedlist"].getNFIname() - self["statusbar"].text = "" - self.nfofilename = "" - self.nfo = "" - self.downloading(False) + def __init__(self, session, startdir, message="", showDirectories = True, showFiles = True, showMountpoints = True, matchingPattern = "", useServiceRef = False, inhibitDirs = False, inhibitMounts = False, isTop = False, enableWrapAround = False, additionalExtensions = None): + Screen.__init__(self, session) - def nfo_finished(self,nfodata=""): - print "[nfo_finished] " + str(nfodata) - self.downloading(False) - self.nfo = nfodata - if self.nfo != "": - self.nfofilename = self["destlist"].getCurrentDirectory() + '/' + self["feedlist"].getNFOname() - self["infolabel"].text = self.nfo - else: - self.nfofilename = "" - self["infolabel"].text = _("No details for this image file") - self["statusbar"].text = _("Press OK to view full changelog") - - def nfi_download(self): - if self["destlist"].getCurrentDirectory() is None: - self.switchList(self.LIST_TARGET) - if self["feedlist"].isValid(): - url = self["feedlist"].getNFIurl() - self.nfilocal = self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname() - print "[nfi_download] downloading %s to %s" % (url, self.nfilocal) - self.download = downloadWithProgress(url,self.nfilocal) - self.download.addProgress(self.nfi_progress) - self["job_progressbar"].range = 1000 - self.download.start().addCallback(self.nfi_finished).addErrback(self.nfi_failed) - self.downloading(True) - - def nfi_progress(self, recvbytes, totalbytes): - #print "[update_progress] recvbytes=%d, totalbytes=%d" % (recvbytes, totalbytes) - self["job_progressbar"].value = int(1000*recvbytes/float(totalbytes)) - self["job_progresslabel"].text = "%d of %d kBytes (%.2f%%)" % (recvbytes/1024, totalbytes/1024, 100*recvbytes/float(totalbytes)) + HelpableScreen.__init__(self) - def nfi_failed(self, failure_instance=None, error_message=""): - if error_message == "" and failure_instance is not None: - error_message = failure_instance.getErrorMessage() - print "[nfi_failed] " + error_message - if fileExists(self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname()): - message = "%s %s\n%s" % (_(".NFI Download failed:"), error_message, _("Remove the incomplete .NFI file?")) - self.session.openWithCallback(self.nfi_remove, MessageBox, message, MessageBox.TYPE_YESNO) + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText() + self["message"] = StaticText(message) + + self.filelist = FileList(startdir, showDirectories = showDirectories, showFiles = showFiles, showMountpoints = showMountpoints, matchingPattern = matchingPattern, useServiceRef = useServiceRef, inhibitDirs = inhibitDirs, inhibitMounts = inhibitMounts, isTop = isTop, enableWrapAround = enableWrapAround, additionalExtensions = additionalExtensions) + self["filelist"] = self.filelist + + self["FilelistActions"] = ActionMap(["SetupActions", "ColorActions"], + { + "green": self.use, + "red": self.exit, + "ok": self.ok, + "cancel": self.exit + }) + + hotplugNotifier.append(self.hotplugCB) + self.onShown.append(self.updateButton) + self.onClose.append(self.removeHotplug) + + def hotplugCB(self, dev, action): + print "[hotplugCB]", dev, action + self.updateButton() + + def updateButton(self): + + if self["filelist"].getFilename() or self["filelist"].getCurrentDirectory(): + self["key_green"].text = _("Use") else: - message = "%s %s" % (_(".NFI Download failed:"),error_message) - self.session.open(MessageBox, message, MessageBox.TYPE_ERROR) - self.downloading(False) + self["key_green"].text = "" + + def removeHotplug(self): + print "[removeHotplug]" + hotplugNotifier.remove(self.hotplugCB) - def nfi_finished(self, string=""): - print "[nfi_finished] " + str(string) - if self.nfo != "": - self.nfofilename = self["destlist"].getCurrentDirectory() + '/' + self["feedlist"].getNFOname() - nfofd = open(self.nfofilename, "w") - if nfofd: - nfofd.write(self.nfo) - nfofd.close() - else: - print "couldn't save nfo file " + self.nfofilename - - pos = self.nfo.find("MD5:") - if pos > 0 and len(self.nfo) >= pos+5+32: - self["statusbar"].text = ("Please wait for md5 signature verification...") - cmd = "md5sum -c -" - md5 = self.nfo[pos+5:pos+5+32] + " " + self.nfilocal - print cmd, md5 - self.download_container.setCWD(self["destlist"].getCurrentDirectory()) - self.download_container.appClosed.append(self.md5finished) - self.download_container.execute(cmd) - self.download_container.write(md5) - self.download_container.dataSent.append(self.md5ready) + def ok(self): + if self.filelist.canDescent(): + if self["filelist"].showMountpoints == True and self["filelist"].showDirectories == False: + self.use() else: - self["statusbar"].text = "Download completed." - self.downloading(False) - else: - self["statusbar"].text = "Download completed." - self.downloading(False) - if self.wizard_mode: - self.configBackup() + self.filelist.descent() - def md5ready(self, retval): - self.download_container.sendEOF() + def use(self): + print "[use]", self["filelist"].getCurrentDirectory(), self["filelist"].getFilename() + if self["filelist"].getCurrentDirectory() is not None: + if self.filelist.canDescent() and self["filelist"].getFilename() and len(self["filelist"].getFilename()) > len(self["filelist"].getCurrentDirectory()): + self.filelist.descent() + self.close(self["filelist"].getCurrentDirectory()) + elif self["filelist"].getFilename(): + self.close(self["filelist"].getFilename()) - def md5finished(self, retval): - print "[md5finished]: " + str(retval) - self.download_container.appClosed.remove(self.md5finished) - if retval==0: - self.downloading(False) - if self.wizard_mode: - self.configBackup() - else: - self["statusbar"].text = _(".NFI file passed md5sum signature check. You can safely flash this image!") - self.switchList(self.LIST_SOURCE) - else: - self.session.openWithCallback(self.nfi_remove, MessageBox, (_("The md5sum validation failed, the file may be downloaded incompletely or be corrupted!") + "\n" + _("Remove the broken .NFI file?")), MessageBox.TYPE_YESNO) - - def nfi_remove(self, answer): - self.downloading(False) - if answer == True: - nfifilename = self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname() - if fileExists(self.nfofilename): - remove(self.nfofilename) - if fileExists(nfifilename): - remove(nfifilename) - self.switchList(self.LIST_SOURCE) - - def askCreateUSBstick(self): - self.downloading() - self.imagefilename = "/tmp/nfiflash_" + self.box + ".img" - message = _("You have chosen to create a new .NFI flasher bootable USB stick. This will repartition the USB stick and therefore all data on it will be erased.") - self.session.openWithCallback(self.flasherdownload_query, MessageBox, (message + '\n' + _("First we need to download the latest boot environment for the USB flasher.")), MessageBox.TYPE_YESNO) - - def flasherdownload_query(self, answer): - if answer is False: - self.downloading(False) - self.switchList(self.LIST_SOURCE) - return - #url = self.feed_base + "/nfiflasher_" + self.box + ".tar.bz2" - url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s.tar.bz2" % self.box - localfile = "/tmp/nfiflasher_image.tar.bz2" - print "[flasherdownload_query] downloading %s to %s" % (url, localfile) - self["statusbar"].text = ("Downloading %s..." % url) - self.download = downloadWithProgress(url,localfile) - self.download.addProgress(self.nfi_progress) - self["job_progressbar"].range = 1000 - self.download.start().addCallback(self.flasherdownload_finished).addErrback(self.flasherdownload_failed) - - def flasherdownload_failed(self, failure_instance=None, error_message=""): - if error_message == "" and failure_instance is not None: - error_message = failure_instance.getErrorMessage() - print "[flasherdownload_failed] " + error_message - message = "%s %s" % (_("Download of USB flasher boot image failed: "),error_message) - self.session.open(MessageBox, message, MessageBox.TYPE_ERROR) - self.remove_img(True) - - def flasherdownload_finished(self, string=""): - print "[flasherdownload_finished] " + str(string) + def exit(self): + self.close(False) + +(ALLIMAGES, RELEASE, EXPERIMENTAL, STICK_WIZARD, START) = range(5) + +class NFIDownload(Screen): + skin = """ + + + + + + + + + + + + + {"templates": + {"default": (25, [ + MultiContentEntryText(pos = (2, 2), size = (330, 24), flags = RT_HALIGN_LEFT, text = 1), # index 0 is the MenuText, + ], True, "showOnDemand") + }, + "fonts": [gFont("Regular", 22)], + "itemHeight": 25 + } + + + + + {"templates": + {"default": (300, [ + MultiContentEntryText(pos = (2, 2), size = (240, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, + ], False, "showNever") + }, + "fonts": [gFont("Regular", 22)], + "itemHeight": 300 + } + + + + """ + + def __init__(self, session, destdir=None): + Screen.__init__(self, session) + #self.skin_path = plugin_path + #self.menu = args + + self.box = HardwareInfo().get_device_name() + self.feed_base = "http://www.dreamboxupdate.com/opendreambox" #/1.5/%s/images/" % self.box + self.usbmountpoint = "/mnt/usb/" + + self.menulist = [] + + self["menu"] = List(self.menulist) + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText() + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + + self["status"] = StaticText(_("Please wait... Loading list...")) + + self["shortcuts"] = ActionMap(["OkCancelActions", "ColorActions", "ShortcutActions", "DirectionActions"], + { + "ok": self.keyOk, + "green": self.keyOk, + "red": self.keyRed, + "blue": self.keyBlue, + "up": self.keyUp, + "upRepeated": self.keyUp, + "downRepeated": self.keyDown, + "down": self.keyDown, + "cancel": self.close, + }, -1) + self.onShown.append(self.go) + self.feedlists = [[],[],[]] + self.branch = START self.container = eConsoleAppContainer() - self.container.appClosed.append(self.umount_finished) self.container.dataAvail.append(self.tool_avail) self.taskstring = "" - umountdevs = "" - from os import listdir - for device in listdir("/dev"): - if device[:2] == "sd" and device[-1:].isdigit(): - umountdevs += "/dev/"+device - self.cmd = "umount " + umountdevs - print "executing " + self.cmd - self.container.execute(self.cmd) + self.image_idx = 0 + self.nfofilename = "" + self.nfo = "" + self.target_dir = None def tool_avail(self, string): print "[tool_avail]" + string self.taskstring += string - def umount_finished(self, retval): - self.container.appClosed.remove(self.umount_finished) - self.container.appClosed.append(self.dmesg_cleared) - self.taskstring = "" - self.cmd = "dmesg -c" - print "executing " + self.cmd - self.container.execute(self.cmd) + def go(self): + self.onShown.remove(self.go) + self["menu"].index = 0 + url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s-md5sums" % self.box + client.getPage(url).addCallback(self.md5sums_finished).addErrback(self.feed_failed) - def dmesg_cleared(self, answer): - self.container.appClosed.remove(self.dmesg_cleared) - self.msgbox = self.session.open(MessageBox, _("Please disconnect all USB devices from your Dreambox and (re-)attach the target USB stick (minimum size is 64 MB) now!"), MessageBox.TYPE_INFO) - hotplugNotifier.append(self.hotplugCB) + def md5sums_finished(self, data): + print "[md5sums_finished]", data + self.stickimage_md5 = data + self.checkUSBStick() - def hotplugCB(self, dev, action): - print "[hotplugCB]", dev, action - if dev.startswith("sd") and action == "add": - self.msgbox.close() - hotplugNotifier.remove(self.hotplugCB) - self.container.appClosed.append(self.dmesg_scanned) - self.taskstring = "" - self.cmd = "dmesg" - print "executing " + self.cmd - self.container.execute(self.cmd) - - def dmesg_scanned(self, retval): - self.container.appClosed.remove(self.dmesg_scanned) - dmesg_lines = self.taskstring.splitlines() - self.devicetext = None - self.stickdevice = None - for i, line in enumerate(dmesg_lines): - if line.find("usb-storage: waiting for device") != -1 and len(dmesg_lines) > i+3: - self.devicetext = dmesg_lines[i+1].lstrip()+"\n"+dmesg_lines[i+3] - elif line.find("/dev/scsi/host") != -1: - self.stickdevice = line.split(":",1)[0].lstrip() - - if retval != 0 or self.devicetext is None or self.stickdevice is None: - self.session.openWithCallback(self.remove_img, MessageBox, _("No useable USB stick found"), MessageBox.TYPE_ERROR) - else: - self.session.openWithCallback(self.fdisk_query, MessageBox, (_("The following device was found:\n\n%s\n\nDo you want to write the USB flasher to this stick?") % self.devicetext), MessageBox.TYPE_YESNO) - - def fdisk_query(self, answer): - if answer == True and self.stickdevice: - self["statusbar"].text = ("Partitioning USB stick...") - self["job_progressbar"].range = 1000 - self["job_progressbar"].value = 100 - self["job_progresslabel"].text = "5.00%" - self.taskstring = "" - self.container.appClosed.append(self.fdisk_finished) - self.container.execute("fdisk " + self.stickdevice + "/disc") - self.container.write("d\n4\nd\n3\nd\n2\nd\nn\np\n1\n\n\nt\n6\nw\n") - self.delayTimer = eTimer() - self.delayTimer.callback.append(self.progress_increment) - self.delayTimer.start(105, False) - else: - self.remove_img(True) - - def fdisk_finished(self, retval): - self.container.appClosed.remove(self.fdisk_finished) - self.delayTimer.stop() - if retval == 0: - if fileExists(self.imagefilename): - self.tar_finished(0) - self["job_progressbar"].value = 700 - else: - self["statusbar"].text = ("Decompressing USB stick flasher boot image...") - self.taskstring = "" - self.container.appClosed.append(self.tar_finished) - self.container.setCWD("/tmp") - self.cmd = "tar -xjvf nfiflasher_image.tar.bz2" - self.container.execute(self.cmd) - print "executing " + self.cmd - self.delayTimer = eTimer() - self.delayTimer.callback.append(self.progress_increment) - self.delayTimer.start(105, False) + def keyRed(self): + if self.branch == START: + self.close() else: - print "fdisk failed: " + str(retval) - self.session.openWithCallback(self.remove_img, MessageBox, ("fdisk " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR) + self.branch = START + self["menu"].setList(self.menulist) + #elif self.branch == ALLIMAGES or self.branch == STICK_WIZARD: - def progress_increment(self): - newval = int(self["job_progressbar"].value) + 1 - if newval < 950: - self["job_progressbar"].value = newval - self["job_progresslabel"].text = "%.2f%%" % (newval/10.0) - - def tar_finished(self, retval): - self.delayTimer.stop() - if len(self.container.appClosed) > 0: - self.container.appClosed.remove(self.tar_finished) - if retval == 0: - self.imagefilename = "/tmp/nfiflash_" + self.box + ".img" - self["statusbar"].text = ("Copying USB flasher boot image to stick...") - self.taskstring = "" - self.container.appClosed.append(self.dd_finished) - self.cmd = "dd if=%s of=%s" % (self.imagefilename,self.stickdevice+"/part1") - self.container.execute(self.cmd) - print "executing " + self.cmd - self.delayTimer = eTimer() - self.delayTimer.callback.append(self.progress_increment) - self.delayTimer.start(105, False) + def keyBlue(self): + if self.nfo != "": + self.session.open(NFOViewer, self.nfo) + + def keyOk(self): + print "[keyOk]", self["menu"].getCurrent() + current = self["menu"].getCurrent() + if current: + if self.branch == START: + currentEntry = current[0] + if currentEntry == RELEASE: + self.image_idx = 0 + self.branch = RELEASE + self.askDestination() + elif currentEntry == EXPERIMENTAL: + self.image_idx = 0 + self.branch = EXPERIMENTAL + self.askDestination() + elif currentEntry == ALLIMAGES: + self.branch = ALLIMAGES + self.listImages() + elif currentEntry == STICK_WIZARD: + self.askStartWizard() + elif self.branch == ALLIMAGES: + self.image_idx = self["menu"].getIndex() + self.askDestination() + self.updateButtons() + + def keyUp(self): + self["menu"].selectPrevious() + self.updateButtons() + + def keyDown(self): + self["menu"].selectNext() + self.updateButtons() + + def updateButtons(self): + current = self["menu"].getCurrent() + if current: + if self.branch == START: + self["key_red"].text = _("Close") + currentEntry = current[0] + if currentEntry in (RELEASE, EXPERIMENTAL): + self.nfo_download(currentEntry, 0) + self["key_green"].text = _("Download") + else: + self.nfofilename = "" + self.nfo = "" + self["key_blue"].text = "" + self["key_green"].text = _("continue") + + elif self.branch == ALLIMAGES: + self["key_red"].text = _("Back") + self["key_green"].text = _("Download") + self.nfo_download(ALLIMAGES, self["menu"].getIndex()) + + def listImages(self): + print "[listImages]" + imagelist = [] + for name, url in self.feedlists[ALLIMAGES]: + imagelist.append((url, name, _("Download %s from Server" ) % url, None)) + self["menu"].setList(imagelist) + + def getUSBPartitions(self): + allpartitions = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)] + print "[getUSBPartitions]", allpartitions + usbpartition = [] + for x in allpartitions: + print x, x[1] == '/', x[0].find("USB"), access(x[1], R_OK) + if x[1] != '/' and x[0].find("USB") > -1: # and access(x[1], R_OK) is True: + usbpartition.append(x) + return usbpartition + + def askDestination(self): + usbpartition = self.getUSBPartitions() + if len(usbpartition) == 1: + self.target_dir = usbpartition[0][1] + self.ackDestinationDevice(device_description=usbpartition[0][0]) + else: + self.openDeviceBrowser() + + def openDeviceBrowser(self): + if self.branch != STICK_WIZARD: + self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=True, showMountpoints=True, inhibitMounts=["/autofs/sr0/"]) + if self.branch == STICK_WIZARD: + self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=False, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/"]) + + def DeviceBrowserClosed(self, path): + print "[DeviceBrowserClosed]", str(path) + self.target_dir = path + if path: + self.ackDestinationDevice() else: - self.session.openWithCallback(self.remove_img, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR) - - def dd_finished(self, retval): - self.delayTimer.stop() - self.container.appClosed.remove(self.dd_finished) - self.downloading(False) - if retval == 0: - self["job_progressbar"].value = 950 - self["job_progresslabel"].text = "95.00%" - self["statusbar"].text = ("Remounting stick partition...") - self.taskstring = "" - self.container.appClosed.append(self.mount_finished) - self.cmd = "mount %s /mnt/usb -o rw,sync" % (self.stickdevice+"/part1") - self.container.execute(self.cmd) - print "executing " + self.cmd + self.keyRed() + + def ackDestinationDevice(self, device_description=None): + if device_description == None: + dev = self.target_dir else: - self.session.openWithCallback(self.remove_img, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR) - - def mount_finished(self, retval): - self.container.dataAvail.remove(self.tool_avail) - self.container.appClosed.remove(self.mount_finished) - if retval == 0: - self["job_progressbar"].value = 1000 - self["job_progresslabel"].text = "100.00%" - self["statusbar"].text = (".NFI Flasher bootable USB stick successfully created.") - self.session.openWithCallback(self.flasherFinishedCB, MessageBox, _("The USB stick is now bootable. Do you want to download the latest image from the feed server and save it on the stick?"), type = MessageBox.TYPE_YESNO) - self["destlist"].changeDir("/mnt/usb") + dev = device_description + message = _("Do you want to download the image to %s ?") % (dev) + choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.openDeviceBrowser), (_("Cancel"),self.keyRed)] + self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices) + + def ackDestination_query(self, choice): + print "[ackDestination_query]", choice + if isinstance(choice, tuple): + choice[1]() else: - self.session.openWithCallback(self.flasherFinishedCB, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR) - self.remove_img(True) - - def remove_img(self, answer): - if fileExists("/tmp/nfiflasher_image.tar.bz2"): - remove("/tmp/nfiflasher_image.tar.bz2") - if fileExists(self.imagefilename): - remove(self.imagefilename) - self.downloading(False) - self.switchList(self.LIST_SOURCE) - - def flasherFinishedCB(self, answer): - if answer == True: - self.wizard_mode = True - self["feedlist"].moveSelection(0) - self["path_bottom"].text = str(self["destlist"].getCurrentDirectory()) - self.nfo_download() - self.nfi_download() - - def configBackup(self): - self.session.openWithCallback(self.runBackup, MessageBox, _("The wizard can backup your current settings. Do you want to do a backup now?")) - - def runBackup(self, result=None): - from Tools.Directories import createDir, isMount, pathExists - from time import localtime - from datetime import date - from Screens.Console import Console - if result: - if isMount("/mnt/usb/"): - if (pathExists("/mnt/usb/backup") == False): - createDir("/mnt/usb/backup", True) - d = localtime() - dt = date(d.tm_year, d.tm_mon, d.tm_mday) - self.backup_file = "backup/" + str(dt) + "_settings_backup.tar.gz" - self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + "/mnt/usb/" + self.backup_file + " /etc/enigma2/ /etc/network/interfaces /etc/wpa_supplicant.conf"], finishedCallback = self.backup_finished, closeOnSuccess = True) + self.keyRed() + + def ackedDestination(self): + print "[ackedDestination]", self.branch, self.target_dir, self.target_dir[8:] + self.container.setCWD("/mnt") + if self.target_dir[:8] == "/autofs/": + self.target_dir = "/dev/" + self.target_dir[8:-1] + + if self.branch == STICK_WIZARD: + job = StickWizardJob(self.target_dir) + job_manager.AddJob(job) + self.session.openWithCallback(self.StickWizardCB, JobView, job) + + elif self.branch != STICK_WIZARD: + url = self.feedlists[self.branch][self.image_idx][1] + filename = self.feedlists[self.branch][self.image_idx][0] + print "[getImage] start downloading %s to %s" % (url, path) + job = ImageDownloadJob(url, filename, self.target_dir, self.usbmountpoint) + job_manager.AddJob(job) + self.session.openWithCallback(self.ImageDownloadCB, JobView, job) + + def StickWizardCB(self, ret=None): + self.session.open(MessageBox, _("The USB stick was prepared to be bootable.\nNow you can download an NFI image file!"), type = MessageBox.TYPE_INFO) + print "[StickWizardCB]", ret + if len(self.feedlists[ALLIMAGES]) == 0: + self.getFeed() else: - self.backup_file = None - self.backup_finished(skipped=True) - - def backup_finished(self, skipped=False): - if not skipped: - wizardfd = open("/mnt/usb/wizard.nfo", "w") - if wizardfd: - wizardfd.write("image: "+self["feedlist"].getNFIname()+'\n') - wizardfd.write("configuration: "+self.backup_file+'\n') - wizardfd.close() + self.setMenu() + + def ImageDownloadCB(self, ret): + print "[ImageDownloadCB]", ret self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) - def closeCB(self): - try: - self.download.stop() - #self.nfi_failed(None, "Cancelled by user request") - self.downloading(False) - except AttributeError: + def getFeed(self): + self.feedDownloader15 = feedDownloader(self.feed_base, self.box, OE_vers="1.5") + self.feedDownloader16 = feedDownloader(self.feed_base, self.box, OE_vers="1.6") + self.feedlists = [[],[],[]] + self.feedDownloader15.getList(self.gotFeed, self.feed_failed) + self.feedDownloader16.getList(self.gotFeed, self.feed_failed) + + def feed_failed(self, message=""): + self["status"].text = _("Could not connect to Dreambox .NFI Image Feed Server:") + "\n" + str(message) + "\n" + _("Please check your network settings!") + + def gotFeed(self, feedlist, OE_vers): + print "[gotFeed]", OE_vers + releaselist = [] + experimentallist = [] + + for name, url in feedlist: + if name.find("release") > -1: + releaselist.append((name, url)) + if name.find("experimental") > -1: + experimentallist.append((name, url)) + self.feedlists[ALLIMAGES].append((name, url)) + + if OE_vers == "1.6": + self.feedlists[RELEASE] = releaselist + self.feedlists[RELEASE] + self.feedlists[EXPERIMENTAL] = experimentallist + self.feedlists[RELEASE] + elif OE_vers == "1.5": + self.feedlists[RELEASE] = self.feedlists[RELEASE] + releaselist + self.feedlists[EXPERIMENTAL] = self.feedlists[EXPERIMENTAL] + experimentallist + + self.setMenu() + + def checkUSBStick(self): + self.target_dir = None + allpartitions = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)] + print "[checkUSBStick] found partitions:", allpartitions + usbpartition = [] + for x in allpartitions: + print x, x[1] == '/', x[0].find("USB"), access(x[1], R_OK) + if x[1] != '/' and x[0].find("USB") > -1: # and access(x[1], R_OK) is True: + usbpartition.append(x) + + print usbpartition + if len(usbpartition) == 1: + self.target_dir = usbpartition[0][1] + self.md5_passback = self.getFeed + self.md5_failback = self.askStartWizard + self.md5verify(self.stickimage_md5, self.target_dir) + elif usbpartition == []: + print "[NFIFlash] needs to create usb flasher stick first!" + self.askStartWizard() + else: + self.askStartWizard() + + def askStartWizard(self): + self.branch = STICK_WIZARD + message = _("""This plugin creates a USB stick which can be used to update the firmware of your Dreambox in case it has no network connection or only WLAN access. +First, you need to prepare a USB stick so that it is bootable. +In the next step, an NFI image file can be downloaded from the update server and saved on the USB stick. +If you already have a prepared bootable USB stick, please insert it now. Otherwise plug in a USB stick with a minimum size of 64 MB!""") + self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/"]) + + def wizardDeviceBrowserClosed(self, path): + print "[wizardDeviceBrowserClosed]", path + self.target_dir = path + if path: + self.md5_passback = self.getFeed + self.md5_failback = self.wizardQuery + self.md5verify(self.stickimage_md5, self.target_dir) + else: self.close() + + def wizardQuery(self): + print "[wizardQuery]" + description = self.target_dir + for name, dev in self.getUSBPartitions(): + if dev == self.target_dir: + description = name + message = _("You have chosen to create a new .NFI flasher bootable USB stick. This will repartition the USB stick and therefore all data on it will be erased.") + "\n" + message += _("The following device was found:\n\n%s\n\nDo you want to write the USB flasher to this stick?") % description + choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.askStartWizard), (_("Cancel"),self.close)] + self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices) + + def setMenu(self): + self.menulist = [] + try: + latest_release = "Release %s (Opendreambox 1.5)" % self.feedlists[RELEASE][0][0][-9:-4] + self.menulist.append((RELEASE, _("Get latest release image"), _("Download %s from Server" ) % latest_release, None)) + except IndexError: + pass + + try: + dat = self.feedlists[EXPERIMENTAL][0][0][-12:-4] + latest_experimental = "Experimental %s-%s-%s (Opendreambox 1.6)" % (dat[:4], dat[4:6], dat[6:]) + self.menulist.append((EXPERIMENTAL, _("Get latest experimental image"), _("Download %s from Server") % latest_experimental, None)) + except IndexError: + pass + + self.menulist.append((ALLIMAGES, _("Choose image to download"), _("Select desired image from feed list" ), None)) + self.menulist.append((STICK_WIZARD, _("USB stick wizard"), _("Prepare another USB stick for image flashing" ), None)) + self["menu"].setList(self.menulist) + self["status"].text = _("Currently installed image") + ": %s" % (about.getImageVersionString())) + self.branch = START + self.updateButtons() + + def nfo_download(self, branch, idx): + nfourl = (self.feedlists[branch][idx][1])[:-4]+".nfo" + self.nfofilename = (self.feedlists[branch][idx][0])[:-4]+".nfo" + print "[check_for_NFO]", nfourl + client.getPage(nfourl).addCallback(self.nfo_finished).addErrback(self.nfo_failed) + + def nfo_failed(self, failure_instance): + print "[nfo_failed] " + str(failure_instance) + self["key_blue"].text = "" + self.nfofilename = "" + self.nfo = "" + + def nfo_finished(self,nfodata=""): + print "[nfo_finished] " + str(nfodata) + self["key_blue"].text = _("Changelog viewer") + self.nfo = nfodata + + def md5verify(self, md5, path): + cmd = "md5sum -c -s" + print "[verify_md5]", md5, path, cmd + self.container.setCWD(path) + self.container.appClosed.append(self.md5finished) + self.container.execute(cmd) + self.container.write(md5) + self.container.dataSent.append(self.md5ready) + + def md5ready(self, retval): + self.container.sendEOF() + + def md5finished(self, retval): + print "[md5finished]", str(retval) + self.container.appClosed.remove(self.md5finished) + self.container.dataSent.remove(self.md5ready) + if retval==0: + print "check passed! calling", repr(self.md5_passback) + self.md5_passback() + else: + print "check failed! calling", repr(self.md5_failback) + self.md5_failback() def main(session, **kwargs): session.open(NFIDownload,"/home/root") diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py index 7a0da851..95c7eee9 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -8,25 +8,55 @@ from Components.Sources.Progress import Progress from Components.Sources.Boolean import Boolean from Components.Label import Label from Components.FileList import FileList -from Components.Task import Task, Job, JobManager +from Components.Task import Task, Job, job_manager, Condition +from Screens.TaskView import JobView from Tools.Directories import fileExists from Tools.HardwareInfo import HardwareInfo from os import system from enigma import eConsoleAppContainer -import re +from Components.About import about + +class md5Postcondition(Condition): + def check(self, task): + print "md5Postcondition::check", task.returncode + return task.returncode == 0 + + def getErrorMessage(self, task): + if task.returncode == 1: + return _("The md5sum validation failed, the file may be corrupted!") + return "md5 error" + +class md5verify(Task): + def __init__(self, job, path, md5): + Task.__init__(self, job, "md5sum") + self.postconditions.append(md5Postcondition()) + self.weighting = 5 + self.cwd = path + self.setTool("md5sum") + self.args += ["-c", "-s"] + self.initial_input = md5 + + def writeInput(self, input): + self.container.dataSent.append(self.md5ready) + print "[writeInput]", input + Task.writeInput(self, input) + + def md5ready(self, retval): + self.container.sendEOF() + + def processOutput(self, data): + print "[md5sum]", class writeNAND(Task): - def __init__(self,job,param,box): + def __init__(self, job, param, box): Task.__init__(self,job, ("Writing image file to NAND Flash")) - self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/mywritenand") + self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/writenfi-mipsel-2.6.18-r1") if box == "dm7025": self.end = 256 elif box[:5] == "dm800": self.end = 512 - if box == "dm8000": - self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand") self.args += param - self.weighting = 1 + self.weighting = 95 def processOutput(self, data): print "[writeNand] " + data @@ -38,149 +68,84 @@ class writeNAND(Task): else: self.output_line = data -class NFISummary(Screen): - skin = ( - """ - - - - - """, - """ - - - - - """) - - def __init__(self, session, parent): - Screen.__init__(self, session, parent) - self["title"] = StaticText(_("Image flash utility")) - self["content"] = StaticText(_("Please select .NFI flash image file from medium")) - self["job_progressbar"] = Progress() - self["job_progresslabel"] = StaticText("") - - def setText(self, text): - self["content"].setText(text) - class NFIFlash(Screen): skin = """ - - - - - - - - - - - - - - """ - - def __init__(self, session, cancelable = True, close_on_finish = False): - self.skin = NFIFlash.skin + + + + + + + + + + + + + + """ + + def __init__(self, session, destdir=None): Screen.__init__(self, session) - self["job_progressbar"] = Progress() - self["job_progresslabel"] = StaticText("") - - self["finished"] = Boolean() + self.box = HardwareInfo().get_device_name() + self.usbmountpoint = "/mnt/usb/" - self["infolabel"] = StaticText("") - self["statusbar"] = StaticText(_("Please select .NFI flash image file from medium")) - self["listlabel"] = StaticText(_("select .NFI flash file")+":") - + self["key_red"] = StaticText() self["key_green"] = StaticText() self["key_yellow"] = StaticText() self["key_blue"] = StaticText() + self.filelist = FileList(self.usbmountpoint, matchingPattern = "^.*\.(nfi|NFI)") + self["filelist"] = self.filelist + self["infolabel"] = StaticText("") - self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"], + self["status"] = StaticText("currently installed image: %s" % (about.getImageVersionString())) + self.job = None + + self["shortcuts"] = ActionMap(["OkCancelActions", "ColorActions", "ShortcutActions", "DirectionActions"], { - "green": self.ok, + "ok": self.keyOk, + "green": self.keyOk, + "up": self.keyUp, + "upRepeated": self.keyUp, + "downRepeated": self.keyDown, + "down": self.keyDown, + "left": self.keyLeft, "yellow": self.reboot, - "blue": self.runWizard, - "ok": self.ok, - "left": self.left, - "right": self.right, - "up": self.up, - "down": self.down + "right": self.keyRight }, -1) - - currDir = "/media/usb/" - self.filelist = FileList(currDir, matchingPattern = "^.*\.(nfi|NFI)") - self["filelist"] = self.filelist - self.nfifile = "" self.md5sum = "" - self.job = None - self.box = HardwareInfo().get_device_name() - self.configuration_restorable = None - self.wizard_mode = False - from enigma import eTimer - self.delayTimer = eTimer() - self.delayTimer.callback.append(self.runWizard) - self.delayTimer.start(50,1) - - def check_for_wizard(self): - if self["filelist"].getCurrentDirectory() is not None and fileExists(self["filelist"].getCurrentDirectory()+"wizard.nfo"): - self["key_blue"].text = _("USB stick wizard") - return True - else: - self["key_blue"].text = "" - return False - def runWizard(self): - if not self.check_for_wizard(): - self.wizard_mode = False - return - wizardcontent = open(self["filelist"].getCurrentDirectory()+"/wizard.nfo", "r").readlines() - nfifile = None - for line in wizardcontent: - line = line.strip() - if line.startswith("image: "): - nfifile = self["filelist"].getCurrentDirectory()+line[7:] - if line.startswith("configuration: "): - backupfile = self["filelist"].getCurrentDirectory()+line[15:] - if fileExists(backupfile): - print "wizard configuration:", backupfile - self.configuration_restorable = backupfile - else: - self.configuration_restorable = None - if nfifile and fileExists(nfifile): - self.wizard_mode = True - print "wizard image:", nfifile - self.check_for_NFO(nfifile) - self.queryFlash() - - def closeCB(self): - if ( self.job is None or self.job.status is not self.job.IN_PROGRESS ) and not self.no_autostart: - self.close() - #else: - #if self.cancelable: - #self.cancel() - - def up(self): + def keyUp(self): self["filelist"].up() self.check_for_NFO() - def down(self): + def keyDown(self): self["filelist"].down() self.check_for_NFO() - def right(self): + def keyRight(self): self["filelist"].pageDown() self.check_for_NFO() - def left(self): + def keyLeft(self): self["filelist"].pageUp() self.check_for_NFO() + def keyOk(self): + if self.job is None or self.job.status is not self.job.IN_PROGRESS: + if self["filelist"].canDescent(): # isDir + self["filelist"].descent() + self.check_for_NFO() + elif self["filelist"].getFilename(): + self.session.openWithCallback(self.queryCB, MessageBox, _("Shall the USB stick wizard proceed and program the image file %s into flash memory?" % self.nfifile.rsplit('/',1)[-1]), MessageBox.TYPE_YESNO) + def check_for_NFO(self, nfifile=None): - self.session.summary.setText(self["filelist"].getFilename()) + print "check_for_NFO", self["filelist"].getFilename(), self["filelist"].getCurrentDirectory() + self["infolabel"].text = "" + self["key_green"].text = "" + if nfifile is None: - self.session.summary.setText(self["filelist"].getFilename()) if self["filelist"].getFilename() is None: return if self["filelist"].getCurrentDirectory() is not None: @@ -191,8 +156,10 @@ class NFIFlash(Screen): if self.nfifile.upper().endswith(".NFI"): self["key_green"].text = _("Flash") nfofilename = self.nfifile[0:-3]+"nfo" + print nfofilename, fileExists(nfofilename) if fileExists(nfofilename): nfocontent = open(nfofilename, "r").read() + print "nfocontent:", nfocontent self["infolabel"].text = nfocontent pos = nfocontent.find("MD5:") if pos > 0: @@ -202,122 +169,27 @@ class NFIFlash(Screen): else: self["infolabel"].text = _("No details for this image file") + (self["filelist"].getFilename() or "") self.md5sum = "" - else: - self["infolabel"].text = "" - self["key_green"].text = "" - - def ok(self): - if self.job is None or self.job.status is not self.job.IN_PROGRESS: - if self["filelist"].canDescent(): # isDir - self["filelist"].descent() - self.session.summary.setText(self["filelist"].getFilename()) - self.check_for_NFO() - self.check_for_wizard() - else: - self.queryFlash() - - def queryFlash(self): - fd = open(self.nfifile, 'r') - print fd - sign = fd.read(11) - print sign - if sign.find("NFI1" + self.box + "\0") == 0: - if self.md5sum != "": - self["statusbar"].text = ("Please wait for md5 signature verification...") - self.session.summary.setText(("Please wait for md5 signature verification...")) - self.container = eConsoleAppContainer() - self.container.setCWD(self["filelist"].getCurrentDirectory()) - self.container.appClosed.append(self.md5finished) - self.container.dataSent.append(self.md5ready) - self.container.execute("md5sum -cw -") - self.container.write(self.md5sum) - else: - self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file does not have a md5sum signature and is not guaranteed to work. Do you really want to burn this image to flash memory?"), MessageBox.TYPE_YESNO) - else: - self.session.open(MessageBox, (_("This .NFI file does not contain a valid %s image!") % (self.box.upper())), MessageBox.TYPE_ERROR) - - def md5ready(self, retval): - self.container.sendEOF() - - def md5finished(self, retval): - if retval==0: - if self.wizard_mode: - self.session.openWithCallback(self.queryCB, MessageBox, _("Shall the USB stick wizard proceed and program the image file %s into flash memory?" % self.nfifile.rsplit('/',1)[-1]), MessageBox.TYPE_YESNO) - else: - self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO) - else: - self.session.openWithCallback(self.queryCB, MessageBox, _("The md5sum validation failed, the file may be corrupted! Are you sure that you want to burn this image to flash memory? You are doing this at your own risk!"), MessageBox.TYPE_YESNO) def queryCB(self, answer): if answer == True: self.createJob() - else: - self["statusbar"].text = _("Please select .NFI flash image file from medium") - self.wizard_mode = False def createJob(self): self.job = Job("Image flashing job") - param = [self.nfifile] - writeNAND(self.job,param,self.box) - #writeNAND2(self.job,param) - #writeNAND3(self.job,param) - self.job.state_changed.append(self.update_job) - self.job.end = 540 - self.cwd = self["filelist"].getCurrentDirectory() - self["job_progressbar"].range = self.job.end - self.startJob() - - def startJob(self): + cwd = self["filelist"].getCurrentDirectory() + md5verify(self.job, cwd, self.md5sum) + writeNAND(self.job, [self.nfifile], self.box) self["key_blue"].text = "" self["key_yellow"].text = "" self["key_green"].text = "" - #self["progress0"].show() - #self["progress1"].show() + job_manager.AddJob(self.job) + self.session.openWithCallback(self.flashed, JobView, self.job, cancelable = False, backgroundable = False) - self.job.start(self.jobcb) - - def update_job(self): - j = self.job - #print "[job state_changed]" - if j.status == j.IN_PROGRESS: - self.session.summary["job_progressbar"].value = j.progress - self.session.summary["job_progressbar"].range = j.end - self.session.summary["job_progresslabel"].text = "%.2f%%" % (100*j.progress/float(j.end)) - self["job_progressbar"].range = j.end - self["job_progressbar"].value = j.progress - #print "[update_job] j.progress=%f, j.getProgress()=%f, j.end=%d, text=%f" % (j.progress, j.getProgress(), j.end, (100*j.progress/float(j.end))) - self["job_progresslabel"].text = "%.2f%%" % (100*j.progress/float(j.end)) - self.session.summary.setText(j.tasks[j.current_task].name) - self["statusbar"].text = (j.tasks[j.current_task].name) - - elif j.status == j.FINISHED: - self["statusbar"].text = _("Writing NFI image file to flash completed") - self.session.summary.setText(_("NFI image flashing completed. Press Yellow to Reboot!")) - if self.wizard_mode: - self.restoreConfiguration() - self["key_yellow"].text = _("Reboot") - - elif j.status == j.FAILED: - self["statusbar"].text = j.tasks[j.current_task].name + " " + _("failed") - self.session.open(MessageBox, (_("Flashing failed") + ":\n" + j.tasks[j.current_task].name + ":\n" + j.tasks[j.current_task].output_line), MessageBox.TYPE_ERROR) - - def jobcb(self, jobref, fasel, blubber): - print "[jobcb] %s %s %s" % (jobref, fasel, blubber) - self["key_green"].text = _("Flash") + def flashed(self, bg): + print "[flashed]" + self["key_yellow"].text = _("Reboot") def reboot(self, ret=None): if self.job.status == self.job.FINISHED: - self["statusbar"].text = ("rebooting...") + self["status"].text = ("rebooting...") TryQuitMainloop(self.session,2) - - def restoreConfiguration(self): - if self.configuration_restorable: - from Screens.Console import Console - cmdlist = [ "mount /dev/mtdblock/3 /mnt/realroot -t jffs2", "tar -xzvf " + self.configuration_restorable + " -C /mnt/realroot/" ] - self.session.open(Console, title = "Restore running", cmdlist = cmdlist, finishedCallback = self.restore_finished, closeOnSuccess = True) - - def restore_finished(self): - self.session.openWithCallback(self.reboot, MessageBox, _("USB stick wizard finished. Your dreambox will now restart with your new image!"), MessageBox.TYPE_INFO) - - def createSummary(self): - return NFISummary diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand b/lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand deleted file mode 100755 index 073a204f..00000000 Binary files a/lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand and /dev/null differ diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py b/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py index 28b33305..1eba1dd4 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py @@ -2,6 +2,7 @@ from Plugins.Plugin import PluginDescriptor from Tools.HardwareInfo import HardwareInfo from Tools.Directories import fileExists from downloader import NFIDownload, filescan +from flasher import NFIFlash def NFIFlasherMain(session, tmp = None, **kwargs): session.open(NFIDownload, "/home/root" ) @@ -13,16 +14,12 @@ def Plugins(**kwargs): # currently only available for DM8000 if HardwareInfo().get_device_name() != "dm8000": return [PluginDescriptor()] - if fileExists("/usr/share/bootlogo-flasher.mvi"): - import flasher - # started from usb stick # don't try to be intelligent and trick this - it's not possible to rewrite the flash memory with a system currently booted from it - return [PluginDescriptor(where = PluginDescriptor.WHERE_WIZARD, fnc = (9,flasher.NFIFlash))] - else: - # started on real enigma2 - return [PluginDescriptor(name=_("NFI Image Flashing"), - description=_("Download .NFI-Files for USB-Flasher"), - icon = "flash.png", - where = PluginDescriptor.WHERE_SOFTWAREMANAGER, - fnc={"SoftwareSupported": NFICallFnc, "menuEntryName": lambda x: _("NFI Image Flashing"), - "menuEntryDescription": lambda x: _("Download .NFI-Files for USB-Flasher")}), - PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)] + #return [PluginDescriptor(where = PluginDescriptor.WHERE_WIZARD, fnc = (9,NFIFlash))] + # it's not possible to rewrite the flash memory with a system currently booted from it + return [PluginDescriptor(name=_("NFI Image Flashing"), + description=_("Download .NFI-Files for USB-Flasher"), + icon = "flash.png", + where = PluginDescriptor.WHERE_SOFTWAREMANAGER, + fnc={"SoftwareSupported": NFICallFnc, "menuEntryName": lambda x: _("NFI Image Flashing"), + "menuEntryDescription": lambda x: _("Download .NFI-Files for USB-Flasher")}), + PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)] -- cgit v1.2.3 From a03c828dc011ddf93525ad9ed6eae77f3691be7f Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Thu, 12 Aug 2010 12:05:33 +0200 Subject: NFIFlash: hide hdd and other mounts (#480) --- lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index c0094cc1..79fa069a 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -515,13 +515,7 @@ class NFIDownload(Screen): self.target_dir = usbpartition[0][1] self.ackDestinationDevice(device_description=usbpartition[0][0]) else: - self.openDeviceBrowser() - - def openDeviceBrowser(self): - if self.branch != STICK_WIZARD: self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=True, showMountpoints=True, inhibitMounts=["/autofs/sr0/"]) - if self.branch == STICK_WIZARD: - self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=False, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/"]) def DeviceBrowserClosed(self, path): print "[DeviceBrowserClosed]", str(path) @@ -537,7 +531,7 @@ class NFIDownload(Screen): else: dev = device_description message = _("Do you want to download the image to %s ?") % (dev) - choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.openDeviceBrowser), (_("Cancel"),self.keyRed)] + choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.askDestination), (_("Cancel"),self.keyRed)] self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices) def ackDestination_query(self, choice): @@ -637,7 +631,7 @@ class NFIDownload(Screen): First, you need to prepare a USB stick so that it is bootable. In the next step, an NFI image file can be downloaded from the update server and saved on the USB stick. If you already have a prepared bootable USB stick, please insert it now. Otherwise plug in a USB stick with a minimum size of 64 MB!""") - self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/"]) + self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/","/autofs/sda1/","/media/hdd/","/media/net/","/media/usb/","/media/dvd/"]) def wizardDeviceBrowserClosed(self, path): print "[wizardDeviceBrowserClosed]", path @@ -678,7 +672,7 @@ If you already have a prepared bootable USB stick, please insert it now. Otherwi self.menulist.append((ALLIMAGES, _("Choose image to download"), _("Select desired image from feed list" ), None)) self.menulist.append((STICK_WIZARD, _("USB stick wizard"), _("Prepare another USB stick for image flashing" ), None)) self["menu"].setList(self.menulist) - self["status"].text = _("Currently installed image") + ": %s" % (about.getImageVersionString())) + self["status"].text = _("Currently installed image") + ": %s" % (about.getImageVersionString()) self.branch = START self.updateButtons() -- cgit v1.2.3 From fbb3e9c9bcbd783d3236d0ff3109b2be7fa24177 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 13 Aug 2010 22:00:08 +0200 Subject: show "nothing connected" instead of empty filelist with only mountpoints shown --- lib/python/Components/FileList.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index 841a2fe5..1d71514b 100755 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -196,6 +196,9 @@ class FileList(MenuList): if (self.matchingPattern is None) or re_compile(self.matchingPattern).search(path): self.list.append(FileEntryComponent(name = name, absolute = x , isDir = False)) + if self.showMountpoints and len(self.list) == 0: + self.list.append(FileEntryComponent(name = _("nothing connected"), absolute = None, isDir = False)) + self.l.setList(self.list) if select is not None: -- cgit v1.2.3 From 24cfe420fd59098b062985d1c92410cbea93e014 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 13 Aug 2010 22:03:26 +0200 Subject: introduce afterEventChangeable parameter --- lib/python/Screens/TaskView.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 9907e2fb..633aae0d 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -7,7 +7,7 @@ import Screens.Standby from Tools import Notifications class JobView(InfoBarNotifications, Screen, ConfigListScreen): - def __init__(self, session, job, parent=None, cancelable = True, backgroundable = True): + def __init__(self, session, job, parent=None, cancelable = True, backgroundable = True, afterEventChangeable = True): from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress from Components.Sources.Boolean import Boolean @@ -50,11 +50,15 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): shutdownString = _("shut down") self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", shutdownString)], default = self.job.afterEvent or "nothing") self.job.afterEvent = self.settings.afterEvent.getValue() + self.afterEventChangeable = afterEventChangeable self.setupList() self.state_changed() def setupList(self): - self["config"].setList( [ getConfigListEntry(_("After event"), self.settings.afterEvent) ]) + if self.afterEventChangeable: + self["config"].setList( [ getConfigListEntry(_("After event"), self.settings.afterEvent) ]) + else: + self["config"].hide() self.job.afterEvent = self.settings.afterEvent.getValue() def keyLeft(self): -- cgit v1.2.3 From dc3561610ca598f28005932605ad87966350b80f Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 13 Aug 2010 22:04:43 +0200 Subject: NFIFlash fixes (#480) --- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 38 +++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 79fa069a..a94de2b6 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -16,7 +16,7 @@ from Components.MultiContent import MultiContentEntryText from Components.ScrollLabel import ScrollLabel from Components.Harddisk import harddiskmanager from Components.Task import Task, Job, job_manager, Condition -from Tools.Directories import fileExists +from Tools.Directories import fileExists, isMount from Tools.HardwareInfo import HardwareInfo from Tools.Downloader import downloadWithProgress from enigma import eConsoleAppContainer, gFont, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, eTimer @@ -30,6 +30,8 @@ class ImageDownloadJob(Job): def __init__(self, url, filename, device=None, mountpoint="/"): Job.__init__(self, _("Download .NFI-Files for USB-Flasher")) if device: + if isMount(mountpoint): + UmountTask(self, mountpoint) MountTask(self, device, mountpoint) ImageDownloadTask(self, url, mountpoint+filename) ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo") @@ -44,7 +46,9 @@ class MountTask(Task): def __init__(self, job, device, mountpoint): Task.__init__(self, job, ("mount")) self.setTool("mount") - self.args += [device, mountpoint, "-orw,sync"] + options = "rw,sync" + self.mountpoint = mountpoint + self.args += [ device, mountpoint, "-o"+options ] self.weighting = 1 def processOutput(self, data): @@ -164,7 +168,7 @@ class UnpackTask(Task): def run(self, callback): Task.run(self, callback) - self.delayTimer.start(1000, False) + self.delayTimer.start(950, False) def progress_increment(self): self.progress += 1 @@ -549,28 +553,40 @@ class NFIDownload(Screen): if self.branch == STICK_WIZARD: job = StickWizardJob(self.target_dir) + job.afterEvent = "close" job_manager.AddJob(job) - self.session.openWithCallback(self.StickWizardCB, JobView, job) + job_manager.failed_jobs = [] + self.session.openWithCallback(self.StickWizardCB, JobView, job, afterEventChangeable = False) elif self.branch != STICK_WIZARD: url = self.feedlists[self.branch][self.image_idx][1] filename = self.feedlists[self.branch][self.image_idx][0] - print "[getImage] start downloading %s to %s" % (url, path) + print "[getImage] start downloading %s to %s" % (url, filename) job = ImageDownloadJob(url, filename, self.target_dir, self.usbmountpoint) + job.afterEvent = "close" job_manager.AddJob(job) - self.session.openWithCallback(self.ImageDownloadCB, JobView, job) + job_manager.failed_jobs = [] + self.session.openWithCallback(self.ImageDownloadCB, JobView, job, afterEventChangeable = False) def StickWizardCB(self, ret=None): - self.session.open(MessageBox, _("The USB stick was prepared to be bootable.\nNow you can download an NFI image file!"), type = MessageBox.TYPE_INFO) print "[StickWizardCB]", ret - if len(self.feedlists[ALLIMAGES]) == 0: - self.getFeed() + print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job + if len(job_manager.failed_jobs) == 0: + self.session.open(MessageBox, _("The USB stick was prepared to be bootable.\nNow you can download an NFI image file!"), type = MessageBox.TYPE_INFO) + if len(self.feedlists[ALLIMAGES]) == 0: + self.getFeed() + else: + self.setMenu() else: - self.setMenu() + self.checkUSBStick() def ImageDownloadCB(self, ret): print "[ImageDownloadCB]", ret - self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job + if len(job_manager.failed_jobs) == 0: + self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + else: + self.branch = START def getFeed(self): self.feedDownloader15 = feedDownloader(self.feed_base, self.box, OE_vers="1.5") -- cgit v1.2.3 From be0859d12ff4d1f68407d1b3b0423ecaf2c693ac Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 16 Aug 2010 11:11:35 +0200 Subject: NFIFlash: change display of feed list details --- lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index a94de2b6..e0bad848 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -499,8 +499,16 @@ class NFIDownload(Screen): def listImages(self): print "[listImages]" imagelist = [] + mask = re.compile("%s/(?P1\.\d)/%s/images/(?P.*?)-%s_(?P.*?).nfi" % (self.feed_base, self.box, self.box), re.DOTALL) for name, url in self.feedlists[ALLIMAGES]: - imagelist.append((url, name, _("Download %s from Server" ) % url, None)) + result = mask.match(url) + if result: + if result.group("version").startswith("20"): + version = ( result.group("version")[:4]+'-'+result.group("version")[4:6]+'-'+result.group("version")[6:8] ) + else: + version = result.group("version") + description = "\nOpendreambox %s\n%s image\n%s\n" % (result.group("OE_vers"), result.group("branch"), version) + imagelist.append((url, name, _("Download %s from Server" ) % description, None)) self["menu"].setList(imagelist) def getUSBPartitions(self): -- cgit v1.2.3 From 892a18f6926fa4711d17a2e0442b293467e8963c Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 17 Aug 2010 20:52:48 +0200 Subject: JobView/HTTPProgressDownloader/NFIFlash correctly handle cancelling downloads --- lib/python/Components/Task.py | 5 +-- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 50 ++++++++++++++++------ lib/python/Screens/TaskView.py | 2 +- 3 files changed, 41 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index 2e4e757d..3a755405 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -64,11 +64,10 @@ class Job(object): def runNext(self): if self.current_task == len(self.tasks): if len(self.resident_tasks) == 0: - cb = self.callback - self.callback = None self.status = self.FINISHED self.state_changed() - cb(self, None, []) + self.callback(self, None, []) + self.callback = None else: print "still waiting for %d resident task(s) %s to finish" % (len(self.resident_tasks), str(self.resident_tasks)) else: diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index e0bad848..8768021c 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -78,7 +78,9 @@ class ImageDownloadTask(Task): self.error_message = "" self.last_recvbytes = 0 self.error_message = None - + self.download = None + self.aborted = False + def run(self, callback): self.callback = callback self.download = downloadWithProgress(self.url,self.path) @@ -86,23 +88,30 @@ class ImageDownloadTask(Task): self.download.start().addCallback(self.download_finished).addErrback(self.download_failed) print "[ImageDownloadTask] downloading", self.url, "to", self.path + def abort(self): + print "[ImageDownloadTask] aborting", self.url + if self.download: + self.download.stop() + self.aborted = True + def download_progress(self, recvbytes, totalbytes): #print "[update_progress] recvbytes=%d, totalbytes=%d" % (recvbytes, totalbytes) if ( recvbytes - self.last_recvbytes ) > 10000: # anti-flicker self.progress = int(100*(float(recvbytes)/float(totalbytes))) self.name = _("Downloading") + ' ' + "%d of %d kBytes" % (recvbytes/1024, totalbytes/1024) self.last_recvbytes = recvbytes - + def download_failed(self, failure_instance=None, error_message=""): self.error_message = error_message if error_message == "" and failure_instance is not None: self.error_message = failure_instance.getErrorMessage() - print "[download_failed]", self.error_message Task.processFinished(self, 1) - + def download_finished(self, string=""): - print "[download_finished]", string - Task.processFinished(self, 0) + if self.aborted: + self.finish(aborted = True) + else: + Task.processFinished(self, 0) class StickWizardJob(Job): def __init__(self, path): @@ -423,7 +432,10 @@ class NFIDownload(Screen): def go(self): self.onShown.remove(self.go) - self["menu"].index = 0 + self.umountCallback = self.getMD5 + self.umount() + + def getMD5(self): url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s-md5sums" % self.box client.getPage(url).addCallback(self.md5sums_finished).addErrback(self.feed_failed) @@ -578,7 +590,7 @@ class NFIDownload(Screen): def StickWizardCB(self, ret=None): print "[StickWizardCB]", ret - print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job +# print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job if len(job_manager.failed_jobs) == 0: self.session.open(MessageBox, _("The USB stick was prepared to be bootable.\nNow you can download an NFI image file!"), type = MessageBox.TYPE_INFO) if len(self.feedlists[ALLIMAGES]) == 0: @@ -586,15 +598,17 @@ class NFIDownload(Screen): else: self.setMenu() else: - self.checkUSBStick() + self.umountCallback = self.checkUSBStick + self.umount() def ImageDownloadCB(self, ret): print "[ImageDownloadCB]", ret - print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job +# print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job if len(job_manager.failed_jobs) == 0: self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) else: - self.branch = START + self.umountCallback = self.keyRed + self.umount() def getFeed(self): self.feedDownloader15 = feedDownloader(self.feed_base, self.box, OE_vers="1.5") @@ -655,7 +669,7 @@ class NFIDownload(Screen): First, you need to prepare a USB stick so that it is bootable. In the next step, an NFI image file can be downloaded from the update server and saved on the USB stick. If you already have a prepared bootable USB stick, please insert it now. Otherwise plug in a USB stick with a minimum size of 64 MB!""") - self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/","/autofs/sda1/","/media/hdd/","/media/net/","/media/usb/","/media/dvd/"]) + self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/","/autofs/sda1/","/media/hdd/","/media/net/",self.usbmountpoint,"/media/dvd/"]) def wizardDeviceBrowserClosed(self, path): print "[wizardDeviceBrowserClosed]", path @@ -740,6 +754,18 @@ If you already have a prepared bootable USB stick, please insert it now. Otherwi print "check failed! calling", repr(self.md5_failback) self.md5_failback() + def umount(self): + cmd = "umount " + self.usbmountpoint + print "[umount]", cmd + self.container.setCWD('/') + self.container.appClosed.append(self.umountFinished) + self.container.execute(cmd) + + def umountFinished(self, retval): + print "[umountFinished]", str(retval) + self.container.appClosed.remove(self.umountFinished) + self.umountCallback() + def main(session, **kwargs): session.open(NFIDownload,"/home/root") diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 633aae0d..78648602 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -118,7 +118,7 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): if self.settings.afterEvent.getValue() == "nothing": return elif self.settings.afterEvent.getValue() == "close": - self.abort() + self.close(False) from Screens.MessageBox import MessageBox if self.settings.afterEvent.getValue() == "deepstandby": if not Screens.Standby.inTryQuitMainloop: -- cgit v1.2.3 From 9bb563148acaa6198c21d333844471c7c90c4fd7 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 18 Aug 2010 17:06:05 +0200 Subject: TaskView: correctly pop-up aborted/failed notifications in foreground --- lib/python/Screens/TaskView.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 78648602..660fb276 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -117,7 +117,7 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): self["config"].hide() if self.settings.afterEvent.getValue() == "nothing": return - elif self.settings.afterEvent.getValue() == "close": + elif self.settings.afterEvent.getValue() == "close" and self.job.status == self.job.FINISHED: self.close(False) from Screens.MessageBox import MessageBox if self.settings.afterEvent.getValue() == "deepstandby": @@ -127,6 +127,12 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback(self.sendStandbyNotification, MessageBox, _("A sleep timer wants to set your\nDreambox to standby. Do that now?"), timeout = 20) + def checkNotifications(self): + InfoBarNotifications.checkNotifications(self) + if Notifications.notifications == []: + if self.settings.afterEvent.getValue() == "close" and self.job.status == self.job.FAILED: + self.close(False) + def sendStandbyNotification(self, answer): if answer: Notifications.AddNotification(Screens.Standby.Standby) -- cgit v1.2.3 From 7dd1afe283f519b4d1238b58f45aa5a14931aefe Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 24 Aug 2010 10:45:21 +0200 Subject: lib/dvb/sec.cpp: fixed typo (LOF/tuner frequency check was broken since latest unicable changes) --- lib/dvb/sec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 58fc5e39..a8292c0c 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -212,7 +212,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite eSecDebugNoSimulate("ret5 %d", ret); - if (ret && lnb_param.SatCR_idx != -1) + if (ret && lnb_param.SatCR_idx == -1) { int lof = sat.frequency > lnb_param.m_lof_threshold ? lnb_param.m_lof_hi : lnb_param.m_lof_lo; -- cgit v1.2.3 From fb75a5db67a5f82d9c4976cd2d056f47376affd3 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 24 Aug 2010 15:03:16 +0200 Subject: fix downloading image to flash or harddrive (#480) --- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 8768021c..2c8b45db 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -539,7 +539,10 @@ class NFIDownload(Screen): self.target_dir = usbpartition[0][1] self.ackDestinationDevice(device_description=usbpartition[0][0]) else: - self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=True, showMountpoints=True, inhibitMounts=["/autofs/sr0/"]) + self.openDeviceBrowser() + + def openDeviceBrowser(self): + self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=True, showMountpoints=True, inhibitMounts=["/autofs/sr0/"]) def DeviceBrowserClosed(self, path): print "[DeviceBrowserClosed]", str(path) @@ -555,7 +558,7 @@ class NFIDownload(Screen): else: dev = device_description message = _("Do you want to download the image to %s ?") % (dev) - choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.askDestination), (_("Cancel"),self.keyRed)] + choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.openDeviceBrowser), (_("Cancel"),self.keyRed)] self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices) def ackDestination_query(self, choice): @@ -566,27 +569,30 @@ class NFIDownload(Screen): self.keyRed() def ackedDestination(self): - print "[ackedDestination]", self.branch, self.target_dir, self.target_dir[8:] + print "[ackedDestination]", self.branch, self.target_dir self.container.setCWD("/mnt") if self.target_dir[:8] == "/autofs/": self.target_dir = "/dev/" + self.target_dir[8:-1] - if self.branch == STICK_WIZARD: - job = StickWizardJob(self.target_dir) - job.afterEvent = "close" - job_manager.AddJob(job) - job_manager.failed_jobs = [] - self.session.openWithCallback(self.StickWizardCB, JobView, job, afterEventChangeable = False) - - elif self.branch != STICK_WIZARD: - url = self.feedlists[self.branch][self.image_idx][1] - filename = self.feedlists[self.branch][self.image_idx][0] - print "[getImage] start downloading %s to %s" % (url, filename) + if self.branch == STICK_WIZARD: + job = StickWizardJob(self.target_dir) + job.afterEvent = "close" + job_manager.AddJob(job) + job_manager.failed_jobs = [] + self.session.openWithCallback(self.StickWizardCB, JobView, job, afterEventChangeable = False) + + elif self.branch != STICK_WIZARD: + url = self.feedlists[self.branch][self.image_idx][1] + filename = self.feedlists[self.branch][self.image_idx][0] + print "[getImage] start downloading %s to %s" % (url, filename) + if self.target_dir.startswith("/dev/"): job = ImageDownloadJob(url, filename, self.target_dir, self.usbmountpoint) - job.afterEvent = "close" - job_manager.AddJob(job) - job_manager.failed_jobs = [] - self.session.openWithCallback(self.ImageDownloadCB, JobView, job, afterEventChangeable = False) + else: + job = ImageDownloadJob(url, filename, None, self.target_dir) + job.afterEvent = "close" + job_manager.AddJob(job) + job_manager.failed_jobs = [] + self.session.openWithCallback(self.ImageDownloadCB, JobView, job, afterEventChangeable = False) def StickWizardCB(self, ret=None): print "[StickWizardCB]", ret -- cgit v1.2.3 From 4ad194a2c8742b4ce5906a7d816c2542f7397085 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Thu, 26 Aug 2010 08:34:43 +0200 Subject: Enigma2: add possibility to configure input device delay and repeat settings. fixes #69 --- data/menu.xml | 3 +- data/skin_default/icons/Makefile.am | 8 + .../icons/input_keyboard-configured.png | Bin 0 -> 2700 bytes data/skin_default/icons/input_keyboard.png | Bin 0 -> 2520 bytes data/skin_default/icons/input_mouse-configured.png | Bin 0 -> 2785 bytes data/skin_default/icons/input_mouse.png | Bin 0 -> 2512 bytes data/skin_default/icons/input_rcnew-configured.png | Bin 0 -> 2809 bytes data/skin_default/icons/input_rcnew.png | Bin 0 -> 2570 bytes data/skin_default/icons/input_rcold-configured.png | Bin 0 -> 2796 bytes data/skin_default/icons/input_rcold.png | Bin 0 -> 2598 bytes lib/python/Components/InputDevice.py | 225 +++++++++++++++-- lib/python/Screens/InputDeviceSetup.py | 280 +++++++++++++++++++++ lib/python/Screens/Makefile.am | 3 +- 13 files changed, 494 insertions(+), 25 deletions(-) create mode 100644 data/skin_default/icons/input_keyboard-configured.png create mode 100644 data/skin_default/icons/input_keyboard.png create mode 100644 data/skin_default/icons/input_mouse-configured.png create mode 100644 data/skin_default/icons/input_mouse.png create mode 100644 data/skin_default/icons/input_rcnew-configured.png create mode 100644 data/skin_default/icons/input_rcnew.png create mode 100644 data/skin_default/icons/input_rcold-configured.png create mode 100644 data/skin_default/icons/input_rcold.png mode change 100644 => 100755 lib/python/Components/InputDevice.py create mode 100755 lib/python/Screens/InputDeviceSetup.py (limited to 'lib') diff --git a/data/menu.xml b/data/menu.xml index 0d874718..6e103542 100755 --- a/data/menu.xml +++ b/data/menu.xml @@ -61,8 +61,9 @@ - + + + {"template": [ + MultiContentEntryPixmapAlphaTest(pos = (2, 8), size = (54, 54), png = 2), # index 3 is the interface pixmap + MultiContentEntryText(pos = (65, 6), size = (450, 54), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER|RT_WRAP, text = 1), # index 1 is the interfacename + ], + "fonts": [gFont("Regular", 28),gFont("Regular", 20)], + "itemHeight": 70 + } + + + + + + """ + + + def __init__(self, session): + Screen.__init__(self, session) + HelpableScreen.__init__(self) + + self.edittext = _("Press OK to edit the settings.") + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Select")) + self["key_yellow"] = StaticText("") + self["key_blue"] = StaticText("") + self["introduction"] = StaticText(self.edittext) + + self.devices = [(iInputDevices.getDeviceName(x),x) for x in iInputDevices.getDeviceList()] + print "[InputDeviceSelection] found devices :->", len(self.devices),self.devices + + self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", + { + "cancel": (self.close, _("Exit input device selection.")), + "ok": (self.okbuttonClick, _("Select input device.")), + }, -2) + + self["ColorActions"] = HelpableActionMap(self, "ColorActions", + { + "red": (self.close, _("Exit input device selection.")), + "green": (self.okbuttonClick, _("Select input device.")), + }, -2) + + self.currentIndex = 0 + self.list = [] + self["list"] = List(self.list) + self.updateList() + self.onLayoutFinish.append(self.layoutFinished) + self.onClose.append(self.cleanup) + + def layoutFinished(self): + self.setTitle(_("Select input device")) + + def cleanup(self): + self.currentIndex = 0 + + def buildInterfaceList(self,device,description,type ): + divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) + activepng = None + devicepng = None + enabled = iInputDevices.getDeviceAttribute(device, 'enabled') + + if type == 'remote': + if config.misc.rcused.value == 0: + if enabled: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew-configured.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew.png")) + else: + if enabled: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcold-configured.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcold.png")) + elif type == 'keyboard': + if enabled: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_keyboard-configured.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_keyboard.png")) + elif type == 'mouse': + if enabled: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_mouse-configured.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_mouse.png")) + else: + devicepng = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/input_rcnew.png")) + return((device, description, devicepng, divpng)) + + def updateList(self): + self.list = [] + for x in self.devices: + dev_type = iInputDevices.getDeviceAttribute(x[1], 'type') + self.list.append(self.buildInterfaceList(x[1],_(x[0]), dev_type )) + self["list"].setList(self.list) + self["list"].setIndex(self.currentIndex) + + def okbuttonClick(self): + selection = self["list"].getCurrent() + self.currentIndex = self["list"].getIndex() + if selection is not None: + self.session.openWithCallback(self.DeviceSetupClosed, InputDeviceSetup, selection[0]) + + def DeviceSetupClosed(self, *ret): + self.updateList() + + +class InputDeviceSetup(Screen, ConfigListScreen): + + skin = """ + + + + + + + + + + + + + """ + + def __init__(self, session, device): + Screen.__init__(self, session) + self.inputDevice = device + iInputDevices.currentDevice = self.inputDevice + self.onChangedEntry = [ ] + self.setup_title = _("Input device setup") + self.isStepSlider = None + self.enableEntry = None + self.repeatEntry = None + self.delayEntry = None + self.nameEntry = None + self.enableConfigEntry = None + + self.list = [ ] + ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry) + + self["actions"] = ActionMap(["SetupActions"], + { + "cancel": self.keyCancel, + "save": self.apply, + }, -2) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + self["introduction"] = StaticText() + + self.createSetup() + self.onLayoutFinish.append(self.layoutFinished) + self.onClose.append(self.cleanup) + + def layoutFinished(self): + self.setTitle(self.setup_title) + + def cleanup(self): + iInputDevices.currentDevice = "" + + def createSetup(self): + self.list = [ ] + cmd = "self.enableEntry = getConfigListEntry(_('"'Change repeat and delay settings?'"'), config.inputDevices." + self.inputDevice + ".enabled)" + exec (cmd) + cmd = "self.repeatEntry = getConfigListEntry(_('"'Interval between keys when repeating:'"'), config.inputDevices." + self.inputDevice + ".repeat)" + exec (cmd) + cmd = "self.delayEntry = getConfigListEntry(_('"'Delay before key repeat starts:'"'), config.inputDevices." + self.inputDevice + ".delay)" + exec (cmd) + cmd = "self.nameEntry = getConfigListEntry(_('"'Devicename:'"'), config.inputDevices." + self.inputDevice + ".name)" + exec (cmd) + if self.enableEntry: + if isinstance(self.enableEntry[1], ConfigYesNo): + self.enableConfigEntry = self.enableEntry[1] + + self.list.append(self.enableEntry) + if self.enableConfigEntry: + if self.enableConfigEntry.value is True: + self.list.append(self.repeatEntry) + self.list.append(self.delayEntry) + else: + self.repeatEntry[1].setValue(self.repeatEntry[1].default) + self["config"].invalidate(self.repeatEntry) + self.delayEntry[1].setValue(self.delayEntry[1].default) + self["config"].invalidate(self.delayEntry) + self.nameEntry[1].setValue(self.nameEntry[1].default) + self["config"].invalidate(self.nameEntry) + + self["config"].list = self.list + self["config"].l.setSeperation(400) + self["config"].l.setList(self.list) + if not self.selectionChanged in self["config"].onSelectionChanged: + self["config"].onSelectionChanged.append(self.selectionChanged) + self.selectionChanged() + + def selectionChanged(self): + if self["config"].getCurrent() == self.enableEntry: + self["introduction"].setText(_("Current device: ") + str(iInputDevices.getDeviceAttribute(self.inputDevice, 'name')) ) + else: + self["introduction"].setText(_("Current value: ") + self.getCurrentValue() + _(" ms")) + + def newConfig(self): + current = self["config"].getCurrent() + if current: + if current == self.enableEntry: + self.createSetup() + + def keyLeft(self): + ConfigListScreen.keyLeft(self) + self.newConfig() + + def keyRight(self): + ConfigListScreen.keyRight(self) + self.newConfig() + + def confirm(self, confirmed): + if not confirmed: + print "not confirmed" + return + else: + self.nameEntry[1].setValue(iInputDevices.getDeviceAttribute(self.inputDevice, 'name')) + cmd = "config.inputDevices." + self.inputDevice + ".name.save()" + exec (cmd) + self.keySave() + + def apply(self): + self.session.openWithCallback(self.confirm, MessageBox, _("Use this input device settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + + def cancelConfirm(self, result): + if not result: + return + for x in self["config"].list: + x[1].cancel() + self.close() + + def keyCancel(self): + if self["config"].isChanged(): + self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + else: + self.close() + # for summary: + def changedEntry(self): + for x in self.onChangedEntry: + x() + self.selectionChanged() + + def getCurrentEntry(self): + return self["config"].getCurrent()[0] + + def getCurrentValue(self): + return str(self["config"].getCurrent()[1].value) + + def createSummary(self): + from Screens.Setup import SetupSummary + return SetupSummary diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index 5cec5127..69600f01 100755 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -14,5 +14,6 @@ install_PYTHON = \ SubtitleDisplay.py SubservicesQuickzap.py ParentalControlSetup.py NumericalTextInputHelpDialog.py \ SleepTimerEdit.py Ipkg.py RdsDisplay.py Globals.py DefaultWizard.py \ SessionGlobals.py LocationBox.py WizardLanguage.py TaskView.py Rc.py VirtualKeyBoard.py \ - TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py ServiceStopScreen.py + TextBox.py FactoryReset.py RecordPaths.py UnhandledKey.py ServiceStopScreen.py \ + InputDeviceSetup.py -- cgit v1.2.3 From 88e935647412df82e4773265ff1e1e10b261e061 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 1 Sep 2010 15:41:15 +0200 Subject: [DVDBurn] remove absolut paths for DVD media toolbox console utilities (add #429) --- lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py index 53287a36..0b81cfdf 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py @@ -68,7 +68,7 @@ class DVDToolbox(Screen): self["info"].text = "" self["details"].setText("") self.Console = Console() - cmd = "/bin/dvd+rw-mediainfo /dev/" + harddiskmanager.getCD() + cmd = "dvd+rw-mediainfo /dev/" + harddiskmanager.getCD() self.Console.ePopen(cmd, self.mediainfoCB) def format(self): @@ -186,7 +186,7 @@ class DVDformatTask(Task): Task.__init__(self, job, ("RW medium format")) self.toolbox = job.toolbox self.postconditions.append(DVDformatTaskPostcondition()) - self.setTool("/bin/dvd+rw-format") + self.setTool("dvd+rw-format") self.args += [ "/dev/" + harddiskmanager.getCD() ] self.end = 1100 self.retryargs = [ ] -- cgit v1.2.3 From 14b0f1f771ab3ece2f104a5bc6ec871e5b5f952d Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 1 Sep 2010 15:53:27 +0200 Subject: [NFIFlash] ask whether to run configuration backup after image download (add #480) --- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 2c8b45db..27038e67 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -35,8 +35,8 @@ class ImageDownloadJob(Job): MountTask(self, device, mountpoint) ImageDownloadTask(self, url, mountpoint+filename) ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo") - if device: - UmountTask(self, mountpoint) + #if device: + #UmountTask(self, mountpoint) def retry(self): self.tasks[0].args += self.tasks[0].retryargs @@ -611,11 +611,30 @@ class NFIDownload(Screen): print "[ImageDownloadCB]", ret # print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job if len(job_manager.failed_jobs) == 0: - self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + self.session.openWithCallback(self.askBackupCB, MessageBox, _("The wizard can backup your current settings. Do you want to do a backup now?"), MessageBox.TYPE_YESNO) else: self.umountCallback = self.keyRed self.umount() + def askBackupCB(self, ret): + if ret: + from Plugins.SystemPlugins.SoftwareManager.BackupRestore import BackupScreen + + class USBBackupScreen(BackupScreen): + def __init__(self, session, usbmountpoint): + BackupScreen.__init__(self, session, runBackup = True) + self.backuppath = usbmountpoint + self.fullbackupfilename = self.backuppath + "/" + self.backupfile + + self.session.openWithCallback(self.showHint, USBBackupScreen, self.usbmountpoint) + else: + self.showHint() + + def showHint(self, ret=None): + self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + self.umountCallback = self.keyRed + self.umount() + def getFeed(self): self.feedDownloader15 = feedDownloader(self.feed_base, self.box, OE_vers="1.5") self.feedDownloader16 = feedDownloader(self.feed_base, self.box, OE_vers="1.6") -- cgit v1.2.3 From 8535d7279ebd982dbcdaf4edc1d10fb56f9b826f Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 7 Sep 2010 14:06:41 +0200 Subject: NFIFlash: integrate configuration backup/restore, string corrections --- .../Plugins/SystemPlugins/NFIFlash/downloader.py | 10 ++--- .../Plugins/SystemPlugins/NFIFlash/flasher.py | 48 ++++++++++++++++++---- 2 files changed, 46 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py index 27038e67..296d3bca 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py @@ -215,7 +215,7 @@ class CopyTask(Task): class NFOViewer(Screen): skin = """ - + """ @@ -631,7 +631,7 @@ class NFIDownload(Screen): self.showHint() def showHint(self, ret=None): - self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) + self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and make sure the bootable USB stick is plugged in.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO) self.umountCallback = self.keyRed self.umount() @@ -690,8 +690,8 @@ class NFIDownload(Screen): def askStartWizard(self): self.branch = STICK_WIZARD - message = _("""This plugin creates a USB stick which can be used to update the firmware of your Dreambox in case it has no network connection or only WLAN access. -First, you need to prepare a USB stick so that it is bootable. + message = _("""This plugin creates a USB stick which can be used to update the firmware of your Dreambox without the need for a network or WLAN connection. +First, a USB stick needs to be prepared so that it becomes bootable. In the next step, an NFI image file can be downloaded from the update server and saved on the USB stick. If you already have a prepared bootable USB stick, please insert it now. Otherwise plug in a USB stick with a minimum size of 64 MB!""") self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/","/autofs/sda1/","/media/hdd/","/media/net/",self.usbmountpoint,"/media/dvd/"]) @@ -753,7 +753,7 @@ If you already have a prepared bootable USB stick, please insert it now. Otherwi def nfo_finished(self,nfodata=""): print "[nfo_finished] " + str(nfodata) - self["key_blue"].text = _("Changelog viewer") + self["key_blue"].text = _("Changelog") self.nfo = nfodata def md5verify(self, md5, path): diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py index 95c7eee9..ba96c071 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -2,6 +2,7 @@ from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox from Screens.Standby import TryQuitMainloop +from Screens.Console import Console from Components.ActionMap import ActionMap from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress @@ -13,7 +14,7 @@ from Screens.TaskView import JobView from Tools.Directories import fileExists from Tools.HardwareInfo import HardwareInfo from os import system -from enigma import eConsoleAppContainer +from enigma import eConsoleAppContainer, quitMainloop from Components.About import about class md5Postcondition(Condition): @@ -95,11 +96,11 @@ class NFIFlash(Screen): self["key_green"] = StaticText() self["key_yellow"] = StaticText() self["key_blue"] = StaticText() - self.filelist = FileList(self.usbmountpoint, matchingPattern = "^.*\.(nfi|NFI)") + self.filelist = FileList(self.usbmountpoint, matchingPattern = "^.*\.(nfi|NFI)", showDirectories = False, showMountpoints = False) self["filelist"] = self.filelist - self["infolabel"] = StaticText("") + self["infolabel"] = StaticText() - self["status"] = StaticText("currently installed image: %s" % (about.getImageVersionString())) + self["status"] = StaticText(_("Please select an NFI file and press green key to flash!") + '\n' + _("currently installed image: %s") % (about.getImageVersionString())) self.job = None self["shortcuts"] = ActionMap(["OkCancelActions", "ColorActions", "ShortcutActions", "DirectionActions"], @@ -115,6 +116,15 @@ class NFIFlash(Screen): "right": self.keyRight }, -1) self.md5sum = "" + self.onShown.append(self.autostart) + + def autostart(self): + self.onShown.remove(self.autostart) + self.check_for_NFO() + print "[[layoutFinished]]", len(self["filelist"].getFileList()) + if len(self["filelist"].getFileList()) == 1: + print "==1" + self.keyOk() def keyUp(self): self["filelist"].up() @@ -176,6 +186,7 @@ class NFIFlash(Screen): def createJob(self): self.job = Job("Image flashing job") + self.job.afterEvent = "close" cwd = self["filelist"].getCurrentDirectory() md5verify(self.job, cwd, self.md5sum) writeNAND(self.job, [self.nfifile], self.box) @@ -183,13 +194,36 @@ class NFIFlash(Screen): self["key_yellow"].text = "" self["key_green"].text = "" job_manager.AddJob(self.job) - self.session.openWithCallback(self.flashed, JobView, self.job, cancelable = False, backgroundable = False) + self.session.openWithCallback(self.flashed, JobView, self.job, cancelable = False, backgroundable = False, afterEventChangeable = False) def flashed(self, bg): print "[flashed]" - self["key_yellow"].text = _("Reboot") + if self.job.status == self.job.FINISHED: + self["status"].text = _("NFI image flashing completed. Press Yellow to Reboot!") + filename = self.usbmountpoint+'enigma2settingsbackup.tar.gz' + if fileExists(filename): + import os.path, time + date = time.ctime(os.path.getmtime(filename)) + self.session.openWithCallback(self.askRestoreCB, MessageBox, _("The wizard found a configuration backup. Do you want to restore your old settings from %s?") % date, MessageBox.TYPE_YESNO) + else: + self.unlockRebootButton() + else: + self["status"].text = _("Flashing failed") + + def askRestoreCB(self, ret): + if ret: + from Plugins.SystemPlugins.SoftwareManager.BackupRestore import getBackupFilename + restorecmd = ["tar -xzvf " + self.usbmountpoint + getBackupFilename() + " -C /"] + self.session.openWithCallback(self.unlockRebootButton, Console, title = _("Restore is running..."), cmdlist = restorecmd, closeOnSuccess = True) + else: + self.unlockRebootButton() + + def unlockRebootButton(self, retval = None): + if self.job.status == self.job.FINISHED: + self["key_yellow"].text = _("Reboot") def reboot(self, ret=None): if self.job.status == self.job.FINISHED: self["status"].text = ("rebooting...") - TryQuitMainloop(self.session,2) + from os import system + system("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/kill_e2_reboot.sh") -- cgit v1.2.3 From 3c4d2076b502a00d66b39f7f390cbed287193ceb Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 13 Sep 2010 23:42:23 +0200 Subject: fixes bug #582 handle keyboard entries in wizard correctly for dynamic config elements --- lib/python/Screens/Wizard.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 1bff0284..a752d31c 100755 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -387,10 +387,14 @@ class Wizard(Screen): def keyNumberGlobal(self, number): if (self.wizard[self.currStep]["config"]["screen"] != None): self.configInstance.keyNumberGlobal(number) + elif (self.wizard[self.currStep]["config"]["type"] == "dynamic"): + self["config"].handleKey(KEY_0 + number) def keyGotAscii(self): if (self.wizard[self.currStep]["config"]["screen"] != None): self["config"].handleKey(KEY_ASCII) + elif (self.wizard[self.currStep]["config"]["type"] == "dynamic"): + self["config"].handleKey(KEY_ASCII) def left(self): self.resetCounter() -- cgit v1.2.3 From ceaa41889d0e8959393b8c0fce601707b9494b73 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Tue, 21 Sep 2010 21:29:48 +0200 Subject: Enigma2-meta: rework plugin meta files and prepare for inclusion into enigma2 translation. Meta.xml files are now only in english and translation is now easy possible for all languages over enigma2 translation project. This also reduces consumed space inside flash memory. Add missing TempFanControl plugin meta and LICENSE. DreamInfohandler.py,SoftwareManager: follow meta xml changes. fixes #578 --- Makefile.am | 8 +- configure.ac | 1 + lib/python/Components/DreamInfoHandler.py | 86 ++++++---------------- .../CutListEditor/meta/plugin_cutlisteditor.xml | 13 +--- .../Extensions/DVDBurn/meta/plugin_dvdburn.xml | 17 ++--- .../Extensions/DVDPlayer/meta/plugin_dvdplayer.xml | 13 +--- .../GraphMultiEPG/meta/plugin_graphmultiepg.xml | 13 +--- .../MediaPlayer/meta/plugin_mediaplayer.xml | 13 +--- .../MediaScanner/meta/plugin_mediascanner.xml | 14 +--- .../PicturePlayer/meta/plugin_pictureplayer.xml | 13 +--- .../Extensions/SocketMMI/meta/plugin_socketmmi.xml | 11 +-- .../TuxboxPlugins/meta/plugin_tuxboxplugins.xml | 11 +-- .../CleanupWizard/meta/plugin_cleanupwizard.xml | 18 +---- .../meta/plugin_commoninterfaceassignment.xml | 23 ++---- .../meta/plugin_crashlogautosubmit.xml | 17 +---- .../meta/plugin_defaultservicesscanner.xml | 16 +--- .../DiseqcTester/meta/plugin_diseqctester.xml | 16 +--- .../meta/plugin_frontprocessorupgrade.xml | 14 +--- .../SystemPlugins/Hotplug/meta/plugin_hotplug.xml | 15 +--- .../NFIFlash/meta/plugin_nfiflash.xml | 18 +---- .../NetworkWizard/meta/plugin_networkwizard.xml | 16 +--- .../meta/plugin_positionersetup.xml | 17 +---- .../meta/plugin_satelliteequipmentcontrol.xml | 16 +--- .../Satfinder/meta/plugin_satfinder.xml | 18 +---- .../SkinSelector/meta/plugin_skinselector.xml | 15 +--- .../SystemPlugins/SoftwareManager/SoftwareTools.py | 2 +- .../meta/plugin_softwaremanager.xml | 18 +---- .../SystemPlugins/SoftwareManager/plugin.py | 39 ++++------ .../Plugins/SystemPlugins/TempFanControl/LICENSE | 12 +++ .../SystemPlugins/TempFanControl/Makefile.am | 4 + .../SystemPlugins/TempFanControl/meta/Makefile.am | 3 + .../TempFanControl/meta/plugin_tempfancontrol.xml | 18 +++++ .../meta/plugin_videoenhancement.xml | 14 +--- .../VideoTune/meta/plugin_videotune.xml | 13 +--- .../Videomode/meta/plugin_videomode.xml | 14 +--- .../WirelessLan/meta/plugin_wirelesslan.xml | 12 +-- tools/genmetaindex.py | 12 ++- 37 files changed, 173 insertions(+), 420 deletions(-) mode change 100644 => 100755 lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml mode change 100644 => 100755 lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml create mode 100755 lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE mode change 100644 => 100755 lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am create mode 100755 lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am create mode 100755 lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml (limited to 'lib') diff --git a/Makefile.am b/Makefile.am index c517d9c5..bc1770b7 100755 --- a/Makefile.am +++ b/Makefile.am @@ -7,12 +7,8 @@ install_PYTHON = \ keyids.py keymapparser.py mytest.py skin.py timer.py tools.py GlobalActions.py \ e2reactor.py -LANGS := $(shell cat $(srcdir)/po/LINGUAS) - install-exec-hook: - for lang in $(LANGS); do \ - $(PYTHON) $(srcdir)/tools/genmetaindex.py $$lang $(DESTDIR)$(datadir)/meta/plugin_*.xml > $(DESTDIR)$(datadir)/meta/index-enigma2_$$lang.xml; \ - done + $(PYTHON) $(srcdir)/tools/genmetaindex.py $(DESTDIR)$(datadir)/meta/plugin_*.xml > $(DESTDIR)$(datadir)/meta/index-enigma2.xml uninstall-hook: - $(RM) $(DESTDIR)$(datadir)/meta/index-enigma2_*.xml + $(RM) $(DESTDIR)$(datadir)/meta/index-enigma2.xml diff --git a/configure.ac b/configure.ac index 05c3a8eb..35fad779 100755 --- a/configure.ac +++ b/configure.ac @@ -159,6 +159,7 @@ lib/python/Plugins/SystemPlugins/Hotplug/Makefile lib/python/Plugins/SystemPlugins/Hotplug/meta/Makefile lib/python/Plugins/SystemPlugins/Makefile lib/python/Plugins/SystemPlugins/TempFanControl/Makefile +lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile lib/python/Plugins/SystemPlugins/NetworkWizard/Makefile lib/python/Plugins/SystemPlugins/NetworkWizard/meta/Makefile lib/python/Plugins/SystemPlugins/NFIFlash/Makefile diff --git a/lib/python/Components/DreamInfoHandler.py b/lib/python/Components/DreamInfoHandler.py index 85e2b533..dd140cbb 100755 --- a/lib/python/Components/DreamInfoHandler.py +++ b/lib/python/Components/DreamInfoHandler.py @@ -16,7 +16,7 @@ class InfoHandlerParseError(Exception): return repr(self.value) class InfoHandler(xml.sax.ContentHandler): - def __init__(self, prerequisiteMet, directory, language = None): + def __init__(self, prerequisiteMet, directory): self.attributes = {} self.directory = directory self.list = [] @@ -26,9 +26,6 @@ class InfoHandler(xml.sax.ContentHandler): self.validFileTypes = ["skin", "config", "services", "favourites", "package"] self.prerequisitesMet = prerequisiteMet self.data = "" - self.language = language - self.translatedPackageInfos = {} - self.foundTranslation = None def printError(self, error): print "Error in defaults xml files:", error @@ -52,15 +49,6 @@ class InfoHandler(xml.sax.ContentHandler): if name == "info": self.foundTranslation = None self.data = "" - if not attrs.has_key("language"): - print "info tag with no language attribute" - else: - if attrs["language"] == 'en': # read default translations - self.foundTranslation = False - self.data = "" - elif attrs["language"] == self.language: - self.foundTranslation = True - self.data = "" if name == "files": if attrs.has_key("type"): @@ -91,20 +79,17 @@ class InfoHandler(xml.sax.ContentHandler): if attrs.has_key("details"): self.attributes["details"] = str(attrs["details"]) if attrs.has_key("name"): - self.attributes["name"] = str(attrs["name"].encode("utf-8")) + self.attributes["name"] = str(attrs["name"]) if attrs.has_key("packagename"): - self.attributes["packagename"] = str(attrs["packagename"].encode("utf-8")) + self.attributes["packagename"] = str(attrs["packagename"]) if attrs.has_key("packagetype"): - self.attributes["packagetype"] = str(attrs["packagetype"].encode("utf-8")) + self.attributes["packagetype"] = str(attrs["packagetype"]) if attrs.has_key("shortdescription"): - self.attributes["shortdescription"] = str(attrs["shortdescription"].encode("utf-8")) + self.attributes["shortdescription"] = str(attrs["shortdescription"]) if name == "screenshot": if attrs.has_key("src"): - if self.foundTranslation is False: - self.attributes["screenshot"] = str(attrs["src"]) - elif self.foundTranslation is True: - self.translatedPackageInfos["screenshot"] = str(attrs["src"]) + self.attributes["screenshot"] = str(attrs["src"]) def endElement(self, name): #print "endElement", name @@ -124,7 +109,7 @@ class InfoHandler(xml.sax.ContentHandler): self.attributes[self.filetype].append({ "name": str(self.fileattrs["name"]), "directory": directory }) if name in ( "default", "package" ): - self.list.append({"attributes": self.attributes, 'prerequisites': self.globalprerequisites ,"translation": self.translatedPackageInfos}) + self.list.append({"attributes": self.attributes, 'prerequisites': self.globalprerequisites}) self.attributes = {} self.globalprerequisites = {} @@ -133,30 +118,13 @@ class InfoHandler(xml.sax.ContentHandler): self.attributes["author"] = str(data) if self.elements[-1] == "name": self.attributes["name"] = str(data) - if self.foundTranslation is False: - if self.elements[-1] == "author": - self.attributes["author"] = str(data) - if self.elements[-1] == "name": - self.attributes["name"] = str(data) - if self.elements[-1] == "packagename": - self.attributes["packagename"] = str(data.encode("utf-8")) - if self.elements[-1] == "shortdescription": - self.attributes["shortdescription"] = str(data.encode("utf-8")) - if self.elements[-1] == "description": - self.data += data.strip() - self.attributes["description"] = str(self.data.encode("utf-8")) - elif self.foundTranslation is True: - if self.elements[-1] == "author": - self.translatedPackageInfos["author"] = str(data) - if self.elements[-1] == "name": - self.translatedPackageInfos["name"] = str(data) - if self.elements[-1] == "description": - self.data += data.strip() - self.translatedPackageInfos["description"] = str(self.data.encode("utf-8")) - if self.elements[-1] == "name": - self.translatedPackageInfos["name"] = str(data.encode("utf-8")) - if self.elements[-1] == "shortdescription": - self.translatedPackageInfos["shortdescription"] = str(data.encode("utf-8")) + if self.elements[-1] == "packagename": + self.attributes["packagename"] = str(data) + if self.elements[-1] == "shortdescription": + self.attributes["shortdescription"] = str(data) + if self.elements[-1] == "description": + self.data += data + self.attributes["description"] = str(self.data) #print "characters", data @@ -166,13 +134,12 @@ class DreamInfoHandler: STATUS_ERROR = 2 STATUS_INIT = 4 - def __init__(self, statusCallback, blocking = False, neededTag = None, neededFlag = None, language = None): + def __init__(self, statusCallback, blocking = False, neededTag = None, neededFlag = None): self.hardware_info = HardwareInfo() self.directory = "/" self.neededTag = neededTag self.neededFlag = neededFlag - self.language = language # caution: blocking should only be used, if further execution in enigma2 depends on the outcome of # the installer! @@ -203,8 +170,8 @@ class DreamInfoHandler: #print handler.list def readIndex(self, directory, file): - print "Reading .xml meta index file", file - handler = InfoHandler(self.prerequisiteMet, directory, self.language) + print "Reading .xml meta index file", directory, file + handler = InfoHandler(self.prerequisiteMet, directory) try: xml.sax.parse(file, handler) for entry in handler.list: @@ -216,7 +183,7 @@ class DreamInfoHandler: def readDetails(self, directory, file): self.packageDetails = [] print "Reading .xml meta details file", file - handler = InfoHandler(self.prerequisiteMet, directory, self.language) + handler = InfoHandler(self.prerequisiteMet, directory) try: xml.sax.parse(file, handler) for entry in handler.list: @@ -225,7 +192,6 @@ class DreamInfoHandler: print "file", file, "ignored due to errors in the file" #print handler.list - # prerequisites = True: give only packages matching the prerequisites def fillPackagesList(self, prerequisites = True): self.packageslist = [] @@ -254,20 +220,14 @@ class DreamInfoHandler: self.directory = [self.directory] for indexfile in os.listdir(self.directory[0]): - if indexfile.startswith("index"): - if indexfile.endswith("_en.xml"): #we first catch all english indexfiles - indexfileList.append(os.path.splitext(indexfile)[0][:-3]) - + if indexfile.startswith("index-"): + if indexfile.endswith(".xml"): + indexfileList.append(indexfile) if len(indexfileList): for file in indexfileList: neededFile = self.directory[0] + "/" + file - if self.language is not None: - if os.path.exists(neededFile + '_' + self.language + '.xml' ): - #print "translated index file found",neededFile + '_' + self.language + '.xml' - self.readIndex(self.directory[0] + "/", neededFile + '_' + self.language + '.xml') - else: - #print "reading original index file" - self.readIndex(self.directory[0] + "/", neededFile + '_en.xml') + if os.path.isfile(neededFile): + self.readIndex(self.directory[0] + "/" , neededFile) if prerequisites: for package in self.packagesIndexlist[:]: diff --git a/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml b/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml index 1431caf4..7132ba02 100755 --- a/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml +++ b/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml @@ -2,23 +2,14 @@ - + Dream Multimedia CutListEditor enigma2-plugin-extensions-cutlisteditor - CutListEditor allows you to edit your movies. + CutListEditor allows you to edit your movies CutListEditor allows you to edit your movies.\nSeek to the start of the stuff you want to cut away. Press OK, select 'start cut'.\nThen seek to the end, press OK, select 'end cut'. That's it. - - Dream Multimedia - Schnitteditor - enigma2-plugin-extensions-cutlisteditor - Mit dem Schnitteditor können Sie Ihre Aufnahmen schneiden. - Mit dem Schnitteditor können Sie Ihre Aufnahmen schneiden.\nSpulen Sie zum Anfang des zu schneidenden Teils der Aufnahme. Drücken Sie dann OK und wählen Sie: 'start cut'.\nDann spulen Sie zum Ende, drücken OK und wählen 'end cut'. Das ist alles. - - - diff --git a/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml b/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml index 647d1cfd..c1e202a9 100755 --- a/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml +++ b/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml @@ -3,22 +3,17 @@ - + Dream Multimedia DVDBurn enigma2-plugin-extensions-dvdburn - With DVDBurn you can burn your recordings to a dvd. - With DVDBurn you can burn your recordings to a dvd.\nArchive all your favorite movies to recordable dvds with menus if wanted. + Burn your recordings to DVD + With DVDBurn you can make compilations of records from your Dreambox hard drive.\n + Optionally you can add customizable menus. You can record the compilation to a standard-compliant DVD that can be played on conventinal DVD players.\n + HDTV recordings can only be burned in proprietary dreambox format. - - Dream Multimedia - DVDBurn - enigma2-plugin-extensions-dvdburn - Mit DVDBurn brennen Sie ihre Aufnahmen auf DVD. - Mit DVDBurn brennen Sie ihre Aufnahmen auf DVD.\nArchivieren Sie Ihre Liblingsfilme auf DVD mit Menus wenn Sie es wünschen. - - + diff --git a/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml b/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml index 1353f7d2..6fc5a6f1 100755 --- a/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml +++ b/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml @@ -2,23 +2,14 @@ - + Dream Multimedia DVDPlayer enigma2-plugin-extensions-dvdplayer - DVDPlayer plays your DVDs on your Dreambox. + DVDPlayer plays your DVDs on your Dreambox DVDPlayer plays your DVDs on your Dreambox.\nWith the DVDPlayer you can play your DVDs on your Dreambox from a DVD or even from an iso file or video_ts folder on your harddisc or network. - - Dream Multimedia - DVDPlayer - enigma2-plugin-extensions-dvdplayer - Spielen Sie Ihre DVDs mit dem DVDPlayer auf Ihrer Dreambox ab. - Spielen Sie Ihre DVDs mit dem DVDPlayer auf Ihrer Dreambox ab.\nMit dem DVDPlayer können Sie Ihre DVDs auf Ihrer Dreambox abspielen. Dabei ist es egal ob Sie von DVD, iso-Datei oder sogar direkt von einer video_ts Ordnerstruktur von Ihrer Festplatte oder dem Netzwerk abspielen. - - - diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml index 3e2a3f6e..d3a2edf8 100755 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml @@ -3,23 +3,14 @@ - + Dream Multimedia GraphMultiEPG enigma2-plugin-extensions-graphmultiepg - GraphMultiEPG shows a graphical timeline EPG. + GraphMultiEPG shows a graphical timeline EPG GraphMultiEPG shows a graphical timeline EPG.\nShows a nice overview of all running und upcoming tv shows. - - Dream Multimedia - GraphMultiEPG - enigma2-plugin-extensions-graphmultiepg - Zeigt ein grafisches Zeitlinien-EPG. - Zeigt ein grafisches Zeitlinien-EPG.\nZeigt eine grafische Übersicht aller laufenden und kommenden Sendungen. - - - diff --git a/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml b/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml index 2f9f22bf..ffbb8e89 100755 --- a/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml +++ b/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml @@ -2,23 +2,14 @@ - + Dream Multimedia MediaPlayer enigma2-plugin-extensions-mediaplayer - Mediaplayer plays your favorite music and videos. + Plays your favorite music and videos Mediaplayer plays your favorite music and videos.\nPlay all your favorite music and video files, organize them in playlists, view cover and album information. - - Dream Multimedia - MediaPlayer - enigma2-plugin-extensions-mediaplayer - Mediaplayer spielt Ihre Musik und Videos. - Mediaplayer spielt Ihre Musik und Videos.\nSie können all Ihre Musik- und Videodateien abspielen, in Playlisten organisieren, Cover und Albuminformationen abrufen. - - - diff --git a/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml b/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml index eced924f..eb9de1b6 100755 --- a/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml +++ b/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml @@ -1,25 +1,15 @@ - - + Dream Multimedia MediaScanner enigma2-plugin-extensions-mediascanner - MediaScanner scans devices for playable media files. + Scan devices for playable media files MediaScanner scans devices for playable media files and displays a menu with possible actions like viewing pictures or playing movies. - - Dream Multimedia - MediaScanner - enigma2-plugin-extensions-mediascanner - MediaScanner durchsucht Geräte nach Mediendateien. - MediaScanner durchsucht Geräte nach Mediendateien und bietet Ihnen die dazu passenden Aktionen an wie z.B. Bilder betrachten oder Videos abspielen. - - - diff --git a/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml b/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml index faff9785..16e2ec90 100755 --- a/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml +++ b/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml @@ -2,23 +2,14 @@ - + Dream Multimedia PicturePlayer enigma2-plugin-extensions-pictureplayer - PicturePlayer displays your photos on the TV. + Display your photos on the TV The PicturePlayer displays your photos on the TV.\nYou can view them as thumbnails or slideshow. - - Dream Multimedia - Bildbetrachter - enigma2-plugin-extensions-pictureplayer - Der Bildbetrachter zeigt Ihre Bilder auf dem Fernseher an. - Der Bildbetrachter zeigt Ihre Bilder auf dem Fernseher an.\nSie können sich Ihre Bilder als Thumbnails, einzeln oder als Slideshow anzeigen lassen. - - - diff --git a/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml b/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml old mode 100644 new mode 100755 index acf8374d..3eaf8fc5 --- a/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml +++ b/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml @@ -2,20 +2,13 @@ - + Dream Multimedia SocketMMI enigma2-plugin-extensions-socketmmi - Python frontend for /tmp/mmi.socket. + Frontend for /tmp/mmi.socket Python frontend for /tmp/mmi.socket. - - Dream Multimedia - SocketMMI - enigma2-plugin-extensions-socketmmi - Python frontend für /tmp/mmi.socket. - Python frontend für /tmp/mmi.socket. - diff --git a/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml b/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml old mode 100644 new mode 100755 index 734c48f1..7ca10826 --- a/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml +++ b/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml @@ -2,20 +2,13 @@ - + Dream Multimedia TuxboxPlugins TuxboxPlugins - Allows the execution of TuxboxPlugins. + Execute TuxboxPlugins Allows the execution of TuxboxPlugins. - - Dream Multimedia - TuxboxPlugins - enigma2-plugin-extensions-tuxboxplugins - Erlaubt das Ausführen von TuxboxPlugins. - Erlaubt das Ausführen von TuxboxPlugins. - diff --git a/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml b/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml index 99add3d3..d0781af4 100755 --- a/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml +++ b/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml @@ -2,26 +2,16 @@ - + Dream Multimedia CleanupWizard enigma2-plugin-systemplugins-cleanupwizard Automatically informs you on low internal memory - The CleanupWizard informs you when your internal free memory of your dreambox has droppen under 2MB. - You can use this wizard to remove some extensions. - + The CleanupWizard informs you when the internal free memory of your dreambox has dropped below a definable threshold. + You can use this wizard to remove some plugins. - - Dream Multimedia - CleanupWizard - enigma2-plugin-systemplugins-cleanupwizard - Informiert Sie automatisch wenn der interne Speicher Ihrer Dreambox voll wird. - Der CleanupWizard informiert Sie, wenn der interne freie Speicher Ihrer Dreambox unter 2MB fällt. - Sie können dann einige Erweiterungen deinstallieren um wieder Platz zu schaffen. - - - + diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml index 9abc5986..f34f0a3c 100755 --- a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml @@ -4,28 +4,17 @@ - + Dream Multimedia CommonInterfaceAssignment enigma2-plugin-systemplugins-commoninterfaceassignment - Assigning providers/services/caids to a dedicated CI module - With the CommonInterfaceAssignment extension it is possible to use different CI modules - in your Dreambox and assign to each of them dedicated providers/services or caids.\n - So it is then possible to watch a scrambled service while recording another one. - - - - - Dream Multimedia - CommonInterfaceAssignment - enigma2-plugin-systemplugins-commoninterfaceassignment - Zuweisen von Providern/Services/CAIDs an ein CI Modul - Mit der CommonInterfaceAssignment Erweiterung ist es möglich jedem CI Modul bestimmte Provider/Services/CAIDs zuzuweisen.\n - So ist es möglich mit einem CI einen Sender aufzunehmen\n - und mit einem anderen einen Sender zu schauen. - + Assigning providers/services/caids to a CI module + With the CommonInterfaceAssignment plugin it is possible to use different + CI modules in your Dreambox and assign dedicated providers/services or caids to each of them.\n + This allows watching a scrambled service while recording another one. + diff --git a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml index a118ed7f..3140b15f 100755 --- a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml +++ b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml @@ -2,26 +2,17 @@ - + Dream Multimedia CrashlogAutoSubmit enigma2-plugin-systemplugins-crashlogautosubmit Automatically send crashlogs to Dream Multimedia - With the CrashlogAutoSubmit extension it is possible to automatically send crashlogs - found on your Harddrive to Dream Multimedia + With the CrashlogAutoSubmit plugin it is possible to automatically + mail crashlogs found on your hard drive to Dream Multimedia. - - Dream Multimedia - CrashlogAutoSubmit - enigma2-plugin-systemplugins-crashlogautosubmit - Automatisches versenden von Crashlogs an Dream Multimedia - Mit dem CrashlogAutoSubmit Plugin ist es möglich auf Ihrer Festplatte - gefundene Crashlogs automatisch an Dream Multimedia zu versenden. - - - + diff --git a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml index 41d41ed6..74b7886f 100755 --- a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml +++ b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml @@ -1,26 +1,18 @@ - + Dream Multimedia DefaultServicesScanner enigma2-plugin-systemplugins-defaultservicesscanner - Scans default lamedbs sorted by satellite with a connected dish positioner. - With the DefaultServicesScanner extension you can scan default lamedbs sorted by satellite with a connected dish positioner. - - - - - Dream Multimedia - DefaultServicesScanner - enigma2-plugin-systemplugins-defaultservicesscanner - Standard Sendersuche nach Satellit mit einem Rotor. - Mit der DefaultServicesScanner Erweiterung können Sie eine standard Sendersuche nach Satellit mit einem angeschlossenen Rotor durchführen. + Scans default lamedbs sorted by satellite + With the DefaultServicesScanner plugin you can scan default lamedbs sorted by satellite with a connected dish positioner. + diff --git a/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml b/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml index 33808b3e..567618b2 100755 --- a/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml +++ b/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml @@ -3,24 +3,16 @@ - + Dream Multimedia DiseqcTester enigma2-plugin-systemplugins-diseqctester - Test your Diseqc equipment. - With the DiseqcTester extension you can test your satellite equipment for Diseqc compatibility and errors. + Test your DiSEqC equipment + With the DiseqcTester plugin you can test your satellite equipment for DiSEqC compatibility and errors. - - Dream Multimedia - DiseqcTester - enigma2-plugin-systemplugins-diseqctester - Testet Ihr Diseqc Equipment. - Mit der DiseqcTester Erweiterung können Sie Ihr Satelliten-Equipment nach Diseqc-Kompatibilität und Fehlern überprüfen. - - - + diff --git a/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml b/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml old mode 100644 new mode 100755 index 1763f67f..7b6fdca7 --- a/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml +++ b/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml @@ -3,24 +3,16 @@ - + Dream Multimedia FrontprocessorUpgrade enigma2-plugin-systemplugins-frontprocessorupgrade internal - Internal firmware updater. + Internal firmware updater This system tool is internally used to program the hardware with firmware updates. - - Dream Multimedia - FrontprocessorUpgrade - enigma2-plugin-systemplugins-frontprocessorupgrade - internal - Interner Firmware-Upgrader. - Dieses Systemtool wird intern benutzt um Firmware-Upgrades für die Hardware aufzuspielen. - - + diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml b/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml old mode 100644 new mode 100755 index 6c2824ca..610dfee6 --- a/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml +++ b/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml @@ -2,22 +2,15 @@ - + Dream Multimedia Hotplug enigma2-plugin-systemplugins-hotplug - Hotplugging for removeable devices. - The Hotplug extension notifies your system of newly added or removed devices. - - - - Dream Multimedia - Hotplug - enigma2-plugin-systemplugins-hotplug - Hotplugging für entfernbare Geräte. - Mit der Hotplug-Erweiterung wird Ihr System über neu angeschlossene oder entfernte Geräte informiert. + Hotplugging for removeable devices + The Hotplug plugin notifies your system of newly added or removed devices. + diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml b/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml index c81f4ca5..f93f5c5a 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml @@ -2,28 +2,18 @@ - - + Dream Multimedia NFIFlash enigma2-plugin-systemplugins-nfiflash - Restore your Dreambox with a USB stick. - With the NFIFlash extension it is possible to prepare a USB stick with an Dreambox image.\n + Restore your Dreambox with a USB stick + With the NFIFlash plugin it is possible to prepare a USB stick with an Dreambox image.\n It is then possible to flash your Dreambox with the image on that stick. - - Dream Multimedia - NFIFlash - enigma2-plugin-systemplugins-nfiflash - Wiederherstellen Ihrer Dreambox mittels USB-Stick. - Mit der NFIFlash Erweiterung können Sie ein Dreambox Image auf einen USB-Stick laden.\ - Mit diesem USB-Stick ist es dann möglich Ihre Dreambox zu flashen. - - - + diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml b/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml index 4d3adcbd..423365f1 100755 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml @@ -1,26 +1,18 @@ + - + Dream Multimedia NetworkWizard enigma2-plugin-systemplugins-networkwizard Step by step network configuration - With the NetworkWizard you can easy configure your network step by step. + With the NetworkWizard you can easily configure your network step by step. - - Dream Multimedia - NetzwerkWizard - enigma2-plugin-systemplugins-networkwizard - Schritt für Schritt Netzwerk konfiguration - Mit dem NetzwerkWizard können Sie Ihr Netzwerk konfigurieren. Sie werden Schritt - für Schritt durch die Konfiguration geleitet. - - - + diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml b/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml index 2cb47c07..5e1db7ba 100755 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml @@ -3,25 +3,16 @@ - + Dream Multimedia PositionerSetup enigma2-plugin-systemplugins-positionersetup - PositionerSetup helps you installing a motorized dish. - With the PositionerSetup extension it is easy to install and configure a motorized dish. - - - - - Dream Multimedia - PositionerSetup - enigma2-plugin-systemplugins-positionersetup - Unterstützt Sie beim installieren eines Rotors. - Die PositionerSetup Erweiterung unterstützt Sie beim einrichten - und konfigurieren einer motorgesteuerten Satellitenantenne. + PositionerSetup helps you installing a motorized dish + With the PositionerSetup plugin it is easy to install and configure a motorized dish. + diff --git a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml index 4c0c7af7..904f9a2e 100755 --- a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml +++ b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml @@ -3,25 +3,17 @@ - + Dream Multimedia SatelliteEquipmentControl SatelliteEquipmentControl enigma2-plugin-systemplugins-satelliteequipmentcontrol - SatelliteEquipmentControl allows you to fine-tune DiSEqC-settings. - With the SatelliteEquipmentControl extension it is possible to fine-tune DiSEqC-settings. - - - - - Dream Multimedia - SatelliteEquipmentControl - enigma2-plugin-systemplugins-satelliteequipmentcontrol - Fein-Einstellungen für DiSEqC - Die SatelliteEquipmentControl-Erweiterung unterstützt Sie beim Feintuning der DiSEqC Einstellungen. + SatelliteEquipmentControl allows you to fine-tune DiSEqC-settings + With the SatelliteEquipmentControl plugin it is possible to fine-tune DiSEqC-settings. + diff --git a/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml b/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml index e9453deb..fe0c901e 100755 --- a/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml +++ b/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml @@ -1,28 +1,18 @@ - + - + Dream Multimedia Satfinder enigma2-plugin-systemplugins-satfinder - Satfinder helps you to align your dish. - The Satfinder extension helps you to align your dish.\n + Satfinder helps you to align your dish + The Satfinder plugin helps you to align your dish.\n It shows you informations about signal rate and errors. - - Dream Multimedia - Satfinder - enigma2-plugin-systemplugins-satfinder - Satfinder unterstützt Sie beim ausrichten ihrer Satellitenanlage. - Die Satfinder-Erweiterung unterstützt Sie beim Ausrichten ihrer Satellitenanlage.\n - Es zeigt Ihnen Daten wie Signalstärke und Fehlerrate an. - - - diff --git a/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml b/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml index 717f732b..73544a56 100755 --- a/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml +++ b/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml @@ -1,28 +1,19 @@ - + Dream Multimedia SkinSelector enigma2-plugin-systemplugins-skinselector - SkinSelector shows a menu with selectable skins. + SkinSelector shows a menu with selectable skins The SkinSelector shows a menu with selectable skins.\n It's now easy to change the look and feel of your Dreambox. - - Dream Multimedia - SkinSelector - enigma2-plugin-systemplugins-skinselector - Der SkinSelector zeigt Ihnen ein Menu mit auswählbaren Skins. - Die SkinSelector Erweiterung zeigt Ihnen ein Menu mit auswählbaren Skins.\n - Sie können nun einfach das Aussehen der grafischen Oberfläche Ihrer Dreambox verändern. - - - + diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index a29a5e99..879bec16 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -69,7 +69,7 @@ class SoftwareTools(DreamInfoHandler): else: self.ImageVersion = 'Stable' self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" - DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion, language = self.language) + DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion) self.directory = resolveFilename(SCOPE_METADIR) self.hardware_info = HardwareInfo() self.list = List([]) diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml b/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml index cd425c33..4135a212 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml @@ -3,27 +3,17 @@ - + Dream Multimedia SoftwareManager enigma2-plugin-systemplugins-softwaremanager - SoftwareManager manages your Dreambox software. + SoftwareManager manages your Dreambox software The SoftwareManager manages your Dreambox software.\n - It's easy to update your receiver's software, install or remove extensions or even backup and restore your system settings. + It's easy to update your receiver's software, install or remove plugins or even backup and restore your system settings. - - Dream Multimedia - SoftwareManager - enigma2-plugin-systemplugins-softwaremanager - Der SoftwareManager verwaltet Ihre Dreambox Software. - Der SoftwareManager verwaltet Ihre Dreambox Software.\n - Sie können nun einfach Ihre Dreambox-Software aktualisieren, neue Erweiterungen installieren oder entfernen, - oder ihre Einstellungen sichern und wiederherstellen. - - - + diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 99837678..0cc57776 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -789,13 +789,13 @@ class PluginManager(Screen, DreamInfoHandler): status = "remove" else: status = "installed" - self.list.append(self.buildEntryComponent(name, details, description, packagename, status, selected = selectState)) + self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState)) else: if selectState == True: status = "install" else: status = "installable" - self.list.append(self.buildEntryComponent(name, details, description, packagename, status, selected = selectState)) + self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState)) if len(self.list): self.list.sort(key=lambda x: x[0]) self["list"].style = "default" @@ -1104,8 +1104,7 @@ class PluginDetails(Screen, DreamInfoHandler): self.skin_path = plugin_path self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" self.attributes = None - self.translatedAttributes = None - DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, language = self.language) + DreamInfoHandler.__init__(self, self.statusCallback, blocking = False) self.directory = resolveFilename(SCOPE_METADIR) if packagedata: self.pluginname = packagedata[0] @@ -1143,8 +1142,6 @@ class PluginDetails(Screen, DreamInfoHandler): self.package = self.packageDetails[0] if self.package[0].has_key("attributes"): self.attributes = self.package[0]["attributes"] - if self.package[0].has_key("translation"): - self.translatedAttributes = self.package[0]["translation"] self.cmdList = [] self.oktext = _("\nAfter pressing OK, please wait!") @@ -1154,7 +1151,7 @@ class PluginDetails(Screen, DreamInfoHandler): self.onLayoutFinish.append(self.setInfos) def setWindowTitle(self): - self.setTitle(_("Details for extension: " + self.pluginname)) + self.setTitle(_("Details for plugin: ") + self.pluginname ) def exit(self): self.close(False) @@ -1169,34 +1166,26 @@ class PluginDetails(Screen, DreamInfoHandler): pass def setInfos(self): - if self.translatedAttributes.has_key("name"): - self.pluginname = self.translatedAttributes["name"] - elif self.attributes.has_key("name"): + if self.attributes.has_key("screenshot"): + self.loadThumbnail(self.attributes) + + if self.attributes.has_key("name"): self.pluginname = self.attributes["name"] else: self.pluginname = _("unknown") - if self.translatedAttributes.has_key("author"): - self.author = self.translatedAttributes["author"] - elif self.attributes.has_key("author"): + if self.attributes.has_key("author"): self.author = self.attributes["author"] else: self.author = _("unknown") - if self.translatedAttributes.has_key("description"): - self.description = self.translatedAttributes["description"] - elif self.attributes.has_key("description"): - self.description = self.attributes["description"] + if self.attributes.has_key("description"): + self.description = _(self.attributes["description"].replace("\\n", "\n")) else: self.description = _("No description available.") - if self.translatedAttributes.has_key("screenshot"): - self.loadThumbnail(self.translatedAttributes) - else: - self.loadThumbnail(self.attributes) - self["author"].setText(_("Author: ") + self.author) - self["detailtext"].setText(self.description.strip()) + self["detailtext"].setText(_(self.description)) if self.pluginstate in ('installable', 'install'): self["key_green"].setText(_("Install")) else: @@ -1206,6 +1195,10 @@ class PluginDetails(Screen, DreamInfoHandler): thumbnailUrl = None if entry.has_key("screenshot"): thumbnailUrl = entry["screenshot"] + if self.language == "de": + if thumbnailUrl[-7:] == "_en.jpg": + thumbnailUrl = thumbnailUrl[:-7] + "_de.jpg" + if thumbnailUrl is not None: self.thumbnail = "/tmp/" + thumbnailUrl.split('/')[-1] print "[PluginDetails] downloading screenshot " + thumbnailUrl + " to " + self.thumbnail diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE b/lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE new file mode 100755 index 00000000..99700593 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE @@ -0,0 +1,12 @@ +This plugin is licensed under the Creative Commons +Attribution-NonCommercial-ShareAlike 3.0 Unported +License. To view a copy of this license, visit +http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative +Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + +Alternatively, this plugin may be distributed and executed on hardware which +is licensed by Dream Multimedia GmbH. + +This plugin is NOT free software. It is open source, you are allowed to +modify it (if you keep the license), but it may not be commercially +distributed other than under the conditions noted above. diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am old mode 100644 new mode 100755 index 78ff11c3..cfdeb654 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am @@ -1,5 +1,9 @@ installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/TempFanControl +SUBDIRS = meta + install_PYTHON = \ __init__.py \ plugin.py + +dist_install_DATA = LICENSE \ No newline at end of file diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am new file mode 100755 index 00000000..da7be245 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am @@ -0,0 +1,3 @@ +installdir = $(datadir)/meta + +dist_install_DATA = plugin_tempfancontrol.xml diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml new file mode 100755 index 00000000..a0bb5fa5 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml @@ -0,0 +1,18 @@ + + + + + + + + Dream Multimedia + TempFanControl + enigma2-plugin-systemplugins-tempfancontrol + Control your system fan + Control your internal system fan. + + + + + + diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml b/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml index 208c7e0c..11b0c59f 100755 --- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml +++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml @@ -6,22 +6,14 @@ - + Dream Multimedia VideoEnhancement enigma2-plugin-systemplugins-videoenhancement - VideoEnhancement provides advanced video enhancement settings. - The VideoEnhancement extension provides advanced video enhancement settings. + VideoEnhancement provides advanced video enhancement settings + The VideoEnhancement plugin provides advanced video enhancement settings. - - Dream Multimedia - Erweiterte A/V Einstellungen - enigma2-plugin-systemplugins-videoenhancement - Erweiterte A/V Einstellungen für Ihre Dreambox. - Erweiterte A/V Einstellungen für Ihre Dreambox. - - diff --git a/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml b/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml index c4609433..78b170ac 100755 --- a/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml +++ b/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml @@ -3,23 +3,14 @@ - + Dream Multimedia VideoTune enigma2-plugin-systemplugins-videotune - VideoTune helps fine-tuning your tv display. + VideoTune helps fine-tuning your tv display The VideoTune helps fine-tuning your tv display.\nYou can control brightness and contrast of your tv. - - Dream Multimedia - DE - VideoTune - DE - enigma2-plugin-systemplugins-videotune - VideoTune hilft beim fein-einstellen des Fernsehers. - VideoTune hilf beim fein-einstellen des Fernsehers.\nSie können Kontrast und Helligkeit fein-einstellen. - - - diff --git a/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml b/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml index fbb6e3f4..e16a7dc8 100755 --- a/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml +++ b/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml @@ -3,22 +3,14 @@ - + Dream Multimedia Videomode enigma2-plugin-systemplugins-videomode - Videomode provides advanced video modes. - The Videomode extension provides advanced video modes. + Videomode provides advanced video mode settings + The Videomode plugin provides advanced video mode settings. - - Dream Multimedia - Videomode - enigma2-plugin-systemplugins-videomode - Videomode bietet erweiterte Video Einstellungen. - Die Videomode-Erweiterung bietet erweiterte Video-Einstellungen. - - diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml b/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml index 1f882b32..eca6c0f9 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml @@ -3,22 +3,14 @@ - + Dream Multimedia WirelessLan enigma2-plugin-systemplugins-wirelesslan Configure your WLAN network interface - The WirelessLan extensions helps you configuring your WLAN network interface. + The WirelessLan plugin helps you configuring your WLAN network interface. - - Dream Multimedia - WirelessLan - enigma2-plugin-systemplugins-wirelesslan - Konfigurieren Sie Ihr WLAN Netzwerk. - Die WirelessLan Erweiterung hilft Ihnen beim konfigurieren Ihres WLAN Netzwerkes.. - - diff --git a/tools/genmetaindex.py b/tools/genmetaindex.py index f7dc5b98..f42cefc2 100755 --- a/tools/genmetaindex.py +++ b/tools/genmetaindex.py @@ -1,25 +1,23 @@ -# usage: genmetaindex.py > index.xml +# usage: genmetaindex.py > index.xml import sys, os from xml.etree.ElementTree import ElementTree, Element -language = sys.argv[1] - root = Element("index") -for file in sys.argv[2:]: +for file in sys.argv[1:]: p = ElementTree() p.parse(file) package = Element("package") package.set("details", os.path.basename(file)) - # we need all prerequisuited + # we need all prerequisites package.append(p.find("prerequisites")) info = None - # we need some of the info, but only our locale + # we need some of the info, but not all for i in p.findall("info"): - if not info or i.get("language") == language: + if not info: info = i assert info -- cgit v1.2.3 From 02e81517baae9a339d8f1550c765e02bf550a484 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 22 Sep 2010 15:39:36 +0200 Subject: Components/DreamInfoHandler.py: ignore old meta-xml index files. refs #578 --- lib/python/Components/DreamInfoHandler.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/python/Components/DreamInfoHandler.py b/lib/python/Components/DreamInfoHandler.py index dd140cbb..40305671 100755 --- a/lib/python/Components/DreamInfoHandler.py +++ b/lib/python/Components/DreamInfoHandler.py @@ -222,6 +222,8 @@ class DreamInfoHandler: for indexfile in os.listdir(self.directory[0]): if indexfile.startswith("index-"): if indexfile.endswith(".xml"): + if indexfile[-7:-6] == "_": + continue indexfileList.append(indexfile) if len(indexfileList): for file in indexfileList: -- cgit v1.2.3 From 98e0c0f0c2dc8fc6ac18981d40bf869ae89fc6ae Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 27 Sep 2010 15:08:16 +0200 Subject: fixes bug #584 - Fixes BSOD in radio mode when trying to add a service to the favourites - Don't close ChannelSelection when adding a service to the facourites. --- lib/python/Screens/ChannelSelection.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 0895c9c2..9ced5840 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -223,7 +223,7 @@ class ChannelContextMenu(Screen): if cnt > 1: # show bouquet list self.bsel = self.session.openWithCallback(self.bouquetSelClosed, BouquetSelector, bouquets, self.addCurrentServiceToBouquet) elif cnt == 1: # add to only one existing bouquet - self.addCurrentServiceToBouquet(bouquets[0][1]) + self.addCurrentServiceToBouquet(bouquets[0][1], closeBouquetSelection = False) def bouquetSelClosed(self, recursive): self.bsel = None @@ -257,12 +257,12 @@ class ChannelContextMenu(Screen): self.csel.addMarker(marker) self.close() - def addCurrentServiceToBouquet(self, dest): + def addCurrentServiceToBouquet(self, dest, closeBouquetSelection = True): self.csel.addServiceToBouquet(dest) if self.bsel is not None: self.bsel.close(True) else: - self.close(True) # close bouquet selection + self.close(closeBouquetSelection) # close bouquet selection def removeCurrentService(self): self.csel.removeCurrentService() @@ -1400,9 +1400,9 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions"], { - "keyTV": self.closeRadio, - "keyRadio": self.closeRadio, - "cancel": self.closeRadio, + "keyTV": self.cancel, + "keyRadio": self.cancel, + "cancel": self.cancel, "ok": self.channelSelected, }) @@ -1440,7 +1440,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS self["RdsActions"].setEnabled(state) ########## RDS Radiotext / Rass Support END - def closeRadio(self): + def cancel(self): self.infobar.rds_display.onRassInteractivePossibilityChanged.remove(self.RassInteractivePossibilityChanged) self.info.hide() #set previous tv service -- cgit v1.2.3 From 9213e54544d3782b1a4766960146f95988c517ed Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 27 Sep 2010 15:18:55 +0200 Subject: refs bug #584 don't show "add service to bouquet" when inside bouquet view in multi bouquet mode and just one bouquet is set don't show "add service to favourites" when inside favourite view (multi bouquet mode is disabled) --- lib/python/Screens/ChannelSelection.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 9ced5840..1c05bbf3 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -111,9 +111,16 @@ class ChannelContextMenu(Screen): else: append_when_current_valid(current, menu, (_("remove from parental protection"), boundFunction(self.removeParentalProtection, csel.getCurrentSelection())), level = 0) if haveBouquets: - append_when_current_valid(current, menu, (_("add service to bouquet"), self.addServiceToBouquetSelected), level = 0) + bouquets = self.csel.getBouquetList() + if bouquets is None: + bouquetCnt = 0 + else: + bouquetCnt = len(bouquets) + if not inBouquet or bouquetCnt > 1: + append_when_current_valid(current, menu, (_("add service to bouquet"), self.addServiceToBouquetSelected), level = 0) else: - append_when_current_valid(current, menu, (_("add service to favourites"), self.addServiceToBouquetSelected), level = 0) + if not inBouquet: + append_when_current_valid(current, menu, (_("add service to favourites"), self.addServiceToBouquetSelected), level = 0) else: if current_root.getPath().find('FROM SATELLITES') != -1: append_when_current_valid(current, menu, (_("remove selected satellite"), self.removeSatelliteServices), level = 0) -- cgit v1.2.3 From 3a44514adf9e366316213ba027d3e8808bad6b0c Mon Sep 17 00:00:00 2001 From: acid-burn Date: Wed, 29 Sep 2010 09:28:40 +0200 Subject: DreamInfoHandler.py: strip data. refs #578 --- lib/python/Components/DreamInfoHandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/Components/DreamInfoHandler.py b/lib/python/Components/DreamInfoHandler.py index 40305671..03d52157 100755 --- a/lib/python/Components/DreamInfoHandler.py +++ b/lib/python/Components/DreamInfoHandler.py @@ -123,7 +123,7 @@ class InfoHandler(xml.sax.ContentHandler): if self.elements[-1] == "shortdescription": self.attributes["shortdescription"] = str(data) if self.elements[-1] == "description": - self.data += data + self.data += data.strip() self.attributes["description"] = str(self.data) #print "characters", data -- cgit v1.2.3 From 970cdaf1f5137645fad5f1404d29fdd90127f5fb Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 2 Oct 2010 14:50:56 +0200 Subject: fixes bug #587 - use new internally connectable detection mechanism - display unsupported tuners --- data/skin_default.xml | 8 ++++---- lib/python/Components/NimManager.py | 28 +++++++++++++++++++++++----- lib/python/Screens/Satconfig.py | 4 +++- 3 files changed, 30 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/data/skin_default.xml b/data/skin_default.xml index 8b26ce7e..f9fb09c1 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -670,12 +670,12 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - - + + {"template": [ - MultiContentEntryText(pos = (10, 5), size = (360, 30), flags = RT_HALIGN_LEFT, text = 1), # index 1 is the nim name, - MultiContentEntryText(pos = (50, 30), size = (320, 50), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings, + MultiContentEntryText(pos = (10, 5), size = (440, 30), flags = RT_HALIGN_LEFT, text = 1), # index 1 is the nim name, + MultiContentEntryText(pos = (50, 30), size = (400, 50), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings, ], "fonts": [gFont("Regular", 20), gFont("Regular", 15)], "itemHeight": 80 diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 805be4df..cb832e41 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -471,7 +471,7 @@ class SecConfigure: self.update() class NIM(object): - def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}): + def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}, frontend_id = None): self.slot = slot if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None): @@ -483,8 +483,11 @@ class NIM(object): self.has_outputs = has_outputs self.internally_connectable = internally_connectable self.multi_type = multi_type + self.frontend_id = frontend_id def isCompatible(self, what): + if not self.isSupported(): + return False compatible = { None: (None,), "DVB-S": ("DVB-S", None), @@ -526,6 +529,9 @@ class NIM(object): def isMultiType(self): return (len(self.multi_type) > 0) + def isSupported(self): + return (self.frontend_id is not None) + # returns dict {: } def getMultiTypeList(self): return self.multi_type @@ -548,8 +554,10 @@ class NIM(object): if self.empty: nim_text += _("(empty)") + elif not self.isSupported(): + nim_text += self.description + " (" + _("not supported") + ")" else: - nim_text += self.description + " (" + self.friendly_type + ")" + nim_text += self.description + " (" + self.friendly_type + ")" return nim_text @@ -675,6 +683,9 @@ class NimManager: elif line.strip().startswith("Internally_Connectable:"): input = int(line.strip()[len("Internally_Connectable:") + 1:]) entries[current_slot]["internally_connectable"] = input + elif line.strip().startswith("Frontend_Device:"): + input = int(line.strip()[len("Frontend_Device:") + 1:]) + entries[current_slot]["frontend_device"] = input elif line.strip().startswith("Mode"): # "Mode 0: DVB-T" -> ["Mode 0", " DVB-T"] split = line.strip().split(":") @@ -688,17 +699,24 @@ class NimManager: entries[current_slot]["name"] = _("N/A") nimfile.close() + from os import path + for id, entry in entries.items(): if not (entry.has_key("name") and entry.has_key("type")): entry["name"] = _("N/A") entry["type"] = None if not (entry.has_key("has_outputs")): entry["has_outputs"] = True - if not (entry.has_key("internally_connectable")): - entry["internally_connectable"] = None + if entry.has_key("frontend_device"): # check if internally connectable + if path.exists("/proc/stb/frontend/%d/rf_switch" % entry["frontend_device"]): + entry["internally_connectable"] = entry["frontend_device"] - 1 + else: + entry["internally_connectable"] = None + else: + entry["frontend_device"] = entry["internally_connectable"] = None if not (entry.has_key("multi_type")): entry["multi_type"] = {} - self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"])) + self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"], frontend_id = entry["frontend_device"])) def hasNimType(self, chktype): for slot in self.nim_slots: diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 44f4251a..a5712dcd 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -489,7 +489,7 @@ class NimSelection(Screen): def okbuttonClick(self): nim = self["nimlist"].getCurrent() nim = nim and nim[3] - if nim is not None and not nim.empty: + if nim is not None and not nim.empty and nim.isSupported(): self.session.openWithCallback(self.updateList, self.resultclass, nim.slot) def showNim(self, nim): @@ -548,6 +548,8 @@ class NimSelection(Screen): text = _("enabled") if x.isMultiType(): text = _("Switchable tuner types:") + "(" + ','.join(x.getMultiTypeList().values()) + ")" + "\n" + text + if not x.isSupported(): + text = _("tuner is not supported") self.list.append((slotid, x.friendly_full_description, text, x)) self["nimlist"].setList(self.list) -- cgit v1.2.3 From 006e3497641164df7a413c8730d9b8914d67e2d8 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sun, 3 Oct 2010 01:33:22 +0200 Subject: refs bug #587 internally linking is now done via /proc/stb/frontend/X/rf_switch instead of /proc/stb/tsmux and moved to the python part of enigma2 --- lib/dvb/sec.cpp | 24 ------------------------ lib/python/Components/NimManager.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 24 deletions(-) (limited to 'lib') diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index a8292c0c..d48d44e1 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -1004,19 +1004,6 @@ RESULT eDVBSatelliteEquipmentControl::clear() //reset some tuner configuration for (eSmartPtrList::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it) { - long tmp; - char c; - if (sscanf(it->m_frontend->getDescription(), "BCM450%c (internal)", &c) == 1 && !it->m_frontend->getData(eDVBFrontend::LINKED_PREV_PTR, tmp) && tmp != -1) - { - FILE *f=fopen("/proc/stb/tsmux/lnb_b_input", "w"); - if (!f || fwrite("B", 1, 1, f) != 1) - eDebug("set /proc/stb/tsmux/lnb_b_input to B failed!! (%m)"); - else - { - eDebug("set /proc/stb/tsmux/lnb_b_input to B OK"); - fclose(f); - } - } it->m_frontend->setData(eDVBFrontend::SATPOS_DEPENDS_PTR, -1); it->m_frontend->setData(eDVBFrontend::LINKED_PREV_PTR, -1); it->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, -1); @@ -1448,17 +1435,6 @@ RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2) char c; p1->m_frontend->setData(eDVBFrontend::LINKED_PREV_PTR, (long)p2); p2->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, (long)p1); - if (!strcmp(p1->m_frontend->getDescription(), p2->m_frontend->getDescription()) && sscanf(p1->m_frontend->getDescription(), "BCM450%c (internal)", &c) == 1) - { - FILE *f=fopen("/proc/stb/tsmux/lnb_b_input", "w"); - if (!f || fwrite("A", 1, 1, f) != 1) - eDebug("set /proc/stb/tsmux/lnb_b_input to A failed!! (%m)"); - else - { - eDebug("set /proc/stb/tsmux/lnb_b_input to A OK"); - fclose(f); - } - } } p1=p2=NULL; diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index cb832e41..4d562b95 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -110,9 +110,16 @@ class SecConfigure: def setSatposDepends(self, sec, nim1, nim2): print "tuner", nim1, "depends on satpos of", nim2 sec.setTunerDepends(nim1, nim2) + + def linkInternally(self, slotid): + nim = self.NimManager.getNim(slotid) + if nim.internallyConnectableTo is not None: + nim.setInternalLink() def linkNIMs(self, sec, nim1, nim2): print "link tuner", nim1, "to tuner", nim2 + if nim2 == (nim1 - 1): + self.linkInternally(nim1) sec.setTunerLinked(nim1, nim2) def getRoot(self, slotid, connto): @@ -127,6 +134,9 @@ class SecConfigure: def update(self): sec = secClass.getInstance() self.configuredSatellites = set() + for slotid in self.NimManager.getNimListOfType("DVB-S"): + if self.NimManager.nimInternallyConnectableTo(slotid) is not None: + self.NimManager.nimRemoveInternalLink(slotid) sec.clear() ## this do unlinking NIMs too !! print "sec config cleared" @@ -526,6 +536,16 @@ class NIM(object): def internallyConnectableTo(self): return self.internally_connectable + def setInternalLink(self): + if self.internally_connectable is not None: + print "setting internal link on frontend id", self.frontend_id + open("/proc/stb/frontend/%d/rf_switch" % self.frontend_id, "w").write("internal") + + def removeInternalLink(self): + if self.internally_connectable is not None: + print "removing internal link on frontend id", self.frontend_id + open("/proc/stb/frontend/%d/rf_switch" % self.frontend_id, "w").write("external") + def isMultiType(self): return (len(self.multi_type) > 0) @@ -735,6 +755,9 @@ class NimManager: def getNimName(self, slotid): return self.nim_slots[slotid].description + + def getNim(self, slotid): + return self.nim_slots[slotid] def getNimListOfType(self, type, exception = -1): # returns a list of indexes for NIMs compatible to the given type, except for 'exception' @@ -765,6 +788,12 @@ class NimManager: def hasOutputs(self, slotid): return self.nim_slots[slotid].hasOutputs() + def nimInternallyConnectableTo(self, slotid): + return self.nim_slots[slotid].internallyConnectableTo() + + def nimRemoveInternalLink(self, slotid): + self.nim_slots[slotid].removeInternalLink() + def canConnectTo(self, slotid): slots = [] if self.nim_slots[slotid].internallyConnectableTo() is not None: -- cgit v1.2.3 From 4cf4560a3dfc1a18f4bc894e153dc501965f4b0f Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 11 Oct 2010 00:03:40 +0200 Subject: fix slotinfo assignment for new "unsupported tuner" handling refs bug #587 --- lib/dvb/dvb.cpp | 35 +++++++++++++++++++++-------------- lib/dvb/frontend.cpp | 14 ++++++++++---- lib/python/Components/NimManager.py | 2 +- 3 files changed, 32 insertions(+), 19 deletions(-) (limited to 'lib') diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 40d44186..51629452 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -320,27 +320,34 @@ PyObject *eDVBResourceManager::setFrontendSlotInformations(ePyObject list) PyErr_SetString(PyExc_StandardError, "eDVBResourceManager::setFrontendSlotInformations argument should be a python list"); return NULL; } - if ((unsigned int)PyList_Size(list) != m_frontend.size()) + unsigned int assigned=0; + for (eSmartPtrList::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i) { + int pos=0; + while (pos < PyList_Size(list)) { + ePyObject obj = PyList_GET_ITEM(list, pos++); + if (!i->m_frontend->setSlotInfo(obj)) + continue; + ++assigned; + break; + } + } + if (assigned != m_frontend.size()) { char blasel[256]; - sprintf(blasel, "eDVBResourceManager::setFrontendSlotInformations list size incorrect %d frontends avail, but %d entries in slotlist", - m_frontend.size(), PyList_Size(list)); + sprintf(blasel, "eDVBResourceManager::setFrontendSlotInformations .. assigned %d socket informations, but %d registered frontends!", + m_frontend.size(), assigned); PyErr_SetString(PyExc_StandardError, blasel); return NULL; } - int pos=0; - for (eSmartPtrList::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i) - { - ePyObject obj = PyList_GET_ITEM(list, pos++); - if (!i->m_frontend->setSlotInfo(obj)) - return NULL; - } - pos=0; for (eSmartPtrList::iterator i(m_simulate_frontend.begin()); i != m_simulate_frontend.end(); ++i) { - ePyObject obj = PyList_GET_ITEM(list, pos++); - if (!i->m_frontend->setSlotInfo(obj)) - return NULL; + int pos=0; + while (pos < PyList_Size(list)) { + ePyObject obj = PyList_GET_ITEM(list, pos++); + if (!i->m_frontend->setSlotInfo(obj)) + continue; + break; + } } Py_RETURN_NONE; } diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index abbb8d29..6f78197a 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -2700,17 +2700,23 @@ int eDVBFrontend::isCompatibleWith(ePtr &feparm) bool eDVBFrontend::setSlotInfo(ePyObject obj) { - ePyObject Id, Descr, Enabled, IsDVBS2; - if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 4) + ePyObject Id, Descr, Enabled, IsDVBS2, frontendId; + if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 5) goto arg_error; Id = PyTuple_GET_ITEM(obj, 0); Descr = PyTuple_GET_ITEM(obj, 1); Enabled = PyTuple_GET_ITEM(obj, 2); IsDVBS2 = PyTuple_GET_ITEM(obj, 3); - if (!PyInt_Check(Id) || !PyString_Check(Descr) || !PyBool_Check(Enabled) || !PyBool_Check(IsDVBS2)) + frontendId = PyTuple_GET_ITEM(obj, 4); + m_slotid = PyInt_AsLong(Id); + if (!PyInt_Check(Id) || !PyString_Check(Descr) || !PyBool_Check(Enabled) || !PyBool_Check(IsDVBS2) || !PyInt_Check(frontendId)) goto arg_error; strcpy(m_description, PyString_AS_STRING(Descr)); - m_slotid = PyInt_AsLong(Id); + if (PyInt_AsLong(frontendId) == -1 || PyInt_AsLong(frontendId) != m_dvbid) { +// eDebugNoSimulate("skip slotinfo for slotid %d, descr %s", +// m_slotid, m_description); + return false; + } m_enabled = Enabled == Py_True; // HACK.. the rotor workaround is neede for all NIMs with LNBP21 voltage regulator... m_need_rotor_workaround = !!strstr(m_description, "Alps BSBE1") || diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 4d562b95..7f041902 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -150,7 +150,7 @@ class SecConfigure: for slot in nim_slots: if slot.type is not None: - used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2"))) + used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2"), slot.frontend_id is None and -1 or slot.frontend_id)) eDVBResourceManager.getInstance().setFrontendSlotInformations(used_nim_slots) for slot in nim_slots: -- cgit v1.2.3 From d21824019fe93603f1c05c7263ef7570aa60e135 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 11 Oct 2010 12:30:00 +0200 Subject: refs bug #587 set empty tuner slots to supported --- lib/python/Components/NimManager.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 7f041902..815cfe35 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -481,7 +481,7 @@ class SecConfigure: self.update() class NIM(object): - def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}, frontend_id = None): + def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}, frontend_id = None, is_empty = False): self.slot = slot if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None): @@ -494,6 +494,7 @@ class NIM(object): self.internally_connectable = internally_connectable self.multi_type = multi_type self.frontend_id = frontend_id + self.__is_empty = is_empty def isCompatible(self, what): if not self.isSupported(): @@ -549,8 +550,12 @@ class NIM(object): def isMultiType(self): return (len(self.multi_type) > 0) + def isEmpty(self): + return self.__is_empty + + # empty tuners are supported! def isSupported(self): - return (self.frontend_id is not None) + return (self.frontend_id is not None) or self.__is_empty # returns dict {: } def getMultiTypeList(self): @@ -695,8 +700,10 @@ class NimManager: entries[current_slot] = {} elif line.strip().startswith("Type:"): entries[current_slot]["type"] = str(line.strip()[6:]) + entries[current_slot]["isempty"] = False elif line.strip().startswith("Name:"): entries[current_slot]["name"] = str(line.strip()[6:]) + entries[current_slot]["isempty"] = False elif line.strip().startswith("Has_Outputs:"): input = str(line.strip()[len("Has_Outputs:") + 1:]) entries[current_slot]["has_outputs"] = (input == "yes") @@ -717,6 +724,7 @@ class NimManager: elif line.strip().startswith("empty"): entries[current_slot]["type"] = None entries[current_slot]["name"] = _("N/A") + entries[current_slot]["isempty"] = True nimfile.close() from os import path @@ -736,7 +744,7 @@ class NimManager: entry["frontend_device"] = entry["internally_connectable"] = None if not (entry.has_key("multi_type")): entry["multi_type"] = {} - self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"], frontend_id = entry["frontend_device"])) + self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"], frontend_id = entry["frontend_device"], is_empty = entry["isempty"])) def hasNimType(self, chktype): for slot in self.nim_slots: -- cgit v1.2.3