Skip to content

Commit

Permalink
[CustomMix] replace unavailable services with streams
Browse files Browse the repository at this point in the history
  • Loading branch information
Huevos committed Dec 9, 2017
1 parent 30abc38 commit 8710cd4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
36 changes: 33 additions & 3 deletions AutoBouquetsMaker/custom/README.txt
Expand Up @@ -214,9 +214,22 @@ bouquets. The "insert" lines have 3 attributes, "provider", "source", and "targe
key of provider from which the channel is being imported. See below for a list of provider keys. "source"
is the channel number being imported. And "target" is the slot in the favourites into which that channel
will be inserted. Each channel that is to be moved requires an "insert" line.
"main" has a value of 0 or 1. "0" means no main bouquet will be created and "1" that one will. Same for
"sections". If "bouquets" -> "sections" is enabled the favourites list will be divided up into sections
bouquets as per the section numbers above. All tags in the above example a necessary to get this working.

"bouquets" -> "main" has a value of 0 or 1. "0" means no main bouquet will be created and "1" that one
will. Same for "bouquets" -> "sections". If "bouquets" -> "sections" is enabled the favourites list will
be divided up into sections bouquets as per the section numbers above.

All tags in the above example are necessary to get this working.

By default the favourites bouquet preceeds all other ABM bouquets, but it is also possible to place it after
another provider. Use a placement tag to do this and just add the number of the provider you want it to follow.

<favourites>
<!-- default fields go here as in above example -->
<placement>2</placement>
</favourites>




----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -245,6 +258,23 @@ for this feature.

----------------------------------------------------------------------------------------------

Streams
-------

"Streams" is available in "CustomMix". Sometimes a channel may not be available to you, e.g. you might
be outside the satellite footprint, but you can access it via a stream. In these cases use a "stream"
tag. Streams can only be attached to channels that actully exist in your bouquet (otherwise the EPG
would not work). You cannot attach streams to empty slots. "url" may be an encoded or non encoded url.
"Target" is the number of the channel you wish to attach the url stream to.

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

----------------------------------------------------------------------------------------------

Provider keys
-------------

Expand Down
3 changes: 2 additions & 1 deletion AutoBouquetsMaker/src/scanner/bouquetswriter.py
Expand Up @@ -926,12 +926,13 @@ 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:\n%s" % (
return "#SERVICE 1:0:%x:%x:%x:%x:%x:0:0:0:%s\n%s" % (
service["service_type"],
service["service_id"],
service["transport_stream_id"],
service["original_network_id"],
service["namespace"],
(("%s:%s" % (service["stream"], self.utf8_convert(service["service_name"]))) if "stream" in service else ""),
(("#DESCRIPTION %s\n" % self.utf8_convert(service["interactive_name"])) if "interactive_name" in service else "")
)

Expand Down
20 changes: 20 additions & 0 deletions AutoBouquetsMaker/src/scanner/tools.py
Expand Up @@ -3,6 +3,7 @@
import xml.dom.minidom
from Components.config import config
from dvbscanner import DvbScanner
from urllib import quote, unquote

class Tools():
def parseXML(self, filename):
Expand Down Expand Up @@ -163,6 +164,25 @@ def customMix(self, services, section_identifier, providers, providerConfig):
if provider and source and target and provider in services and source in services[provider]["video"]:
customised["video"][target] = services[provider]["video"][source]

# experimental, to replace unavailable services with streams
elif node.tagName == "streams":
for node2 in node.childNodes:
if node2.nodeType == node2.ELEMENT_NODE and node2.tagName == "stream":
url = ''
target = ''
for i in range(0, node2.attributes.length):
if node2.attributes.item(i).name == "url":
url = node2.attributes.item(i).value.encode("utf-8")
breakout = 10 # break loop if something goes wrong
while breakout > 0 and "%" in url[:10]: # remove multi url encoding if present
url = unquote(url)
breakout -= 1
url = quote(url) # single encode url
elif node2.attributes.item(i).name == "target":
target = 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 node.tagName == "deletes":
for node2 in node.childNodes:
if node2.nodeType == node2.ELEMENT_NODE and node2.tagName == "delete":
Expand Down

0 comments on commit 8710cd4

Please sign in to comment.