Skip to content

Commit 2e56e10

Browse files
DimitarCCHuevos
authored andcommitted
[Updated] Parental control handling
1 parent 9fe193b commit 2e56e10

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

lib/python/Components/Converter/ServiceName.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, type):
4040

4141
@cached
4242
def getText(self):
43-
service = self.source.service
43+
service = self.source.service or (hasattr(self.source, "serviceref") and self.source.serviceref)
4444
info = None
4545
if isinstance(service, eServiceReference):
4646
info = self.source.info

lib/python/Components/ParentalControl.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ def isServicePlayable(self, ref, callback, session=None):
122122
self.PinDlg = session.openWithCallback(boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=self.getPinList(), service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control"), simple=False)
123123
else:
124124
Tools.Notifications.AddNotificationParentalControl(boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=self.getPinList(), service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control"))
125+
import NavigationInstance
126+
if NavigationInstance.instance and NavigationInstance.instance.currentlyPlayingServiceReference:
127+
NavigationInstance.instance.stopService() # kill current service since we are on protected service and canceled the pin
125128
return False
126129
else:
127130
return True
@@ -189,7 +192,10 @@ def servicePinEntered(self, service, result=None):
189192
if result:
190193
self.setSessionPinCached()
191194
self.hideBlacklist()
192-
self.callback(ref=service)
195+
try:
196+
self.callback(ref=service, forceRestart=True)
197+
except:
198+
self.callback(ref=service)
193199
elif result is False:
194200
messageText = _("The pin code you entered is wrong.")
195201
if self.session:

lib/python/Components/Sources/EventInfo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class EventInfo(PerServiceBase, Source):
118118

119119
def __init__(self, navcore, now_or_next):
120120
self.now_or_next = now_or_next
121+
self.__service = None
121122
self.timer = eTimer()
122123
self.timer.callback.append(boundFunction(self.gotEvent, iPlayableService.evUpdatedEventInfo, True))
123124
Source.__init__(self)
@@ -129,7 +130,6 @@ def __init__(self, navcore, now_or_next):
129130
iPlayableService.evEnd: self.gotEvent
130131
}, with_event=True)
131132
self.epgQuery = eEPGCache.getInstance().lookupEventTime
132-
self.__service = None
133133

134134
@cached
135135
def getEvent(self):
@@ -156,7 +156,7 @@ def getEvent(self):
156156
def gotEvent(self, what, from_timer=False):
157157
self.timer.stop()
158158
print("[EventInfo] gotEvent, type:", ("'now'" if self.now_or_next == self.NOW else "'next'") + ",", "what:", "'%s'" % str({iPlayableService.evStart: "evStart", iPlayableService.evUpdatedInfo: "evUpdatedInfo", iPlayableService.evUpdatedEventInfo: "evUpdatedEventInfo", iPlayableService.evEnd: "evEnd"}.get(what, "Unknown")) + ",", "is timed repeat:", str(from_timer))
159-
if what == iPlayableService.evEnd:
159+
if what == iPlayableService.evEnd and not self.__service:
160160
self.changed((self.CHANGED_CLEAR,))
161161
else:
162162
self.changed((self.CHANGED_ALL,))

lib/python/Navigation.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,6 @@ def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust
133133
return 1
134134
print("[Navigation] playing ref", ref and ref.toString())
135135

136-
if "%3a//" in ref.toString():
137-
self.currentlyPlayingServiceReference = None
138-
self.currentlyPlayingService = None
139-
if current_service_source:
140-
current_service_source.newService(False)
141-
142136
self.currentlyPlayingServiceReference = ref
143137
self.currentlyPlayingServiceOrGroup = ref
144138
self.originalPlayingServiceReference = ref

lib/python/Screens/ChannelSelection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2594,7 +2594,7 @@ def saveChannel(self, ref):
25942594
refstr = ref.toString()
25952595
else:
25962596
refstr = ""
2597-
if refstr != self.lastservice.value and not Components.ParentalControl.parentalControl.isProtected(ref):
2597+
if refstr != self.lastservice.value:
25982598
self.lastservice.value = refstr
25992599
self.lastservice.save()
26002600

0 commit comments

Comments
 (0)