git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'origin/bug_345_configurable_recordingnames'
[enigma2.git]
/
lib
/
python
/
Components
/
Timezones.py
diff --git
a/lib/python/Components/Timezones.py
b/lib/python/Components/Timezones.py
index 15837450e1074a70966a57a627740c74b0ed807e..7f709159286b0065cc3e53fd9a1dd6f76e9b7c74 100644
(file)
--- a/
lib/python/Components/Timezones.py
+++ b/
lib/python/Components/Timezones.py
@@
-1,11
+1,9
@@
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
-import os
+from os import environ, unlink, symlink
import time
import time
-from enigma import *
-
class Timezones:
class parseTimezones(ContentHandler):
def __init__(self, timezones):
class Timezones:
class parseTimezones(ContentHandler):
def __init__(self, timezones):
@@
-38,20
+36,30
@@
class Timezones:
if len(self.timezones) <= index:
return
if len(self.timezones) <= index:
return
- os.environ['TZ'] = self.timezones[index][1]
+ environ['TZ'] = self.timezones[index][1]
+ try:
+ unlink("/etc/localtime")
+ except OSError:
+ pass
+ try:
+ symlink("/usr/share/zoneinfo/%s" %(self.timezones[index][1]), "/etc/localtime")
+ except OSError:
+ pass
try:
time.tzset()
except:
try:
time.tzset()
except:
- etimezone()
+ from enigma import e_tzset
+ e_tzset()
def getTimezoneList(self):
def getTimezoneList(self):
- list = []
- for x in self.timezones:
- list.append(str(x[0]))
- return list
-
+ return [ str(x[0]) for x in self.timezones ]
+
def getDefaultTimezone(self):
# TODO return something more useful - depending on country-settings?
def getDefaultTimezone(self):
# TODO return something more useful - depending on country-settings?
- return 27
+ t = "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Vienna"
+ for (a,b) in self.timezones:
+ if a == t:
+ return a
+ return self.timezones[0][0]
timezones = Timezones()
timezones = Timezones()