diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
index e94b8cd7e..c484ba79a 100644
--- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
+++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
@@ -228,6 +228,7 @@
+
diff --git a/src/NzbDrone.Core.Test/OrganizerTests/CleanTitleFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/CleanTitleFixture.cs
new file mode 100644
index 000000000..82b8b2e76
--- /dev/null
+++ b/src/NzbDrone.Core.Test/OrganizerTests/CleanTitleFixture.cs
@@ -0,0 +1,74 @@
+using System.Collections.Generic;
+using System.Linq;
+using FizzWare.NBuilder;
+using FluentAssertions;
+using NUnit.Framework;
+using NzbDrone.Core.MediaFiles;
+using NzbDrone.Core.Organizer;
+using NzbDrone.Core.Qualities;
+using NzbDrone.Core.Test.Framework;
+using NzbDrone.Core.Tv;
+
+namespace NzbDrone.Core.Test.OrganizerTests
+{
+ [TestFixture]
+ public class CleanTitleFixture : CoreTest
+ {
+ private Series _series;
+ private Episode _episode;
+ private EpisodeFile _episodeFile;
+ private NamingConfig _namingConfig;
+
+ [SetUp]
+ public void Setup()
+ {
+ _series = Builder
+ .CreateNew()
+ .With(s => s.Title = "South Park")
+ .Build();
+
+ _episode = Builder.CreateNew()
+ .With(e => e.Title = "City Sushi")
+ .With(e => e.SeasonNumber = 15)
+ .With(e => e.EpisodeNumber = 6)
+ .With(e => e.AbsoluteEpisodeNumber = 100)
+ .Build();
+
+ _episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p), ReleaseGroup = "SonarrTest" };
+
+ _namingConfig = new NamingConfig();
+ _namingConfig.RenameEpisodes = true;
+
+ Mocker.GetMock()
+ .Setup(c => c.GetConfig()).Returns(_namingConfig);
+
+ Mocker.GetMock()
+ .Setup(v => v.Get(Moq.It.IsAny()))
+ .Returns(v => Quality.DefaultQualityDefinitions.First(c => c.Quality == v));
+ }
+
+ [TestCase("Florence + the Machine", "Florence + the Machine")]
+ [TestCase("Beyoncé X10", "Beyoncé X10")]
+ [TestCase("Girlfriends' Guide to Divorce", "Girlfriends Guide to Divorce")]
+ [TestCase("Rule #23: Never Lie to the Kids", "Rule #23 Never Lie to the Kids")]
+ [TestCase("Anne Hathaway/Florence + The Machine", "Anne Hathaway Florence + The Machine")]
+ [TestCase("Chris Rock/Prince", "Chris Rock Prince")]
+ [TestCase("Karma's a B*tch!", "Karmas a B-tch!")]
+ [TestCase("Ke$ha: My Crazy Beautiful Life", "Ke$ha My Crazy Beautiful Life")]
+ [TestCase("$#*! My Dad Says", "$#-! My Dad Says")]
+ [TestCase("Free! - Iwatobi Swim Club", "Free! Iwatobi Swim Club")]
+ [TestCase("Tamara Ecclestone: Billion $$ Girl", "Tamara Ecclestone Billion $$ Girl")]
+ [TestCase("Marvel's Agents of S.H.I.E.L.D.", "Marvels Agents of S.H.I.E.L.D")]
+ [TestCase("Castle (2009)", "Castle 2009")]
+// [TestCase("", "")]
+// [TestCase("", "")]
+ public void should_get_expected_title_back(string title, string expected)
+ {
+ _series.Title = title;
+ _namingConfig.StandardEpisodeFormat = "{Series CleanTitle}";
+
+ Subject.BuildFileName(new List { _episode }, _series, _episodeFile)
+ .Should().Be(expected);
+ }
+ }
+}
diff --git a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderFixture.cs
index d703ec1c5..857c6a434 100644
--- a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderFixture.cs
+++ b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderFixture.cs
@@ -874,37 +874,5 @@ public void should_use_Sonarr_as_release_group_when_not_available()
Subject.BuildFileName(new List { _episode1 }, _series, _episodeFile)
.Should().Be("Sonarr");
}
-
- [Test]
- public void should_scenify_series_title_when_using_period_separator()
- {
- _series.Title = "Girlfriends' Guide to Divorce";
- _namingConfig.StandardEpisodeFormat = "{Series.CleanTitle}";
-
- Subject.BuildFileName(new List { _episode1 }, _series, _episodeFile)
- .Should().Be("Girlfriends.Guide.to.Divorce");
- }
-
- [Test]
- public void should_scenify_episode_title_when_using_period_separator()
- {
- _episode1.Title = "Rule #23: Never Lie to the Kids";
-
- _namingConfig.StandardEpisodeFormat = "{Episode.CleanTitle}";
-
- Subject.BuildFileName(new List { _episode1 }, _series, _episodeFile)
- .Should().Be("Rule.#23.Never.Lie.to.the.Kids");
- }
-
- [Test]
- public void should_replace_forward_slash_sign_when_scenifying_episode_title()
- {
- _episode1.Title = "Anne Hathaway/Florence + The Machine";
-
- _namingConfig.StandardEpisodeFormat = "{Episode.CleanTitle}";
-
- Subject.BuildFileName(new List { _episode1 }, _series, _episodeFile)
- .Should().Be("Anne.Hathaway.Florence.The.Machine");
- }
}
}
diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs
index 3d3fcdff3..815905375 100644
--- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs
+++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs
@@ -56,8 +56,9 @@ public class FileNameBuilder : IBuildFileNames
private static readonly Regex FileNameCleanupRegex = new Regex(@"([- ._])(\1)+", RegexOptions.Compiled);
private static readonly Regex TrimSeparatorsRegex = new Regex(@"[- ._]$", RegexOptions.Compiled);
- private static readonly Regex ScenifyRemoveChars = new Regex(@"[^a-z0-9+#\/ ]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
- private static readonly Regex ScenifyReplaceChars = new Regex(@"[+\/]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ //private static readonly Regex ScenifyRemoveChars = new Regex(@"(?|\/|\\|;|:|'|""|\||`|~|!|@|$|%|^|&|\*|-|_|=){1}(?=\s)|('|:)(?=s|\s)|(\(|\)|\[|\]|\{|\})", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ private static readonly Regex ScenifyReplaceChars = new Regex(@"[\/]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly char[] EpisodeTitleTrimCharacters = new[] { ' ', '.', '?' };