fix: episode refresh resilience and allanime fallback

This commit is contained in:
2026-05-29 21:12:53 +02:00
committed by Milas Holsting
parent 9383e132e7
commit 704b03655b
2 changed files with 35 additions and 3 deletions

View File

@@ -220,6 +220,7 @@ func (c *AllAnimeProvider) GetEpisodeAvailabilityByProviderID(ctx context.Contex
func (c *AllAnimeProvider) resolveShowIDStrict(ctx context.Context, animeID int, titleCandidates []string, mode string) (string, error) {
targetMalIDStr := strconv.Itoa(animeID)
var firstAvailableShowID string
for _, title := range titleCandidates {
searchResults, err := c.Search(ctx, title, mode)
if err != nil {
@@ -229,8 +230,14 @@ func (c *AllAnimeProvider) resolveShowIDStrict(ctx context.Context, animeID int,
if res.MalID == targetMalIDStr {
return res.ID, nil
}
if firstAvailableShowID == "" {
firstAvailableShowID = res.ID
}
}
}
if firstAvailableShowID != "" {
return firstAvailableShowID, nil
}
return "", fmt.Errorf("allanime: no strict mal id match for %d", animeID)
}