Index: /ipk/source/browsers_elektro_1_0/CONTROL/preinst
===================================================================
--- /ipk/source/browsers_elektro_1_0/CONTROL/preinst	(revision 2773)
+++ /ipk/source/browsers_elektro_1_0/CONTROL/preinst	(revision 2774)
@@ -8,5 +8,5 @@
 	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | tail -n1`
 	FREE=`expr $SPACE - 50`
-	SIZE=40
+	SIZE=100
 	echo "checking freespace"
 	echo packege size $SIZE kb
Index: /ipk/source/browsers_elektro_1_0/usr/lib/enigma2/python/Plugins/Extensions/Elektro/plugin.py
===================================================================
--- /ipk/source/browsers_elektro_1_0/usr/lib/enigma2/python/Plugins/Extensions/Elektro/plugin.py	(revision 2774)
+++ /ipk/source/browsers_elektro_1_0/usr/lib/enigma2/python/Plugins/Extensions/Elektro/plugin.py	(revision 2774)
@@ -0,0 +1,496 @@
+﻿#
+# Power Save Plugin by gutemine
+# Rewritten by Morty (morty@gmx.net)
+#
+# Deep standby will be called sleep. Normal standby will be named standby!
+# All calculations are in the local timezone, or in the relative Timezone.
+# In the relative timezone the day starts at "nextday". If it is before nextday the last day will be used.
+#
+#
+
+
+#from enigma import *
+
+
+from Screens.InfoBarGenerics import *
+# from RecordTimer import *
+
+
+import calendar 
+#################
+
+# Plugin
+from Plugins.Plugin import PluginDescriptor
+
+# GUI (Screens)
+from Screens.Screen import Screen
+from Components.ConfigList import ConfigListScreen
+from Screens.MessageBox import MessageBox
+from Screens.Console import Console
+from Screens import Standby 
+
+# GUI (Summary)
+# from Screens.Setup import SetupSummary
+
+# GUI (Components)
+from Components.ActionMap import ActionMap
+from Components.Button import Button
+
+# Configuration
+from Components.config import getConfigListEntry, ConfigEnableDisable, \
+	ConfigYesNo, ConfigText, ConfigClock, ConfigNumber, ConfigSelection, \
+	config, ConfigSubsection, ConfigSubList, ConfigSubDict
+
+# Startup/shutdown notification
+from Tools import Notifications
+
+import os
+# Timer, etc
+
+#import time
+from time import localtime, asctime, time, gmtime
+# import datetime
+# import codecs
+
+
+# Enigma system functions
+from enigma import quitMainloop, eTimer
+
+
+# import Wakeup?!
+from Tools.DreamboxHardware import getFPWasTimerWakeup
+
+
+
+# from Tools import Directories
+import gettext
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS
+try:
+	_ = gettext.translation('elektro', resolveFilename(SCOPE_PLUGINS, "Extensions/Elektro/locale"), [config.osd.language.getText()]).gettext
+except IOError:
+	print "[Elektro] Locale not found!"
+	pass
+
+#############
+
+# Globals
+session = None
+ElektroWakeUpTime = -1
+elektro_pluginversion = "3.3.4"
+elektro_readme = "/usr/lib/enigma2/python/Plugins/Extensions/Elektro/readme.txt"
+elektrostarttime = 60 
+elektrosleeptime = 5
+elektroShutdownThreshold = 60 * 20
+
+
+#Configuration
+config.plugins.elektro = ConfigSubsection()
+config.plugins.elektro.nextday = ConfigClock(default = ((6 * 60 + 0) * 60) )
+
+config.plugins.elektro.sleep = ConfigSubDict()
+for i in range(7):
+	config.plugins.elektro.sleep[i] = ConfigClock(default = ((1 * 60 + 0) * 60) )
+
+config.plugins.elektro.wakeup = ConfigSubDict()
+for i in range(7):
+	config.plugins.elektro.wakeup[i] = ConfigClock(default = ((9 * 60 + 0) * 60) )
+
+config.plugins.elektro.standbyOnBoot = ConfigEnableDisable(default = False)
+config.plugins.elektro.standbyOnManualBoot =  ConfigEnableDisable(default = True)
+config.plugins.elektro.standbyOnBootTimeout = ConfigNumber(default = 60)
+config.plugins.elektro.enable = ConfigEnableDisable(default = False)
+config.plugins.elektro.nextwakeup = ConfigNumber(default = 0)
+config.plugins.elektro.force = ConfigEnableDisable(default = False)
+config.plugins.elektro.dontwakeup = ConfigEnableDisable(default = False)
+config.plugins.elektro.holiday =  ConfigEnableDisable(default = False)
+
+
+
+weekdays = [
+	_("Monday"),
+	_("Tuesday"),
+	_("Wednesday"),
+	_("Thursday"),
+	_("Friday"),
+	_("Saturday"),
+	_("Sunday"),
+]
+
+
+#global ElektroWakeUpTime
+ElektroWakeUpTime = -1
+
+def autostart(reason, **kwargs):
+	global session  
+	if reason == 0 and kwargs.has_key("session"):
+		session = kwargs["session"]
+		session.open(DoElektro)
+
+def getNextWakeup():
+	global ElektroWakeUpTime
+	
+	#it might happen, that session does not exist. I don't know why. :-(
+	if session is None:
+		return ElektroWakeUpTime;
+	
+	nextTimer = session.nav.RecordTimer.getNextRecordingTime()
+	print "[Elektro] Now: " + strftime("%a:%H:%M:%S",  gmtime(time()))
+	if (nextTimer < 1) or (nextTimer > ElektroWakeUpTime):
+		print "[Elektro] will wake up " + strftime("%a:%H:%M:%S",  gmtime(ElektroWakeUpTime))
+		return ElektroWakeUpTime
+	
+	#We have to make sure, that the Box will wake up because of us
+	# and not because of the timer
+	print "[Elektro] will wake up due to the next timer" + strftime("%a:%H:%M:%S",  gmtime(nextTimer))
+	return nextTimer - 1
+	   
+	
+	
+	
+def Plugins(**kwargs):
+	return [
+		PluginDescriptor(
+			name="Elektro", 
+			description="Elektro Power Save Plugin Ver. " + elektro_pluginversion, 
+			where = [
+				PluginDescriptor.WHERE_SESSIONSTART, 
+				PluginDescriptor.WHERE_AUTOSTART
+			], 
+			fnc = autostart, 
+			wakeupfnc=getNextWakeup
+		),
+		PluginDescriptor(
+			name="Elektro", 
+			description="Elektro Power Save Plugin Ver. " + elektro_pluginversion, 
+			where = PluginDescriptor.WHERE_PLUGINMENU, 
+			icon="elektro.png", 
+			fnc=main
+		)
+	]
+
+	
+def main(session,**kwargs):
+	try:	
+	 	session.open(Elektro)
+	except:
+		print "[Elektro] Pluginexecution failed"
+
+class Elektro(ConfigListScreen,Screen):
+	skin = """
+			<screen position="100,100" size="550,400" title="Elektro Power Save Ver. """ + elektro_pluginversion + """" >
+			<widget name="config" position="0,0" size="550,360" scrollbarMode="showOnDemand" />
+			
+			<widget name="key_red" position="0,360" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;18" transparent="1"/> 
+			<widget name="key_green" position="140,360" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;18" transparent="1"/> 
+			<widget name="key_yellow" position="280,360" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;18" transparent="1"/>
+			
+			<ePixmap name="red"    position="0,360"   zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
+			<ePixmap name="green"  position="140,360" zPosition="2" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
+			<ePixmap name="yellow" position="280,360" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" /> 
+		</screen>"""
+		
+	def __init__(self, session, args = 0):
+		self.session = session
+		Screen.__init__(self, session)
+	
+		
+		self.list = []
+		
+		
+		self.list.append(getConfigListEntry(_("Enable Elektro Power Save"),config.plugins.elektro.enable))
+		self.list.append(getConfigListEntry(_("Standby on boot"), config.plugins.elektro.standbyOnBoot ))
+		self.list.append(getConfigListEntry(_("Standby on manual boot"), config.plugins.elektro.standbyOnManualBoot ))
+		self.list.append(getConfigListEntry(_("Standby on boot screen timeout"), config.plugins.elektro.standbyOnBootTimeout))
+		self.list.append(getConfigListEntry(_("Force sleep (even when not in standby)"), config.plugins.elektro.force ))
+		self.list.append(getConfigListEntry(_("Dont wake up"), config.plugins.elektro.dontwakeup ))
+		self.list.append(getConfigListEntry(_("Holiday mode (experimental)"), config.plugins.elektro.holiday ))
+		
+		self.list.append(getConfigListEntry(_("Next day starts at"), config.plugins.elektro.nextday))
+
+		for i in range(7):
+			self.list.append(getConfigListEntry(weekdays[i] + ": "  + _("Wakeup"), config.plugins.elektro.wakeup[i]))
+			self.list.append(getConfigListEntry(weekdays[i] + ": "  + _("Sleep"), config.plugins.elektro.sleep[i]))
+			
+		ConfigListScreen.__init__(self, self.list)
+		
+		self["key_red"] = Button(_("Cancel"))
+		self["key_green"] = Button(_("Ok"))
+		self["key_yellow"] = Button(_("Help"))
+		self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
+		{
+			"red": self.cancel,
+			"green": self.save,
+			"yellow": self.help,
+			"save": self.save,
+			"cancel": self.cancel,
+			"ok": self.save,
+		}, -2)
+	
+	def save(self):
+		#print "saving"
+		for x in self["config"].list:
+			x[1].save()
+		self.close(True,self.session)
+
+	def cancel(self):
+		#print "cancel"
+		for x in self["config"].list:
+			x[1].cancel()
+		self.close(False,self.session)
+		
+	def help(self):
+		self.session.open(Console,_("Showing Elektro readme.txt"),["cat %s" % elektro_readme])
+
+
+class DoElektro(Screen):
+	skin = """ <screen position="100,100" size="300,300" title="Elektro Plugin Menu" > </screen>"""
+	
+	def __init__(self,session):
+		Screen.__init__(self,session)
+		
+		print "[Elektro] Starting up Version " + elektro_pluginversion
+		
+		self.session = session
+		
+		# Make sure wakeup time is set.
+		self.setNextWakeuptime()
+		
+		# If we didn't wake up by a timer we don't want to go to sleep any more.
+		# Unforturnately it is not possible to use getFPWasTimerWakeup()
+		# Therfore we're checking wheter there is a recording starting within
+		# the next five min		
+		self.dontsleep = False
+		
+		#Let's assume we got woken up manually
+		timerWakeup = False
+		
+		#Is a recording already runniong ->woken up by a timer
+		if self.session.nav.RecordTimer.isRecording():
+			timerWakeup = True
+		# Is the next timer within 5 min -> woken up by a timer	
+		if abs(self.session.nav.RecordTimer.getNextRecordingTime() - time()) <= 360:
+			timerWakeup = True
+			
+		# Did we wake up by Elektro?
+		# Let's hope this get's run early enaugh, and this get's run
+		# before the requested wakeup-time (should be the case)
+		#
+		if abs(ElektroWakeUpTime - time()) <= 360:
+			timerWakeup = True	
+			
+		# If the was a manual wakeup: Don't go to sleep	
+		if timerWakeup == False:
+			self.dontsleep = True
+		
+		
+		#Check whether we should try to sleep:
+		trysleep = config.plugins.elektro.standbyOnBoot.value
+		
+		#Don't go to sleep when this was a manual wakeup and the box shouldn't go to standby
+		if timerWakeup == False and	config.plugins.elektro.standbyOnManualBoot.value == False:
+			trysleep = False
+			
+	
+		#if waken up by timer and configured ask whether to go to sleep.
+		if trysleep:
+			self.TimerStandby = eTimer()
+			self.TimerStandby.callback.append(self.CheckStandby)
+			self.TimerStandby.startLongTimer(elektrosleeptime)
+			print "[Elektro] Set up standby timer"
+
+		self.TimerSleep = eTimer()
+		self.TimerSleep.callback.append(self.CheckElektro)
+		self.TimerSleep.startLongTimer(elektrostarttime)
+		print "[Elektro] Set up sleep timer"
+		print "[Elektro] Translation test: " + _("Standby on boot")
+		
+	def clkToTime(self, clock):
+		return ( (clock.value[0]) * 60 + (int)(clock.value[1]) )  * 60
+		
+	def getTime(self):
+		ltime = localtime();
+		return ( (int)(ltime.tm_hour) * 60 + (int)(ltime.tm_min) ) * 60
+	
+	def getPrintTime(self, secs):
+		return strftime("%H:%M:%S", gmtime(secs))
+
+	
+	# This function converts the time into the relative Timezone where the day starts at "nextday"
+	# This is done by substracting nextday from the current time. Negative times are corrected using the mod-operator
+	def getReltime(self, time):
+		nextday = self.clkToTime(config.plugins.elektro.nextday)
+		return (time - nextday) %  (24 * 60 * 60)
+		
+	
+	def CheckStandby(self):
+		print "[Elektro] Showing Standby Sceen "
+		try:
+			self.session.openWithCallback(self.DoElektroStandby,MessageBox,_("Go to Standby now?"),type = MessageBox.TYPE_YESNO,
+					timeout = config.plugins.elektro.standbyOnBootTimeout.value)		
+		except:
+			# Couldn't be shown. Restart timer.
+			print "[Elektro] Failed Showing Standby Sceen "
+			self.TimerStandby.startLongTimer(elektrostarttime)
+
+
+	def DoElektroStandby(self,retval):
+		if (retval):
+			#Yes, go to sleep
+			Notifications.AddNotification(Standby.Standby)
+		
+
+			
+	def setNextWakeuptime(self):
+		# Do not set a wakeup time if
+		#  - Elektro isn't enabled
+		#  - Elektro shouldn't wake up
+		#  - Holiday mode is turned on
+		if ((config.plugins.elektro.enable.value == False) 
+		      or (config.plugins.elektro.dontwakeup.value == True)
+		      or config.plugins.elektro.holiday.value == True): 
+			global ElektroWakeUpTime
+			ElektroWakeUpTime = -1
+			return
+			
+		time_s = self.getTime()
+		ltime = localtime()
+		
+		#print "Nextday:" + time.ctime(self.clkToTime(config.plugins.elektro.nextday))
+		# If it isn't past next-day time we need yesterdays settings
+		if time_s < self.clkToTime(config.plugins.elektro.nextday):
+			day = (ltime.tm_wday - 1) % 7
+		else:
+			day = ltime.tm_wday
+		
+		#Check whether we wake up today or tomorrow
+		# Relative Time is needed for this
+		time_s = self.getReltime(time_s)
+		wakeuptime = self.getReltime(self.clkToTime(config.plugins.elektro.wakeup[day]))
+		
+		# Lets see if we already woke up today
+		if wakeuptime < time_s:
+			#yes we did -> Next wakeup is tomorrow
+			#print "Elektro: Wakeup tomorrow"
+			day = (day + 1) % 7
+			wakeuptime = self.getReltime(self.clkToTime(config.plugins.elektro.wakeup[day]))
+		
+		# Tomorrow we'll wake up erly-> Add a full day.
+		if wakeuptime < time_s:
+			wakeuptime = wakeuptime + 24 * 60 * 60
+		
+		# The next wakeup will be in wakupin seconds
+		wakeupin = wakeuptime - time_s
+		
+		# Now add this to the current time to get the wakeuptime
+		wakeuptime = (int)(time()) + wakeupin
+		
+		#Write everything to the global variable
+		ElektroWakeUpTime = wakeuptime
+			
+			
+	def CheckElektro(self):
+		# first set the next wakeuptime - it would be much better to call that function on sleep. This will be a todo!
+		self.setNextWakeuptime()
+	
+		#convert to seconds
+		time_s = self.getTime()
+		ltime = localtime()
+		
+		print "[Elektro] Testtime; " + self.getPrintTime(2 * 60 * 60)
+		
+		#Which day is it? The next day starts at nextday
+		print "[Elektro] wday 1: " + str(ltime.tm_wday)
+		if time_s < self.clkToTime(config.plugins.elektro.nextday):
+			day = (ltime.tm_wday - 1) % 7
+		else:
+			day = ltime.tm_wday
+			
+		print "[Elektro] wday 2: " + str(day)
+		
+		#Let's get the day
+		wakeuptime = self.clkToTime(config.plugins.elektro.wakeup[day])
+		sleeptime = self.clkToTime(config.plugins.elektro.sleep[day])
+		print "[Elektro] Current time: " + self.getPrintTime(time_s)
+		print "[Elektro] Wakeup time: " + self.getPrintTime(wakeuptime)
+		print "[Elektro] Sleep time: " + self.getPrintTime(sleeptime)
+		
+		#convert into relative Times
+		time_s = self.getReltime(time_s)
+		wakeuptime  = self.getReltime(wakeuptime)
+		sleeptime = self.getReltime(sleeptime)
+		
+		print "[Elektro] Current Rel-time: " + self.getPrintTime(time_s)
+		print "[Elektro] Wakeup Rel-time: " + self.getPrintTime(wakeuptime)
+		print "[Elektro] Sleep Rel-time: " + self.getPrintTime(sleeptime)
+		
+		
+		#let's see if we should be sleeping
+		trysleep = False
+		if time_s < (wakeuptime - elektroShutdownThreshold): # Wakeup is in the future -> sleep!
+			trysleep = True
+			print "[Elektro] Wakeup!" + str(time_s) + " < " + str(wakeuptime)
+		if sleeptime < time_s : #Sleep is in the past -> sleep!
+			trysleep = True
+			print "[Elektro] Sleep: " + str(sleeptime) + " < " + str(time_s)
+		
+		#We are not tying to go to sleep anymore -> maybe go to sleep again the next time
+		if trysleep == False:
+			self.dontsleep = False
+		
+		#The User aborted to got to sleep -> Don't go to sleep.
+		if self.dontsleep:
+			trysleep = False
+			
+		# If we are in holydaymode we should try to got to sleep anyway
+		# This should be set after self.dontsleep has been handled
+		if config.plugins.elektro.holiday.value:
+			trysleep = True
+		
+		# We are not enabled -> Dont go to sleep (This could have been catched earlier!)
+		if config.plugins.elektro.enable.value == False:
+			trysleep = False
+		
+		# Only go to sleep if we are in standby or sleep is forced by settings
+		if  not ((Standby.inStandby) or (config.plugins.elektro.force.value == True) ):
+			trysleep = False
+		
+		# No Sleep while recording
+		if self.session.nav.RecordTimer.isRecording():
+			trysleep = False
+		
+		# Will there be a recording in a short while?
+		nextRecTime = self.session.nav.RecordTimer.getNextRecordingTime()
+		if  (nextRecTime > 0) and (nextRecTime - (int)(time()) <  elektroShutdownThreshold):
+			trysleep = False
+			
+		# Looks like there really is a reason to go to sleep -> Lets try it!
+		if trysleep:
+			#self.();
+			try:
+				self.session.openWithCallback(self.DoElektroSleep, MessageBox, _("Go to sleep now?"),type = MessageBox.TYPE_YESNO,timeout = 60)	
+			except:
+				#reset the timer and try again
+				self.TimerSleep.startLongTimer(elektrostarttime) 
+				
+		#set Timer, which calls this function again.
+		self.TimerSleep.startLongTimer(elektrostarttime) 
+		
+		
+
+
+	def DoElektroSleep(self,retval):
+		if (retval):
+			# os.system("wall 'Powermanagent does Deepsleep now'")
+			#  Notifications.AddNotification(TryQuitMainloop,1)
+			# 1 = Deep Standby -> enigma2:/doc/RETURNCODES
+			
+			global inTryQuitMainloop
+			if Standby.inTryQuitMainloop == False:
+				self.session.open(Standby.TryQuitMainloop, 1) # <- This might not work reliably
+				#quitMainloop(1)
+		else:
+			# Dont try to sleep until next wakeup
+			self.dontsleep = True
+			#Start the timer again
+			self.TimerSleep.startLongTimer(elektrostarttime) 
+			
Index: /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/PluginComponent.py.patch
===================================================================
--- /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/PluginComponent.py.patch	(revision 2774)
+++ /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/PluginComponent.py.patch	(revision 2774)
@@ -0,0 +1,11 @@
+--- /usr/lib/enigma2/python/Components/PluginComponent.py	2009-03-31 19:32:46.000000000 +0200
++++ /usr/lib/enigma2/python/Components/PluginComponent.py	2009-07-20 20:02:32.000000000 +0200
+@@ -121,7 +121,7 @@
+ 		wakeup = -1
+ 		for p in self.pluginList:
+ 			current = p.getWakeupTime()
+-			if current > -1 and wakeup < current:
++			if current > -1 and (wakeup > current or wakeup == -1):
+ 				wakeup = current
+ 		return int(wakeup)
+ 
Index: /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/locale/de/LC_MESSAGES/elektro.po
===================================================================
--- /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/locale/de/LC_MESSAGES/elektro.po	(revision 2774)
+++ /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/locale/de/LC_MESSAGES/elektro.po	(revision 2774)
@@ -0,0 +1,110 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Elektro Power Save\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-04-26 11:35+0100\n"
+"PO-Revision-Date: 2009-04-26 11:35+0100\n"
+"Last-Translator: Moritz 'Morty' Strübe <morty@gmx.net>\n"
+"Language-Team: Morty <morty@gmx.net>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: German\n"
+"X-Poedit-Country: GERMANY\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Poedit-Basepath: ../../..\n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: plugin.py:110
+msgid "Monday"
+msgstr "Montag"
+
+#: plugin.py:111
+msgid "Tuesday"
+msgstr "Dienstag"
+
+#: plugin.py:112
+msgid "Wednesday"
+msgstr "Mittwoch"
+
+#: plugin.py:113
+msgid "Thursday"
+msgstr "Donnerstag"
+
+#: plugin.py:114
+msgid "Friday"
+msgstr "Freitag"
+
+#: plugin.py:115
+msgid "Saturday"
+msgstr "Samstag"
+
+#: plugin.py:116
+msgid "Sunday"
+msgstr "Sonntag"
+
+#: plugin.py:195
+msgid "Enable Elektro Power Save"
+msgstr "Elektro Power Save aktivieren"
+
+#: plugin.py:196
+#: plugin.py:300
+msgid "Standby on boot"
+msgstr "Nach dem Booten in den Standby"
+
+#: plugin.py:197
+msgid "Standby on manual boot"
+msgstr "Nach dem manuellen Booten in den Standby"
+
+#: plugin.py:198
+msgid "Standby on boot screen timeout"
+msgstr "In-den-Standby-Bildschirm Anzeigezeit"
+
+#: plugin.py:199
+msgid "Force sleep (even when not in standby)"
+msgstr "Erzwinge Ruhezustand (auch wenn nicht im Standby)"
+
+#: plugin.py:200
+msgid "Dont wake up"
+msgstr "Nicht aufwachen"
+
+#: plugin.py:201
+msgid "Holiday mode (experimental)"
+msgstr "Urlaubsmodus (Experimentell)"
+
+#: plugin.py:203
+msgid "Next day starts at"
+msgstr "Die nächste Tag beginnt um"
+
+#: plugin.py:206
+msgid "Wakeup"
+msgstr "Aufwachen"
+
+#: plugin.py:207
+msgid "Sleep"
+msgstr "Ruhezustand"
+
+#: plugin.py:211
+msgid "Cancel"
+msgstr "Abbruch"
+
+#: plugin.py:212
+msgid "Ok"
+msgstr "OK"
+
+#: plugin.py:213
+msgid "Help"
+msgstr "Hilfe"
+
+#: plugin.py:237
+msgid "Showing Elektro readme.txt"
+msgstr "Zeige Electro Readme.txt"
+
+#: plugin.py:323
+msgid "Go to Standby now?"
+msgstr "Jetzt in den Standby gehen?"
+
+#: plugin.py:465
+msgid "Go to sleep now?"
+msgstr "Jetzt in den Ruhezustand gehen?"
+
Index: /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/locale/it/LC_MESSAGES/elektro.po
===================================================================
--- /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/locale/it/LC_MESSAGES/elektro.po	(revision 2774)
+++ /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/locale/it/LC_MESSAGES/elektro.po	(revision 2774)
@@ -0,0 +1,107 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: enigma2 - elektropowersaver\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-03-28 16:15+0100\n"
+"PO-Revision-Date: 2009-03-28 16:32+0100\n"
+"Last-Translator: Spaeleus <spaeleus@croci.org>\n"
+"Language-Team: www.linsat.net <spaeleus@croci.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-Language: Italian\n"
+"X-Poedit-Country: ITALY\n"
+"X-Poedit-SourceCharset: iso-8859-1\n"
+"X-Poedit-Basepath: /home/dario/Plugins/elektro\n"
+"X-Poedit-SearchPath-0: /home/dario/Plugins/elektro\n"
+
+#: /home/dario/Plugins/elektro/plugin.py:108
+msgid "Monday"
+msgstr "Lunedì"
+
+#: /home/dario/Plugins/elektro/plugin.py:109
+msgid "Tuesday"
+msgstr "Martedì"
+
+#: /home/dario/Plugins/elektro/plugin.py:110
+msgid "Wednesday"
+msgstr "Mercoledì"
+
+#: /home/dario/Plugins/elektro/plugin.py:111
+msgid "Thursday"
+msgstr "Giovedì"
+
+#: /home/dario/Plugins/elektro/plugin.py:112
+msgid "Friday"
+msgstr "Venerdì"
+
+#: /home/dario/Plugins/elektro/plugin.py:113
+msgid "Saturday"
+msgstr "Sabato"
+
+#: /home/dario/Plugins/elektro/plugin.py:114
+msgid "Sunday"
+msgstr "Domenica"
+
+#: /home/dario/Plugins/elektro/plugin.py:182
+msgid "Enable Elektro Power Save"
+msgstr "Abilitare \"Elektro Power Save\""
+
+#: /home/dario/Plugins/elektro/plugin.py:183
+#: /home/dario/Plugins/elektro/plugin.py:269
+msgid "Standby on boot"
+msgstr "Standby all'avvio"
+
+#: /home/dario/Plugins/elektro/plugin.py:184
+msgid "Standby on boot screen timeout"
+msgstr "Timeout standby su schermata di avvio"
+
+#: /home/dario/Plugins/elektro/plugin.py:185
+msgid "Force sleep (even when not in standby)"
+msgstr "Forzare spegnimento (anche se non in standby)"
+
+#: /home/dario/Plugins/elektro/plugin.py:186
+msgid "Dont wake up"
+msgstr "Non accendere"
+
+#: /home/dario/Plugins/elektro/plugin.py:187
+msgid "Holiday mode (experimental)"
+msgstr "Modalità \"vacanza\" (sperimentale)"
+
+#: /home/dario/Plugins/elektro/plugin.py:189
+msgid "Next day starts at"
+msgstr "Il prossimo giorno inizia alle"
+
+#: /home/dario/Plugins/elektro/plugin.py:192
+msgid "Wakeup"
+msgstr "Accendere"
+
+#: /home/dario/Plugins/elektro/plugin.py:193
+msgid "Sleep"
+msgstr "Spegnere"
+
+#: /home/dario/Plugins/elektro/plugin.py:197
+msgid "Cancel"
+msgstr "Annull."
+
+#: /home/dario/Plugins/elektro/plugin.py:198
+msgid "Ok"
+msgstr "Ok"
+
+#: /home/dario/Plugins/elektro/plugin.py:199
+msgid "Help"
+msgstr "Aiuto"
+
+#: /home/dario/Plugins/elektro/plugin.py:223
+msgid "Showing Elektro readme.txt"
+msgstr "Elektro readme.txt"
+
+#: /home/dario/Plugins/elektro/plugin.py:292
+msgid "Go to Standby now?"
+msgstr "Standby?"
+
+#: /home/dario/Plugins/elektro/plugin.py:434
+msgid "Go to sleep now?"
+msgstr "Spegenere?"
+
Index: /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/locale/tr/LC_MESSAGES/Elektro-tr.po
===================================================================
--- /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/locale/tr/LC_MESSAGES/Elektro-tr.po	(revision 2774)
+++ /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/locale/tr/LC_MESSAGES/Elektro-tr.po	(revision 2774)
@@ -0,0 +1,108 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Enigma2 Elektro Power Save Plugin Turkish Locale\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-04-26 11:35+0100\n"
+"PO-Revision-Date: 2009-09-22 14:05+0200\n"
+"Last-Translator: Zülfikar VEYİSOĞLU <z.veyisoglu@hobiagaci.com>\n"
+"Language-Team: http://hobiagaci.com <z.veyisoglu@hobiagaci.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: Turkish\n"
+"X-Poedit-Country: TURKEY\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+#: plugin.py:110
+msgid "Monday"
+msgstr "Pazartesi"
+
+#: plugin.py:111
+msgid "Tuesday"
+msgstr "Salı"
+
+#: plugin.py:112
+msgid "Wednesday"
+msgstr "Çarşamba"
+
+#: plugin.py:113
+msgid "Thursday"
+msgstr "Perşembe"
+
+#: plugin.py:114
+msgid "Friday"
+msgstr "Cuma"
+
+#: plugin.py:115
+msgid "Saturday"
+msgstr "Cumartesi"
+
+#: plugin.py:116
+msgid "Sunday"
+msgstr "Pazar"
+
+#: plugin.py:195
+msgid "Enable Elektro Power Save"
+msgstr "Elektro enerji tasarrufçusunu etkinleştir"
+
+#: plugin.py:196
+#: plugin.py:300
+msgid "Standby on boot"
+msgstr "Açılışta hazırda beklet"
+
+#: plugin.py:197
+msgid "Standby on manual boot"
+msgstr "Elle açılırken hazırda beklet"
+
+#: plugin.py:198
+msgid "Standby on boot screen timeout"
+msgstr "Açılış ekranı zaman aşımı süresi"
+
+#: plugin.py:199
+msgid "Force sleep (even when not in standby)"
+msgstr "Hazırda beklemeye zorla (hazırda beklemede değilken)"
+
+#: plugin.py:200
+msgid "Dont wake up"
+msgstr "Uyanma"
+
+#: plugin.py:201
+msgid "Holiday mode (experimental)"
+msgstr "Tatil modu (deneme)"
+
+#: plugin.py:203
+msgid "Next day starts at"
+msgstr "Sonraki gün başlangıcı"
+
+#: plugin.py:206
+msgid "Wakeup"
+msgstr "Uyan"
+
+#: plugin.py:207
+msgid "Sleep"
+msgstr "Hazırda beklet"
+
+#: plugin.py:211
+msgid "Cancel"
+msgstr "Vazgeç"
+
+#: plugin.py:212
+msgid "Ok"
+msgstr "Tamam"
+
+#: plugin.py:213
+msgid "Help"
+msgstr "Yardım"
+
+#: plugin.py:237
+msgid "Showing Elektro readme.txt"
+msgstr "Elektro benioku.txt gösteriliyor"
+
+#: plugin.py:323
+msgid "Go to Standby now?"
+msgstr "Hazırda bekletme kipine şimdi geçilsin mi?"
+
+#: plugin.py:465
+msgid "Go to sleep now?"
+msgstr "Uyku kipine şimdi geçilsin mi?"
+
Index: /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/plugin.py
===================================================================
--- /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/plugin.py	(revision 2774)
+++ /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/plugin.py	(revision 2774)
@@ -0,0 +1,496 @@
+﻿#
+# Power Save Plugin by gutemine
+# Rewritten by Morty (morty@gmx.net)
+#
+# Deep standby will be called sleep. Normal standby will be named standby!
+# All calculations are in the local timezone, or in the relative Timezone.
+# In the relative timezone the day starts at "nextday". If it is before nextday the last day will be used.
+#
+#
+
+
+#from enigma import *
+
+
+from Screens.InfoBarGenerics import *
+# from RecordTimer import *
+
+
+import calendar 
+#################
+
+# Plugin
+from Plugins.Plugin import PluginDescriptor
+
+# GUI (Screens)
+from Screens.Screen import Screen
+from Components.ConfigList import ConfigListScreen
+from Screens.MessageBox import MessageBox
+from Screens.Console import Console
+from Screens import Standby 
+
+# GUI (Summary)
+# from Screens.Setup import SetupSummary
+
+# GUI (Components)
+from Components.ActionMap import ActionMap
+from Components.Button import Button
+
+# Configuration
+from Components.config import getConfigListEntry, ConfigEnableDisable, \
+	ConfigYesNo, ConfigText, ConfigClock, ConfigNumber, ConfigSelection, \
+	config, ConfigSubsection, ConfigSubList, ConfigSubDict
+
+# Startup/shutdown notification
+from Tools import Notifications
+
+import os
+# Timer, etc
+
+#import time
+from time import localtime, asctime, time, gmtime
+# import datetime
+# import codecs
+
+
+# Enigma system functions
+from enigma import quitMainloop, eTimer
+
+
+# import Wakeup?!
+from Tools.DreamboxHardware import getFPWasTimerWakeup
+
+
+
+# from Tools import Directories
+import gettext
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS
+try:
+	_ = gettext.translation('elektro', resolveFilename(SCOPE_PLUGINS, "Extensions/Elektro/locale"), [config.osd.language.getText()]).gettext
+except IOError:
+	print "[Elektro] Locale not found!"
+	pass
+
+#############
+
+# Globals
+session = None
+ElektroWakeUpTime = -1
+elektro_pluginversion = "3.3.4"
+elektro_readme = "/usr/lib/enigma2/python/Plugins/Extensions/Elektro/readme.txt"
+elektrostarttime = 60 
+elektrosleeptime = 5
+elektroShutdownThreshold = 60 * 20
+
+
+#Configuration
+config.plugins.elektro = ConfigSubsection()
+config.plugins.elektro.nextday = ConfigClock(default = ((6 * 60 + 0) * 60) )
+
+config.plugins.elektro.sleep = ConfigSubDict()
+for i in range(7):
+	config.plugins.elektro.sleep[i] = ConfigClock(default = ((1 * 60 + 0) * 60) )
+
+config.plugins.elektro.wakeup = ConfigSubDict()
+for i in range(7):
+	config.plugins.elektro.wakeup[i] = ConfigClock(default = ((9 * 60 + 0) * 60) )
+
+config.plugins.elektro.standbyOnBoot = ConfigEnableDisable(default = False)
+config.plugins.elektro.standbyOnManualBoot =  ConfigEnableDisable(default = True)
+config.plugins.elektro.standbyOnBootTimeout = ConfigNumber(default = 60)
+config.plugins.elektro.enable = ConfigEnableDisable(default = False)
+config.plugins.elektro.nextwakeup = ConfigNumber(default = 0)
+config.plugins.elektro.force = ConfigEnableDisable(default = False)
+config.plugins.elektro.dontwakeup = ConfigEnableDisable(default = False)
+config.plugins.elektro.holiday =  ConfigEnableDisable(default = False)
+
+
+
+weekdays = [
+	_("Monday"),
+	_("Tuesday"),
+	_("Wednesday"),
+	_("Thursday"),
+	_("Friday"),
+	_("Saturday"),
+	_("Sunday"),
+]
+
+
+#global ElektroWakeUpTime
+ElektroWakeUpTime = -1
+
+def autostart(reason, **kwargs):
+	global session  
+	if reason == 0 and kwargs.has_key("session"):
+		session = kwargs["session"]
+		session.open(DoElektro)
+
+def getNextWakeup():
+	global ElektroWakeUpTime
+	
+	#it might happen, that session does not exist. I don't know why. :-(
+	if session is None:
+		return ElektroWakeUpTime;
+	
+	nextTimer = session.nav.RecordTimer.getNextRecordingTime()
+	print "[Elektro] Now: " + strftime("%a:%H:%M:%S",  gmtime(time()))
+	if (nextTimer < 1) or (nextTimer > ElektroWakeUpTime):
+		print "[Elektro] will wake up " + strftime("%a:%H:%M:%S",  gmtime(ElektroWakeUpTime))
+		return ElektroWakeUpTime
+	
+	#We have to make sure, that the Box will wake up because of us
+	# and not because of the timer
+	print "[Elektro] will wake up due to the next timer" + strftime("%a:%H:%M:%S",  gmtime(nextTimer))
+	return nextTimer - 1
+	   
+	
+	
+	
+def Plugins(**kwargs):
+	return [
+		PluginDescriptor(
+			name="Elektro", 
+			description="Elektro Power Save Plugin Ver. " + elektro_pluginversion, 
+			where = [
+				PluginDescriptor.WHERE_SESSIONSTART, 
+				PluginDescriptor.WHERE_AUTOSTART
+			], 
+			fnc = autostart, 
+			wakeupfnc=getNextWakeup
+		),
+		PluginDescriptor(
+			name="Elektro", 
+			description="Elektro Power Save Plugin Ver. " + elektro_pluginversion, 
+			where = PluginDescriptor.WHERE_PLUGINMENU, 
+			icon="elektro.png", 
+			fnc=main
+		)
+	]
+
+	
+def main(session,**kwargs):
+	try:	
+	 	session.open(Elektro)
+	except:
+		print "[Elektro] Pluginexecution failed"
+
+class Elektro(ConfigListScreen,Screen):
+	skin = """
+			<screen position="100,100" size="550,400" title="Elektro Power Save Ver. """ + elektro_pluginversion + """" >
+			<widget name="config" position="0,0" size="550,360" scrollbarMode="showOnDemand" />
+			
+			<widget name="key_red" position="0,360" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;18" transparent="1"/> 
+			<widget name="key_green" position="140,360" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;18" transparent="1"/> 
+			<widget name="key_yellow" position="280,360" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;18" transparent="1"/>
+			
+			<ePixmap name="red"    position="0,360"   zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
+			<ePixmap name="green"  position="140,360" zPosition="2" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
+			<ePixmap name="yellow" position="280,360" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" /> 
+		</screen>"""
+		
+	def __init__(self, session, args = 0):
+		self.session = session
+		Screen.__init__(self, session)
+	
+		
+		self.list = []
+		
+		
+		self.list.append(getConfigListEntry(_("Enable Elektro Power Save"),config.plugins.elektro.enable))
+		self.list.append(getConfigListEntry(_("Standby on boot"), config.plugins.elektro.standbyOnBoot ))
+		self.list.append(getConfigListEntry(_("Standby on manual boot"), config.plugins.elektro.standbyOnManualBoot ))
+		self.list.append(getConfigListEntry(_("Standby on boot screen timeout"), config.plugins.elektro.standbyOnBootTimeout))
+		self.list.append(getConfigListEntry(_("Force sleep (even when not in standby)"), config.plugins.elektro.force ))
+		self.list.append(getConfigListEntry(_("Dont wake up"), config.plugins.elektro.dontwakeup ))
+		self.list.append(getConfigListEntry(_("Holiday mode (experimental)"), config.plugins.elektro.holiday ))
+		
+		self.list.append(getConfigListEntry(_("Next day starts at"), config.plugins.elektro.nextday))
+
+		for i in range(7):
+			self.list.append(getConfigListEntry(weekdays[i] + ": "  + _("Wakeup"), config.plugins.elektro.wakeup[i]))
+			self.list.append(getConfigListEntry(weekdays[i] + ": "  + _("Sleep"), config.plugins.elektro.sleep[i]))
+			
+		ConfigListScreen.__init__(self, self.list)
+		
+		self["key_red"] = Button(_("Cancel"))
+		self["key_green"] = Button(_("Ok"))
+		self["key_yellow"] = Button(_("Help"))
+		self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
+		{
+			"red": self.cancel,
+			"green": self.save,
+			"yellow": self.help,
+			"save": self.save,
+			"cancel": self.cancel,
+			"ok": self.save,
+		}, -2)
+	
+	def save(self):
+		#print "saving"
+		for x in self["config"].list:
+			x[1].save()
+		self.close(True,self.session)
+
+	def cancel(self):
+		#print "cancel"
+		for x in self["config"].list:
+			x[1].cancel()
+		self.close(False,self.session)
+		
+	def help(self):
+		self.session.open(Console,_("Showing Elektro readme.txt"),["cat %s" % elektro_readme])
+
+
+class DoElektro(Screen):
+	skin = """ <screen position="100,100" size="300,300" title="Elektro Plugin Menu" > </screen>"""
+	
+	def __init__(self,session):
+		Screen.__init__(self,session)
+		
+		print "[Elektro] Starting up Version " + elektro_pluginversion
+		
+		self.session = session
+		
+		# Make sure wakeup time is set.
+		self.setNextWakeuptime()
+		
+		# If we didn't wake up by a timer we don't want to go to sleep any more.
+		# Unforturnately it is not possible to use getFPWasTimerWakeup()
+		# Therfore we're checking wheter there is a recording starting within
+		# the next five min		
+		self.dontsleep = False
+		
+		#Let's assume we got woken up manually
+		timerWakeup = False
+		
+		#Is a recording already runniong ->woken up by a timer
+		if self.session.nav.RecordTimer.isRecording():
+			timerWakeup = True
+		# Is the next timer within 5 min -> woken up by a timer	
+		if abs(self.session.nav.RecordTimer.getNextRecordingTime() - time()) <= 360:
+			timerWakeup = True
+			
+		# Did we wake up by Elektro?
+		# Let's hope this get's run early enaugh, and this get's run
+		# before the requested wakeup-time (should be the case)
+		#
+		if abs(ElektroWakeUpTime - time()) <= 360:
+			timerWakeup = True	
+			
+		# If the was a manual wakeup: Don't go to sleep	
+		if timerWakeup == False:
+			self.dontsleep = True
+		
+		
+		#Check whether we should try to sleep:
+		trysleep = config.plugins.elektro.standbyOnBoot.value
+		
+		#Don't go to sleep when this was a manual wakeup and the box shouldn't go to standby
+		if timerWakeup == False and	config.plugins.elektro.standbyOnManualBoot.value == False:
+			trysleep = False
+			
+	
+		#if waken up by timer and configured ask whether to go to sleep.
+		if trysleep:
+			self.TimerStandby = eTimer()
+			self.TimerStandby.callback.append(self.CheckStandby)
+			self.TimerStandby.startLongTimer(elektrosleeptime)
+			print "[Elektro] Set up standby timer"
+
+		self.TimerSleep = eTimer()
+		self.TimerSleep.callback.append(self.CheckElektro)
+		self.TimerSleep.startLongTimer(elektrostarttime)
+		print "[Elektro] Set up sleep timer"
+		print "[Elektro] Translation test: " + _("Standby on boot")
+		
+	def clkToTime(self, clock):
+		return ( (clock.value[0]) * 60 + (int)(clock.value[1]) )  * 60
+		
+	def getTime(self):
+		ltime = localtime();
+		return ( (int)(ltime.tm_hour) * 60 + (int)(ltime.tm_min) ) * 60
+	
+	def getPrintTime(self, secs):
+		return strftime("%H:%M:%S", gmtime(secs))
+
+	
+	# This function converts the time into the relative Timezone where the day starts at "nextday"
+	# This is done by substracting nextday from the current time. Negative times are corrected using the mod-operator
+	def getReltime(self, time):
+		nextday = self.clkToTime(config.plugins.elektro.nextday)
+		return (time - nextday) %  (24 * 60 * 60)
+		
+	
+	def CheckStandby(self):
+		print "[Elektro] Showing Standby Sceen "
+		try:
+			self.session.openWithCallback(self.DoElektroStandby,MessageBox,_("Go to Standby now?"),type = MessageBox.TYPE_YESNO,
+					timeout = config.plugins.elektro.standbyOnBootTimeout.value)		
+		except:
+			# Couldn't be shown. Restart timer.
+			print "[Elektro] Failed Showing Standby Sceen "
+			self.TimerStandby.startLongTimer(elektrostarttime)
+
+
+	def DoElektroStandby(self,retval):
+		if (retval):
+			#Yes, go to sleep
+			Notifications.AddNotification(Standby.Standby)
+		
+
+			
+	def setNextWakeuptime(self):
+		# Do not set a wakeup time if
+		#  - Elektro isn't enabled
+		#  - Elektro shouldn't wake up
+		#  - Holiday mode is turned on
+		if ((config.plugins.elektro.enable.value == False) 
+		      or (config.plugins.elektro.dontwakeup.value == True)
+		      or config.plugins.elektro.holiday.value == True): 
+			global ElektroWakeUpTime
+			ElektroWakeUpTime = -1
+			return
+			
+		time_s = self.getTime()
+		ltime = localtime()
+		
+		#print "Nextday:" + time.ctime(self.clkToTime(config.plugins.elektro.nextday))
+		# If it isn't past next-day time we need yesterdays settings
+		if time_s < self.clkToTime(config.plugins.elektro.nextday):
+			day = (ltime.tm_wday - 1) % 7
+		else:
+			day = ltime.tm_wday
+		
+		#Check whether we wake up today or tomorrow
+		# Relative Time is needed for this
+		time_s = self.getReltime(time_s)
+		wakeuptime = self.getReltime(self.clkToTime(config.plugins.elektro.wakeup[day]))
+		
+		# Lets see if we already woke up today
+		if wakeuptime < time_s:
+			#yes we did -> Next wakeup is tomorrow
+			#print "Elektro: Wakeup tomorrow"
+			day = (day + 1) % 7
+			wakeuptime = self.getReltime(self.clkToTime(config.plugins.elektro.wakeup[day]))
+		
+		# Tomorrow we'll wake up erly-> Add a full day.
+		if wakeuptime < time_s:
+			wakeuptime = wakeuptime + 24 * 60 * 60
+		
+		# The next wakeup will be in wakupin seconds
+		wakeupin = wakeuptime - time_s
+		
+		# Now add this to the current time to get the wakeuptime
+		wakeuptime = (int)(time()) + wakeupin
+		
+		#Write everything to the global variable
+		ElektroWakeUpTime = wakeuptime
+			
+			
+	def CheckElektro(self):
+		# first set the next wakeuptime - it would be much better to call that function on sleep. This will be a todo!
+		self.setNextWakeuptime()
+	
+		#convert to seconds
+		time_s = self.getTime()
+		ltime = localtime()
+		
+		print "[Elektro] Testtime; " + self.getPrintTime(2 * 60 * 60)
+		
+		#Which day is it? The next day starts at nextday
+		print "[Elektro] wday 1: " + str(ltime.tm_wday)
+		if time_s < self.clkToTime(config.plugins.elektro.nextday):
+			day = (ltime.tm_wday - 1) % 7
+		else:
+			day = ltime.tm_wday
+			
+		print "[Elektro] wday 2: " + str(day)
+		
+		#Let's get the day
+		wakeuptime = self.clkToTime(config.plugins.elektro.wakeup[day])
+		sleeptime = self.clkToTime(config.plugins.elektro.sleep[day])
+		print "[Elektro] Current time: " + self.getPrintTime(time_s)
+		print "[Elektro] Wakeup time: " + self.getPrintTime(wakeuptime)
+		print "[Elektro] Sleep time: " + self.getPrintTime(sleeptime)
+		
+		#convert into relative Times
+		time_s = self.getReltime(time_s)
+		wakeuptime  = self.getReltime(wakeuptime)
+		sleeptime = self.getReltime(sleeptime)
+		
+		print "[Elektro] Current Rel-time: " + self.getPrintTime(time_s)
+		print "[Elektro] Wakeup Rel-time: " + self.getPrintTime(wakeuptime)
+		print "[Elektro] Sleep Rel-time: " + self.getPrintTime(sleeptime)
+		
+		
+		#let's see if we should be sleeping
+		trysleep = False
+		if time_s < (wakeuptime - elektroShutdownThreshold): # Wakeup is in the future -> sleep!
+			trysleep = True
+			print "[Elektro] Wakeup!" + str(time_s) + " < " + str(wakeuptime)
+		if sleeptime < time_s : #Sleep is in the past -> sleep!
+			trysleep = True
+			print "[Elektro] Sleep: " + str(sleeptime) + " < " + str(time_s)
+		
+		#We are not tying to go to sleep anymore -> maybe go to sleep again the next time
+		if trysleep == False:
+			self.dontsleep = False
+		
+		#The User aborted to got to sleep -> Don't go to sleep.
+		if self.dontsleep:
+			trysleep = False
+			
+		# If we are in holydaymode we should try to got to sleep anyway
+		# This should be set after self.dontsleep has been handled
+		if config.plugins.elektro.holiday.value:
+			trysleep = True
+		
+		# We are not enabled -> Dont go to sleep (This could have been catched earlier!)
+		if config.plugins.elektro.enable.value == False:
+			trysleep = False
+		
+		# Only go to sleep if we are in standby or sleep is forced by settings
+		if  not ((Standby.inStandby) or (config.plugins.elektro.force.value == True) ):
+			trysleep = False
+		
+		# No Sleep while recording
+		if self.session.nav.RecordTimer.isRecording():
+			trysleep = False
+		
+		# Will there be a recording in a short while?
+		nextRecTime = self.session.nav.RecordTimer.getNextRecordingTime()
+		if  (nextRecTime > 0) and (nextRecTime - (int)(time()) <  elektroShutdownThreshold):
+			trysleep = False
+			
+		# Looks like there really is a reason to go to sleep -> Lets try it!
+		if trysleep:
+			#self.();
+			try:
+				self.session.openWithCallback(self.DoElektroSleep, MessageBox, _("Go to sleep now?"),type = MessageBox.TYPE_YESNO,timeout = 60)	
+			except:
+				#reset the timer and try again
+				self.TimerSleep.startLongTimer(elektrostarttime) 
+				
+		#set Timer, which calls this function again.
+		self.TimerSleep.startLongTimer(elektrostarttime) 
+		
+		
+
+
+	def DoElektroSleep(self,retval):
+		if (retval):
+			# os.system("wall 'Powermanagent does Deepsleep now'")
+			#  Notifications.AddNotification(TryQuitMainloop,1)
+			# 1 = Deep Standby -> enigma2:/doc/RETURNCODES
+			
+			global inTryQuitMainloop
+			if Standby.inTryQuitMainloop == False:
+				self.session.open(Standby.TryQuitMainloop, 1) # <- This might not work reliably
+				#quitMainloop(1)
+		else:
+			# Dont try to sleep until next wakeup
+			self.dontsleep = True
+			#Start the timer again
+			self.TimerSleep.startLongTimer(elektrostarttime) 
+			
Index: /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/readme.txt
===================================================================
--- /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/readme.txt	(revision 2774)
+++ /ipk/source/swapbrowsers_elektro_1_0/var/swap/Extensions/Elektro/readme.txt	(revision 2774)
@@ -0,0 +1,230 @@
+====================================================
+Elektro Power Save for Dreambox 7025 
+Version 1 & 2 by gutemine
+Version 3 by Morty <morty@gmx.net>
+====================================================
+Release infos 
+====================================================
+1.0   first version, as usually completely 
+      untested - have Fun !
+1.1   now after boot the Dreambox will go 
+      immediately to normal Standby
+1.2   some bugfixes on Plugin Text and 
+      make standby on boot configurable
+2.0   make ipk kit, add info messages before standby 
+      and prevent deepstandby if timer is running
+2.1   bug fixes and support for new images with TryQuit
+      mainloop (which is since mid January 2007 in CVS)
+2.2   still alive 
+2.3   make compatible with latest CVS changes
+      probably last version by gutemine
+
+3.0   Rewritten by Morty, lots of new features
+3.0.2 It's now possible to adjust the how long to
+      show the shutdown screen
+3.0.4 Bugfix
+3.0.5 Fixed problem where the box shuts down again
+      when it boots up too fast
+3.1.0 Removed unneeded dependencies
+      Don't shut down if woken up manually
+3.2.0 Recording detection should work now
+      Holiday mode has been implemented
+3.2.1 Fixed Bug not recognizing a wakeup by Elektro 
+3.2.2 Added the Italian translation by Spaeleus     
+3.2.3 Fixed problem with auto-Timers
+3.3.0 Added an option to choose whether to go to 
+      standby on manual boot
+3.3.1 Fixed problem when the global session was not
+      available
+3.3.2 Fixed some problems shutting down on latest
+	  versions of enigma2.
+3.3.3 Added patch to installer to fix enigma2. It 
+	  should now be possible to run Elektro and 
+	  EPG refresh in parallel.
+3.3.4 Added Turkish locale by MytHoLoG	  
+====================================================
+The English Documentation follows the German one 
+====================================================
+
+1) Voraussetzung
+----------------
+Power Save sollte auf den meisten Systemen mit Enigma2
+funktionieren. Muss aber nicht.
+DM7025 + DM8000: Wird unterstützt.
+DM800: Kann nicht alleine aufwachen, wird daher nicht
+wirklich unterstützt.
+
+2) Installation
+---------------
+
+Zuerst kopiert das elektro*.ipk File vom  auf /tmp mit 
+ftp (TCP/IP muss natürlich schon funktionieren). 
+
+Wenn Ihr ein Image geflashed habt, das ein Blue 
+Pannel hat könnt Ihr damit mit Manual Install das
+ipk file installieren.
+
+Wenn nicht, dann installiert elektro mit folgenden 
+Kommandos im Telnet:
+
+cd /
+ipkg install /tmp/elektro*.ipk
+
+Damit Elektro zuverlässig funktioniert muss die Box 
+neu gestartet werden. 
+
+
+3) Funktionsweise
+-----------------
+
+Das Elektro Power Save Plugin sorgt dafür, zu die Box
+zu bestimmten Zeiten in den Ruhezustand (Deep Standby)
+heruntergefahren wird. Dies passiert nur, wenn sie
+sich in Standby befindet und keine Aufnahme läuft
+oder in den nächsten 20 Minuten gestartet wird.
+
+Zu Aufnahmen und nach Ende der Ruhezeit wacht die Box
+von alleine wieder auf, so dass man nicht ewig warten
+muss, bis sie Bereit ist.
+
+4) Optionen
+-----------
+Hauptmenü -> Erweiterungen -> Elektro Power Save
+
+ - Elektro Power Save aktivieren
+   Aktiviert das Plugin
+   
+ - Nach dem Booten in den Standby
+   Geht nach dem Booten in den Standby
+   
+ - Nach dem manuellen Booten in den Standby
+   Soll nach einem manuellen Bootvorgang in den 
+   Standby gegangen werden? Die Box geht nach 
+   einem manuellen Bootvorgang erst in der nächsten
+   den Ruhezeit in den Ruhezustand, selbst wenn
+   diese Option aktiviert ist.
+   Diese Option wird nur ausgewertet, wenn "Nach 
+   dem Booten in den Standby" aktiviert ist.
+   
+ - In-den-Standby-Bildschirm Anzeigezeit
+   Stellt ein wie lange die Stanby-Abfrge angezeigt
+   wird. Dieser Wert kann erhöht werden um sicher zu
+   stellen, dass sich die Box während der Ruhe-Zeit 
+   nicht zu schnell wieder abschaltet.
+   
+ - Erzwinge Ruhezustand
+   Erzwingt den Ruhezustand auch, wenn die Box nicht
+   im Standby ist. Auf Aufnahmen hat dies keinen Ein-
+   fluss.
+   
+ - Nicht aufwachen
+   Die Box wacht nach dem eine der Ruhe-Zeit nicht von
+   alleine auf.
+   
+ - Urlaubsmodus
+   Die Box geht immer schlafen, wenn nicht gerade
+   aufgenommen wird.
+   
+ - Die nächste Tag beginnt um und sostige Zeiten
+   Soll die Box Montag Nacht um 1 in den Ruhezustand,
+   ist es genau genommen schon Dienstag. Damit dies
+   trotzdem möglich ist, muss angegeben werden wann 
+   der nächste Tag anfängt.
+   Der Rest ist hoffentlich selbsterklärend.
+   
+
+
+
+====================================================
+Viel Spass mit dem Stromsparen und Umweltschützen
+mit dem Elektro Plugin auf der Dreambox 7025 !!!!
+====================================================
+
+
+1) Prerequisites
+----------------
+
+Should work on most systems using Enigma2, but this 
+isn't granted.
+DM7025 + DM8000: Supported.
+DM800: Can not wake up by itself. It therefore isn't
+really supported.
+
+2) Installation
+---------------
+
+First copy the elektro*.ipk file from elektro*.zip
+to /tmp with ftp (TCP/IP must be working already). 
+
+If you have flashed an image that offer in Blue 
+Pannel Manual Addon Install you can use this 
+functionality to install the ipk file.
+
+If not, then install Elektro by entering the 
+following commands in a Telnet session:
+
+cd /
+ipkg install /tmp/elektro*.ipk
+
+To ensure proper operation of Elektro please reboot
+the box. 
+
+
+3) Mode of operation    
+--------------------
+The Elektro Power Save Plugin puts the box from 
+stand by to sleep mode (Deep Standby) at certain 
+times. This only happens if the box is in standby
+and no recording is running or sheduled in the 
+next 20 minutes.
+
+The box automatically wakes up for recordings or
+at the end of the sleep time. You therefore don't
+have to wait until it is on again.
+
+4) Optiones
+-----------
+Main menu -> Extensions -> Elektro Power Save
+
+ - Enable Elektro Power Save
+   Enables the Plugin.
+   
+ - Standby on boot
+   Puts the box in standby after boot.  
+   
+ - Standby on manual boot
+   Whether to put the box in standby when booted
+   manually. On manual boot the box will not go
+   to sleep until the next sleep intervall eaven
+   when this is turned on.
+   This option is only evaluated if Standby on
+   boot is turned on.  
+   
+ - Standby on boot screen timeout
+   How long to show the standby on boot screen.
+   This value can be encreased to ensure the box
+   does not shut down again to quickly during
+   sleep times.
+   
+ - Force sleep 
+   Forces sleep, even when not in standby. This
+   has influence on sheduled recordings.
+   
+ - Dont wake up
+   Do not wake up at the end of the sleep time.
+   
+ - Holiday mode
+   The box goes to sleep when not recording   
+   
+ - Next day starts at and other times
+   If the box is supposed to go to sleep Monday night
+   at 1 it is actually already Thuesday. To make this
+   nonetheless possible, it must be known when the
+   next day Starts.
+   Hopefully the rest is self-explanatory. 
+
+
+======================================================
+Have Fun to let Elektro Save Power and the 
+Environment with your Dreambox 7025 !!!!
+======================================================
