aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorFraxinas <andreas.frisch@multimedia-labs.de>2010-05-30 23:57:52 +0200
committerFraxinas <andreas.frisch@multimedia-labs.de>2010-05-30 23:57:52 +0200
commitd37c356fa54be2fd93a92566c686a468a741cd0f (patch)
tree6a78e41a134825ea231409e2dc82ebe2a09cd425 /lib/python/Components
parent9529d3ec43c9d81811dd5efa4c998821df90c9b5 (diff)
parentec485b760f7aa361870421587055bcd929df7729 (diff)
downloadenigma2-d37c356fa54be2fd93a92566c686a468a741cd0f.tar.gz
enigma2-d37c356fa54be2fd93a92566c686a468a741cd0f.zip
Merge branch 'experimental' of git.opendreambox.org:/git/enigma2 into experimental
Diffstat (limited to 'lib/python/Components')
-rwxr-xr-xlib/python/Components/Network.py51
-rw-r--r--lib/python/Components/ParentalControl.py11
-rwxr-xr-x[-rw-r--r--]lib/python/Components/RecordingConfig.py6
3 files changed, 50 insertions, 18 deletions
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/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/lib/python/Components/RecordingConfig.py b/lib/python/Components/RecordingConfig.py
index fe9284d9..40dfb2ca 100644..100755
--- 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