sok.media.base_media
Base media class with API integration.
Provides the BaseMedia class that extends MediaItem with functionality to search for and retrieve metadata from configured media APIs.
BaseMedia
class BaseMedia( title: str, media_type: MediaType, content_type: ContentType, media_manager: UniversalMediaManager, language: str = 'en',)Bases: MediaItem
Base class for all media items with API integration.
Extends MediaItem with functionality to search and retrieve metadata from configured media APIs.
Initialize a media item with API support.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
title | str | The item's display title. | |
media_type | MediaType | The media category (VIDEO, MUSIC, etc.). | |
content_type | ContentType | The specific content type. | |
media_manager | UniversalMediaManager | Manager instance for API calls. | |
language | str | 'en' | Language code for searches (default: 'en'). |
Attributes
| Name | Description |
|---|---|
language | Language code for API requests. |
media_manager | Manager for API operations. |
path | Storage path for the media item. |
get_folder_structureabstractmethod
def get_folder_structure() -> List[str]:Return the recommended folder hierarchy for this item.
Returns
List[str]A list of folder names representing the path structure.
get_formatted_nameabstractmethod
def get_formatted_name() -> str:Return the formatted filename for this media item.
Returns
strA formatted string suitable for use as a filename.
search_and_set_mediaasync
async def search_and_set_media() -> None:Search for and populate media metadata from API.
Searches using the configured API and updates this item's metadata with the first matching result.
Raises
ValueErrorIf no results are found for the title.
set_path
def set_path(path: str) -> None:Set the storage path for this media item.
Parameters
| Name | Type | Description |
|---|---|---|
path | str | File system path where the media is stored. |