Skip to content
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

[Added] handling of IPTV services properly #668

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions autotimer/src/AutoTimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ def readXml(self, **kwargs):
# Parse Config
try:
configuration = cet_parse(XML_CONFIG).getroot()
except:
except Exception as error:
print("An exception occurred:", error)
try:
if os_path.exists(XML_CONFIG + "_old"):
os_rename(XML_CONFIG + "_old", XML_CONFIG + "_old(1)")
Expand Down Expand Up @@ -365,7 +366,7 @@ def parseTimer(self, timer, epgcache, serviceHandler, recordHandler, checkEvtLim
except UnicodeDecodeError:
pass

self.isIPTV = bool([service for service in timer.services if ":http" in service])
self.isIPTV = bool([service for service in timer.services if "%3a//" in service])

# As well as description, also allow timers on individual IPTV streams
if timer.searchType == "description" or self.isIPTV:
Expand Down
40 changes: 20 additions & 20 deletions autotimer/src/AutoTimerComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,11 @@ def checkServices(self, check_service):
if s.valid():
# strip all after last :
value = s.toString()
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]
#pos = value.rfind(':')
#if pos != -1:
# if value[pos - 1] == ':':
# pos -= 1
# value = value[:pos + 1]

if value == check_service:
return False
Expand Down Expand Up @@ -477,11 +477,11 @@ def getAlternative(self, override_service):
if s.valid():
# strip all after last :
value = s.toString()
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]
#pos = value.rfind(':')
#if pos != -1:
# if value[pos - 1] == ':':
# pos -= 1
# value = value[:pos + 1]

if value == override_service:
return service
Expand Down Expand Up @@ -691,11 +691,11 @@ def getFastServices(self):
if s.valid():
# strip all after last :
value = s.toString()
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]
#pos = value.rfind(':')
#if pos != -1:
# if value[pos - 1] == ':':
# pos -= 1
# value = value[:pos + 1]

comp = value.split(':')
append(':'.join(value[3:]))
Expand Down Expand Up @@ -730,11 +730,11 @@ def getAlternative(self, override_service):
if s.valid():
# strip all after last :
value = s.toString()
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]
#pos = value.rfind(':')
#if pos != -1:
# if value[pos - 1] == ':':
# pos -= 1
# value = value[:pos + 1]

if ':'.join(value.split(':')[3:]) == override:
return service
Expand Down
36 changes: 18 additions & 18 deletions autotimer/src/AutoTimerConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ def parseEntry(element, baseTimer, defaults=False):
for service in l:
value = service.text
if value:
myref = eServiceReference(str(value))
if not (myref.flags & eServiceReference.isGroup):
# strip all after last :
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]
#myref = eServiceReference(str(value))
#if not (myref.flags & eServiceReference.isGroup):
# # strip all after last :
# pos = value.rfind(':')
# if pos != -1:
# if value[pos - 1] == ':':
# pos -= 1
# value = value[:pos + 1]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong!

servicelist.append(value)
baseTimer.services = servicelist
Expand Down Expand Up @@ -369,14 +369,14 @@ def parseConfigOld(configuration, list, uniqueTimerId=0):
for service in elements:
value = service.text
if value:
myref = eServiceReference(str(value))
if not (myref.flags & eServiceReference.isGroup):
# strip all after last :
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]
#myref = eServiceReference(str(value))
#if not (myref.flags & eServiceReference.isGroup):
# # strip all after last :
# pos = value.rfind(':')
# if pos != -1:
# if value[pos - 1] == ':':
# pos -= 1
# value = value[:pos + 1]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also wrong

