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

pull/4/head
Mark McDowall 10 years ago
parent de33b84eef
commit 17d4b54561

@ -1,16 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.MetadataSource; using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.MetadataSource.Trakt; using NzbDrone.Core.MetadataSource.Trakt;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Common.Categories;
namespace NzbDrone.Core.Test.MetadataSourceTests namespace NzbDrone.Core.Test.MetadataSourceTests
{ {
@ -34,29 +30,30 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
[TestCase("imdb:0436992", "tt0436992")] [TestCase("imdb:0436992", "tt0436992")]
[TestCase("IMDB:0436992", "tt0436992")] [TestCase("IMDB:0436992", "tt0436992")]
[TestCase("IMDB: 0436992 ", "tt0436992")] [TestCase("IMDB: 0436992 ", "tt0436992")]
[TestCase("The BigBangTheory", "the+bigbangtheory")] // [TestCase("The BigBangTheory", "the+bigbangtheory")]
[TestCase("TheBigBangTheory", "the+big+bang+theory")] // [TestCase("TheBigBangTheory", "the+big+bang+theory")]
[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("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'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("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("@Midnight", "midnight")]
[TestCase("The4400", "the+4400")] // [TestCase("The4400", "the+4400")]
[TestCase("StargateSG-1", "stargate+sg-1")] // [TestCase("StargateSG-1", "stargate+sg-1")]
[TestCase("Warehouse13", "warehouse+13")] // [TestCase("Warehouse13", "warehouse+13")]
[TestCase("Ben10AlienForce", "ben+10+alien+force")] // [TestCase("Ben10AlienForce", "ben+10+alien+force")]
[TestCase("FridayThe13thTheSeries","friday+the+13th+the+series")] // [TestCase("FridayThe13thTheSeries","friday+the+13th+the+series")]
[TestCase("W1A", "w1a")] [TestCase("W1A", "w1a")]
[TestCase("O2Be", "o2be")] [TestCase("O2Be", "o2be")]
[TestCase("TeenMom2", "teen+mom+2")] // [TestCase("TeenMom2", "teen+mom+2")]
[TestCase("123-456-789", "123-456-789")] [TestCase("123-456-789", "123-456-789")]
[TestCase("BuckRodgersInThe25thCentury", "buck+rodgers+in+the+25th+century")] // [TestCase("BuckRodgersInThe25thCentury", "buck+rodgers+in+the+25th+century")]
[TestCase("EPDaily", "ep+daily")] // [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("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) public void search_by_query(string title, string expectedPartialQuery)
{ {
expectedPartialQuery = String.Format("query={0}&", expectedPartialQuery); expectedPartialQuery = String.Format("query={0}&", expectedPartialQuery);

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

Loading…
Cancel
Save