-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mod for IPTV autotimers #178
Closed
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,9 @@ def __init__(self): | |
True # Enabled | ||
) | ||
|
||
self.haveCachedServiceList = False | ||
self.cachedServiceList = [] | ||
|
||
# Configuration | ||
def readXml(self): | ||
# Abort if no config found | ||
|
@@ -305,7 +308,7 @@ def JobStart(self): | |
def parseTimer(self, timer, epgcache, serviceHandler, recordHandler, checkEvtLimit, evtLimit, timers, conflicting, similars, skipped, existing, timerdict, moviedict, simulateOnly=False): | ||
new = 0 | ||
modified = 0 | ||
|
||
# Precompute timer destination dir | ||
dest = timer.destination or config.usage.default_path.value | ||
|
||
|
@@ -406,12 +409,12 @@ def parseTimer(self, timer, epgcache, serviceHandler, recordHandler, checkEvtLim | |
for idx, ( serviceref, eit, name, begin, duration, shortdesc, extdesc ) in enumerate( epgmatches ): | ||
|
||
eserviceref = eServiceReference(serviceref) | ||
evt = epgcache.lookupEventId(eserviceref, eit) | ||
evt = epgcache.lookupEventId(eserviceref, eit) | ||
if not evt: | ||
msg="[AutoTimer] Could not create Event!" | ||
print(msg) | ||
skipped.append((name, begin, begin, str(serviceref), timer.name, msg)) | ||
continue | ||
continue | ||
# Try to determine real service (we always choose the last one) | ||
n = evt.getNumOfLinkageServices() | ||
if n > 0: | ||
|
@@ -455,7 +458,21 @@ def parseTimer(self, timer, epgcache, serviceHandler, recordHandler, checkEvtLim | |
|
||
# Check timer conditions | ||
# NOTE: similar matches do not care about the day/time they are on, so ignore them | ||
if timer.checkServices(serviceref) \ | ||
|
||
chkServices = timer.checkServices(serviceref) | ||
|
||
if str(timer).find("http") != -1: | ||
#print("[AutoTimerIPTVMod] Found http in timer!") | ||
# now replace serviceref with http one | ||
for service in timer.services: | ||
if str(service).find(serviceref) != -1: | ||
#print("[AutoTimerIPTVMod] Service matched (" + serviceref + ") (" + str(service) + ")") | ||
chkServices = False | ||
serviceref = str(service) | ||
#else: | ||
#print("[AutoTimerIPTVMod] Service not matched (" + serviceref + ") (" + str(service) + ")") | ||
|
||
if chkServices \ | ||
or timer.checkDuration(duration) \ | ||
or (not similarTimer and (\ | ||
timer.checkTimespan(timestamp) \ | ||
|
@@ -466,6 +483,14 @@ def parseTimer(self, timer, epgcache, serviceHandler, recordHandler, checkEvtLim | |
skipped.append((name, begin, end, serviceref, timer.name, msg)) | ||
continue | ||
|
||
if str(timer).find("http") != -1: | ||
#print("[AutoTimerIPTVMod] Geting full service name") | ||
#try to get full service from bouquet, incl name at end | ||
fullserviceref = self.getFullServiceRef(serviceref, serviceHandler) | ||
if fullserviceref != "": | ||
print("[AutoTimerIPTVMod] full service found (" + serviceref + ") (" + fullserviceref + ")") | ||
serviceref = fullserviceref | ||
|
||
if timer.hasOffset(): | ||
# Apply custom Offset | ||
begin, end = timer.applyOffset(begin, end) | ||
|
@@ -817,3 +842,51 @@ def checkDoubleTimers(self, timer, name1, name2, starttime1, starttime2, endtime | |
foundstart = starttime1 == starttime2 | ||
foundend = endtime1 == endtime2 | ||
return foundTitle and foundstart and foundend | ||
|
||
def getFullServiceRef(self, serviceref, serviceHandler): | ||
if not self.haveCachedServiceList: | ||
print("[AutoTimerIPTVMod] Getting full service list") | ||
# Get all bouquets | ||
bouquetlist = [] | ||
refstr = '1:134:1:0:0:0:0:0:0:0:FROM BOUQUET \"bouquets.tv\" ORDER BY bouquet' | ||
bouquetroot = eServiceReference(refstr) | ||
mask = eServiceReference.isDirectory | ||
if config.usage.multibouquet.value: | ||
bouquets = serviceHandler.list(bouquetroot) | ||
if bouquets: | ||
while True: | ||
s = bouquets.getNext() | ||
if not s.valid(): | ||
break | ||
if s.flags & mask: | ||
info = serviceHandler.info(s) | ||
if info: | ||
bouquetlist.append((info.getName(s), s)) | ||
else: | ||
info = serviceHandler.info(bouquetroot) | ||
if info: | ||
bouquetlist.append((info.getName(bouquetroot), bouquetroot)) | ||
|
||
# Get all services | ||
mask = (eServiceReference.isMarker | eServiceReference.isDirectory) | ||
for name, bouquet in bouquetlist: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get all services from bouquet can be like this. servicelist = ServiceList(eServiceReference(bRef)) |
||
if not bouquet.valid(): #check end of list | ||
break | ||
if bouquet.flags & eServiceReference.isDirectory: | ||
services = serviceHandler.list(bouquet) | ||
if not services is None: | ||
while True: | ||
service = services.getNext() | ||
if not service.valid(): #check end of list | ||
break | ||
if not (service.flags & mask): | ||
if service.toString().find("http") != -1: #only save http streams | ||
self.cachedServiceList.append( service.toString() ) | ||
self.haveCachedServiceList = True | ||
else: | ||
print("[AutoTimerIPTVMod] Using cached full service list") | ||
|
||
for service in self.cachedServiceList: | ||
if service.find(serviceref) != -1: | ||
return service | ||
return "" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get all bouquets is much easier:
serviceHandler = eServiceCenter.getInstance()
services = serviceHandler.list(eServiceReference('1:134:1:0:0:0:0:0:0:0:FROM BOUQUET "bouquets.tv" ORDER BY bouquet'))
bouquets = services and services.getContent("SN", True)