suisa-sendemeldung


Namesuisa-sendemeldung JSON
Version 0.12.5 PyPI version JSON
download
home_pagehttp://github.com/radiorabe/suisa_reporting
SummaryACRCloud client for SUISA reporting
upload_time2023-07-25 21:07:33
maintainer
docs_urlNone
authorRaBe IT-Reaktion
requires_python>=3.11,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # suisa_sendemeldung

ACRCloud client that fetches data on our playout history and formats them in a CSV file format containing the data (like Track, Title and ISRC) requested by SUISA. Also takes care of sending the report to SUISA via email for hands-off operations.

## Installation

You can build a Docker image using the included [Dockerfile](Dockerfile):

```bash
git clone https://github.com/radiorabe/suisa_sendemeldung
cd suisa_sendemeldung
podman build -t suisa_sendemeldung .
```

Then you can run it by passing in command line switches:

```bash
podman run --rm suisa_sendemeldung --bearer-token abcdefghijklmnopqrstuvwxyzabcdef --stream_id a-bcdefgh --stdout
```

Or by setting environment variables:

```bash
podman run --rm --env BEARER_TOKEN=abcdefghijklmnopqrstuvwxyzabcdef --env STREAM_ID=a-bcdefgh --env STDOUT=True suisa_sendemeldung
```

A prebuilt image is available from the GitHub Package Registry:

```bash
docker pull ghcr.io/radiorabe/suisasendemeldung:master
```

## Usage

This is the output of `suisa_sendemeldung -h`.
```
usage: suisa_sendemeldung [-h] --bearer-token BEARER_TOKEN --project-id
                          PROJECT_ID --stream-id STREAM_ID
                          [--station-name STATION_NAME]
                          [--station-name-short STATION_NAME_SHORT] [--file]
                          [--filetype {xlsx,csv}] [--email]
                          [--email-from EMAIL_FROM] [--email-to EMAIL_TO]
                          [--email-cc EMAIL_CC] [--email-bcc EMAIL_BCC]
                          [--email-server EMAIL_SERVER]
                          [--email-login EMAIL_LOGIN]
                          [--email-pass EMAIL_PASS]
                          [--email-subject EMAIL_SUBJECT]
                          [--email-text EMAIL_TEXT]
                          [--email-footer EMAIL_FOOTER]
                          [--responsible-email RESPONSIBLE_EMAIL]
                          [--start-date START_DATE] [--end-date END_DATE]
                          [--last-month] --timezone TIMEZONE [--locale LOCALE]
                          [--filename FILENAME] [--stdout]

ACRCloud client for SUISA reporting @ RaBe.

options:
  -h, --help            show this help message and exit
  --bearer-token BEARER_TOKEN
                        the bearer token for ACRCloud (required) [env var:
                        BEARER_TOKEN]
  --project-id PROJECT_ID
                        the id of the project at ACRCloud (required) [env var:
                        PROJECT_ID]
  --stream-id STREAM_ID
                        the id of the stream at ACRCloud (required) [env var:
                        STREAM_ID]
  --station-name STATION_NAME
                        Station name, used in Output and Emails [env var:
                        STATION_NAME]
  --station-name-short STATION_NAME_SHORT
                        Shortname for station as used in Filenames (locally
                        and in attachment) [env var: STATION_NAME_SHORT]
  --file                create file [env var: FILE]
  --filetype {xlsx,csv}
                        filetype to attach to email or write to file [env var:
                        FILETYPE]
  --email               send an email [env var: EMAIL]
  --email-from EMAIL_FROM
                        the sender of the email [env var: EMAIL_FROM]
  --email-to EMAIL_TO   the recipients of the email [env var: EMAIL_TO]
  --email-cc EMAIL_CC   the cc recipients of the email [env var: EMAIL_CC]
  --email-bcc EMAIL_BCC
                        the bcc recipients of the email [env var: EMAIL_BCC]
  --email-server EMAIL_SERVER
                        the smtp server to send the mail with [env var:
                        EMAIL_SERVER]
  --email-login EMAIL_LOGIN
                        the username to logon to the smtp server (default:
                        email_from) [env var: EMAIL_LOGIN]
  --email-pass EMAIL_PASS
                        the password for the smtp server [env var: EMAIL_PASS]
  --email-subject EMAIL_SUBJECT
                        The subject of the email, placeholders are
                        $station_name, $year and $month [env var:
                        EMAIL_SUBJECT]
  --email-text EMAIL_TEXT
                        A template for the Email text, placeholders are
                        $station_name, $month, $year, $previous_year,
                        $responsible_email, and $email_footer. [env var:
                        EMAIL_TEXT]
  --email-footer EMAIL_FOOTER
                        Footer for the Email [env var: EMAIL_FOOTER]
  --responsible-email RESPONSIBLE_EMAIL
                        Used to hint whom to contact in the emails text. [env
                        var: RESPONSIBLE_EMAIL]
  --start-date START_DATE
                        the start date of the interval in format YYYY-MM-DD
                        (default: 30 days before end_date) [env var:
                        START_DATE]
  --end-date END_DATE   the end date of the interval in format YYYY-MM-DD
                        (default: today) [env var: END_DATE]
  --last-month          download data of whole last month [env var:
                        LAST_MONTH]
  --timezone TIMEZONE   set the timezone for localization [env var: TIMEZONE]
  --locale LOCALE       set locale for date and time formatting [env var:
                        LOCALE]
  --filename FILENAME   file to write to (default:
                        <station_name_short>_<year>_<month>.csv when reporting
                        last month, <station_name_short>_<start_date>.csv
                        else) [env var: FILENAME]
  --stdout              also print to stdout [env var: STDOUT]

Args that start with '--' (eg. --bearer-token) can also be set in a config
file (/etc/suisa_sendemeldung.conf or /home/hairmare/suisa_sendemeldung.conf
or suisa_sendemeldung.conf). Config file syntax allows: key=value, flag=true,
stuff=[a,b,c] (for details, see syntax at https://goo.gl/R74nmi). If an arg is
specified in more than one place, then commandline values override environment
variables which override config file values which override defaults.
```

