Skip to main content

Command-line recorder for public live TV streams.

Project description

tv-recorder

Command-line recorder for public live TV streams.

Local Installation

python -m pip install -e .

Chromium is installed automatically on first use if Playwright does not already have it.

The recorder uses the ffmpeg binary provided by imageio-ffmpeg.

Usage

tv-recorder radio-canada.ca now 2h

The general form is:

tv-recorder SOURCE START DURATION

Examples:

tv-recorder radio-canada.ca now 30m
tv-recorder radio-canada.ca 2026-05-24T20:00:00 2h --output-dir recordings
tv-recorder tvaplus.ca now 30m
tv-recorder telequebec.tv now 30m
tv-recorder cpac-english now 30m
tv-recorder cpac-francais now 30m
tv-recorder canal-assemblee-nationale now 30m
tv-recorder globalnews-national now 30m
tv-recorder globalnews-montreal now 30m
tv-recorder radio-canada.ca now 10m --headful
tv-recorder radio-canada.ca now 10m --dry-run
tv-recorder radio-canada.ca now 10m --debug

START accepts now or a local ISO date. DURATION accepts values such as 90s, 30m, 2h, or 01:30:00.

By default, the CLI runs at --info level and prints the effective recording URL or inputs. During recording, a small activity indicator moves when ffmpeg emits progress. Use --debug to show discovery details, step results, and ffmpeg output.

Configuration YAML

The package includes a default configuration. To replace it, provide your own YAML file:

tv-recorder radio-canada.ca now 2h --config my-file.yaml

Each source can define:

  • start_url: page to open with Playwright.
  • stream_url_pattern: regular expression used to identify stream URLs.
  • stream_request_urls: optional JSON endpoints to call before browser steps.
  • stream_response_url_patterns: response URL patterns whose JSON can contain stream URLs.
  • stream_response_json_keys: JSON keys whose values should be treated as stream URLs.
  • stream_url_reject_patterns: stream URL patterns to ignore.
  • recording: video/audio track selection.
  • steps: browser interaction recipe before stream detection.
  • output_extension: output file extension.
  • user_agent: optional user-agent for browser and recorder requests.

Track selection:

recording:
  video:
    height: 720
  audio:
    language: "fre"
    reject_comments:
      - "audio_dv"

If no video track matches the requested height, the highest available resolution is used. For audio, rejected comments are filtered first, then language and comment preferences are used to choose the main track.

Supported steps:

steps:
  - action: wait_for_stream
  - action: wait_for_selector
    selector: "button.vjs-big-play-button"
  - action: click_by_text
    text: "EN DIRECT"
  - action: click_by_selector
    selector: "button:has-text('Play')"
    fallback:
      action: click_by_text
      text: "Play"
    required: true
    timeout_ms: 30000

Notes

The recorder uses browser automation to discover streams when a channel does not expose a stable feed URL, then records the selected audio/video tracks without re-encoding. This version starts the recording at the requested time in the current process. A real system scheduler can be layered on top of the same command later.

Publishing

Install packaging tools:

python -m pip install -e ".[dev]"

Build and check the package:

python scripts/check_version.py --tag v0.1.0
python -m build
python -m twine check dist/*

Publish to TestPyPI first:

python -m twine upload --repository testpypi dist/*

Publish to PyPI:

python -m twine upload dist/*

Before publishing, update version in pyproject.toml, then rebuild from a clean dist directory. The package __version__ is resolved from the package metadata generated from pyproject.toml. The GitHub release tag must match the version in pyproject.toml; a leading v is accepted, so v0.1.0 matches 0.1.0.

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

tv_recorder-0.0.0.dev2.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

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

tv_recorder-0.0.0.dev2-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file tv_recorder-0.0.0.dev2.tar.gz.

File metadata

  • Download URL: tv_recorder-0.0.0.dev2.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tv_recorder-0.0.0.dev2.tar.gz
Algorithm Hash digest
SHA256 f9415069641202c0a5cf08fcb1d5ec358f45f6267d3818cbda87dd6a80049b5b
MD5 4e898f0fc0ec2038a6945b02fc5cc91b
BLAKE2b-256 45075789d5a62f1f5687e7396e5db2a39e2ef65a301724c9d31e8914c4aa5828

See more details on using hashes here.

Provenance

The following attestation bundles were made for tv_recorder-0.0.0.dev2.tar.gz:

Publisher: publish.yml on onclefranck/tv-recorder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tv_recorder-0.0.0.dev2-py3-none-any.whl.

File metadata

File hashes

Hashes for tv_recorder-0.0.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 304eed734220424b12cea0c4b2420c78e9a692ebf30f54a109644e686b8b21f7
MD5 7bd300bac4001edf98301758b2b2c161
BLAKE2b-256 256ae00cd966c81f8d15e577a44ced3ad96761821948fc4cb50ed2d36bc87985

See more details on using hashes here.

Provenance

The following attestation bundles were made for tv_recorder-0.0.0.dev2-py3-none-any.whl:

Publisher: publish.yml on onclefranck/tv-recorder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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