Skip to content

Commit

Permalink
fix: skip auto-matching future episodes
Browse files Browse the repository at this point in the history
  • Loading branch information
revam committed Sep 29, 2024
1 parent 4577af3 commit 780a906
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Shoko.Server/Providers/TMDB/TmdbLinkingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,12 @@ private CrossRef_AniDB_TMDB_Episode TryFindAnidbAndTmdbMatch(SVR_AniDB_Anime ani
}

var anidbDate = anidbEpisode.GetAirDateAsDateOnly();
if (anidbDate is not null && anidbDate > DateOnly.FromDateTime(DateTime.UtcNow.AddDays(1)))
{
_logger.LogTrace("Skipping future episode {EpisodeID}", anidbEpisode.EpisodeID);
return new(anidbEpisode.EpisodeID, anidbEpisode.AnimeID, 0, 0, MatchRating.SarahJessicaParker, 0);
}

var airdateProbability = tmdbEpisodes
.Select(episode => new { episode, probability = CalculateAirDateProbability(anidbDate, episode.AiredAt) })
.Where(result => result.probability != 0)
Expand Down

0 comments on commit 780a906

Please sign in to comment.