mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-18 02:54:07 +02:00
feat: add loading bar component and integrate it into TV shows and recommendations loading states and cache metadataprovider responsens in backend
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
from cachetools import TTLCache, cached
|
||||
|
||||
import metadataProvider.tmdb
|
||||
import metadataProvider.tvdb
|
||||
@@ -7,6 +8,7 @@ from metadataProvider.schemas import MetaDataProviderShowSearchResult
|
||||
from tv.schemas import Show
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
search_show_cache = TTLCache(maxsize=128, ttl=24 * 60 * 60) # Cache for 24 hours
|
||||
|
||||
|
||||
def get_show_metadata(id: int = None, provider: str = "tmdb") -> Show:
|
||||
@@ -15,6 +17,7 @@ def get_show_metadata(id: int = None, provider: str = "tmdb") -> Show:
|
||||
return metadata_providers[provider].get_show_metadata(id)
|
||||
|
||||
|
||||
@cached(search_show_cache)
|
||||
def search_show(query: str | None = None, provider: str = "tmdb") -> list[MetaDataProviderShowSearchResult]:
|
||||
"""
|
||||
If no query is provided, it will return the most popular shows.
|
||||
|
||||
Reference in New Issue
Block a user