Skip to content

Commit

Permalink
fix: add fast paths for 1 and 0 xrefs in playlist for videos
Browse files Browse the repository at this point in the history
  • Loading branch information
revam committed Nov 1, 2024
1 parent 31e56e9 commit 5c36776
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Shoko.Server/Services/GeneratedPlaylistService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,17 @@ public bool TryParsePlaylist(string[] items, out IReadOnlyList<(IReadOnlyList<IS
private IEnumerable<(IReadOnlyList<IShokoEpisode> episodes, IReadOnlyList<IVideo> videos)> GetListForVideo(IVideo video)
{
var crossReferences = video.CrossReferences;
if (crossReferences.Count is 0)
return [];

if (crossReferences.Count is 1)
{
if (crossReferences[0].ShokoEpisode is not { } episode)
return [];

return [([episode], [video])];
}

var seriesOrder = crossReferences
.OrderBy(xref => xref.Order)
.Select(xref => xref.AnidbAnimeID)
Expand Down

0 comments on commit 5c36776

Please sign in to comment.