Skip to content

Commit

Permalink
misc: add more special featurettes detections
Browse files Browse the repository at this point in the history
- Add more special featurettes detections, but this time for the 'other'
  type episodes.
  • Loading branch information
revam committed May 2, 2024
1 parent 128b246 commit 9fbfc78
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Shokofin/API/Info/SeasonInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ public SeasonInfo(Series series, DateTime? earliestImportedAt, DateTime? lastImp
lastNormalEpisode = index;
break;
case EpisodeType.Other:
altEpisodesList.Add(episode);
if (episode.ExtraType != null)
extrasList.Add(episode);
else
altEpisodesList.Add(episode);
break;
default:
if (episode.ExtraType != null) {
Expand Down
16 changes: 15 additions & 1 deletion Shokofin/Utils/Ordering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,28 @@ public static int GetSeasonNumber(ShowInfo showInfo, SeasonInfo seasonInfo, Epis
switch (episode.Type)
{
case EpisodeType.Normal:
case EpisodeType.Other:
return null;
case EpisodeType.ThemeSong:
case EpisodeType.OpeningSong:
case EpisodeType.EndingSong:
return ExtraType.ThemeVideo;
case EpisodeType.Trailer:
return ExtraType.Trailer;
case EpisodeType.Other: {
var title = Text.GetTitlesForLanguage(episode.Titles, false, "en");
if (string.IsNullOrEmpty(title))
return null;
// Interview
if (title.Contains("interview", System.StringComparison.OrdinalIgnoreCase))
return ExtraType.Interview;
// Cinema/theatrical intro/outro
if (
(title.StartsWith("cinema ", System.StringComparison.OrdinalIgnoreCase) || title.StartsWith("theatrical ", System.StringComparison.OrdinalIgnoreCase)) &&
(title.Contains("intro", System.StringComparison.OrdinalIgnoreCase) || title.Contains("outro", System.StringComparison.OrdinalIgnoreCase))
)
return ExtraType.Clip;
return null;
}
case EpisodeType.Special: {
var title = Text.GetTitlesForLanguage(episode.Titles, false, "en");
if (string.IsNullOrEmpty(title))
Expand Down

0 comments on commit 9fbfc78

Please sign in to comment.