Usage ‐ PLM ‐ Manage Playlists ‐ Child Station Mappings - babsonnexus/stream-link-manager-for-channels GitHub Wiki
There may be occasions when users need some automated solutions to deal with the large amount of potentially loaded child stations. For instance, perhaps a user wants a child station to be always set to a specific parent or Ignore
if it contains a certain value in its name. Or there might be other situations where the URL needs to be corrected because it is not coming from the source in an expected way. With these situations and plenty more, there is the Child Station Mappings
feature found in Manage Playlists
.
Here you can create a set of rules that match your specific needs. First, you must give your rule a name, otherwise the Add
and Save
buttons remain disabled until you do so. Uniqueness of names is not enforced, but will most likely make life confusing for you if you choose to name things the same. After giving a rule a required name, you can then put in the source information to examine:
-
The source playlist to check against, either all of them or a single specific one.
-
The field to check within that playlist, again either all of them or a specific one.
-
How you want to check that field, meaning either equal to, contains, begins with, ends with, has a REGEX pattern, or the opposite ("not") of each of those.
-
The value to use that check with. As an example, you might want to verify if the
Station Name
|Contains
|"Baseball"
. Leaving this blank is fine as it will be interpreted as no value. This can be used in reverse, too, where something likeCategories
|Not Equals
|""
would be seen as "Categories are not empty". Please note that this is case sensitive.
With this information to test for, you can then set what you want to happen if the conditions are met:
-
You can choose to change a single field's value. This can be the source field (i.e., if the source field is
Station Logo
, so, too, will be the changed field), any other field, or no field at all if you only want to use this for a parent assignment and/or stream format override. -
If you are changing a field, you can choose what you want to do by either replacing, appending, or prepending the value in that field. With a positive test (i.e., equals, contains, etc...), you can either choose to replace the matching string or the entire field's contents. Should you be replacing a string with a REGEX pattern match, you can also use a REGEX pattern for the target replacement. Otherwise, putting in a REGEX pattern in a non-REGEX text will treat those values as literal. Conversely, with a negative test (i.e., not equals, does not contain, etc...), you can only replace the entire field's contents. The
Add
andSave
buttons are disabled when you have an incorrect combination selected. -
The value you want to change the string or field to. Once more, leaving this blank is okay as it would set the string/field to be nothing, thus removing whatever came from the source playlist.
-
Next, as referred to above, you can set the parent station. This can be any existing station, setting it to be
Ignore
, making it into a parent itself, or just left atManual Assignment
if you do not want the rule to set the parent. Should you selectMake Parent
, it will only create a new parent if the child station isUnassigned
; once it has a parent assignment, no new parent will be created again. -
Finally, as also referred to above, you can set a stream format override for the individual station or leave this as the default
None
and accept the stream format of the playlist itself or whatever you have manually selected. In other words, if the mapping is set toNone
, but you have manually set the stream format override, that manual selection will be retained. However, if you choose a format here in the mapping, it will override any manually set value orNone
.
These mapping rules execute as the last step in the Update Station List process, directly changing the details of the child stations each time. Because order matters, you have the ability to set the priority:
The tests will then run in order, allowing you to make one change then another in succession, almost like a nested statement. In other words, you can make one modification and then test that modification in order to do another action. It is up to you to decide the best order for you actions. As these things happen, notifications will be added to let you know about the mappings:
MAPPED: BBC Home & Garden on Test Playlist B [plex-bbc-home-and-garden]
MAPPED: BBC Sci-Fi on Test Playlist B [plex-bbc-sci-fi]
MAPPED: BBC Travel on Test Playlist B [plex-bbc-travel]
It should be noted that the next time stations are updated, these same children will give a notification of an update even if nothing has changed because they return to baseline before being mapped again. On a similar note, only Active
mapping rules are available for prioritization and, thus, being able to be run. Another way that a rule might become inactive is if a source playlist is assigned, but then that source playlist is deleted.
As can be seen, not only did the rule become inactive, but its source playlist turned into a warning. The same is true if you delete a parent station that is used:
Even if you make these active, though, the rule will not run so long as these "warning" values remain in place.
To further illustrate how this might work, let's look at some examples...
Example #1: Auto-Ignore, Auto-Set Parent, Auto-Make Parent, Modify/Remove Strings in Title, Create Description Based on Title, Change Stream Format Based on Title
Say we have a starting point like this:
This reflects a one-time load of the source playlists and making/assigning one parent manually. This leaves our unassigned child stations looking like this:
Now, we'll create some rules:
In these rules, we are saying several things, some of them overlapping. Due to this, priority will matter:
As an overview, in this particular example, what we'll be looking to do is...
- Any station that has been marked as "SD" will be set to
Ignore
. - Any station that has a "ñ" or other identifying marks as being Spanish language will be set to
Ignore
. - Any station that begins with "BET " will be set to
Ignore
. That space is particularly important because another station could still begin with those letters but be something else. - Any station that contains "Bloomberg TV" is assigned to the pre-existing parent of the same name.
- Based upon what remains, if " HD" can be found in the title, that is removed. Note the space again to make sure we are getting all the expected string taken off.
- Some daily games with "vs." or " @ " in the
Title
should be made a new parent so they are created without any manual intervention. They are also given a description of "Game of the Day" and have their stream format overridden toMPEG-TS
from the playlist's default ofHLS
. - Through a waterfall of tests, check for various iterations of feed names, remove that text, and make those stations parents. It is worth again highlighting that case matters, so "Eastern Feed" is not the same as "Eastern feed", thus requiring both.
Now, when the rules run, the final output will look like this:
As such, this is exactly what you'll see in the PLM created m3u's and final consumption tools like Channels DVR.
Example #2: Auto-mapping MPEG-DASH Media Presentation Description (MPD)
Playlist Manager has the ability to convert MPEG-DASH Media Presentation Description (MPD) live streams into the MPEG-TS format that can be consumed by programs like Channels DVR. While there are already options to use a manual method or an internally managed option, sometimes these MPD streams are inside hosted m3u's. In these situations, we can combine the knowledge of the manual method with Child Station Mappings
.
What is done here is:
-
If it is the playlist we know has a MPD in it (it could run on all playlists, this was just for testing)...
-
And if the
URL
contains.mpd
... -
Then prepend the same field (
URL
) withhttp://host.docker.internal:5000/playlists/streams/stream_mpegts?url=
, which in this case is the "manual method" base link. -
Then also set the
Stream Format Override
toMPEG-TS
so it will be that no matter what the source playlist is set to. (NOTE: The sample also uses theMake Parent
function, but this was only done for testing purposes and is not necessary.)
The result is although the originally imported m3u looked like this...
...the resulting PLM m3u ended up having this:
With that, once loaded into something like Channels DVR, it plays exactly as expected: