1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Fixed: Use empty string when {Original Title} is not available

This commit is contained in:
Mark McDowall 2014-09-28 00:47:24 -07:00
parent d34a170214
commit 3f11fcf2e1
2 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -615,5 +616,17 @@ public void should_remove_duplicate_non_word_characters()
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be("Venture.Bros.15x06");
}
[Test]
public void should_use_empty_string_instead_of_null_when_scene_name_is_not_available()
{
_namingConfig.RenameEpisodes = true;
_namingConfig.StandardEpisodeFormat = "{Original Title}";
_episodeFile.SceneName = null;
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be(String.Empty);
}
}
}

View File

@ -398,7 +398,7 @@ private void AddEpisodeTokens(Dictionary<String, Func<TokenMatch, String>> token
private void AddEpisodeFileTokens(Dictionary<String, Func<TokenMatch, String>> tokenHandlers, Series series, EpisodeFile episodeFile)
{
tokenHandlers["{Original Title}"] = m => episodeFile.SceneName;
tokenHandlers["{Original Title}"] = m => episodeFile.SceneName ?? String.Empty;
tokenHandlers["{Release Group}"] = m => episodeFile.ReleaseGroup ?? "DRONE";
tokenHandlers["{Quality Title}"] = m => GetQualityTitle(series, episodeFile.Quality);
}