Skip to content

Commit 739e996

Browse files
committed
[epgCopy] - add option to deactivate copying
1 parent 0f51257 commit 739e996

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

epgcopy/src/plugin.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
from os import path, remove
3434
from shutil import move
3535
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
3838

3939

4040
from time import time, strftime, mktime, localtime
@@ -45,6 +45,7 @@
4545
)
4646

4747
config.plugins.epgCopy = ConfigSubsection()
48+
config.plugins.epgCopy.active = ConfigOnOff(default=True)
4849
config.plugins.epgCopy.username = ConfigText(default = "root", fixed_size = False)
4950
config.plugins.epgCopy.password = ConfigPassword(default = "", fixed_size = False)
5051
config.plugins.epgCopy.ip = ConfigIP(default = [0, 0, 0, 0])
@@ -94,18 +95,20 @@ def __init__(self, session):
9495
def configChange(self, configElement = None):
9596
if self.timer.isActive(): # stop timer if running
9697
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)
109112

110113
def __doCopy(self):
111114
if config.plugins.epgCopy.copytime.value:
@@ -163,6 +166,7 @@ def __init__(self, session):
163166
self["key_red"] = Button(_("cancel"))
164167

165168
ConfigListScreen.__init__(self, [
169+
getConfigListEntry(_("EPG Copy - Active"), config.plugins.epgCopy.active),
166170
getConfigListEntry(_("EPG Copy - Source Network IP"), config.plugins.epgCopy.ip),
167171
getConfigListEntry(_("EPG Copy - Username"), config.plugins.epgCopy.username),
168172
getConfigListEntry(_("EPG Copy - Password"), config.plugins.epgCopy.password),

0 commit comments

Comments
 (0)