Skip to content

Repository files navigation

dvb-i-tools

Pauls DVB Tools

csr.js - a DVB-I CSR / SLR

Description

This server application implements a Service List Registry as defined by the DVB-I Service Discovery and Content Metadata specification - A177r6 in clause 5.1.3.2.

The application works by reading in a reference/master XML document and then pruning out any provider and service offerings that do not match the specified query parameters. Per A177r2, the allowed query parameters added to the /query are

  • TargetCountry
  • regulatorListFlag
  • Delivery
  • Language
  • Genre
  • ProviderName
  • inlineImages default is "false"

These parameter names are case sensitive and the comparisons made with their values are also case sensitive against the master Service List Entry Points Registy (SLEPR)

Note that these values are case sensitive, and a case sensitive matching is performed with the values, thus "AUT" != "aut"

Installation

  1. Clone this repository git clone https://github.com/paulhiggs/dvb-i-tools.git
  2. Install necessary libraries (express, libxmljs, morgan) npm install

Operation

  1. Edit the Service List Entry Point Registry XML document (slepr-master.xml) as needed
  2. run it - node csr.js [--port 3000] [--sport 3001] [--file ./slepr-master.xml] [--CORSmode library]

The server can be reloaded with an updated slepr-master.xml file by invoking it with /reload, i.e. http://localhost:3000/reload

Server arguments

  • --port [-p] <port> set the HTTP listening port (default: 3000)
  • --sport [-s] <port> set the HTTPS listening port (default: 3001)
  • --urls [-u] load configation from network locations (default: use local files)
  • --CSRfile [-f] <filename> name of the registry file to use, can be an http(s) URL (default: ./registries/slepr-main.xml)
  • --CORSmode [-c] <mode> select the type of CORS handling
    • "library" - default mode - use the Express CORS library
    • "manual" - do code based CORS header insertion (not fully implemented or tested)
    • "none" - dont do any CORS handling
  • --workers [-w] <number> the number of worker threads (constrained interally to 1~num CPUs)
  • --SLRmode <mode> select the type of processing for the SLR response
    • "default" - default mode - according to A177 specification
    • "italy" - process the SLR response accirding to Italian method
  • --help [-h] server and client command help

If you want to start an HTTPS server, make sure you have selfsigned.crt and selfsigned.key files in the same directory. These can be generated (on Linux) with sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./selfsigned.key -out selfsigned.crt

all-in-one.js

Implements csr.js, validate_cg.js and validate_sl.js in a single node

Description

Validates the syntax and semantic value space of DVB-I service list registry, service list, playlist and content guide metadata according to DVB Bluebook A177

Supported A177 revisions

Installation

node.js

  1. Clone this repository git clone https://github.com/paulhiggs/dvb-i-tools.git
  2. Install necessary libraries (express, libxmljs, morgan) npm install
  3. run it - node all-in-one [--urls] [--port 3030] [--sport 3031]

If you want to start an HTTPS server, make sure you have selfsigned.crt and selfsigned.key files in the same directory. These can be generated (on Linux) with sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./selfsigned.key -out selfsigned.crt

Occassionally, the language-subtag-registry file can be updated from https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

Docker

  1. Clone this repository git clone https://github.com/paulhiggs/dvb-i-tools.git
  2. run it - docker compose up

Command Line Arguments

  • --urls [-u] forces the classification scheme, country and language values to be read from the internet. Default is to load values from local files.
  • --port [-p] <port> set the HTTP listening port (default: 3030)
  • --sport [-s] <port> set the HTTPS listening port (default: 3031)
  • --motd [-m] <filename> file to read for Message of the Day (default: motd.html)
  • --nocsr flag to disable SLR operation (default: false)
  • --nocg flag to disable Content Guide validation (default: false)
  • --nosl flag to disable Service List validation (default: false)
  • --nopl flag to disable Playlist validation (default: false)
  • --noslr flag to disable Service List Registry validation (default: false)
  • --CORSmode [-c] <mode> select the type of CORS handling
    • "library" - default mode - use the Express CORS library
    • "manual" - do code based CORS header insertion (not fully implemented or tested)
    • "none" - dont do any CORS handling
  • --CSRfile [-f] <filename> file to use for SLR responses (default: ./registries/slepr-main.xml)
  • --SLRmode <mode> select the type of processing for the SLR response
    • "default" - default mode - according to A177 specification
  • --help [-h] server and client command help

Use

<server>/check gives a basic/primitive UI. Select the valildation type (service list or Content Guide) and provide either a URL or local file. Press "Validate!" button. Await results!

Service list validation endpoints

<server>/validate_sl?url=<service_list_url> gives the validation results of the service list in the "url"-parameter as HTML, same format as the /check validation. Also accepts POST request with the servicelist in the request body with content type "application/xml". The url query parameter in the POST request can be used to show the name of the list in the resulting HTML

