Library Provider API
AniBridge library provider base package.
HistoryEntry
dataclass
User history event for a library item.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
LibraryEntity
dataclass
Bases: ABC
Base class for library entities.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
key
property
Return the unique key for this entity.
media_kind
property
Return the high-level media kind of this entity.
title
property
Return the entity title.
__eq__(other)
Compare entities by provider namespace and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
__hash__()
Compute a hash based on provider namespace, class name, and key.
__repr__()
LibraryEntry
dataclass
Bases: LibraryEntity[ProviderT], ABC
Base class for library entries.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
key
property
Return the unique key for this entity.
media_kind
property
Return the high-level media kind of this entity.
on_watching
abstractmethod
property
Whether the item is on the user's current watching list.
on_watchlist
abstractmethod
property
Whether the item is on the user's watchlist.
review
abstractmethod
async
property
Return the user's review text for this item, if any.
title
property
Return the entity title.
user_rating
abstractmethod
property
User rating on a 0-100 scale, or None if not rated.
view_count
abstractmethod
property
Total view count for the item (including children).
__eq__(other)
Compare entities by provider namespace and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
__hash__()
Compute a hash based on provider namespace, class name, and key.
__repr__()
history()
abstractmethod
async
Return user history entries for this media item (tz-aware timestamps).
mapping_descriptors()
abstractmethod
Return possible mapping descriptors for the media item.
The returned descriptors refer to providers in the mapping database. They are not related to the library provider of this item (although, they might match).
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
media()
abstractmethod
provider()
section()
abstractmethod
LibraryEpisode
dataclass
Bases: LibraryEntry[LibraryProviderT], ABC
Episode item within a season/show.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
key
property
Return the unique key for this entity.
media_kind
property
Return the high-level media kind of this entity.
on_watching
abstractmethod
property
Whether the item is on the user's current watching list.
on_watchlist
abstractmethod
property
Whether the item is on the user's watchlist.
review
abstractmethod
async
property
Return the user's review text for this item, if any.
title
property
Return the entity title.
user_rating
abstractmethod
property
User rating on a 0-100 scale, or None if not rated.
view_count
abstractmethod
property
Total view count for the item (including children).
__eq__(other)
Compare entities by provider namespace and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
__hash__()
Compute a hash based on provider namespace, class name, and key.
__repr__()
Short representation including show title, season and episode indexes.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
history()
abstractmethod
async
Return user history entries for this media item (tz-aware timestamps).
mapping_descriptors()
abstractmethod
Return possible mapping descriptors for the media item.
The returned descriptors refer to providers in the mapping database. They are not related to the library provider of this item (although, they might match).
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
media()
abstractmethod
provider()
season()
abstractmethod
Get the parent season of the episode.
Returns:
| Name | Type | Description |
|---|---|---|
LibrarySeason |
LibrarySeason[LibraryProviderT]
|
The parent season. |
section()
abstractmethod
show()
abstractmethod
Get the parent show of the episode.
Returns:
| Name | Type | Description |
|---|---|---|
LibraryShow |
LibraryShow[LibraryProviderT]
|
The parent show. |
LibraryMedia
dataclass
Bases: LibraryEntity[LibraryProviderT], ABC
Base class for library media items.
Implementations should provide concrete behaviour for the abstract properties and methods below.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
external_url
property
URL to the provider's media item, if available.
key
property
Return the unique key for this entity.
media_kind
property
Return the high-level media kind of this entity.
poster_image
property
Primary poster or cover image URL, if available.
title
property
Return the entity title.
__eq__(other)
Compare entities by provider namespace and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
__hash__()
Compute a hash based on provider namespace, class name, and key.
__repr__()
LibraryMovie
dataclass
Bases: LibraryEntry[LibraryProviderT], ABC
Movie item in a media library.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
key
property
Return the unique key for this entity.
media_kind
property
Return the high-level media kind of this entity.
on_watching
abstractmethod
property
Whether the item is on the user's current watching list.
on_watchlist
abstractmethod
property
Whether the item is on the user's watchlist.
review
abstractmethod
async
property
Return the user's review text for this item, if any.
title
property
Return the entity title.
user_rating
abstractmethod
property
User rating on a 0-100 scale, or None if not rated.
view_count
abstractmethod
property
Total view count for the item (including children).
__eq__(other)
Compare entities by provider namespace and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
__hash__()
Compute a hash based on provider namespace, class name, and key.
__repr__()
history()
abstractmethod
async
Return user history entries for this media item (tz-aware timestamps).
mapping_descriptors()
abstractmethod
Return possible mapping descriptors for the media item.
The returned descriptors refer to providers in the mapping database. They are not related to the library provider of this item (although, they might match).
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
media()
abstractmethod
provider()
section()
abstractmethod
LibraryProvider
Bases: ABC
Abstract base provider that exposes a user media library.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
__init__(*, logger, config=None)
Initialize the provider with optional configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger
|
ProviderLogger
|
Application logger injected by AniBridge. |
required |
config
|
dict | None
|
Any configuration options that were detected with the provider's namespace as a prefix. |
None
|
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
clear_cache()
async
Clear any cached data held by the provider.
For more efficient implementations, it is a good idea to cache data fetched from the provider to minimize network requests. AniBridge uses this method occasionally to clear such caches.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
close()
async
get_sections()
abstractmethod
async
Return available library sections for the provider.
Returns:
| Type | Description |
|---|---|
Sequence[LibrarySection[LibraryProviderT]]
|
Sequence[LibrarySection[LibraryProviderT]]: The available library sections. |
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
initialize()
async
Asynchronous initialization hook.
Put any async logic that should be run after construction here.
list_items(section, *, min_last_modified=None, require_watched=False, keys=None)
abstractmethod
async
List items in a library section with optional filtering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section
|
LibrarySection[LibraryProviderT]
|
The library section to list items from. |
required |
min_last_modified
|
datetime | None
|
If provided, only include items modified after this timezone-aware timestamp. |
None
|
require_watched
|
bool
|
If True, only include items marked as watched. |
False
|
keys
|
Sequence[str] | None
|
If provided, only include items whose keys are in this sequence. |
None
|
Returns:
| Type | Description |
|---|---|
Sequence[LibraryEntry[LibraryProviderT]]
|
Sequence[LibraryEntry[LibraryProviderT]]: The list of library items. |
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
parse_webhook(request)
async
Parse an incoming webhook and return the affected item keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
Request
|
The incoming HTTP request. |
required |
Returns:
| Type | Description |
|---|---|
tuple[bool, Sequence[str]]
|
tuple[bool, Sequence[str]]: A tuple where the first element indicates whether the webhook applies to the current provider, and the second element is a sequence of affected item keys. |
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
user()
abstractmethod
Return the associated user object, if any.
Returns:
| Type | Description |
|---|---|
LibraryUser | None
|
LibraryUser | None: The associated user object, if any. |
LibrarySeason
dataclass
Bases: LibraryEntry[LibraryProviderT], ABC
Season container within a show.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
key
property
Return the unique key for this entity.
media_kind
property
Return the high-level media kind of this entity.
on_watching
abstractmethod
property
Whether the item is on the user's current watching list.
on_watchlist
abstractmethod
property
Whether the item is on the user's watchlist.
review
abstractmethod
async
property
Return the user's review text for this item, if any.
title
property
Return the entity title.
user_rating
abstractmethod
property
User rating on a 0-100 scale, or None if not rated.
view_count
abstractmethod
property
Total view count for the item (including children).
__eq__(other)
Compare entities by provider namespace and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
__hash__()
Compute a hash based on provider namespace, class name, and key.
__repr__()
Short representation including show title and season index.
episodes()
abstractmethod
Get child episodes belonging to the season.
Returns:
| Type | Description |
|---|---|
Sequence[LibraryEpisode[LibraryProviderT]]
|
Sequence[LibraryEpisode]: Child episodes. |
history()
abstractmethod
async
Return user history entries for this media item (tz-aware timestamps).
mapping_descriptors()
abstractmethod
Return possible mapping descriptors for the media item.
The returned descriptors refer to providers in the mapping database. They are not related to the library provider of this item (although, they might match).
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
media()
abstractmethod
provider()
section()
abstractmethod
show()
abstractmethod
Get the parent show of the season.
Returns:
| Name | Type | Description |
|---|---|---|
LibraryShow |
LibraryShow[LibraryProviderT]
|
The parent show. |
LibrarySection
dataclass
Bases: LibraryEntity[LibraryProviderT], ABC
Represents a logical collection/section within the media library.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
key
property
Return the unique key for this entity.
media_kind
property
Return the high-level media kind of this entity.
title
property
Return the entity title.
__eq__(other)
Compare entities by provider namespace and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
__hash__()
Compute a hash based on provider namespace, class name, and key.
__repr__()
LibraryShow
dataclass
Bases: LibraryEntry[LibraryProviderT], ABC
Episodic show/series in a media library.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
key
property
Return the unique key for this entity.
media_kind
property
Return the high-level media kind of this entity.
on_watching
abstractmethod
property
Whether the item is on the user's current watching list.
on_watchlist
abstractmethod
property
Whether the item is on the user's watchlist.
review
abstractmethod
async
property
Return the user's review text for this item, if any.
title
property
Return the entity title.
user_rating
abstractmethod
property
User rating on a 0-100 scale, or None if not rated.
view_count
abstractmethod
property
Total view count for the item (including children).
__eq__(other)
Compare entities by provider namespace and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
__hash__()
Compute a hash based on provider namespace, class name, and key.
__repr__()
episodes()
abstractmethod
Get child episodes belonging to the show.
Returns:
| Type | Description |
|---|---|
Sequence[LibraryEpisode[LibraryProviderT]]
|
Sequence[LibraryEpisode]: Child episodes. |
history()
abstractmethod
async
Return user history entries for this media item (tz-aware timestamps).
mapping_descriptors()
abstractmethod
Return possible mapping descriptors for the media item.
The returned descriptors refer to providers in the mapping database. They are not related to the library provider of this item (although, they might match).
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
media()
abstractmethod
provider()
seasons()
abstractmethod
Get child seasons belonging to the show.
Returns:
| Type | Description |
|---|---|
Sequence[LibrarySeason[LibraryProviderT]]
|
Sequence[LibrarySeason]: Child seasons. |
section()
abstractmethod
LibraryUser
dataclass
User information for a library provider.
Source code in .venv/lib/python3.14/site-packages/anibridge/library/base.py
MediaKind
Bases: StrEnum
Supported high-level media kinds within a library provider.