Fixed: Issue extracting subtitle information for unknown episodes

This commit is contained in:
Mark McDowall 2024-03-02 17:18:55 -08:00 committed by Mark McDowall
parent 07bd159436
commit 32c32e2f88
2 changed files with 11 additions and 4 deletions

View File

@ -4,6 +4,7 @@ using System.Linq;
using NLog; using NLog;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Extras.Files; using NzbDrone.Core.Extras.Files;
using NzbDrone.Core.Languages;
using NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation; using NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
@ -78,11 +79,11 @@ namespace NzbDrone.Core.Extras.Subtitles
SeasonNumber = localEpisode.SeasonNumber, SeasonNumber = localEpisode.SeasonNumber,
EpisodeFileId = firstEpisode.EpisodeFileId, EpisodeFileId = firstEpisode.EpisodeFileId,
RelativePath = series.Path.GetRelativePath(possibleSubtitleFile), RelativePath = series.Path.GetRelativePath(possibleSubtitleFile),
Language = localEpisode.SubtitleInfo.Language, Language = localEpisode.SubtitleInfo?.Language ?? Language.Unknown,
LanguageTags = localEpisode.SubtitleInfo.LanguageTags, LanguageTags = localEpisode.SubtitleInfo?.LanguageTags ?? new List<string>(),
Title = localEpisode.SubtitleInfo.Title, Title = localEpisode.SubtitleInfo?.Title,
Extension = extension, Extension = extension,
Copy = localEpisode.SubtitleInfo.Copy Copy = localEpisode.SubtitleInfo?.Copy ?? 0
}; };
subtitleFiles.Add(subtitleFile); subtitleFiles.Add(subtitleFile);

View File

@ -2,6 +2,7 @@ using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Extras.Subtitles; using NzbDrone.Core.Extras.Subtitles;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
@ -30,6 +31,11 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators
return localEpisode; return localEpisode;
} }
if (localEpisode.Episodes.Empty())
{
return localEpisode;
}
var firstEpisode = localEpisode.Episodes.First(); var firstEpisode = localEpisode.Episodes.First();
var episodeFile = firstEpisode.EpisodeFile.Value; var episodeFile = firstEpisode.EpisodeFile.Value;
localEpisode.SubtitleInfo = CleanSubtitleTitleInfo(episodeFile, path); localEpisode.SubtitleInfo = CleanSubtitleTitleInfo(episodeFile, path);