# nowplaypadgen
DAB+ now playing PAD (DLS+ and MOT SLS) generator
## Usage
### DL+
You can use this to generate some DLPlus Tags.
```python
>>> 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.
```python
>>> 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](https://github.com/opendigitalradio/ODR-PadEnc) style string.
```python
>>> 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](https://www.conventionalcommits.org/en/v1.0.0/).
There is a GitHub Action in [.github/workflows/semantic-release.yaml](./.github/workflows/semantic-release.yaml)
that uses [go-semantic-commit](https://go-semantic-release.xyz/) 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
1. **feat:** a commit of the type `feat` gets released as a MINOR version bump
1. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:` gets released as a MAJOR version bump
1. 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](https://pypi.org/)
using the GitHub Action in [.github/workflows/pypi.yaml](./.github/workflows/pypi.yaml) which uses [twine](https://twine.readthedocs.io/)
to publish the package to pypi.
## Development
### Install requirements
```bash
make init
```
### Run Tests
```bash
make test
```
### Generate docs
```bash
make docs
```
Raw data
{
"_id": null,
"home_page": "https://github.com/radiorabe/nowplaypadgen",
"name": "nowplaypadgen",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": null,
"author": "RaBe IT-Reaktion",
"author_email": "it@rabe.ch",
"download_url": "https://files.pythonhosted.org/packages/f4/c2/95a052cafd27bd054bdc1d3734d1fdc1f4a238fc4711f06f0de19e84104f/nowplaypadgen-0.5.2.tar.gz",
"platform": null,
"description": "# nowplaypadgen\n\nDAB+ now playing PAD (DLS+ and MOT SLS) generator\n\n## Usage\n\n### DL+\n\nYou can use this to generate some DLPlus Tags.\n\n```python\n>>> from nowplaypadgen.dlplus import *\n>>> message = DLPlusMessage()\n>>> message.add_dlp_object(DLPlusObject(\"STATIONNAME.LONG\", \"Radio Bern RaBe\"))\n>>> message.add_dlp_object(DLPlusObject(\"STATIONNAME.SHORT\", \"RaBe\"))\n>>> message.add_dlp_object(DLPlusObject(\"ITEM.TITLE\", \"Radio Bern\"))\n>>> message.build(\"$STATIONNAME.LONG\")\n>>> message.message\n'Radio Bern RaBe'\n>>> tags = message.get_dlp_tags()\n>>> long = tags['STATIONNAME.LONG']\n>>> f\"{long}: {long.code} {long.start} {long.length}\"\n'STATIONNAME.LONG: 32 0 15'\n>>> short = tags['STATIONNAME.SHORT']\n>>> f\"{short}: {short.code} {short.start} {short.length}\"\n'STATIONNAME.SHORT: 31 11 4'\n>>> title = tags['ITEM.TITLE']\n>>> f\"{title}: {title.code} {title.start} {title.length}\"\n'ITEM.TITLE: 1 0 10'\n\n```\n\nLater on you might want to generate DL+ that deletes an item tag.\n\n```python\n>>> message = DLPlusMessage()\n>>> message.add_dlp_object(DLPlusObject(\"STATIONNAME.LONG\", \"Radio Bern RaBe\"))\n>>> message.add_dlp_object(DLPlusObject(\"ITEM.TITLE\", delete=True))\n>>> message.build(\"$STATIONNAME.LONG\")\n>>> message.message\n'Radio Bern RaBe'\n>>> tags = message.get_dlp_tags()\n>>> title = tags['ITEM.TITLE']\n>>> f\"{title}: {title.code} {title.start} {title.length}\"\n'ITEM.TITLE: 1 5 0'\n\n```\n\nFinally, you can render it as an [ODR-PadEnc](https://github.com/opendigitalradio/ODR-PadEnc) style string.\n\n```python\n>>> from nowplaypadgen.dlplus import *\n>>> message = DLPlusMessage()\n>>> message.add_dlp_object(DLPlusObject(\"ITEM.TITLE\", \"Radio Bern\"))\n>>> message.add_dlp_object(DLPlusObject(\"STATIONNAME.SHORT\", \"RaBe\"))\n>>> message.add_dlp_object(DLPlusObject(\"STATIONNAME.LONG\", \"Radio Bern RaBe\"))\n>>> message.build(\"$STATIONNAME.LONG\")\n>>> from nowplaypadgen.renderer.odr import ODRPadEncRenderer\n>>> renderer = ODRPadEncRenderer(message)\n\n```\n\nThis will generate the following ODR-PadEnc style DLS string when rendered with `print(renderer)`:\n\n```\n##### parameters { #####\nDL_PLUS=1\nDL_PLUS_TAG=1 0 10\nDL_PLUS_TAG=31 11 4\nDL_PLUS_TAG=32 0 15\n##### parameters } #####\nRadio Bern RaBe\n```\n\n## Release Management\n\nThe CI/CD setup uses semantic commit messages following the [conventional commits standard](https://www.conventionalcommits.org/en/v1.0.0/).\nThere is a GitHub Action in [.github/workflows/semantic-release.yaml](./.github/workflows/semantic-release.yaml)\nthat uses [go-semantic-commit](https://go-semantic-release.xyz/) to create new\nreleases.\n\nThe commit message should be structured as follows:\n\n```\n<type>[optional scope]: <description>\n\n[optional body]\n\n[optional footer(s)]\n```\n\nThe commit contains the following structural elements, to communicate intent to the consumers of your library:\n\n1. **fix:** a commit of the type `fix` patches gets released with a PATCH version bump\n1. **feat:** a commit of the type `feat` gets released as a MINOR version bump\n1. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:` gets released as a MAJOR version bump\n1. types other than `fix:` and `feat:` are allowed and don't trigger a release\n\nIf a commit does not contain a conventional commit style message you can fix\nit during the squash and merge operation on the PR.\n\nOnce a commit has landed on the `main` branch a release will be created and automatically published to [pypi](https://pypi.org/)\nusing the GitHub Action in [.github/workflows/pypi.yaml](./.github/workflows/pypi.yaml) which uses [twine](https://twine.readthedocs.io/)\nto publish the package to pypi.\n\n## Development\n\n### Install requirements\n\n```bash\nmake init\n```\n\n### Run Tests\n\n```bash\nmake test\n```\n\n### Generate docs\n\n```bash\nmake docs\n```\n",
"bugtrack_url": null,
"license": "AGPL-3",
"summary": "DAB+ now playing PAD (DLS+ generator)",
"version": "0.5.2",
"project_urls": {
"Homepage": "https://github.com/radiorabe/nowplaypadgen",
"Repository": "https://github.com/radiorabe/nowplaypadgen"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ebfebaa046143b3bfcf78cec8ba26159fef04d1f746b943f4b3bb440b5bc8177",
"md5": "f8d3c41db09332201d4cce45a6c2b70c",
"sha256": "e63e29abf32731a02b548617b1de669c7edfee095cc0011367dbe66e47f4c022"
},
"downloads": -1,
"filename": "nowplaypadgen-0.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f8d3c41db09332201d4cce45a6c2b70c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 28010,
"upload_time": "2024-12-21T12:04:03",
"upload_time_iso_8601": "2024-12-21T12:04:03.045618Z",
"url": "https://files.pythonhosted.org/packages/eb/fe/baa046143b3bfcf78cec8ba26159fef04d1f746b943f4b3bb440b5bc8177/nowplaypadgen-0.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f4c295a052cafd27bd054bdc1d3734d1fdc1f4a238fc4711f06f0de19e84104f",
"md5": "c0112b9096735a8431b6958995195209",
"sha256": "9fe7a43be86b3cc08aa157af5af77c5faf892a9029ee5d7bb9d9ffc1736b64ba"
},
"downloads": -1,
"filename": "nowplaypadgen-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "c0112b9096735a8431b6958995195209",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 26171,
"upload_time": "2024-12-21T12:04:05",
"upload_time_iso_8601": "2024-12-21T12:04:05.387868Z",
"url": "https://files.pythonhosted.org/packages/f4/c2/95a052cafd27bd054bdc1d3734d1fdc1f4a238fc4711f06f0de19e84104f/nowplaypadgen-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-21 12:04:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "radiorabe",
"github_project": "nowplaypadgen",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nowplaypadgen"
}