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

pull/6/head
Mark McDowall 10 years ago
parent d34a170214
commit 3f11fcf2e1

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -615,5 +616,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
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);
}
}
}

@ -398,7 +398,7 @@ namespace NzbDrone.Core.Organizer
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);
}

Loading…
Cancel
Save