diff --git a/Shoko.Server/API/v3/Controllers/SeriesController.cs b/Shoko.Server/API/v3/Controllers/SeriesController.cs
index 510df94f4..691bc33d2 100644
--- a/Shoko.Server/API/v3/Controllers/SeriesController.cs
+++ b/Shoko.Server/API/v3/Controllers/SeriesController.cs
@@ -2110,7 +2110,7 @@ private static void CheckTitlesStartsWith(SVR_AnimeSeries a, string query,
/// Page number.
///
[HttpGet("WithSoftDuplicates")]
- public ActionResult> GetSeriesWithSoftDuplicates(
+ public ActionResult> GetSeriesWithSoftDuplicates(
[FromQuery, ModelBinder(typeof(CommaDelimitedModelBinder))] HashSet includeDataFrom = null,
[FromQuery] bool ignoreVariations = true,
[FromQuery] bool onlyFinishedSeries = false,
@@ -2127,7 +2127,9 @@ public ActionResult> GetSeriesWithSoftDuplicates(
}
return enumerable
- .ToListResult(series => _seriesFactory.GetSeries(series, false, includeDataFrom), page, pageSize);
+ .OrderBy(series => series.GetSeriesName())
+ .ThenBy(series => series.AniDB_ID)
+ .ToListResult(series => _seriesFactory.GetSeriesWithDuplicatesResult(series, false, includeDataFrom, ignoreVariations), page, pageSize);
}
#endregion
diff --git a/Shoko.Server/API/v3/Helpers/SeriesFactory.cs b/Shoko.Server/API/v3/Helpers/SeriesFactory.cs
index 7033dd2bd..a6ef1a890 100644
--- a/Shoko.Server/API/v3/Helpers/SeriesFactory.cs
+++ b/Shoko.Server/API/v3/Helpers/SeriesFactory.cs
@@ -866,4 +866,30 @@ public SeriesSearchResult GetSeriesSearchResult(SeriesSearch.SearchResult includeDataFrom = null,
+ bool ignoreVariations = true)
+ {
+ var series = GetSeries(animeSeries, randomiseImages, includeDataFrom);
+ var episodesWithSoftDuplicates = RepoFactory.AnimeEpisode.GetWithSoftDuplicates(ignoreVariations, animeSeries.AniDB_ID).Count;
+ return new()
+ {
+ Name = series.Name,
+ IDs = series.IDs,
+ Size = series.Size,
+ Sizes = series.Sizes,
+ Created = series.Created,
+ Updated = series.Updated,
+ AirsOn = series.AirsOn,
+ UserRating = series.UserRating,
+ Images = series.Images,
+ Links = series.Links,
+ _AniDB = series._AniDB,
+ _TvDB = series._TvDB,
+ EpisodesWithSoftDuplicates = episodesWithSoftDuplicates,
+ };
+ }
}
diff --git a/Shoko.Server/API/v3/Models/Shoko/Series.cs b/Shoko.Server/API/v3/Models/Shoko/Series.cs
index 92a32613f..ec777fcbf 100644
--- a/Shoko.Server/API/v3/Models/Shoko/Series.cs
+++ b/Shoko.Server/API/v3/Models/Shoko/Series.cs
@@ -481,6 +481,17 @@ public class SeriesSearchResult : Series
public string Match { get; set; } = string.Empty;
}
+///
+/// An extended model for use with the soft duplicate endpoint.
+///
+public class SeriesWithDuplicatesResult : Series
+{
+ ///
+ /// Number of episodes in the series which have soft duplicates.
+ ///
+ public int EpisodesWithSoftDuplicates { get; set; }
+}
+
public enum SeriesType
{
///