<server>/validate_sl_json?url=<service_list_url>; validates the list in the "url"-parameter and gives the number of errors, warnings and informationals as JSON. Also accepts POST request with the servicelist in the request body with content type "application/xml" instead of the url query parameter. Example response:

{
	"errors": 1,
	"warnings": 0,
	"informationals": 0
}

<server>/validate_sl_json?url=<service_list_url>&results=all valdiates the list "url"-parameter and gives the complete validation results as JSON. Also accepts POST request with the servicelist in the request body with content type "application/xml" instead of the url query parameter. Example response:

{
	"errs": {
		"countsErr": [],
		"countsWarn": [],
		"countsInfo": [],
		"errors": [
			{
				"code": "SL005:6",
				"message": "Error: Element '{urn:dvb:metadata:servicediscovery:2024}Service': Missing child element(s). Expected is one of ( {urn:dvb:metadata:servicediscovery:2024}ServiceName, {urn:dvb:metadata:servicediscovery:2024}ProviderName ).\n",
				"element": "    <Service version=\"1\">",
				"line": 3
			}
		],
		"warnings": [],
		"informationals": [],
		"markupXML": [
			{ "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "ix": 1 },
			{
				"value": "<ServiceList xmlns=\"urn:dvb:metadata:servicediscovery:2024\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema‑instance\" id=\"tag:example.com,2024:list1\" version=\"20240611115822\" xml:lang=\"en\">",
				"ix": 2
			},
			{ "value": "  <Name>List</Name>", "ix": 3 },
			{ "value": "  <ProviderName>Provider</ProviderName>", "ix": 4 },
			{
				"value": "  <Service version=\"1\">",
				"ix": 5,
				"validationErrors": [
					"(E) SL005:6: Error: Element '{urn:dvb:metadata:servicediscovery:2024}Service': Missing child element(s). Expected is one of ( {urn:dvb:metadata:servicediscovery:2024}ServiceName, {urn:dvb:metadata:servicediscovery:2024}ProviderName ).\n"
				]
			},
			{ "value": "   <UniqueIdentifier>tag:example.com,2024:ch1</UniqueIdentifier>", "ix": 6 },
			{ "value": "   <ServiceName>Service</ServiceName>", "ix": 7 },
			{ "value": " </Service>", "ix": 8 },
			{ "value": "</ServiceList>", "ix": 9 }
		],
		"errorDescriptions": []
	}
}

Content guide validation endpoints

Type-parameter for all content guide validation requests is one of the following:

  • Schedule Info (time stamp): Time
  • Schedule Info (now/next): NowNext
  • Schedule Info (window): Window
  • Program Info: ProgInfo
  • More Episodes: MoreEpisodes
  • Box Set Categories: bsCategories
  • Box Set Lists: bsLists
  • Box Set Contents: bsContents

<server>/validate_cg?url=<content_guide_url>&type=<type> gives the validation results of the content guide data in the "url"-parameter as HTML, same format as the /check validation. Also accepts POST request with the content guide data in the request body with content type "application/xml". The url query parameter in the POST request can be used to show the name of the list in the resulting HTML

<server>/validate_gc_json?url=<content_guide_url>&type=<type> validates the content guide data in the "url"-parameter and gives the number of errors, warnings and informationals as JSON. Also accepts POST request with the content guide fragment in the request body with content type "application/xml" instead of the url query parameter. The response is in the same format as <server>/validate_sl__json?url=<service_list_url> request

<server>/validate_cg_json?url=<content_guide_url>&results=all&type=<type> validates the content guide document in "url"-parameter and gives the complete validation results as JSON. Also accepts POST request with the content guide fragment in the request body with content type "application/xml" instead of the url query parameter. The response is in the same format as <server>/validate_sl_json?url=<service_list_url>&results=all request

accepted valies for <type>

  • Time - Content guide fragment represents a Timestamp Filtered Schedule response according to DVB A177 clause 6.5.4.3.1
  • NowNext - Content guide fragment represents a Now/Next Filtered Schedule response according to DVB A177 clause 6.5.4.3.2
  • Window - Content guide fragment represents a Now/Next (window) Filtered Schedule response according to DVB A177 clause 6.5.4.3.3
  • ProgInfo - Content guide fragment contains a Detailed Program Information response according to DVD A177 clause 6.6.3
  • MoreEpisodes - Content guide fragment contains a More episodes response according to DVB A177 clause 6.7.3
  • bsCategories - Content guide fragment contains a Box Set Categories response according to DVB A177 clause 6.8.2.3
  • bsLists - Content guide fragment contains a Box Set Lists response according to DVB A177 clause 6.8.3.3
  • bsContents - Content guide fragment contains a Box Set Contents response according to DVB A177 clause 6.8.3.3

Copyright (c) 2021-2026, Paul Higgs
All rights reserved

About

No description or website provided.

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages