Skip to main content

DAB+ now playing PAD (DLS+ generator)

Project description

nowplaypadgen

DAB+ now playing PAD (DLS+ and MOT SLS) generator

Usage

DL+

You can use this to generate some DLPlus Tags.

>>> from nowplaypadgen.dlplus import *
>>> message = DLPlusMessage()
>>> message.add_dlp_object(DLPlusObject("STATIONNAME.LONG", "Radio Bern RaBe"))
>>> message.add_dlp_object(DLPlusObject("STATIONNAME.SHORT", "RaBe"))
>>> message.add_dlp_object(DLPlusObject("ITEM.TITLE", "Radio Bern"))
>>> message.build("$STATIONNAME.LONG")
>>> message.message
'Radio Bern RaBe'
>>> tags = message.get_dlp_tags()
>>> long = tags['STATIONNAME.LONG']
>>> f"{long}: {long.code} {long.start} {long.length}"
'STATIONNAME.LONG: 32 0 15'
>>> short = tags['STATIONNAME.SHORT']
>>> f"{short}: {short.code} {short.start} {short.length}"
'STATIONNAME.SHORT: 31 11 4'
>>> title = tags['ITEM.TITLE']
>>> f"{title}: {title.code} {title.start} {title.length}"
'ITEM.TITLE: 1 0 10'

Later on you might want to generate DL+ that deletes an item tag.

>>> message = DLPlusMessage()
>>> message.add_dlp_object(DLPlusObject("STATIONNAME.LONG", "Radio Bern RaBe"))
>>> message.add_dlp_object(DLPlusObject("ITEM.TITLE", delete=True))
>>> message.build("$STATIONNAME.LONG")
>>> message.message
'Radio Bern RaBe'
>>> tags = message.get_dlp_tags()
>>> title = tags['ITEM.TITLE']
>>> f"{title}: {title.code} {title.start} {title.length}"
'ITEM.TITLE: 1 5 0'

Finally, you can render it as an ODR-PadEnc style string.

>>> from nowplaypadgen.dlplus import *
>>> message = DLPlusMessage()
>>> message.add_dlp_object(DLPlusObject("ITEM.TITLE", "Radio Bern"))
>>> message.add_dlp_object(DLPlusObject("STATIONNAME.SHORT", "RaBe"))
>>> message.add_dlp_object(DLPlusObject("STATIONNAME.LONG", "Radio Bern RaBe"))
>>> message.build("$STATIONNAME.LONG")
>>> from nowplaypadgen.renderer.odr import ODRPadEncRenderer
>>> renderer = ODRPadEncRenderer(message)

This will generate the following ODR-PadEnc style DLS string when rendered with print(renderer):

##### parameters { #####
DL_PLUS=1
DL_PLUS_TAG=1 0 10
DL_PLUS_TAG=31 11 4
DL_PLUS_TAG=32 0 15
##### parameters } #####
Radio Bern RaBe

Release Management

The CI/CD setup uses semantic commit messages following the conventional commits standard. There is a GitHub Action in .github/workflows/semantic-release.yaml that uses go-semantic-commit to create new releases.

The commit message should be structured as follows:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

The commit contains the following structural elements, to communicate intent to the consumers of your library:

  1. fix: a commit of the type fix patches gets released with a PATCH version bump
  2. feat: a commit of the type feat gets released as a MINOR version bump
  3. BREAKING CHANGE: a commit that has a footer BREAKING CHANGE: gets released as a MAJOR version bump
  4. types other than fix: and feat: are allowed and don't trigger a release

If a commit does not contain a conventional commit style message you can fix it during the squash and merge operation on the PR.

Once a commit has landed on the main branch a release will be created and automatically published to pypi using the GitHub Action in .github/workflows/pypi.yaml which uses twine to publish the package to pypi.

Development

Install requirements

make init

Run Tests

make test

Generate docs

make docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nowplaypadgen-0.5.1.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nowplaypadgen-0.5.1-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file nowplaypadgen-0.5.1.tar.gz.

File metadata

  • Download URL: nowplaypadgen-0.5.1.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-1017-azure

File hashes

Hashes for nowplaypadgen-0.5.1.tar.gz
Algorithm Hash digest
SHA256 b4c2a853c86e63de96eadcf06ba8e522f8a87e88702450727ea8fa6d10d26c01
MD5 432a833e3a748d0a91ea9d56c1611b93
BLAKE2b-256 93f22397f4f9d52a8d9f7a6e5ca264bf1400f73fa57fa49290d762af1373b201

See more details on using hashes here.

File details

Details for the file nowplaypadgen-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: nowplaypadgen-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-1017-azure

File hashes

Hashes for nowplaypadgen-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a844eeffc19110573a903be1bf23229fa80a6d50a262fad3cc0fe94376a6c98
MD5 bfbae07e83749dcf771400ae753d2dea
BLAKE2b-256 696a6b65fc3cf7845c488d8b49981d79db545f13892f89edbed4c16c79074ffa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page