## Configuration

You can configure this script either with a configuration file (default is `suisa_sendemeldung.conf`), environment variables or command line arguments as shown above.

Command line arguments override environment variables which themselves override settings in the configuration file.

### Configuration file

The configuration files will be evaluated in the following order (last takes precedence over first):

  1. `/etc/suisa_sendemeldung.conf`
  2. `$HOME/suisa_sendemeldung.conf`
  3. `./suisa_sendemeldung.conf`

For details on how to set configuration values, have a look at [suisa_sendemeldung.conf](etc/suisa_sendemeldung.conf).

### Environment variables

Environment variables can also be passed as options. The relevant variables are listed in the [Usage](#Usage) part of this document. For example run the script as follows:

```bash
BEARER_TOKEN=abcdefghijklmnopqrstuvwxyzabcdef STREAM_ID=a-bcdefgh STDOUT=True ./suisa_sendemeldung.py
```

### Command line switches

As documented in [Usage](#Usage), you can also pass in options on the command line as arguments. Simply run the script as follows:

```bash
./suisa_sendemeldung.py --bearer-token=abcdefghijklmnopqrstuvwxyzabcdef --stream_id=a-bcdefgh --stdout
```

## 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/release.yaml](./.github/workflows/reliease.yaml) which uses [twine](https://twine.readthedocs.io/)
to publish the package to pypi. The `release.yaml` action also takes care of pushing a [container](https://opencontainers.org/)
image to [GitHub Packages](https://github.com/features/packages).

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/radiorabe/suisa_reporting",
    "name": "suisa-sendemeldung",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "RaBe IT-Reaktion",
    "author_email": "it@rabe.ch",
    "download_url": "https://files.pythonhosted.org/packages/66/e7/cf49b550e2781f29708eba2a4b1152b23fb4f61e0f856842ca134a4e8baf/suisa_sendemeldung-0.12.5.tar.gz",
    "platform": null,
    "description": "# suisa_sendemeldung\n\nACRCloud client that fetches data on our playout history and formats them in a CSV file format containing the data (like Track, Title and ISRC) requested by SUISA. Also takes care of sending the report to SUISA via email for hands-off operations.\n\n## Installation\n\nYou can build a Docker image using the included [Dockerfile](Dockerfile):\n\n```bash\ngit clone https://github.com/radiorabe/suisa_sendemeldung\ncd suisa_sendemeldung\npodman build -t suisa_sendemeldung .\n```\n\nThen you can run it by passing in command line switches:\n\n```bash\npodman run --rm suisa_sendemeldung --bearer-token abcdefghijklmnopqrstuvwxyzabcdef --stream_id a-bcdefgh --stdout\n```\n\nOr by setting environment variables:\n\n```bash\npodman run --rm --env BEARER_TOKEN=abcdefghijklmnopqrstuvwxyzabcdef --env STREAM_ID=a-bcdefgh --env STDOUT=True suisa_sendemeldung\n```\n\nA prebuilt image is available from the GitHub Package Registry:\n\n```bash\ndocker pull ghcr.io/radiorabe/suisasendemeldung:master\n```\n\n## Usage\n\nThis is the output of `suisa_sendemeldung -h`.\n```\nusage: suisa_sendemeldung [-h] --bearer-token BEARER_TOKEN --project-id\n                          PROJECT_ID --stream-id STREAM_ID\n                          [--station-name STATION_NAME]\n                          [--station-name-short STATION_NAME_SHORT] [--file]\n                          [--filetype {xlsx,csv}] [--email]\n                          [--email-from EMAIL_FROM] [--email-to EMAIL_TO]\n                          [--email-cc EMAIL_CC] [--email-bcc EMAIL_BCC]\n                          [--email-server EMAIL_SERVER]\n                          [--email-login EMAIL_LOGIN]\n                          [--email-pass EMAIL_PASS]\n                          [--email-subject EMAIL_SUBJECT]\n                          [--email-text EMAIL_TEXT]\n                          [--email-footer EMAIL_FOOTER]\n                          [--responsible-email RESPONSIBLE_EMAIL]\n                          [--start-date START_DATE] [--end-date END_DATE]\n                          [--last-month] --timezone TIMEZONE [--locale LOCALE]\n                          [--filename FILENAME] [--stdout]\n\nACRCloud client for SUISA reporting @ RaBe.\n\noptions:\n  -h, --help            show this help message and exit\n  --bearer-token BEARER_TOKEN\n                        the bearer token for ACRCloud (required) [env var:\n                        BEARER_TOKEN]\n  --project-id PROJECT_ID\n                        the id of the project at ACRCloud (required) [env var:\n                        PROJECT_ID]\n  --stream-id STREAM_ID\n                        the id of the stream at ACRCloud (required) [env var:\n                        STREAM_ID]\n  --station-name STATION_NAME\n                        Station name, used in Output and Emails [env var:\n                        STATION_NAME]\n  --station-name-short STATION_NAME_SHORT\n                        Shortname for station as used in Filenames (locally\n                        and in attachment) [env var: STATION_NAME_SHORT]\n  --file                create file [env var: FILE]\n  --filetype {xlsx,csv}\n                        filetype to attach to email or write to file [env var:\n                        FILETYPE]\n  --email               send an email [env var: EMAIL]\n  --email-from EMAIL_FROM\n                        the sender of the email [env var: EMAIL_FROM]\n  --email-to EMAIL_TO   the recipients of the email [env var: EMAIL_TO]\n  --email-cc EMAIL_CC   the cc recipients of the email [env var: EMAIL_CC]\n  --email-bcc EMAIL_BCC\n                        the bcc recipients of the email [env var: EMAIL_BCC]\n  --email-server EMAIL_SERVER\n                        the smtp server to send the mail with [env var:\n                        EMAIL_SERVER]\n  --email-login EMAIL_LOGIN\n                        the username to logon to the smtp server (default:\n                        email_from) [env var: EMAIL_LOGIN]\n  --email-pass EMAIL_PASS\n                        the password for the smtp server [env var: EMAIL_PASS]\n  --email-subject EMAIL_SUBJECT\n                        The subject of the email, placeholders are\n                        $station_name, $year and $month [env var:\n                        EMAIL_SUBJECT]\n  --email-text EMAIL_TEXT\n                        A template for the Email text, placeholders are\n                        $station_name, $month, $year, $previous_year,\n                        $responsible_email, and $email_footer. [env var:\n                        EMAIL_TEXT]\n  --email-footer EMAIL_FOOTER\n                        Footer for the Email [env var: EMAIL_FOOTER]\n  --responsible-email RESPONSIBLE_EMAIL\n                        Used to hint whom to contact in the emails text. [env\n                        var: RESPONSIBLE_EMAIL]\n  --start-date START_DATE\n                        the start date of the interval in format YYYY-MM-DD\n                        (default: 30 days before end_date) [env var:\n                        START_DATE]\n  --end-date END_DATE   the end date of the interval in format YYYY-MM-DD\n                        (default: today) [env var: END_DATE]\n  --last-month          download data of whole last month [env var:\n                        LAST_MONTH]\n  --timezone TIMEZONE   set the timezone for localization [env var: TIMEZONE]\n  --locale LOCALE       set locale for date and time formatting [env var:\n                        LOCALE]\n  --filename FILENAME   file to write to (default:\n                        <station_name_short>_<year>_<month>.csv when reporting\n                        last month, <station_name_short>_<start_date>.csv\n                        else) [env var: FILENAME]\n  --stdout              also print to stdout [env var: STDOUT]\n\nArgs that start with '--' (eg. --bearer-token) can also be set in a config\nfile (/etc/suisa_sendemeldung.conf or /home/hairmare/suisa_sendemeldung.conf\nor suisa_sendemeldung.conf). Config file syntax allows: key=value, flag=true,\nstuff=[a,b,c] (for details, see syntax at https://goo.gl/R74nmi). If an arg is\nspecified in more than one place, then commandline values override environment\nvariables which override config file values which override defaults.\n```\n\n## Configuration\n\nYou can configure this script either with a configuration file (default is `suisa_sendemeldung.conf`), environment variables or command line arguments as shown above.\n\nCommand line arguments override environment variables which themselves override settings in the configuration file.\n\n### Configuration file\n\nThe configuration files will be evaluated in the following order (last takes precedence over first):\n\n  1. `/etc/suisa_sendemeldung.conf`\n  2. `$HOME/suisa_sendemeldung.conf`\n  3. `./suisa_sendemeldung.conf`\n\nFor details on how to set configuration values, have a look at [suisa_sendemeldung.conf](etc/suisa_sendemeldung.conf).\n\n### Environment variables\n\nEnvironment variables can also be passed as options. The relevant variables are listed in the [Usage](#Usage) part of this document. For example run the script as follows:\n\n```bash\nBEARER_TOKEN=abcdefghijklmnopqrstuvwxyzabcdef STREAM_ID=a-bcdefgh STDOUT=True ./suisa_sendemeldung.py\n```\n\n### Command line switches\n\nAs documented in [Usage](#Usage), you can also pass in options on the command line as arguments. Simply run the script as follows:\n\n```bash\n./suisa_sendemeldung.py --bearer-token=abcdefghijklmnopqrstuvwxyzabcdef --stream_id=a-bcdefgh --stdout\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/release.yaml](./.github/workflows/reliease.yaml) which uses [twine](https://twine.readthedocs.io/)\nto publish the package to pypi. The `release.yaml` action also takes care of pushing a [container](https://opencontainers.org/)\nimage to [GitHub Packages](https://github.com/features/packages).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "ACRCloud client for SUISA reporting",
    "version": "0.12.5",
    "project_urls": {
        "Homepage": "http://github.com/radiorabe/suisa_reporting",
        "Repository": "http://github.com/radiorabe/suisa_reporting"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ea742c1274c7324bdf5351b5027aa64ce9a9b7a89a06c5789f43623c2564b5f2",
                "md5": "eb21d32944c78a32dae29e0ef9242027",
                "sha256": "96e6524fff7f32ccf09ea4b69ae825adf44ab4f84e23538b0898d26e57a2b6eb"
            },
            "downloads": -1,
            "filename": "suisa_sendemeldung-0.12.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "eb21d32944c78a32dae29e0ef9242027",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 15192,
            "upload_time": "2023-07-25T21:07:32",
            "upload_time_iso_8601": "2023-07-25T21:07:32.634559Z",
            "url": "https://files.pythonhosted.org/packages/ea/74/2c1274c7324bdf5351b5027aa64ce9a9b7a89a06c5789f43623c2564b5f2/suisa_sendemeldung-0.12.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "66e7cf49b550e2781f29708eba2a4b1152b23fb4f61e0f856842ca134a4e8baf",
                "md5": "3564ec86892c58b717e717d49dbcbee9",
                "sha256": "f56921fc250fe4108e6123c34bd4df8d2f8a619ca9b84acc6247014f25c43590"
            },
            "downloads": -1,
            "filename": "suisa_sendemeldung-0.12.5.tar.gz",
            "has_sig": false,
            "md5_digest": "3564ec86892c58b717e717d49dbcbee9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 15611,
            "upload_time": "2023-07-25T21:07:33",
            "upload_time_iso_8601": "2023-07-25T21:07:33.694097Z",
            "url": "https://files.pythonhosted.org/packages/66/e7/cf49b550e2781f29708eba2a4b1152b23fb4f61e0f856842ca134a4e8baf/suisa_sendemeldung-0.12.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-25 21:07:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "radiorabe",
    "github_project": "suisa_reporting",
    "github_not_found": true,
    "lcname": "suisa-sendemeldung"
}
        
Elapsed time: 0.11931s