Skip to main content

Library provider base classes for the AniBridge project.

Project description

anibridge-library-base

anibridge-library-base provides base classes and utilities to implement and register media library providers for the AniBridge project.

[!IMPORTANT] This package is intended for developers building AniBridge library providers. If you're looking to use AniBridge as an end user, please refer to the AniBridge documentation.

Installation

pip install anibridge-library-base
# pip install git+https://github.com/anibridge/anibridge-library-base.git

API reference

The package exposes its public API from anibridge.library and the core definitions in anibridge.library.base.

To get more context, read the anibridge.library.base module docstrings.

  • LibraryProvider (base class)

    • Key methods and hooks:
      • __init__(*, logger: ProviderLogger, config: dict | None = None) -> None: Construct a provider with an injected logger and optional configuration.
      • async initialize() -> None: Optional async initialization hook for I/O or authentication.
      • async clear_cache() -> None: Clear any provider caches to free memory or refresh data.
      • async close() -> None: Close the provider and release resources.
      • async get_sections() -> Sequence[LibrarySection[LibraryProviderT]]: Return available library sections for the provider.
      • async list_items(section: LibrarySection[LibraryProviderT], *, min_last_modified: datetime | None = None, require_watched: bool = False, keys: Sequence[str] | None = None) -> Sequence[LibraryEntry[LibraryProviderT]]: List entries within a section with optional filtering.
      • async parse_webhook(request: Request) -> tuple[bool, Sequence[str]]: Parse an incoming webhook and return whether it applies plus affected item keys.
      • user() -> LibraryUser | None: Return the associated user object, if any.
  • LibraryEntry (per-item user state)

    • Key methods and properties:
      • async history() -> Sequence[HistoryEntry]: Return user history events for the item (tz-aware timestamps).
      • mapping_descriptors() -> Sequence[MappingDescriptor]: Return mapping descriptors for AniBridge matching.
      • media() -> LibraryMedia[LibraryProviderT]: Return the associated LibraryMedia object.
      • on_watching -> bool: Whether the item is currently being watched.
      • on_watchlist -> bool: Whether the item is on the user's watchlist.
      • review -> str | None: Optional user review text.
      • section() -> LibrarySection[LibraryProviderT]: Return the parent library section for the item.
      • user_rating -> int | None: Optional user rating on a 0-100 scale.
      • view_count -> int: Total view count for the item (including children).
  • LibraryMedia (media metadata)

    • Key properties:
      • external_url -> str | None: URL to the provider's media item, if available.
      • poster_image -> str | None: Poster or cover image URL, if available.
  • LibraryShow, LibrarySeason, LibraryEpisode, LibraryMovie

    • LibraryShow exposes episodes() and seasons().
    • LibrarySeason exposes index, episodes(), and show().
    • LibraryEpisode exposes index, season_index, season(), and show().
  • HistoryEntry

    • library_key: str, viewed_at: datetime record a timezone-aware view event for an item.
  • MediaKind (StrEnum)

    • High-level media kinds: MOVIE, SHOW, SEASON, EPISODE.

Examples

You can view the following built-in provider implementations as examples of how to implement the base classes:

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

anibridge_library_base-0.2.0b6.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

anibridge_library_base-0.2.0b6-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file anibridge_library_base-0.2.0b6.tar.gz.

File metadata

  • Download URL: anibridge_library_base-0.2.0b6.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for anibridge_library_base-0.2.0b6.tar.gz
Algorithm Hash digest
SHA256 33ac7ecfdddafda7931721675a8610f4c76108e20684d1f2cbc94532f3d26cce
MD5 70b1806f1997b3ef3ff8c89cfde6b2f2
BLAKE2b-256 66dffa0731ff143c3d08246640cb1288b3e7cb74f7083708f805978cbfd4c85f

See more details on using hashes here.

File details

Details for the file anibridge_library_base-0.2.0b6-py3-none-any.whl.

File metadata

  • Download URL: anibridge_library_base-0.2.0b6-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for anibridge_library_base-0.2.0b6-py3-none-any.whl
Algorithm Hash digest
SHA256 9ae0e4847055edb93c5b55ff769bada66fb5b3cc21a86d099b41fc6823dd458a
MD5 0cefe422dfa2d5d72c96ae0fd7a25c7c
BLAKE2b-256 69aed6d4e6cf8b1bbc42af4bd36faf1b9e07f0e1aac3ab624acd195c8c7d3767

See more details on using hashes here.

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