diff --git a/Jellyfin.Plugin.Bangumi/Providers/SeasonProvider.cs b/Jellyfin.Plugin.Bangumi/Providers/SeasonProvider.cs index 901ae25..fc8f12d 100644 --- a/Jellyfin.Plugin.Bangumi/Providers/SeasonProvider.cs +++ b/Jellyfin.Plugin.Bangumi/Providers/SeasonProvider.cs @@ -46,7 +46,7 @@ public async Task> GetMetadata(SeasonInfo info, Cancellat }; var localConfiguration = await LocalConfiguration.ForPath(info.Path); - var parent = _libraryManager.FindByPath(Path.GetDirectoryName(info.Path), true); + var seasonPath = Path.GetDirectoryName(info.Path); var subjectId = 0; if (localConfiguration.Id != 0) @@ -65,7 +65,7 @@ public async Task> GetMetadata(SeasonInfo info, Cancellat { subjectId = subjectIdFromParent; } - else if (parent is Series series) + else if (seasonPath is not null && _libraryManager.FindByPath(seasonPath, true) is Series series) { var previousSeason = series.Children // Search "Season 2" for "Season 1" and "Season 2 Part X"