Skip to main content

Series Intro Recognizer

Detailed documentation is available at Wiki.

Comparing episodes of a series to find the opening/endings of the series.

This library receives a list of episodes, extracts the audio features of each episode and compares them to find the common part of the series.

To reduce the number of comparisons, the library compares 4 sequential episodes. The number of episodes to be compared can be changed in configuration.

Installation

The project uses Cupy. It supports both Cuda and AMD GPUs. Please refer to the Cupy installation guide to install the correct version for your system.

pip install series-intro-recognizer

Options

Input options:

  • Iterator of audio samples (numpy ndarrays), offset and duration
  • Iterator of audio files
  • Iterator of audio files, offset and duration

Offset and duration are used to extract the audio features of the episodes and can be None. If None, the whole audio will be used.

WARN: See the warning #1 in the Usage section.

Output:

  • List of intervals of the same fragment in the episodes

To find an opening, pass the first minutes (e.g. 5 minutes) of the episodes. To find an ending, pass the last minutes (e.g. 5 minutes) of the episodes.

WARN: See the warning #2 in the Usage section.

Configuration:

Every call of methods should pass a configuration object. Feel free to just pass the default configuration.

The configuration object has the following fields:

  • rate: Audio sample rate.
  • min_segment_length_sec: Minimum length of the intro in seconds.
  • max_segment_length_sec: Maximum length of the intro in seconds.
  • precision_secs: Precision of the correlation in seconds.
  • series_window: Number of sequential audio samples to be matched with each other.
  • offset_searcher__sequential_secs: Number of sequential 'non-intro' seconds that signal the end of the intro.
  • adjustment_threshold: Threshold for adjusting the borders of the intro.
  • adjustment_threshold_secs: Threshold for adjusting the borders of the intro to the borders of the audio.
  • save_intermediate_results: Save the correlation results.

Important warnings

WARNING #1: Do not pass the whole episodes, it will take a long time to process and the results will not be accurate (in this case, the library will find the intro or outro, depending on which part is longer).

WARNING #2: If you use recognise_from_audio_files_with_offsets and offsets are provided, the library WILL NOT add it to the output intervals. Please, add it manually.

WARNING #3: There is a well-known memory leak in sklearn. You will see a warning when running the app. The memory leak should not be a problem for a short run, but it is recommended to add OMP_NUM_THREADS=1 to the environment variables.

Usage

You can find other examples in the tests/processors folder.

To find the opening of a series by audio paths:

cfg = Config()
files = [f'assets/audio_files/{i}.wav' for i in paths]
recognised = recognise_from_audio_files(files, cfg)
# Returns a list of intervals
# [(start=0.25, end=30.25), (start=0.20, end=30.20), ...]

To find the opening of a series by audio samples:

def some_audio_loading_function() -> np.ndarray:
    return np.random.rand(1000)


cfg = Config()
samples = map(lambda _: (some_audio_loading_funciton(), None, None), range(10))
recognised = recognise_from_audio_samples(samples, cfg)
# Returns a list of intervals
# [(start=0.25, end=30.25), (start=0.20, end=30.20), ...]

To find the ending of a series by audio paths, analysing intervals from 1 to 35 seconds:

cfg = Config()
files = [(f'assets/audio_files/{i}.wav', 2, 30) for i in paths]
recognised = recognise_from_audio_files(files, cfg)
# Returns a list of intervals
# [(start=0, end=28.25), (start=0, end=28.20), ...]

Development & Contributing

Quality Standards

The project enforces strict code quality checks:

  • Type Checking: All code must pass mypy in strict mode with 100% type coverage
  • Test Coverage: Minimum 80% test coverage is required (enforced in CI/CD)
  • Unit Tests: All new features must include unit tests
  • Code Style: Code must pass ruff linting checks

Running Tests Locally

# Run all tests with coverage report
pytest --cov=series_intro_recognizer --cov-report=html tests/
# Run type checking
mypy --strict series_intro_recognizer tests

Coverage Reports

Coverage reports are automatically generated and commented on pull requests. The project maintains an 80% minimum coverage threshold. Coverage reports can be:

  • Viewed in CI/CD workflow runs
  • Downloaded from codecov
  • Generated locally using pytest --cov=series_intro_recognizer --cov-report=html tests/

Pull Request Requirements

All pull requests must:

  1. Pass all automated checks (tests, type checking, linting)
  2. Maintain or improve the current test coverage (minimum 80%)
  3. Include type hints for all new functions/methods
  4. Have meaningful commit messages

GPU CI runner

See the GPU runner guide for Podman setup, restarting after reboot, and registration or image updates.

Metadata

Release files for series-intro-recognizer 1.4.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for series-intro-recognizer 1.4.6
File Size Uploaded Provenance Actions
series_intro_recognizer-1.4.6.tar.gz 39.1 kB With provenance Details for series_intro_recognizer-1.4.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for series-intro-recognizer 1.4.6
File Interpreter ABI Platform Actions
series_intro_recognizer-1.4.6-py3-none-any.whl Python 3 none any Details for series_intro_recognizer-1.4.6-py3-none-any.whl

Total release size: 61.3 kB

Release files / series_intro_recognizer-1.4.6.tar.gz

Download URL series_intro_recognizer-1.4.6.tar.gz
Size 39.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a1788fbb55b0c56eefbf2205c73128845ba54962b61817f0b918ea8d85f6b7a2
BLAKE2b-256 checksum
How to use checksums
e79a7f15ce768368aea5258177aa9bd4b0f44b6ef4e771e4fa4607b213baa4d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / series_intro_recognizer-1.4.6-py3-none-any.whl

Download URL series_intro_recognizer-1.4.6-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe48a32baadabf4a88a6a5526f858e47260838419a200660bcb293e4844e4f26
BLAKE2b-256 checksum
How to use checksums
22c3962f825ec04f609e1dab4a94905723a1a636fb9b91e967e248d8cbf553d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for series-intro-recognizer 1.4.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for series_intro_recognizer-1.4.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page