Skip to content

Commit

Permalink
Adds ability to specify serviceref type (#128)
Browse files Browse the repository at this point in the history
Adds ability to specify service ref types (ie 4097, 5001, etc) on a case-by-case basis for each stream added via custom mix file

All credit goes to @Huevos

Co-Authored-By: Huevos <huevos@users.noreply.github.com>
  • Loading branch information
bbbuk and Huevos committed Dec 1, 2019
1 parent 827984d commit 9fe1fea
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
17 changes: 17 additions & 0 deletions AutoBouquetsMaker/custom/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,23 @@ The name and service reference will be the same as the DVB service. This will al
</streams>
</custommix>


You can also give your stream a "service reference type". This allows you to tell the receiver which playback software to use for that individual stream.

In this example "servicereftype" has been added:

<custommix>
<streams>
<stream url="http://stream.source:port/live/username/F36/password/308.ts" target="118" servicereftype="4097" />
</streams>
</custommix>

The following is a list of currently valid "service reference types":
1 processed by the SoC (for when buffering is not required)
4097 processed by gstreamer via servicemp3
5001 processed by gstreamer via gst-player
5002 processed via extplayer3

You can also add streams into empty LCN slots. As these do not have a name from the DVB source, it has to be specified.
When inserting streams into empty LCN slots, the service reference will be "1:0:1:0:0:0:0:0:0:0:".
EPG will not work becuase of this.
Expand Down
5 changes: 3 additions & 2 deletions AutoBouquetsMaker/src/scanner/bouquetswriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def containServicesLines(self, path, filename):
bouquets = open(path + "/" + filename, "r")
content = bouquets.read().strip().split("\n")
bouquets.close()
recognised_service_lines = ["#SERVICE %d:0:" % i for i in (1,4097,5001,5002)] + ["#SERVICE 1:7:"]
recognised_service_lines = ["#SERVICE %d:0:" % i for i in Tools.SERVICEREF_ALLOWED_TYPES] + ["#SERVICE 1:7:"]
for line in content:
if "%s:" % ':'.join(line.split(":")[:2]) in recognised_service_lines: # service or iptv line found, eg "#SERVICE 4097:0:"
return True
Expand Down Expand Up @@ -891,7 +891,8 @@ def buildBouquets(self, path, provider_config, services, sections, section_ident
print>>log, "[ABM-BouquetsWriter] Done"

def bouquetServiceLine(self, service):
return "#SERVICE 1:0:%x:%x:%x:%x:%x:0:0:0:%s\n%s" % (
return "#SERVICE %d:0:%x:%x:%x:%x:%x:0:0:0:%s\n%s" % (
(service["servicereftype"] if "servicereftype" in service and service["servicereftype"] in Tools.SERVICEREF_ALLOWED_TYPES else 1),
service["service_type"],
service["service_id"],
service["transport_stream_id"],
Expand Down
7 changes: 6 additions & 1 deletion AutoBouquetsMaker/src/scanner/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from urllib import quote

class Tools():
SERVICEREF_ALLOWED_TYPES = [1, 4097, 5001, 5002]
def parseXML(self, filename):
try:
tool = open(filename, "r")
Expand Down Expand Up @@ -173,6 +174,7 @@ def customMix(self, services, section_identifier, providers, providerConfig):
url = ''
target = ''
name = ''
servicereftype = ''
for i in range(0, node2.attributes.length):
if node2.attributes.item(i).name == "name":
name = node2.attributes.item(i).value.encode("utf-8")
Expand All @@ -182,11 +184,14 @@ def customMix(self, services, section_identifier, providers, providerConfig):
url = quote(url) # single encode url
elif node2.attributes.item(i).name == "target":
target = int(node2.attributes.item(i).value)
elif node2.attributes.item(i).name == "servicereftype":
servicereftype = int(node2.attributes.item(i).value)
if url and target and target in customised["video"]: # must be a current service
customised["video"][target]["stream"] = url
elif name and url and target and target not in customised["video"]: # non existing service
customised["video"][target] = {'service_id': 0, 'transport_stream_id': 0, 'original_network_id': 0, 'namespace': 0, 'service_name': name, 'number': target, 'numbers': [target], 'free_ca': 0, 'service_type': 1, 'stream': url}

if servicereftype and servicereftype in self.SERVICEREF_ALLOWED_TYPES and target and target in customised["video"] and "stream" in customised["video"][target]: # if a stream was added above, a custom servicereftype may also be added
customised["video"][target]["servicereftype"] = servicereftype
elif node.tagName == "deletes":
for node2 in node.childNodes:
if node2.nodeType == node2.ELEMENT_NODE and node2.tagName == "delete":
Expand Down

0 comments on commit 9fe1fea

Please sign in to comment.