|
33 | 33 | from os import path, remove
|
34 | 34 | from shutil import move
|
35 | 35 | from Components.config import getConfigListEntry, config, \
|
36 |
| - ConfigSubsection, ConfigText, ConfigIP, ConfigYesNo, \ |
37 |
| - ConfigPassword, ConfigNumber, KEY_LEFT, KEY_RIGHT, KEY_0, ConfigClock |
| 36 | + ConfigSubsection, ConfigText, ConfigIP, ConfigOnOff, \ |
| 37 | + ConfigPassword, KEY_LEFT, KEY_RIGHT, KEY_0, ConfigClock |
38 | 38 |
|
39 | 39 |
|
40 | 40 | from time import time, strftime, mktime, localtime
|
|
45 | 45 | )
|
46 | 46 |
|
47 | 47 | config.plugins.epgCopy = ConfigSubsection()
|
| 48 | +config.plugins.epgCopy.active = ConfigOnOff(default=True) |
48 | 49 | config.plugins.epgCopy.username = ConfigText(default = "root", fixed_size = False)
|
49 | 50 | config.plugins.epgCopy.password = ConfigPassword(default = "", fixed_size = False)
|
50 | 51 | config.plugins.epgCopy.ip = ConfigIP(default = [0, 0, 0, 0])
|
@@ -94,18 +95,20 @@ def __init__(self, session):
|
94 | 95 | def configChange(self, configElement = None):
|
95 | 96 | if self.timer.isActive(): # stop timer if running
|
96 | 97 | self.timer.stop()
|
97 |
| - now = localtime() |
98 |
| - begin = int(mktime( |
99 |
| - (now.tm_year, now.tm_mon, now.tm_mday, |
100 |
| - config.plugins.epgCopy.copytime.value[0], |
101 |
| - config.plugins.epgCopy.copytime.value[1], |
102 |
| - now.tm_sec, now.tm_wday, now.tm_yday, now.tm_isdst) |
103 |
| - )) |
104 |
| - if begin < time(): |
105 |
| - begin += 86400 |
106 |
| - next = int(abs(time() - begin)) |
107 |
| - myPrint("[copyEveryDay] next reset: %s" % strftime("%c", localtime(time()+ next))) |
108 |
| - self.timer.startLongTimer(next) |
| 98 | + |
| 99 | + if config.plugins.epgCopy.active.value: |
| 100 | + now = localtime() |
| 101 | + begin = int(mktime( |
| 102 | + (now.tm_year, now.tm_mon, now.tm_mday, |
| 103 | + config.plugins.epgCopy.copytime.value[0], |
| 104 | + config.plugins.epgCopy.copytime.value[1], |
| 105 | + now.tm_sec, now.tm_wday, now.tm_yday, now.tm_isdst) |
| 106 | + )) |
| 107 | + if begin < time(): |
| 108 | + begin += 86400 |
| 109 | + next = int(abs(time() - begin)) |
| 110 | + myPrint("[copyEveryDay] next reset: %s" % strftime("%c", localtime(time()+ next))) |
| 111 | + self.timer.startLongTimer(next) |
109 | 112 |
|
110 | 113 | def __doCopy(self):
|
111 | 114 | if config.plugins.epgCopy.copytime.value:
|
@@ -163,6 +166,7 @@ def __init__(self, session):
|
163 | 166 | self["key_red"] = Button(_("cancel"))
|
164 | 167 |
|
165 | 168 | ConfigListScreen.__init__(self, [
|
| 169 | + getConfigListEntry(_("EPG Copy - Active"), config.plugins.epgCopy.active), |
166 | 170 | getConfigListEntry(_("EPG Copy - Source Network IP"), config.plugins.epgCopy.ip),
|
167 | 171 | getConfigListEntry(_("EPG Copy - Username"), config.plugins.epgCopy.username),
|
168 | 172 | getConfigListEntry(_("EPG Copy - Password"), config.plugins.epgCopy.password),
|
|
0 commit comments