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
tv-recorder radio-canada.ca now 10m --comskip
tv-recorder comskip recordings\tvaplus.ca-20260529-190942.mp4

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.

Commercial Marking

Use --comskip to run Comskip after a successful recording and create a commercial-free MP4. The original recording is kept unchanged. Comskip writes sidecar files next to it, including an .edl file when commercials are detected:

tv-recorder radio-canada.ca now 1h --comskip

Run the same post-processing on an existing recording:

tv-recorder comskip recordings\tvaplus.ca-20260529-190942.mp4

The channel settings are selected from the file name prefix, such as tvaplus.ca-...mp4.

On Windows, Comskip is downloaded automatically on first use if comskip.exe is not already available. It is installed inside the active Python environment under share\tv-recorder\comskip\, which keeps a pipx installation self-contained.

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.
  • comskip: commercial marking and cutting settings.
  • 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.dev3.tar.gz (28.0 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.dev3-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tv_recorder-0.0.0.dev3.tar.gz
  • Upload date:
  • Size: 28.0 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.dev3.tar.gz
Algorithm Hash digest
SHA256 a1ce7d099da660821e568f2dfd724887d386c5282f6c89382f88ce3749961334
MD5 34af18553b2060127920f6019072163e
BLAKE2b-256 49c80a7e314ea63de299fa0138096b184784399e79b4aabeb4ace44afd62d28a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tv_recorder-0.0.0.dev3.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.dev3-py3-none-any.whl.

File metadata

File hashes

Hashes for tv_recorder-0.0.0.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 0980c46177d792b04a713c911bcff0f00eca22040c446229b74f5bd0391bdc7e
MD5 f91fba52bb0f4a3a72352add081c609d
BLAKE2b-256 3444249dd4de4627a650e3f162279af8e236d6701bededb8a47de9395c3ca3ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for tv_recorder-0.0.0.dev3-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