Common Python library for BBC reference implementations of NMOS APIs.
This library provides common components required by NMOS API implementations. Additionally, it provides SDK components for interacting with the nmos-node, nmos-registration and nmos-query implementations.
- Linux (untested on Windows and Mac)
- Python 2.7 or 3.3+
- Python Pip
# Install Python setuptools
$ pip install setuptools
# Install the library
$ sudo python setup.py install
The following code snippet demonstrates registering a service and its resources with the Node API.
from nmoscommon.facade import Facade
# Initialise service name to use for Node API interactions
nodeapi = Facade("myservice/v1.0")
# Register the service with the Node API including its own API endpoint
nodeapi.register_service("http://127.0.0.1", "myservice/v1.0")
# Heartbeat with the Node API - You'll need to call this every 5 seconds from another thread
nodeapi.heartbeat_service()
# Register your resources with the Node API
nodeapi.addResource("device", "my-device-uuid", "my-device-json-here")
The following components are deprecated and are maintained here as a compatibility interface to alternative underlying libraries. New code should make direct use of the underlying libraries as opposed to the classes and functions provided here.
- json.py: Now provided by 'mediajson'
- ptptime.py: Now provided by 'mediatimestamp'
- timestamp.py: Now provided by 'mediatimestamp'
This library makes use of the underlying 'mediatimestamp' library, which may be used to get the current TAI time. The system will provide the time in UTC. As TAI does not account for leap seconds it maintains an offset from UTC that changes every time a leap second occurs1. The library contains a table of leap seconds, which is up to date as of the end of 2017. Users of this library should ensure this table is up to date by checking with the IERS who are responsible for the scheduling of leap seconds and publish decisions in their Bulletin C.
When this library is used on a system where the BBC R&D internal pyipputils is installed the following libraries will automatically revert to using their pyipputils equivalents to ensure correct behaviour in house. These are:
- logger.py Uses pyipputils IppLogger class instead so that underlying C logging libraries are still used in order to maintain a single log file for all of IP Studio.
# Run the tests
$ make test
# Debian packaging
$ make deb
# RPM packaging
$ make rpm
We use Semantic Versioning for this repository
See CHANGELOG.md
See CONTRIBUTING.md
Please ensure you have run the test suite before submitting a Pull Request, and include a version bump in line with our Versioning policy.
See LICENSE.md