fix missing list

This commit is contained in:
Lukas 2025-11-02 15:29:16 +01:00
parent a80bfba873
commit 5c88572ac7

View File

@ -27,12 +27,15 @@ async def get_anime_status(
HTTPException: If status retrieval fails
"""
try:
directory = getattr(series_app, "directory", "") if series_app else ""
directory = (
getattr(series_app, "directory_to_search", "")
if series_app else ""
)
# Get series count
series_count = 0
if series_app and hasattr(series_app, "List"):
series = series_app.List.GetList()
if series_app and hasattr(series_app, "list"):
series = series_app.list.GetList()
series_count = len(series) if series else 0
return {
@ -166,10 +169,10 @@ async def list_anime(
try:
# Get missing episodes from series app
if not hasattr(series_app, "List"):
if not hasattr(series_app, "list"):
return []
series = series_app.List.GetMissingEpisode()
series = series_app.list.GetMissingEpisode()
summaries: List[AnimeSummary] = []
for serie in series:
# Get all properties from the serie object
@ -499,8 +502,8 @@ async def add_series(
detail="Series name cannot be empty",
)
# Check if series_app has the List attribute
if not hasattr(series_app, "List"):
# Check if series_app has the list attribute
if not hasattr(series_app, "list"):
raise HTTPException(
status_code=status.HTTP_501_NOT_IMPLEMENTED,
detail="Series list functionality not available",
@ -520,7 +523,7 @@ async def add_series(
)
# Add the series to the list
series_app.List.add(serie)
series_app.list.add(serie)
# Refresh the series list to update the cache
if hasattr(series_app, "refresh_series_list"):
@ -558,13 +561,13 @@ async def get_anime(
"""
try:
# Check if series_app is available
if not series_app or not hasattr(series_app, "List"):
if not series_app or not hasattr(series_app, "list"):
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="Series not found",
)
series = series_app.List.GetList()
series = series_app.list.GetList()
found = None
for serie in series:
matches_key = getattr(serie, "key", None) == anime_id