servicelist.append(value)
else:
Expand Down Expand Up @@ -628,7 +628,7 @@ def buildConfig(defaultTimer, timers, webif=False):
# Services
for serviceref in defaultTimer.services:
ref = ServiceReference(str(serviceref))
extend((' <serviceref>', serviceref, '</serviceref>',
extend((' <serviceref>', serviceref.replace("&", "&amp;"), '</serviceref>',
' <!-- ', stringToXML(removeBad(ref.getServiceName())), ' -->\n',
))

Expand Down Expand Up @@ -785,7 +785,7 @@ def buildConfig(defaultTimer, timers, webif=False):
# Services
for serviceref in timer.services:
ref = ServiceReference(str(serviceref))
extend((' <serviceref>', serviceref, '</serviceref>',
extend((' <serviceref>', serviceref.replace("&", "&amp;"), '</serviceref>',
' <!-- ', stringToXML(removeBad(ref.getServiceName())), ' -->\n',
))

Expand Down
48 changes: 24 additions & 24 deletions autotimer/src/AutoTimerEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1536,13 +1536,13 @@ def finishedServiceSelection(self, *args):
list = self["config"].getList()
sname = args[0].toString()

if self.typeSelection.value == "channels" and not (args[0].flags & eServiceReference.isGroup):
#if self.typeSelection.value == "channels" and not (args[0].flags & eServiceReference.isGroup):
# strip all after last : when adding a (non alternative) channel
pos = sname.rfind(':')
if pos != -1:
if sname[pos - 1] == ':':
pos -= 1
sname = sname[:pos + 1]
#pos = sname.rfind(':')
#if pos != -1:
# if sname[pos - 1] == ':':
# pos -= 1
# sname = sname[:pos + 1]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wrong.

list.append(getConfigListEntry(_("Record on"), NoSave(ConfigSelection(choices=[(sname, ServiceReference(args[0]).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))]))))
self["config"].setList(list)
Expand Down Expand Up @@ -1612,13 +1612,13 @@ def addAutotimerFromEvent(session, evt=None, service=None):
if service is not None:
service = str(service)
myref = eServiceReference(service)
if not (myref.flags & eServiceReference.isGroup):
#if not (myref.flags & eServiceReference.isGroup):
# strip all after last :
pos = service.rfind(':')
if pos != -1:
if service[pos - 1] == ':':
pos -= 1
service = service[:pos + 1]
#pos = service.rfind(':')
#if pos != -1:
# if service[pos - 1] == ':':
# pos -= 1
# service = service[:pos + 1]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also wrong

sref = ServiceReference(myref)
if evt:
Expand Down Expand Up @@ -1704,11 +1704,11 @@ def addAutotimerFromService(session, service=None):
sref = info and info.getInfoString(service, iServiceInformation.sServiceref)
if sref:
# strip all after last :
pos = sref.rfind(':')
if pos != -1:
if sref[pos - 1] == ':':
pos -= 1
sref = sref[:pos + 1]
#pos = sref.rfind(':')
#if pos != -1:
# if sref[pos - 1] == ':':
# pos -= 1
# sref = sref[:pos + 1]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use toCompareString() instead

sref = ServiceReference(sref)
if info:
Expand Down Expand Up @@ -1781,13 +1781,13 @@ def addAutotimerFromEventSilent(session, evt=None, service=None):
if service is not None:
service = str(service)
myref = eServiceReference(service)
if not (myref.flags & eServiceReference.isGroup):
# strip all after last :
pos = service.rfind(':')
if pos != -1:
if service[pos - 1] == ':':
pos -= 1
service = service[:pos + 1]
#if not (myref.flags & eServiceReference.isGroup):
# # strip all after last :
# pos = service.rfind(':')
# if pos != -1:
# if service[pos - 1] == ':':
# pos -= 1
# service = service[:pos + 1]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also wrong

if evt:
# timespan defaults to +- 1h
Expand Down
28 changes: 14 additions & 14 deletions autotimer/src/AutoTimerImporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,13 @@ def accept(self):
value = item[1]

myref = eServiceReference(value)
if not (myref.flags & eServiceReference.isGroup):
# strip all after last :
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]
#if not (myref.flags & eServiceReference.isGroup):
# # strip all after last :
# pos = value.rfind(':')
# if pos != -1:
# if value[pos - 1] == ':':
# pos -= 1
# value = value[:pos + 1]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also wrong

autotimer.services = [value]
elif item[2] == 4: # AfterEvent
Expand All @@ -337,13 +337,13 @@ def accept(self):
if self.isIPTV:
value = str(self.sref)
myref = eServiceReference(value)
if not (myref.flags & eServiceReference.isGroup):
# strip all after last :
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]
#if not (myref.flags & eServiceReference.isGroup):
# # strip all after last :
# pos = value.rfind(':')
# if pos != -1:
# if value[pos - 1] == ':':
# pos -= 1
# value = value[:pos + 1]
autotimer.services = [value]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also wrong


if autotimer.match == "":
Expand Down
14 changes: 7 additions & 7 deletions autotimer/src/AutoTimerResource.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,13 @@ def getA(name, default=None):
appendlist = []
for value in servicelist:
myref = eServiceReference(str(value))
if not (myref.flags & eServiceReference.isGroup):
# strip all after last :
pos = value.rfind(':')
if pos != -1:
if value[pos - 1] == ':':
pos -= 1
value = value[:pos + 1]
#if not (myref.flags & eServiceReference.isGroup):
# # strip all after last :
# pos = value.rfind(':')
# if pos != -1:
# if value[pos - 1] == ':':
# pos -= 1
# value = value[:pos + 1]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also wrong

if myref.valid():
appendlist.append(value)
Expand Down