Metadata-Version: 2.1
Name: earhorn
Version: 0.8.2
Summary: Listen, monitor and archive your streams!
Author: Joola
Author-email: jooola@users.noreply.github.com
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: click (>=8.0.1,<9.0.0)
Requires-Dist: httpx (>=0.21.1,<0.23.0)
Requires-Dist: loguru (>=0.5.3,<0.7.0)
Requires-Dist: more-itertools (>=8.10.0,<9.0.0)
Requires-Dist: prometheus-client (>=0.13.1,<0.14.0)
Requires-Dist: pydantic (>=1.9.0,<2.0.0)
Description-Content-Type: text/markdown

# earhorn

Listen, monitor and archive your streams!

[![](https://mermaid.ink/svg/eyJjb2RlIjoic3RhdGVEaWFncmFtLXYyXG4gICAgc3RhdGUgXCJTdGFydCBldmVudCBoYW5kbGVyXCIgYXMgc3RhcnRfaGFuZGxlclxuICAgIFsqXSAtLT4gc3RhcnRfaGFuZGxlclxuXG4gICAgc3RhdGUgXCJDaGVjayByZW1vdGUgc3RyZWFtXCIgYXMgY2hlY2tfc3RyZWFtXG4gICAgc3RhcnRfaGFuZGxlciAtLT4gY2hlY2tfc3RyZWFtXG5cbiAgICBzdGF0ZSBpZl9zdHJlYW1fb2sgPDxjaG9pY2U-PlxuICAgIHN0YXRlIHN0YXJ0IDw8Zm9yaz4-XG4gICAgY2hlY2tfc3RyZWFtIC0tPiBpZl9zdHJlYW1fb2s6IElzIHRoZSBzdHJlYW0gb2sgP1xuXG4gICAgaWZfc3RyZWFtX29rIC0tPiBzdGFydDogWWVzXG4gICAgc3RhdGUgXCJTdGFydCBsaXN0ZW5lclwiIGFzIHN0YXJ0X2xpc3RlbmVyXG4gICAgc3RhdGUgXC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p0cnVlLCJ1cGRhdGVEaWFncmFtIjpmYWxzZX0)

## Install

```sh
sudo apt install ffmpeg
pip install earhorn
```

```sh
earhorn --archive-path=/to/my/archive https://stream.example.org/live.ogg
```

### Docker

```sh
docker pull ghcr.io/jooola/earhorn
```

## Usage

```
Usage: earhorn [OPTIONS] URL

  URL of the `stream`.

  See the ffmpeg documentation for details about the `--archive-segment-*` options:
  https://ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment

Options:
  --hook PATH                     Path to a custom script executed to handle stream state `events`.
  --prometheus                    Enable the prometheus metrics endpoint. The endpoint expose the state of the
                                  `stream`
  --prometheus-listen-port INTEGER
                                  Listen port for the prometheus metrics endpoint.  [default: 9950]
  --archive-path PATH             Path to the archive storage directory. If defined, the archiver will save the
                                  `stream` in segments in the storage path.
  --archive-segment-size INTEGER  Archive segment size in seconds.  [default: 3600]
  --archive-segment-filename TEXT
                                  Archive segment filename (without extension).  [default: archive-%Y%m%d_%H%M%S]
  --archive-segment-format TEXT   Archive segment format.  [default: ogg]
  --archive-segment-format-options TEXT
                                  Archive segment format options.
  --archive-copy-stream           Copy the `stream` without transcoding (reduce CPU usage). WARNING: The stream has to
                                  be in the same format as the `--archive-segment-format`.
  --help                          Show this message and exit.

```

## Releases

To release a new version, first bump the version number in `pyproject.toml` by hand or by using:

```sh
# poetry version --help
poetry version <patch|minor|major>
```

Run the release target:

```sh
make release
```

Finally, push the release commit and tag to publish them to Pypi:

```sh
git push --follow-tags
```

