SharkyEXE icon

Untitled

SharkyEXE | PRO | 11/03/18 08:30:40 AM UTC | 0 ⭐ | 714 👁️ | Never ⏰ | []
text |

1.51 KB

|

None

|

0 👍

/

0 👎

from enigma import eTimer
from Components.config import config
from Components.Console import Console
from enigma import eTimer, eDVBLocalTimeHandler, eEPGCache
try:
 from Tools.StbHardware import setRTCtime
except:
 from Tools.DreamboxHardware import setRTCtime
from time import time
 class NTPSyncPoller:
 """Automatically Poll NTP"""
 def __init__(self):
  self.timer = eTimer()
  self.Console = Console()
  def start(self):
  if not self.timer.callback:
   self.timer.callback.append(self.NTPStart)
  self.timer.startLongTimer(0)
  def stop(self):
  if self.timer.callback:
   self.timer.callback.remove(self.NTPStart)
  self.timer.stop()
  def NTPStart(self):
  if config.plugins.SetClock.choiceSystemTime.value == "1":
   if not config.plugins.SetClock.useNTPminutes.value == "0":
    cmd = '/usr/lib/enigma2/python/Plugins/Extensions/SetClock/ntpdate -s -u %s' % config.plugins.SetClock.ip.value
    self.Console.ePopen(cmd, self.update_schedule)
    self.timer.startLongTimer(int(config.plugins.SetClock.useNTPminutes.value) * 60)
  def update_schedule(self, result = None, retval = None, extra_args = None):
  if eDVBLocalTimeHandler.getInstance().ready():
   nowTime = time()
   if nowTime > 1388534400:
    setRTCtime(nowTime)
    if config.plugins.SetClock.choiceSystemTime.value == "0":
     eDVBLocalTimeHandler.getInstance().setUseDVBTime(True)
    else:
     eDVBLocalTimeHandler.getInstance().setUseDVBTime(False)
    try:
     eEPGCache.getInstance().timeUpdated()
    except:
     pass

Comments