List Provider API
AniBridge list provider base classes package.
ListEntity
dataclass
Bases: ABC
Base class for list entities.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
key
property
Return the unique key for this entity.
title
property
Return the title of this entity.
__eq__(other)
Check equality with another ListEntity based on provider and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
__hash__()
Compute a hash based on the provider namespace, class name, and key.
__repr__()
Return a string representation of the ListEntity.
ListEntry
dataclass
Bases: ListEntity[ProviderT], ABC
Base class for list entries for a given media item.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
finished_at
abstractmethod
property
writable
Timestamp when the user first completed the entry (timezone-aware).
key
property
Return the unique key for this entity.
progress
abstractmethod
property
writable
Progress integer (e.g., episodes watched).
repeats
abstractmethod
property
writable
Repeat count for the entry.
review
abstractmethod
property
writable
User review text, if any.
started_at
abstractmethod
property
writable
Timestamp when the user started the entry (timezone-aware).
status
abstractmethod
property
writable
Watch status for the entry.
title
property
Return the title of this entity.
user_rating
abstractmethod
property
writable
User rating on a 0-100 scale.
__eq__(other)
Check equality with another ListEntity based on provider and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
__hash__()
Compute a hash based on the provider namespace, class name, and key.
__repr__()
Return a string representation of the ListEntity.
media()
abstractmethod
Get the media item associated with this entry.
For an efficient implementation, this should return a cached media item if possible, rather than fetching it anew each time.
Returns:
| Name | Type | Description |
|---|---|---|
ListMedia |
ListMedia[ProviderT]
|
The media item associated with this entry. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
ListMedia
dataclass
Bases: ListEntity[ProviderT], ABC
Base class for media items in a provider list.
Subclasses should call the base constructor and may override properties if they need custom behaviour; defaults store values provided at init time.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
external_url
property
URL to the provider's media item, if available.
key
property
Return the unique key for this entity.
labels
property
Display labels such as season or release year.
media_type
abstractmethod
property
Type of media (e.g., TV, MOVIE).
poster_image
property
Poster or cover image URL, if provided by the provider.
title
property
Return the title of this entity.
total_units
abstractmethod
property
Total number of units (episodes/chapters) for the media.
__eq__(other)
Check equality with another ListEntity based on provider and key.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
__hash__()
Compute a hash based on the provider namespace, class name, and key.
__repr__()
Return a string representation of the ListEntity.
ListMediaType
ListProvider
Bases: ABC
Abstract base provider that exposes a user media list.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
279 280 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
__init__(*, config=None)
Initialize the provider with optional configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
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/list/base.py
backup_list()
async
Backup the entire list from the provider.
It is up to the implementation to decide the format of the backup data. Whatever format, it should be serializable/deserializable as a string.
Backup capabilities are optional. If a provider does not support backups, this method should raise a NotImplementedError.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
A serialized string representation of all list entries. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/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/list/base.py
close()
async
delete_entry(key)
abstractmethod
async
Delete a list entry by its media key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The unique key of the media item to delete. |
required |
get_entries_batch(keys)
async
Retrieve multiple list entries by their media keys.
The order of the returned sequence must match the order of the input keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
Sequence[str]
|
The unique keys of the media items to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[ListEntry[Self] | None]
|
Sequence[ListEntry | None]: A sequence of list entries, with None for any not found. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
get_entry(key)
abstractmethod
async
Retrieve a list entry by its media key.
Only return None if the media item does not exist on the provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The unique key of the media item to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
ListEntry[Self] | None
|
ListEntry | None: The list entry if found, otherwise None. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
initialize()
async
Asynchronous initialization hook.
Put any async logic that should be run after construction here.
resolve_mapping_descriptors(descriptors)
abstractmethod
async
Resolve mapping descriptors into list media keys.
Implementations should return one ListTarget for each mapping descriptor that can be resolved into a list media key. Multiple list keys may be returned for a single descriptor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
descriptors
|
Sequence[MappingDescriptor]
|
Mapping descriptors to resolve. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[ListTarget]
|
Sequence[ListTarget]: The resolved descriptor/key pairs. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
restore_list(backup)
async
Restore list entries from a backup string.
The format of the backup string is determined by the implementation
of backup_list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backup
|
str
|
The serialized string representation of the list entries. |
required |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
search(query)
async
Search the provider for entries matching the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The search query string. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[ListEntry[Self]]
|
Sequence[ListEntry]: A sequence of matching list entries. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
update_entries_batch(entries)
async
Update multiple list entries in a single operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Sequence[ListEntry]
|
The list entries to update. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[ListEntry[Self] | None]
|
Sequence[ListEntry | None]: A sequence of updated list entries, with None for any that could not be updated. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
update_entry(key, entry)
abstractmethod
async
Update a list entry with new information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The unique key of the media item to update. |
required |
entry
|
ListEntry
|
The updated entry information. |
required |
Returns:
| Type | Description |
|---|---|
ListEntry[Self] | None
|
ListEntry | None: The updated list entry, or None if the update failed. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
user()
abstractmethod
Return the associated user object, if any.
Returns:
| Type | Description |
|---|---|
ListUser | None
|
User | None: The associated user object, if any. |
ListProviderRegistry
Registry for ListProvider implementations.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/registry.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
__contains__(namespace)
Check if a provider is registered under namespace.
__init__()
__iter__()
clear()
create(namespace, *, config=None)
Instantiate the provider registered under namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str
|
The namespace identifier to create. |
required |
config
|
dict | None
|
Optional configuration dictionary to pass to the provider constructor. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
ListProvider |
ListProvider
|
An instance of the registered provider. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/registry.py
get(namespace)
Return the provider class registered under namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str
|
The namespace identifier to look up. |
required |
Returns:
| Type | Description |
|---|---|
type[ListProvider]
|
type[ListProvider]: The registered provider class. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/registry.py
namespaces()
register(provider_cls=None, *, namespace=None)
Register a provider class, optionally used as a decorator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider_cls
|
type[LP] | None
|
The provider class to register. If |
None
|
namespace
|
str | None
|
Explicit namespace override. Defaults to the class'
|
None
|
Returns:
| Type | Description |
|---|---|
type[LP] | Callable[[type[LP]], type[LP]]
|
type[LP] | Callable[[type[LP]], type[LP]]: The registered provider class, or a decorator that registers the class. |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/registry.py
unregister(namespace)
Remove a provider registration if it exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str
|
The namespace identifier to unregister. |
required |
Source code in .venv/lib/python3.14/site-packages/anibridge/list/registry.py
ListStatus
Bases: StrEnum
Supported statuses for media items in a list.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
priority
property
Get the priority of the ListStatus for comparison purposes.
__eq__(other)
Check equality with another ListStatus (not based on priority).
__ge__(other)
Check if this ListStatus has higher or equal priority than another.
Source code in .venv/lib/python3.14/site-packages/anibridge/list/base.py
__gt__(other)
Check if this ListStatus has higher priority than another.
__le__(other)
Check if this ListStatus has lower or equal priority than another.
__lt__(other)
Check if this ListStatus has lower priority than another.
ListTarget
dataclass
ListUser
dataclass
list_provider(cls=None, *, namespace=None, registry=None)
Class decorator that registers ListProvider implementations.
This helper lets third-party providers register themselves declaratively:
```
from anibridge.list import list_provider
@list_provider(namespace="anilist")
class AnilistListProvider:
NAMESPACE = "anilist"
...
```
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
type[LP] | None
|
The provider class to register. If |
None
|
namespace
|
str | None
|
Explicit namespace override. Defaults to the class'
|
None
|
registry
|
ListProviderRegistry | None
|
Alternate registry to insert into. Defaults to the module-level one. |
None
|
Returns:
| Type | Description |
|---|---|
type[LP] | Callable[[type[LP]], type[LP]]
|
type[LP] | Callable[[type[LP]], type[LP]]: The registered provider class, or a decorator that registers the class. |