Fixed: Matching of custom formats during episode file import

This commit is contained in:
bpoxy 2023-04-01 18:03:53 -06:00 committed by GitHub
parent a776b68574
commit 7fedfe7423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -107,7 +107,7 @@ namespace NzbDrone.Core.CustomFormats
var episodeInfo = new ParsedEpisodeInfo
{
SeriesTitle = localEpisode.Series.Title,
ReleaseTitle = localEpisode.SceneName,
ReleaseTitle = localEpisode.SceneName.IsNotNullOrWhiteSpace() ? localEpisode.SceneName : Path.GetFileName(localEpisode.Path),
Quality = localEpisode.Quality,
Languages = localEpisode.Languages,
ReleaseGroup = localEpisode.ReleaseGroup
@ -118,7 +118,8 @@ namespace NzbDrone.Core.CustomFormats
EpisodeInfo = episodeInfo,
Series = localEpisode.Series,
Size = localEpisode.Size,
Languages = localEpisode.Languages
Languages = localEpisode.Languages,
Filename = Path.GetFileName(localEpisode.Path)
};
return ParseCustomFormat(input);
@ -154,25 +155,25 @@ namespace NzbDrone.Core.CustomFormats
private static List<CustomFormat> ParseCustomFormat(EpisodeFile episodeFile, Series series, List<CustomFormat> allCustomFormats)
{
var sceneName = string.Empty;
var releaseTitle = string.Empty;
if (episodeFile.SceneName.IsNotNullOrWhiteSpace())
{
sceneName = episodeFile.SceneName;
releaseTitle = episodeFile.SceneName;
}
else if (episodeFile.OriginalFilePath.IsNotNullOrWhiteSpace())
{
sceneName = Path.GetFileName(episodeFile.OriginalFilePath);
releaseTitle = Path.GetFileName(episodeFile.OriginalFilePath);
}
else if (episodeFile.RelativePath.IsNotNullOrWhiteSpace())
{
sceneName = Path.GetFileName(episodeFile.RelativePath);
releaseTitle = Path.GetFileName(episodeFile.RelativePath);
}
var episodeInfo = new ParsedEpisodeInfo
{
SeriesTitle = series.Title,
ReleaseTitle = sceneName,
ReleaseTitle = releaseTitle,
Quality = episodeFile.Quality,
Languages = episodeFile.Languages,
ReleaseGroup = episodeFile.ReleaseGroup