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