How to configure SPI (Service and Programme Information) for ODR-DabMux

From Opendigitalradio
(Difference between revisions)
Jump to: navigation, search
(How to install odr-radioepg-bridge on Debian Jessie)
 
m (Ubr moved page User:Ubr to How to install odr-radioepg-bridge in Debian Jessie: Was created without a title)

Revision as of 18:23, 12 July 2020

Howto by Ulrik Brinck on odr-radioepg-bridge installation on Debian Jessie

Contents

Introduction

This tool (or rather series of tools) will pick up your SPI (Service and Programme Information) from the internet via RadioDNS and generate a DAB EPG from it. It was written by Ben Poor and Nick Piggott. In this HowTo, I will describe how it can be installed on Debian Jessie. Some details might be slightly different on other Debian generations.

  • In this context, EPG and SPI is basically the same thing. While EPG (Electronic Programme Guide) is an old, but commonly well-known term, SPI (Service and Programme Information) is now the official name of this feature.

Notes

You must already have a working EPG (SPI) for hybrid radio via radioDNS, before you can use this tool.

I have assumed that you are logged in to your Linux system as a standard user and have sudo installed on your system. If sudo is not installed, you can see here, how to install it on Debian Jessie: https://www.geek17.com/en/content/debian-8-jessie-install-and-configure-sudo-25

Installation

Step 0: Update your system

Begin with "sudo apt-get update" to make sure that you can install all that you need.

Step 1: Miscellaneous dependencies

First there are some dependencies to install with apt-get:

sudo apt-get install python-crcmod
sudo apt-get install python-bitarray
sudo apt-get install python-isodate

Next there are some dependencies and subcomponents which must be downloaded from github and installed:

Step 2: python-dabmot

Download from here https://github.com/GlobalRadio/python-dabmot and unpack to a folder, e.g. /home/user/python-dabmot-master

Then navigate to the folder and run:

sudo python setup.py install

Step 3: python-mot-epg

Download from here https://github.com/GlobalRadio/python-mot-epg and unpack to a folder, e.g. /home/user/python-mot-epg-master

Then navigate to the folder and run:

sudo python setup.py install

Step 4: python-msc

Download from here https://github.com/nickpiggott/python-dabmsc and unpack to a folder, e.g. /home/user/python-dabmsc-master

Important: It MUST be this commit, NOT the original one from GlobalRadio from 2017 (thanks to Nick Piggott for help figuring out this).

Then navigate to the folder and run:

sudo apt-get install python-dateutil
sudo python setup.py install
sudo ln -s /home/user/python-dabmsc-master/bin/decode /usr/bin/decode

(If your folder is not /home/user/python-dabmsc-master, use your_path/bin/decode in the last command line above).

Step 5: odr-radiodns-bridge

Download from here https://github.com/nickpiggott/odr-radiodns-bridge and unpack to a folder, e.g. /home/user/odr-radiodns-bridge-master

Then navigate to the folder and run:

sudo apt-get install python-pip
sudo pip install hybridspi
sudo pip install pyradiodns

There is no setup.py file in this package, but you can create one yourself. Go to the /src subfolder (/home/user/odr-radiodns-bridge-master/src) and create a file, setup.py with this content:

from distutils.core import setup

setup(
    name='odr-radiodns-bridge',
    version='1.0',
    packages=['odr', 'odr.radiodns'],
    url='https://github.com/nickpiggott/odr-radiodns-bridge',
    license='GNU Lesser General Public License 2.1',
    author='Nick Piggott',
    author_email='nick@piggott.eu',
    description='Tools to bridge RadioDNS applications into the OpenDigitalRadio environment'
)

Then run:

sudo python setup.py install

Step 6: python-hybridspi

Download from here https://github.com/magicbadger/python-hybridspi and unpack to a folder, e.g. /home/user/python-hybridspi-master

Then navigate to the folder and run:

sudo python setup.py install

Step 7: odr-radioepg-bridge

And now for the RadioEPG-bridge itself.

Download from here https://github.com/nickpiggott/odr-radioepg-bridge and unpack to a folder, e.g. /home/user/odr-radioepg-bridge-master

Then run:

sudo ln -s /home/user/odr-radioepg-bridge-master/generate-epg /usr/bin/generate-epg

(If your folder is not /home/user/odr-radioepg-bridge-master, use your_path/generate-epg in the last command line above).

That's it. You should now be able to run this command and see a help text:

generate-epg -h

Generating and broadcasting your EPG

To be written....

Updating your EPG automatically every day

To be written....

Some problems and solutions

Local variable 'ecc' referenced before assignment

For some domains, lookup will cause the script to fail with error message "local variable 'ecc' referenced before assignment" if the domain has no _radiotag._tcp SRV record.

You can get around this by opening this file in a text editor:

/usr/local/lib/python2.7/dist-packages/pyradiodns/rdns.py

and remove or comment out line 13 "('radiotag', 'TCP'),".

If the domain is not using RadioVIS, you might also have to remove line 14 "('radiovis', 'TCP'),", but I haven't experienced this myself.

Note: When you modify this file, you might have to remove rdns.pyc in the same folder to make sure that your changes are being used.

Radio programmes listed on a wrong date

I have observed that radio programmes beginning before noon (or all programmes on some receivers) were listed on a wrong date, one day before the correct date. My solution was to modify line 428 in this file:

/usr/local/lib/python2.7/dist-packages/spi/binary/__init__py

Here, "(timepoint.hour - 12)" should be changed to "timepoint.hour", so that line 428 will be:

jd = jdn + timepoint.hour / 24 + timepoint.minute / 1440 + timepoint.second / 86400

This should fix the daystamp issue.

Note: When you modify this file, you might have to remove __init__.pyc in the same folder to make sure that your changes are being used.

Radio programmes listed with wrong timestamps if your time zone is not UTC

I have observed that if the time zone is not UTC, all radio programmes were listed with wrong times. My solution was to make some modifications to this file:

/usr/local/lib/python2.7/dist-packages/spi/binary/__init__py

After line 419 ("bits.setall(False)") I have added the following two lines:

offset = (timepoint.utcoffset().days * 86400 + timepoint.utcoffset().seconds) + (timepoint.dst().days * 86400 + timepoint.dst().days)
timepoint=timepoint - timedelta(seconds=offset)

(The first line is taken from line 457, from where it can then be removed)

And after line 28 ("import sys"), I have added this line:

from datetime import timedelta

This should fix the timestamp issue.

Note: When you modify this file, you might have to remove __init__.pyc in the same folder to make sure that your changes are being used.

Other observations

  • According to specs, logo slides in DAB EPG must be PNG. Although JPG is allowed in hybrid radio SPI, JPG logos will not be added to your DAB EPG. Be sure that your logos (up to 320x240) are PNG.
  • Programme descriptions (shortDescription) seem to be processed but not shown. Perhaps we will have to look a little further into this.
Personal tools