Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'e2/master'

Conflicts:
	elektro/src/plugin.py
	epgrefresh/src/EPGRefresh.py
  • Loading branch information...
commit 7def28ec6dd7db7b711d82be669105a5ad415487 2 parents 82c207b + adeaef9
@andyblac andyblac authored
View
1  Makefile.am
@@ -40,7 +40,6 @@ SUBDIRS = \
infobartunerstate \
internetradio \
kiddytimer \
- lastfm \
letterbox \
mediadownloader \
merlinepg \
View
98 elektro/src/plugin.py
@@ -14,8 +14,8 @@
from __init__ import _
from Screens.InfoBarGenerics import *
-# from RecordTimer import *
+from RecordTimer import RecordTimerEntry
import calendar
#################
@@ -43,7 +43,7 @@
# Configuration
from Components.config import configfile, getConfigListEntry, ConfigEnableDisable, \
ConfigYesNo, ConfigText, ConfigClock, ConfigNumber, ConfigSelection, \
- config, ConfigSubsection, ConfigSubList, ConfigSubDict, ConfigIP
+ config, ConfigSubsection, ConfigSubList, ConfigSubDict, ConfigIP, ConfigInteger
# Startup/shutdown notification
from Tools import Notifications
@@ -76,8 +76,8 @@
debug = False # If set True, plugin will print some additional status info to track logic flow
session = None
ElektroWakeUpTime = -1
-elektro_pluginversion = "3.4.5a"
-elektrostarttime = 60
+elektro_pluginversion = "3.4.5b"
+elektrostarttime = 60
elektrosleeptime = 5
elektroShutdownThreshold = 60 * 20
###############################################################################
@@ -117,13 +117,13 @@
config.plugins.elektro.enable = ConfigEnableDisable(default = False)
config.plugins.elektro.standbyOnBoot = ConfigYesNo(default = False)
config.plugins.elektro.standbyOnManualBoot = ConfigYesNo(default = True)
-config.plugins.elektro.standbyOnBootTimeout = ConfigNumber(default = 60)
config.plugins.elektro.nextwakeup = ConfigNumber(default = 0)
config.plugins.elektro.force = ConfigYesNo(default = False)
config.plugins.elektro.dontwakeup = ConfigEnableDisable(default = False)
config.plugins.elektro.holiday = ConfigEnableDisable(default = False)
config.plugins.elektro.hddsleep = ConfigYesNo(default = False)
config.plugins.elektro.IPenable = ConfigYesNo(default = False)
+config.plugins.elektro.deepstandby_wakeup_time = ConfigInteger(default = 0)
config.plugins.elektro.NASenable = ConfigSelection(choices = [("false", "no"), ("true", "yes"), ("1", _("yes, Profile 1")), ("2", _("yes, Profile 2"))], default="false")
config.plugins.elektro.NASname = ConfigText(default = "", fixed_size = False, visible_width = 50)
@@ -190,20 +190,19 @@ def autostart(reason, **kwargs):
def getNextWakeup():
global ElektroWakeUpTime
- #it might happen, that session does not exist. I don't know why. :-(
- if session is None:
- return ElektroWakeUpTime;
+ wakeuptime = 0
- nextTimer = session.nav.RecordTimer.getNextRecordingTime()
- print pluginPrintname, "Now:", strftime("%a:%H:%M:%S", gmtime(time()))
- if (nextTimer < 1) or (nextTimer > ElektroWakeUpTime):
- print pluginPrintname, "Will wake up", strftime("%a:%H:%M:%S", gmtime(ElektroWakeUpTime))
- return ElektroWakeUpTime
+ now = time()
+ print pluginPrintname, "Now:", strftime("%a:%H:%M:%S", gmtime(now))
- #We have to make sure, that the Box will wake up because of us
- # and not because of the timer
- print pluginPrintname, "Will wake up due to the next timer", strftime("%a:%H:%M:%S", gmtime(nextTimer))
- return nextTimer - 1
+ if ElektroWakeUpTime > now:
+ print pluginPrintname, "Will wake up at", strftime("%a:%H:%M:%S", gmtime(ElektroWakeUpTime))
+ wakeuptime = ElektroWakeUpTime
+
+ config.plugins.elektro.deepstandby_wakeup_time.value = wakeuptime
+ config.plugins.elektro.deepstandby_wakeup_time.save()
+
+ return wakeuptime or -1
def Plugins(**kwargs):
if debug:
@@ -467,8 +466,6 @@ def __init__(self, session, args = 0):
_("Puts the box in standby mode after boot.")),
getConfigListEntry(_("Standby on manual boot"), config.plugins.elektro.standbyOnManualBoot,
_("Whether to put the box in standby when booted manually. On manual boot the box will not go to standby before the next deep standby interval starts, even if this option is set. This option is only active if 'Standby on boot' option is set, too.")),
- getConfigListEntry(_("Standby on boot screen timeout"), config.plugins.elektro.standbyOnBootTimeout,
- _("Specify how long to show the standby query on boot screen. This value can be set to ensure the box does not shut down to deep standby again too fast when in standby mode.")),
getConfigListEntry(_("Force sleep (even when not in standby)"), config.plugins.elektro.force,
_("Forces deep standby, even when not in standby mode. Scheduled recordings remain unaffected.")),
getConfigListEntry(_("Avoid deep standby when HDD is active, e.g. for FTP"), config.plugins.elektro.hddsleep,
@@ -575,45 +572,30 @@ def __init__(self,session):
# 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
+ # the next five min
+
+ automatic_wakeup = self.session.nav.wasTimerWakeup() # woken by any timer
+
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
+ timerWakeup = automatic_wakeup
# 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:
+ 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 pluginPrintname, "Set up standby timer"
+ print pluginPrintname, "add standby notification"
+ Notifications.AddNotificationWithID("Standby", Standby.Standby)
self.TimerSleep = eTimer()
self.TimerSleep.callback.append(self.CheckElektro)
@@ -632,7 +614,6 @@ def getTime(self):
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):
@@ -642,24 +623,6 @@ def getReltime(self, time):
nextday = self.clkToTime(config.plugins.elektro.nextday2)
return (time - nextday) % (24 * 60 * 60)
-
- def CheckStandby(self):
- print pluginPrintname, "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 pluginPrintname, "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
@@ -841,17 +804,14 @@ def DoElektroSleep(self,retval):
config.plugins.elektro.profile.save()
self.setNextWakeuptime()
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:
+ if not Standby.inTryQuitMainloop:
if config.plugins.elektro.NASenable.value == "true" or config_NASenable:
ret = NASpowerdown(config.plugins.elektro.NASname.value, config.plugins.elektro.NASuser.value, config.plugins.elektro.NASpass.value, config.plugins.elektro.NAScommand.value, config.plugins.elektro.NASport.value)
configfile.save()
- self.session.open(Standby.TryQuitMainloop, 1) # <- This might not work reliably
- #quitMainloop(1)
+ if Standby.inStandby:
+ RecordTimerEntry.TryQuitMainloop()
+ else:
+ Notifications.AddNotificationWithID("Shutdown", Standby.TryQuitMainloop, 1)
else:
# Dont try to sleep until next wakeup
self.dontsleep = True
View
14 epgrefresh/src/EPGRefresh.py
@@ -10,6 +10,8 @@
# ...
from ServiceReference import ServiceReference
+from RecordTimer import RecordTimerEntry
+
# Timer
from EPGRefreshTimer import epgrefreshtimer, EPGRefreshTimerEntry, checkTimespan
@@ -310,11 +312,13 @@ def finish(self, *args, **kwargs):
# shutdown if we're supposed to go to deepstandby and not recording
- if not self.forcedScan and config.plugins.epgrefresh.afterevent.value and not Screens.Standby.inTryQuitMainloop:
- self.session.open(
- Screens.Standby.TryQuitMainloop,
- 1
- )
+ if not self.forcedScan and config.plugins.epgrefresh.afterevent.value \
+ and not Screens.Standby.inTryQuitMainloop:
+
+ if Screens.Standby.inStandby:
+ RecordTimerEntry.TryQuitMainloop()
+ else:
+ Notifications.AddNotificationWithID("Shutdown", Screens.Standby.TryQuitMainloop, 1)
def refresh(self):
if self.forcedScan:
View
66 epgrefresh/src/plugin.py
@@ -5,7 +5,7 @@
# Config
from Components.config import config, ConfigYesNo, ConfigNumber, \
- ConfigSelection, ConfigSubsection, ConfigClock, ConfigYesNo
+ ConfigSelection, ConfigSubsection, ConfigClock, ConfigYesNo, ConfigInteger
# Calculate default begin/end
from time import time, localtime, mktime
@@ -42,6 +42,8 @@
)
config.plugins.epgrefresh.show_in_extensionsmenu = ConfigYesNo(default = False)
config.plugins.epgrefresh.show_help = ConfigYesNo(default = True)
+config.plugins.epgrefresh.wakeup_time = ConfigInteger(default=-1)
+
# convert previous parameters
config.plugins.epgrefresh.background = ConfigYesNo(default = False)
@@ -55,45 +57,6 @@
config.plugins.epgrefresh.interval.value = 2
config.plugins.epgrefresh.save()
-del now, begin, end
-
-#pragma mark - Workaround for unset clock
-
-from enigma import eDVBLocalTimeHandler
-
-def timeCallback(isCallback=True):
- """Time Callback/Autostart management."""
- thInstance = eDVBLocalTimeHandler.getInstance()
- if isCallback:
- # NOTE: this assumes the clock is actually ready when called back
- # this may not be true, but we prefer silently dying to waiting forever
- thInstance.m_timeUpdated.get().remove(timeCallback)
- elif not thInstance.ready():
- thInstance.m_timeUpdated.get().append(timeCallback)
- return
-
- if config.plugins.epgrefresh.wakeup.value:
- now = localtime()
- begin = int(mktime(
- (now.tm_year, now.tm_mon, now.tm_mday,
- config.plugins.epgrefresh.begin.value[0],
- config.plugins.epgrefresh.begin.value[1],
- 0, now.tm_wday, now.tm_yday, now.tm_isdst)
- ))
- # booted +- 10min from begin of timespan
- if abs(time() - begin) < 600:
- from Screens.MessageBox import MessageBox
- from Tools.Notifications import AddNotificationWithCallback
- from Tools.BoundFunction import boundFunction
- # XXX: we use a notification because this will be suppressed otherwise
- AddNotificationWithCallback(
- boundFunction(standbyQuestionCallback, epgrefresh.session),
- MessageBox,
- _("This might have been an automated bootup to refresh the EPG. For this to happen it is recommended to put the receiver to Standby.\nDo you want to do this now?"),
- timeout = 15
- )
- epgrefresh.start()
-
#pragma mark - Help
try:
from Plugins.SystemPlugins.MPHelp import registerHelp, XMLHelpReader
@@ -116,11 +79,6 @@ def timeCallback(isCallback=True):
from Components.PluginComponent import plugins
from Plugins.Plugin import PluginDescriptor
-def standbyQuestionCallback(session, res = None):
- if res:
- from Screens.Standby import Standby
- session.open(Standby)
-
# Autostart
def autostart(reason, **kwargs):
if reason == 0 and "session" in kwargs:
@@ -128,7 +86,14 @@ def autostart(reason, **kwargs):
epgrefresh.session = session
if config.plugins.epgrefresh.enabled.value:
- timeCallback(isCallback=False)
+ # check if box was woken up by a timer, if so, check if epgrefresh set this timer
+ if session.nav.wasTimerWakeup() and config.misc.prev_wakeup_time.value == config.plugins.epgrefresh.wakeup_time.value:
+ # if box is not in idle mode, do that
+ from Screens.Standby import Standby, inStandby
+ if not inStandby:
+ from Tools import Notifications
+ Notifications.AddNotificationWithID("Standby", Standby)
+ epgrefresh.start()
elif reason == 1:
epgrefresh.stop()
@@ -138,6 +103,7 @@ def getNextWakeup():
if not config.plugins.epgrefresh.enabled.value or \
not config.plugins.epgrefresh.wakeup.value:
+ setConfigWakeupTime(-1)
return -1
now = localtime()
@@ -147,12 +113,20 @@ def getNextWakeup():
config.plugins.epgrefresh.begin.value[1],
0, now.tm_wday, now.tm_yday, now.tm_isdst)
))
+
# todays timespan has not yet begun
if begin > time():
+ setConfigWakeupTime(begin)
return begin
+
# otherwise add 1 day
+ setConfigWakeupTime(begin+86400)
return begin+86400
+def setConfigWakeupTime(value):
+ config.plugins.epgrefresh.wakeup_time.value = value
+ config.plugins.epgrefresh.save()
+
# Mainfunction
def main(session, **kwargs):
epgrefresh.stop()
View
6 startuptostandby/src/plugin.py
@@ -1,7 +1,7 @@
# -*- coding: iso-8859-1 -*-
from Plugins.Plugin import PluginDescriptor
from Components.config import config, ConfigSubsection, ConfigEnableDisable
-from Screens.Standby import Standby
+from Screens.Standby import Standby, inStandby
from StartupToStandbyConfiguration import StartupToStandbyConfiguration
from Tools import Notifications
@@ -15,8 +15,8 @@ def main(session, **kwargs):
# sessionstart
def sessionstart(reason, session = None):
print "[StartupToStandby] autostart"
- if config.plugins.startuptostandby.enabled.value and reason == 0:
- Notifications.AddNotification(Standby)
+ if config.plugins.startuptostandby.enabled.value and reason == 0 and not inStandby:
+ Notifications.AddNotificationWithID("Standby", Standby)
def Plugins(path, **kwargs):
return [PluginDescriptor(name="StartupToStandby", description="Startup To Standby", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main, needsRestart = False),
View
34 webinterface/src/web-data/core.js
@@ -498,6 +498,30 @@ var MediaPlayer = Class.create(Controller, {
command: function(cmd){
this.handler.command(cmd);
+ },
+
+ onInstantPlay: function(event, element){
+ var ref = $F('instantPlay').gsub(":", "%3a");
+ ref = "4097:0:1:0:0:0:0:0:0:0:" + ref;
+ this.playFile(ref)
+ event.stop();
+ },
+
+ addInstantPlayInput: function(){
+ var form = new Element('form');
+ form.id = 'instantPlayForm';
+ var input = new Element('input');
+ input.id = 'instantPlay';
+ setInputPlaceholder(input, strings.play);
+
+ form.insert({top : input});
+ form.on('submit', this.onInstantPlay.bind(this));
+
+ $('contentHdExt').update(form);
+ },
+
+ onFinished: function(){
+ this.addInstantPlayInput();
}
});
@@ -794,7 +818,7 @@ var Services = Class.create(Controller, {
addFilterInput: function(){
var input = new Element('input');
input.id = 'serviceFilter';
- input.value = strings.filter_services;
+ setInputPlaceholder(input, strings.filter_services);
$('contentHdExt').update(input);
input.on('focus', this.onFilterFocus.bind(this));
input.on('keyup', this.filter.bind(this));
@@ -1028,7 +1052,6 @@ var BaseCore = Class.create({
initialize: function(){
this.popUpBlockerHinted = false;
this.hideNotifierTimeout = '';
-
this.sessionProvider = new SessionProvider( this.onSessionAvailable.bind(this) );
if(userprefs.data.style != "dark" && userprefs.data.style != "light"){
userprefs.data.style = "dark";
@@ -1481,12 +1504,6 @@ var E2WebCore = Class.create(BaseCore, {
event.stop();
}.bind(this)
);
- $('epgSearch').on(
- 'focus',
- function(event, element){
- element.value = "";
- }.bind(this)
- );
$('epgSearchClear').on(
'click',
function(event, element){
@@ -1992,7 +2009,6 @@ var E2WebCore = Class.create(BaseCore, {
if( userprefs.data.updateCurrentInterval != updateCurrentInterval){
userprefs.data.updateCurrentInterval = updateCurrentInterval;
-
changed = true;
this.startUpdateCurrentPoller();
}
View
22 webinterface/src/web-data/helpers.js
@@ -49,6 +49,20 @@ String.prototype.format = function(){
return data;
};
+function setInputPlaceholder(element, value){
+ if('placeholder' in element){
+ element.placeholder = value
+ } else {
+ element.value = value;
+ element.on(
+ 'focus',
+ function(event, element){
+ element.value = "";
+ }.bind(this)
+ );
+ }
+}
+
//General Helpers
function toOptionList(lst, selected, split) {
var retList = Array();
@@ -93,9 +107,13 @@ function toOptionList(lst, selected, split) {
return retList;
}
-
-var _consoleDebug = console.log.bind(console);
var _nullDebug = function(item){};
+try{
+ var _consoleDebug = console.log.bind(console); //on IE devtools have to be open or this won't work!
+} catch(e){
+ var _consoleDebug = _nullDebug;
+}
+
var debug = userprefs.data.debug ? _consoleDebug : _nullDebug;
function parseNr(num) {
View
5 webinterface/src/web-data/tpl/default/index.html
@@ -165,7 +165,7 @@
<div id="searchHd" class="header"><div>EPG-Search</div></div>
<div class="boxContent">
<form id="epgSearchForm" action="">
- <input type="text" id="epgSearch" value="Search EPG" />
+ <input type="text" id="epgSearch" />
<img id="epgSearchClear" style="vertical-align:middle" src="/web-data/img/cross.png" alt="clear..." title="Clear Search"/>
</form>
</div>
@@ -199,11 +199,10 @@
$('instantRecordHd').update(strings.instant_record);
$('volHd').update(strings.volume);
$('searchHd').update(strings.epgsearch);
- $('epgSearch').value = strings.epgsearch_hint;
+ setInputPlaceholder($('epgSearch'), strings.epgsearch_hint);
$('epgSearchClear').title = strings.clear_serach;
$('openSignalPanelImg').title = strings.open_signal_panel;
$('instantRecordImg').title = strings.instant_record;
-
core.run();
</script>
Please sign in to comment.
Something went wrong with that request. Please try again.