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:
maxDorninger
2025-05-25 14:36:50 +02:00
parent e9578cbeaf
commit 304ff6b42d
13 changed files with 104 additions and 38 deletions

View File

@@ -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.