Skip to content

Commit ffa2301

Browse files
committed
fix: respect no merge tag
If you want a series to never be merged, then (potentially create and) add the `"shokofin/no merge"` custom tag on the series in shoko server, and it will never be merged with another series in the plugin.
1 parent dc39caf commit ffa2301

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Shokofin/API/ShokoAPIManager.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,10 @@ private async Task<SeasonInfo> CreateSeasonInfo(Series series)
851851
if (series.AniDBEntity.AirDate is null)
852852
return (primaryId, extraIds);
853853

854+
var customTags = await GetNamespacedTagsForSeries(primaryId).ConfigureAwait(false);
855+
if (customTags.ContainsKey("/custom user tags/shokofin/no merge"))
856+
return (primaryId, extraIds);
857+
854858
Logger.LogTrace("Creating new series-to-season mapping for series. (Series={SeriesId})", primaryId);
855859

856860
// We potentially have a "follow-up" season candidate, so look for the "primary" season candidate, then jump into that.
@@ -886,6 +890,10 @@ private async Task<SeasonInfo> CreateSeasonInfo(Series series)
886890
continue;
887891
}
888892

893+
var prequelCustomTags = await GetNamespacedTagsForSeries(prequelSeries.IDs.Shoko.ToString()).ConfigureAwait(false);
894+
if (prequelCustomTags.ContainsKey("/custom user tags/shokofin/no merge"))
895+
continue;
896+
889897
var prequelMainTitle = prequelSeries.AniDBEntity.Titles.First(title => title.Type == TitleType.Main).Value;
890898
var prequelResult = YearRegex.Match(prequelMainTitle);
891899
if (!prequelResult.Success) {
@@ -937,6 +945,10 @@ private async Task<SeasonInfo> CreateSeasonInfo(Series series)
937945
continue;
938946
}
939947

948+
var sequelCustomTags = await GetNamespacedTagsForSeries(sequelSeries.IDs.Shoko.ToString()).ConfigureAwait(false);
949+
if (sequelCustomTags.ContainsKey("/custom user tags/shokofin/no merge"))
950+
continue;
951+
940952
var sequelMainTitle = sequelSeries.AniDBEntity.Titles.First(title => title.Type == TitleType.Main).Value;
941953
var sequelResult = YearRegex.Match(sequelMainTitle);
942954
if (!sequelResult.Success)

0 commit comments

Comments
 (0)