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

Fixed: Removed support for CamelCase in folder names to support legitimate show titles like MythBusters

This commit is contained in:
Mark McDowall 2014-12-05 17:24:08 -08:00
parent de33b84eef
commit 17d4b54561
2 changed files with 18 additions and 22 deletions

View File

@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Http;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.MetadataSource.Trakt;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
using NzbDrone.Test.Common.Categories;
namespace NzbDrone.Core.Test.MetadataSourceTests
{
@ -34,29 +30,30 @@ public void search_by_lookup(string title, string expectedPartialQuery)
[TestCase("imdb:0436992", "tt0436992")]
[TestCase("IMDB:0436992", "tt0436992")]
[TestCase("IMDB: 0436992 ", "tt0436992")]
[TestCase("The BigBangTheory", "the+bigbangtheory")]
[TestCase("TheBigBangTheory", "the+big+bang+theory")]
[TestCase(" TheBigBangTheory", "the+big+bang+theory")]
// [TestCase("The BigBangTheory", "the+bigbangtheory")]
// [TestCase("TheBigBangTheory", "the+big+bang+theory")]
// [TestCase(" TheBigBangTheory", "the+big+bang+theory")]
[TestCase("Agents of S.H.I.E.L.D.", "agents+of+s.h.i.e.l.d.")]
[TestCase("Marvel's Agents of S.H.I.E.L.D.", "marvels+agents+of+s.h.i.e.l.d.")]
[TestCase("Marvel'sAgentsOfS.H.I.E.L.D.", "marvels+agents+of+s.h.i.e.l.d.")]
// [TestCase("Marvel'sAgentsOfS.H.I.E.L.D.", "marvels+agents+of+s.h.i.e.l.d.")]
[TestCase("Utopia (US) (2014)", "utopia+us+2014")]
[TestCase("Utopia US 2014", "utopia+us+2014")]
[TestCase("UtopiaUS2014", "utopia+us+2014")]
// [TestCase("UtopiaUS2014", "utopia+us+2014")]
[TestCase("@Midnight", "midnight")]
[TestCase("The4400", "the+4400")]
[TestCase("StargateSG-1", "stargate+sg-1")]
[TestCase("Warehouse13", "warehouse+13")]
[TestCase("Ben10AlienForce", "ben+10+alien+force")]
[TestCase("FridayThe13thTheSeries","friday+the+13th+the+series")]
// [TestCase("The4400", "the+4400")]
// [TestCase("StargateSG-1", "stargate+sg-1")]
// [TestCase("Warehouse13", "warehouse+13")]
// [TestCase("Ben10AlienForce", "ben+10+alien+force")]
// [TestCase("FridayThe13thTheSeries","friday+the+13th+the+series")]
[TestCase("W1A", "w1a")]
[TestCase("O2Be", "o2be")]
[TestCase("TeenMom2", "teen+mom+2")]
// [TestCase("TeenMom2", "teen+mom+2")]
[TestCase("123-456-789", "123-456-789")]
[TestCase("BuckRodgersInThe25thCentury", "buck+rodgers+in+the+25th+century")]
[TestCase("EPDaily", "ep+daily")]
// [TestCase("BuckRodgersInThe25thCentury", "buck+rodgers+in+the+25th+century")]
// [TestCase("EPDaily", "ep+daily")]
[TestCase("6ad072c8-d000-4ed5-97d5-324858c45774", "6ad072c8-d000-4ed5-97d5-324858c45774")]
[TestCase("6AD072C8-D000-4ED5-97D5-324858C45774", "6ad072c8-d000-4ed5-97d5-324858c45774")]
[TestCase("MythBusters", "mythbusters")]
public void search_by_query(string title, string expectedPartialQuery)
{
expectedPartialQuery = String.Format("query={0}&", expectedPartialQuery);

View File

@ -4,7 +4,6 @@
using System.Linq;
using System.Text.RegularExpressions;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Core.MediaCover;
@ -237,10 +236,10 @@ private static string GetSearchTerm(string phrase)
phrase = phrase.RemoveAccent();
phrase = InvalidSearchCharRegex.Replace(phrase, "");
if (!phrase.Any(char.IsWhiteSpace) && phrase.Any(char.IsUpper) && phrase.Any(char.IsLower) && phrase.Length > 4)
{
phrase = ExpandCamelCaseRegEx.Replace(phrase, " ");
}
// if (!phrase.Any(char.IsWhiteSpace) && phrase.Any(char.IsUpper) && phrase.Any(char.IsLower) && phrase.Length > 4)
// {
// phrase = ExpandCamelCaseRegEx.Replace(phrase, " ");
// }
phrase = CollapseSpaceRegex.Replace(phrase, " ").Trim();
phrase = phrase.Trim('-');