diff --git a/Shokofin/Utils/OrderingUtil.cs b/Shokofin/Utils/OrderingUtil.cs
index e6bf8b63..b666cc1b 100644
--- a/Shokofin/Utils/OrderingUtil.cs
+++ b/Shokofin/Utils/OrderingUtil.cs
@@ -38,6 +38,12 @@ public enum GroupType
/// Group movies based on Shoko's series.
///
ShokoSeries = 3,
+
+ ///
+ /// Group both movies and shows into collections based on shoko's
+ /// groups.
+ ///
+ ShokoGroupPlus = 4,
}
///
@@ -78,7 +84,7 @@ public enum SpecialOrderType {
AfterSeason = 2,
///
- /// Use a mix of and .
+ /// Use a mix of and .
///
InBetweenSeasonMixed = 3,
@@ -93,68 +99,6 @@ public enum SpecialOrderType {
InBetweenSeasonByOtherData = 5,
}
- ///
- /// Get index number for a movie in a box-set.
- ///
- /// Absolute index.
- public static int GetMovieIndexNumber(ShowInfo group, SeasonInfo series, EpisodeInfo episode)
- {
- switch (Plugin.Instance.Configuration.BoxSetGrouping) {
- default:
- case GroupType.Default:
- return 1;
- case GroupType.ShokoSeries:
- return episode.AniDB.EpisodeNumber;
- case GroupType.ShokoGroup: {
- int offset = 0;
- foreach (SeasonInfo s in group.SeasonList) {
- var sizes = s.Shoko.Sizes.Total;
- if (s != series) {
- if (episode.AniDB.Type == EpisodeType.Special) {
- var index = series.SpecialsList.FindIndex(e => string.Equals(e.Id, episode.Id));
- if (index == -1)
- throw new System.IndexOutOfRangeException($"Episode not in the filtered specials list. (Group={group.Id},Series={series.Id},Episode={episode.Id})");
- return offset - (index + 1);
- }
- switch (episode.AniDB.Type) {
- case EpisodeType.Normal:
- // offset += 0; // it's not needed, so it's just here as a comment instead.
- break;
- case EpisodeType.Special:
- offset += sizes?.Episodes ?? 0;
- goto case EpisodeType.Normal;
- case EpisodeType.Unknown:
- offset += sizes?.Specials ?? 0;
- goto case EpisodeType.Special;
- // Add them to the bottom of the list if we didn't filter them out properly.
- case EpisodeType.Parody:
- offset += sizes?.Others ?? 0;
- goto case EpisodeType.Unknown;
- case EpisodeType.OpeningSong:
- offset += sizes?.Parodies ?? 0;
- goto case EpisodeType.Parody;
- case EpisodeType.Trailer:
- offset += sizes?.Credits ?? 0;
- goto case EpisodeType.OpeningSong;
- default:
- offset += sizes?.Trailers ?? 0;
- goto case EpisodeType.Trailer;
- }
- return offset + episode.AniDB.EpisodeNumber;
- }
- else {
- if (episode.AniDB.Type == EpisodeType.Special) {
- offset -= series.SpecialsList.Count;
- }
- offset += (sizes?.Episodes ?? 0) + (sizes?.Parodies ?? 0) + (sizes?.Others ?? 0);
- }
- }
- break;
- }
- }
- return 0;
- }
-
///
/// Get index number for an episode in a series.
///
@@ -169,7 +113,7 @@ public static int GetEpisodeNumber(ShowInfo group, SeasonInfo series, EpisodeInf
var index = series.SpecialsList.FindIndex(e => string.Equals(e.Id, episode.Id));
if (index == -1)
throw new System.IndexOutOfRangeException($"Episode not in the filtered specials list. (Series={series.Id},Episode={episode.Id})");
- return (index + 1);
+ return index + 1;
}
return episode.AniDB.EpisodeNumber;
case GroupType.MergeFriendly: {
@@ -181,14 +125,14 @@ public static int GetEpisodeNumber(ShowInfo group, SeasonInfo series, EpisodeInf
case GroupType.ShokoGroup: {
int offset = 0;
if (episode.AniDB.Type == EpisodeType.Special) {
- var seriesIndex = group.SeasonList.FindIndex(s => string.Equals(s.Id, series.Id));
- if (seriesIndex == -1)
+ var seasonIndex = group.SeasonList.FindIndex(s => string.Equals(s.Id, series.Id));
+ if (seasonIndex == -1)
throw new System.IndexOutOfRangeException($"Series is not part of the provided group. (Group={group.Id},Series={series.Id},Episode={episode.Id})");
var index = series.SpecialsList.FindIndex(e => string.Equals(e.Id, episode.Id));
if (index == -1)
throw new System.IndexOutOfRangeException($"Episode not in the filtered specials list. (Group={group.Id},Series={series.Id},Episode={episode.Id})");
- offset = group.SeasonList.GetRange(0, seriesIndex).Aggregate(0, (count, series) => count + series.SpecialsList.Count);
- return offset + (index + 1);
+ offset = group.SeasonList.GetRange(0, seasonIndex).Aggregate(0, (count, series) => count + series.SpecialsList.Count);
+ return offset + index + 1;
}
var sizes = series.Shoko.Sizes.Total;
switch (episode.AniDB.Type) {
@@ -332,7 +276,6 @@ public static int GetSeasonNumber(ShowInfo group, SeasonInfo series, EpisodeInfo
if (!group.SeasonNumberBaseDictionary.TryGetValue(series, out var seasonNumber))
throw new System.IndexOutOfRangeException($"Series is not part of the provided group. (Group={group.Id},Series={series.Id})");
-
var offset = 0;
switch (episode.AniDB.Type) {
default:
@@ -347,7 +290,7 @@ public static int GetSeasonNumber(ShowInfo group, SeasonInfo series, EpisodeInfo
}
}
- return seasonNumber + (seasonNumber < 0 ? -offset : offset);
+ return seasonNumber + offset;
}
}
}
@@ -384,7 +327,7 @@ public static int GetSeasonNumber(ShowInfo group, SeasonInfo series, EpisodeInfo
return ExtraType.Clip;
// Music videos
if (title.Contains("music video", System.StringComparison.OrdinalIgnoreCase))
- return ExtraType.Clip;
+ return ExtraType.ThemeVideo;
// Behind the Scenes
if (title.Contains("making of", System.StringComparison.CurrentCultureIgnoreCase))
return ExtraType.BehindTheScenes;
diff --git a/Shokofin/Utils/TextUtil.cs b/Shokofin/Utils/TextUtil.cs
index a796583a..c17dbb4c 100644
--- a/Shokofin/Utils/TextUtil.cs
+++ b/Shokofin/Utils/TextUtil.cs
@@ -309,7 +309,7 @@ public static string GetTitle(IEnumerable seriesTitles, IEnumerable GetTitleByType(seriesTitles, TitleType.Main) ?? seriesTitle;
- var getEpisodeTitle = () => GetTitleByLanguages(episodeTitles, "en", mainTitleLanguage) ?? episodeTitle;
+ var getEpisodeTitle = () => episodeTitle;
return ConstructTitle(getSeriesTitle, getEpisodeTitle, outputType);
}
}