1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Merge branch 'master' into backbone

This commit is contained in:
Mark McDowall 2013-01-01 13:14:47 -08:00
commit 5ba1c0eceb
30 changed files with 225 additions and 173 deletions

View File

@ -21,10 +21,10 @@ public void tostring_single_season_episode()
parseResult.EpisodeNumbers = new List<int> { 3 };
parseResult.FullSeason = false;
parseResult.AirDate = null;
parseResult.Quality = new QualityModel(QualityTypes.HDTV, false);
parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, false);
parseResult.ToString().Should().Be("My Series - S12E03 HDTV");
parseResult.ToString().Should().Be("My Series - S12E03 HDTV-720p");
}
[Test]
@ -36,10 +36,10 @@ public void tostring_single_season_episode_proper()
parseResult.EpisodeNumbers = new List<int> { 3 };
parseResult.FullSeason = false;
parseResult.AirDate = null;
parseResult.Quality = new QualityModel(QualityTypes.HDTV, true);
parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, true);
parseResult.ToString().Should().Be("My Series - S12E03 HDTV [proper]");
parseResult.ToString().Should().Be("My Series - S12E03 HDTV-720p [proper]");
}
[Test]
@ -51,10 +51,10 @@ public void tostring_multi_season_episode()
parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 };
parseResult.FullSeason = false;
parseResult.AirDate = null;
parseResult.Quality = new QualityModel(QualityTypes.HDTV, false);
parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, false);
parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV");
parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV-720p");
}
[Test]
@ -66,10 +66,10 @@ public void tostring_multi_season_episode_proper()
parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 };
parseResult.FullSeason = false;
parseResult.AirDate = null;
parseResult.Quality = new QualityModel(QualityTypes.HDTV, true);
parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, true);
parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV [proper]");
parseResult.ToString().Should().Be("My Series - S12E03-04-05 HDTV-720p [proper]");
}
@ -81,10 +81,10 @@ public void tostring_full_season()
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
parseResult.AirDate = null;
parseResult.Quality = new QualityModel(QualityTypes.HDTV, false);
parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, false);
parseResult.ToString().Should().Be("My Series - Season 12 HDTV");
parseResult.ToString().Should().Be("My Series - Season 12 HDTV-720p");
}
@ -96,10 +96,10 @@ public void tostring_full_season_proper()
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
parseResult.AirDate = null;
parseResult.Quality = new QualityModel(QualityTypes.HDTV, true);
parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, true);
parseResult.ToString().Should().Be("My Series - Season 12 HDTV [proper]");
parseResult.ToString().Should().Be("My Series - Season 12 HDTV-720p [proper]");
}
[Test]
@ -110,10 +110,10 @@ public void tostring_daily_show()
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
parseResult.AirDate = new DateTime(2010, 12, 30);
parseResult.Quality = new QualityModel(QualityTypes.HDTV, false);
parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, false);
parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV");
parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV-720p");
}
[Test]
@ -124,10 +124,10 @@ public void tostring_daily_show_proper()
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
parseResult.AirDate = new DateTime(2010, 12, 30);
parseResult.Quality = new QualityModel(QualityTypes.HDTV, true);
parseResult.Quality = new QualityModel(QualityTypes.HDTV720p, true);
parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV [proper]");
parseResult.ToString().Should().Be("My Series - 2010-12-30 HDTV-720p [proper]");
}
}

View File

@ -22,16 +22,16 @@
"script":"None",
"nzb_name":"The.Mentalist.S04E12.720p.HDTV.x264-IMMERSE.nzb",
"download_time":524,
"storage":"C:\\ServerPool\\ServerFolders\\Unsorted TV\\The Mentalist - 4x12 - My Bloody Valentine [HDTV]",
"storage":"C:\\ServerPool\\ServerFolders\\Unsorted TV\\The Mentalist - 4x12 - My Bloody Valentine [HDTV-720p]",
"status":"Completed",
"script_line":"",
"completed":1327033479,
"nzo_id":"SABnzbd_nzo_0crgis",
"downloaded":1016942445,
"report":"",
"path":"D:\\SABnzbd\\downloading\\The Mentalist - 4x12 - My Bloody Valentine [HDTV]",
"path":"D:\\SABnzbd\\downloading\\The Mentalist - 4x12 - My Bloody Valentine [HDTV-720p]",
"postproc_time":24,
"name":"The Mentalist - 4x12 - My Bloody Valentine [HDTV]",
"name":"The Mentalist - 4x12 - My Bloody Valentine [HDTV-720p]",
"url":"",
"bytes":1016942445,
"url_info":"",

View File

@ -54,7 +54,7 @@
"avg_age":"149d",
"cat":"tv",
"eta":"06:55 AM Sat 21 Jan",
"filename":"30 Rock - 1x05 - Title [HDTV]",
"filename":"30 Rock - 1x05 - Title [HDTV-720p]",
"index":0,
"mb":"267.44",
"mbleft":"238.66",
@ -187,7 +187,7 @@
"verbosity":"",
"mb":"546.13",
"sizeleft":"546 MB",
"filename":"DUPLICATE / The Big Bang Theory - 5x13 - The Recombination Hypothesis [HDTV] [Proper]",
"filename":"DUPLICATE / The Big Bang Theory - 5x13 - The Recombination Hypothesis [HDTV-720p] [Proper]",
"priority":"Normal",
"cat":"tv",
"mbleft":"546.13",

View File

@ -54,7 +54,7 @@
"avg_age":"149d",
"cat":"tv",
"eta":"06:55 AM Sat 21 Jan",
"filename":"30 Rock - 1x05 - Title [HDTV]",
"filename":"30 Rock - 1x05 - Title [HDTV-720p]",
"index":0,
"mb":"267.44",
"mbleft":"238.66",
@ -187,7 +187,7 @@
"verbosity":"",
"mb":"546.13",
"sizeleft":"546 MB",
"filename":"DUPLICATE / The Big Bang Theory - 5x13 - The Recombination Hypothesis [HDTV] [Proper]",
"filename":"DUPLICATE / The Big Bang Theory - 5x13 - The Recombination Hypothesis [HDTV-720p] [Proper]",
"priority":"NotReal",
"cat":"tv",
"mbleft":"546.13",

View File

@ -122,5 +122,16 @@ public void SeasonSearch_should_allow_searching_of_season_zero()
ExceptionVerification.ExpectedWarns(1);
}
[Test]
public void should_search_for_individual_episodes_when_no_partial_results_are_returned()
{
Mocker.GetMock<SearchProvider>()
.Setup(c => c.PartialSeasonSearch(notification, 1, 1)).Returns(new List<int>());
Mocker.Resolve<SeasonSearchJob>().Start(notification, new { SeriesId = 1, SeasonNumber = 1 });
Mocker.GetMock<EpisodeSearchJob>().Verify(v => v.Start(notification, It.Is<object>(o => o.GetPropertyValue<Int32>("EpisodeId") > 0)), Times.Exactly(_episodes.Count));
}
}
}

View File

@ -163,7 +163,7 @@
<Compile Include="JobTests\RssSyncJobTest.cs" />
<Compile Include="JobTests\PostDownloadScanJobFixture.cs" />
<Compile Include="JobTests\RecentBacklogSearchJobTest.cs" />
<Compile Include="ParserFixture\QualityParserTests.cs" />
<Compile Include="ParserTests\QualityParserFixture.cs" />
<Compile Include="ProviderTests\ConfigProviderTests\ConfigCachingFixture.cs" />
<Compile Include="ProviderTests\BannerProviderTest.cs" />
<Compile Include="ProviderTests\DecisionEngineTests\AllowedReleaseGroupSpecificationFixture.cs" />
@ -250,7 +250,7 @@
<Compile Include="ProviderTests\ConfigProviderTests\ConfigProviderFixture.cs" />
<Compile Include="ProviderTests\EpisodeProviderTests\EpisodeProviderTest.cs" />
<Compile Include="Framework\TestDbHelper.cs" />
<Compile Include="ParserFixture\ParserTest.cs" />
<Compile Include="ParserTests\ParserFixture.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QualityProfileTest.cs" />
<Compile Include="ProviderTests\DownloadClientTests\SabProviderTests\SabProviderFixture.cs" />

View File

@ -1,28 +1,27 @@
// ReSharper disable RedundantUsingDirective
using System;
using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.Contract;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ParserFixture
namespace NzbDrone.Core.Test.ParserTests
{
// ReSharper disable InconsistentNaming
[TestFixture]
public class ParserTest : CoreTest
public class ParserFixture : CoreTest
{
/*Fucked-up hall of shame,
* WWE.Wrestlemania.27.PPV.HDTV.XviD-KYR
* Unreported.World.Chinas.Lost.Sons.WS.PDTV.XviD-FTP
* [TestCase("Big Time Rush 1x01 to 10 480i DD2 0 Sianto", "Big Time Rush", 1, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 10)]
* [TestCase("Desparate Housewives - S07E22 - 7x23 - And Lots of Security.. [HDTV].mkv", "Desparate Housewives", 7, new[] { 22, 23 }, 2)]
* [TestCase("S07E22 - 7x23 - And Lots of Security.. [HDTV].mkv", "", 7, new[] { 22, 23 }, 2)]
* [TestCase("Desparate Housewives - S07E22 - 7x23 - And Lots of Security.. [HDTV-720p].mkv", "Desparate Housewives", 7, new[] { 22, 23 }, 2)]
* [TestCase("S07E22 - 7x23 - And Lots of Security.. [HDTV-720p].mkv", "", 7, new[] { 22, 23 }, 2)]
*/
[TestCase("Sonny.With.a.Chance.S02E15", "Sonny.With.a.Chance", 2, 15)]
@ -68,7 +67,7 @@ public class ParserTest : CoreTest
[TestCase("hawaii.five-0.2010.217.hdtv-lol", "Hawaii Five-0 (2010)", 2, 17)]
[TestCase("Looney Tunes - S1936E18 - I Love to Singa", "Looney Tunes", 1936, 18)]
[TestCase("American_Dad!_-_7x6_-_The_Scarlett_Getter_[SDTV]", "American Dad!", 7, 6)]
[TestCase("Falling_Skies_-_1x1_-_Live_and_Learn_[HDTV]", "Falling Skies", 1, 1)]
[TestCase("Falling_Skies_-_1x1_-_Live_and_Learn_[HDTV-720p]", "Falling Skies", 1, 1)]
[TestCase("Top Gear - 07x03 - 2005.11.70", "Top Gear", 7, 3)]
[TestCase("Hatfields and McCoys 2012 Part 1 REPACK 720p HDTV x264 2HD", "Hatfields and McCoys 2012", 1, 1)]
[TestCase("Glee.S04E09.Swan.Song.1080p.WEB-DL.DD5.1.H.264-ECI", "Glee", 4, 9)]
@ -138,10 +137,10 @@ public void unparsable_title_should_report_title()
[TestCase("The Borgias S01e01 e02 ShoHD On Demand 1080i DD5 1 ALANiS", "The Borgias", 1, new[] { 1, 2 })]
[TestCase("White.Collar.2x04.2x05.720p.BluRay-FUTV", "White.Collar", 2, new[] { 4, 5 })]
[TestCase("Desperate.Housewives.S07E22E23.720p.HDTV.X264-DIMENSION", "Desperate.Housewives", 7, new[] { 22, 23 })]
[TestCase("Desparate Housewives - S07E22 - S07E23 - And Lots of Security.. [HDTV].mkv", "Desparate Housewives", 7, new[] { 22, 23 })]
[TestCase("Desparate Housewives - S07E22 - S07E23 - And Lots of Security.. [HDTV-720p].mkv", "Desparate Housewives", 7, new[] { 22, 23 })]
[TestCase("S03E01.S03E02.720p.HDTV.X264-DIMENSION", "", 3, new[] { 1, 2 })]
[TestCase("Desparate Housewives - S07E22 - 7x23 - And Lots of Security.. [HDTV].mkv", "Desparate Housewives", 7, new[] { 22, 23 })]
[TestCase("S07E22 - 7x23 - And Lots of Security.. [HDTV].mkv", "", 7, new[] { 22, 23 })]
[TestCase("Desparate Housewives - S07E22 - 7x23 - And Lots of Security.. [HDTV-720p].mkv", "Desparate Housewives", 7, new[] { 22, 23 })]
[TestCase("S07E22 - 7x23 - And Lots of Security.. [HDTV-720p].mkv", "", 7, new[] { 22, 23 })]
[TestCase("2x04x05.720p.BluRay-FUTV", "", 2, new[] { 4, 5 })]
[TestCase("S02E04E05.720p.BluRay-FUTV", "", 2, new[] { 4, 5 })]
[TestCase("S02E03-04-05.720p.BluRay-FUTV", "", 2, new[] { 3,4,5 })]
@ -319,6 +318,9 @@ public void parse_series_name(string postTitle, string title)
[TestCase("Castle.2009.S01E14.Turkish.HDTV.XviD-LOL", LanguageType.Turkish)]
[TestCase("Castle.2009.S01E14.Portuguese.HDTV.XviD-LOL", LanguageType.Portuguese)]
[TestCase("Castle.2009.S01E14.HDTV.XviD-LOL", LanguageType.English)]
[TestCase("person.of.interest.1x19.ita.720p.bdmux.x264-novarip", LanguageType.Italian)]
[TestCase("Salamander.S01E01.FLEMISH.HDTV.x264-BRiGAND", LanguageType.Flemish)]
[TestCase("H.Polukatoikia.S03E13.Greek.PDTV.XviD-Ouzo", LanguageType.Greek)]
public void parse_language(string postTitle, LanguageType language)
{
var result = Parser.ParseLanguage(postTitle);

View File

@ -1,28 +1,24 @@
// ReSharper disable RedundantUsingDirective
using System;
using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.Contract;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ParserFixture
namespace NzbDrone.Core.Test.ParserTests
{
[TestFixture]
// ReSharper disable InconsistentNaming
public class QualityParserTests : CoreTest
public class QualityParserFixture : CoreTest
{
public static object[] QualityParserCases =
{
new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD, false },
new object[] { "WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", QualityTypes.DVD, false },
new object[] { "WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD, false },
new object[] { "Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV, false },
new object[] { "Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV720p, false },
new object[] { "this has no extention or periods HDTV", QualityTypes.SDTV, false },
new object[] { "Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV, false },
new object[] { "The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD, false },
@ -30,14 +26,14 @@ public class QualityParserTests : CoreTest
new object[] { "The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.SDTV, false },
new object[] { "Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.SDTV, false },
new object[] { "Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", QualityTypes.WEBDL720p, false },
new object[] { "Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV, false },
new object[] { "Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV, false },
new object[] { "Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV720p, false },
new object[] { "Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV720p, false },
new object[] { "Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV, false },
new object[] { "Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV, false },
new object[] { "Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV, false },
new object[] { "Sonny.With.a.Chance.S02E15", QualityTypes.Unknown, false },
new object[] { "Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV, false },
new object[] { "Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV, false },
new object[] { "Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV720p, false },
new object[] { "Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV720p, false },
new object[] { "Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720p, false },
new object[] { "Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080p, false },
new object[] { "Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL720p, false },
@ -45,9 +41,9 @@ public class QualityParserTests : CoreTest
new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD, false },
new object[] { "Law & Order: Special Victims Unit - 11x11 - Quickie", QualityTypes.Unknown, false },
new object[] { "(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", QualityTypes.Unknown, false },
new object[] { "S07E23 - [HDTV].mkv ", QualityTypes.HDTV, false },
new object[] { "S07E23 - [HDTV-720p].mkv ", QualityTypes.HDTV720p, false },
new object[] { "S07E23 - [WEBDL].mkv ", QualityTypes.WEBDL720p, false },
new object[] { "S07E23.mkv ", QualityTypes.HDTV, false },
new object[] { "S07E23.mkv ", QualityTypes.HDTV720p, false },
new object[] { "S07E23 .avi ", QualityTypes.SDTV, false },
new object[] { "WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3.-HELLYWOOD.avi", QualityTypes.DVD, false },
new object[] { "WEEDS.S03E01-06.DUAL.Bluray.AC3.-HELLYWOOD.avi", QualityTypes.Bluray720p, false },
@ -58,7 +54,7 @@ public class QualityParserTests : CoreTest
new object[] { "White.Van.Man.2011.S02E01.WS.PDTV.x264-TLA", QualityTypes.SDTV, false },
new object[] { "White.Van.Man.2011.S02E01.WS.PDTV.x264-REPACK-TLA", QualityTypes.SDTV, true },
new object[] { "WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3-REPACK.-HELLYWOOD.avi", QualityTypes.DVD, true },
new object[] { "Pawn Stars S04E87 REPACK 720p HDTV x264 aAF", QualityTypes.HDTV, true },
new object[] { "Pawn Stars S04E87 REPACK 720p HDTV x264 aAF", QualityTypes.HDTV720p, true },
new object[] { "The Real Housewives of Vancouver S01E04 DSR x264 2HD", QualityTypes.SDTV, false },
new object[] { "Vanguard S01E04 Mexicos Death Train DSR x264 MiNDTHEGAP", QualityTypes.SDTV, false },
new object[] { "Vanguard S01E04 Mexicos Death Train 720p WEB DL", QualityTypes.WEBDL720p, false },
@ -74,7 +70,13 @@ public class QualityParserTests : CoreTest
new object[] { "Elementary.S01E10.The.Leviathan.480p.WEB-DL.x264-mSD", QualityTypes.WEBDL480p, false },
new object[] { "Glee.S04E10.Glee.Actually.480p.WEB-DL.x264-mSD", QualityTypes.WEBDL480p, false },
new object[] { "The.Big.Bang.Theory.S06E11.The.Santa.Simulation.480p.WEB-DL.x264-mSD", QualityTypes.WEBDL480p, false },
new object[] { "The.Big.Bang.Theory.S06E11.The.Santa.Simulation.1080p.WEB-DL.DD5.1.H.264", QualityTypes.WEBDL1080p, false }
new object[] { "The.Big.Bang.Theory.S06E11.The.Santa.Simulation.1080p.WEB-DL.DD5.1.H.264", QualityTypes.WEBDL1080p, false },
new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.X264-QCF", QualityTypes.HDTV1080p, false },
new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.x264-QCF", QualityTypes.HDTV1080p, false },
new object[] { "DEXTER.S07E01.ARE.YOU.1080P.HDTV.proper.X264-QCF", QualityTypes.HDTV1080p, true },
new object[] { "Dexter - S01E01 - Title [HDTV]", QualityTypes.HDTV720p, false },
new object[] { "Dexter - S01E01 - Title [HDTV-720p]", QualityTypes.HDTV720p, false },
new object[] { "Dexter - S01E01 - Title [HDTV-1080p]", QualityTypes.HDTV1080p, false }
};
public static object[] SelfQualityParserCases =
@ -82,7 +84,7 @@ public class QualityParserTests : CoreTest
new object[] { QualityTypes.SDTV },
new object[] { QualityTypes.DVD },
new object[] { QualityTypes.WEBDL480p },
new object[] { QualityTypes.HDTV },
new object[] { QualityTypes.HDTV720p },
new object[] { QualityTypes.WEBDL720p },
new object[] { QualityTypes.WEBDL1080p },
new object[] { QualityTypes.Bluray720p },

View File

@ -23,7 +23,7 @@ public class QualityAllowedByProfileSpecificationFixture : CoreTest
public static object[] AllowedTestCases =
{
new object[] { QualityTypes.DVD },
new object[] { QualityTypes.HDTV },
new object[] { QualityTypes.HDTV720p },
new object[] { QualityTypes.Bluray1080p }
};
@ -56,7 +56,7 @@ public void Setup()
public void should_allow_if_quality_is_defined_in_profile(QualityTypes qualityType)
{
parseResult.Quality.Quality = qualityType;
parseResult.Series.QualityProfile.Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.HDTV, QualityTypes.Bluray1080p };
parseResult.Series.QualityProfile.Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.HDTV720p, QualityTypes.Bluray1080p };
_qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeTrue();
}
@ -65,7 +65,7 @@ public void should_allow_if_quality_is_defined_in_profile(QualityTypes qualityTy
public void should_not_allow_if_quality_is_not_defined_in_profile(QualityTypes qualityType)
{
parseResult.Quality.Quality = qualityType;
parseResult.Series.QualityProfile.Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.HDTV, QualityTypes.Bluray1080p };
parseResult.Series.QualityProfile.Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.HDTV720p, QualityTypes.Bluray1080p };
_qualityAllowedByProfile.IsSatisfiedBy(parseResult).Should().BeFalse();
}

View File

@ -20,8 +20,8 @@ public class QualityUpgradeSpecificationFixture : CoreTest
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, true, QualityTypes.WEBDL720p, true },
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, false, QualityTypes.SDTV, false },
new object[] { QualityTypes.SDTV, false, QualityTypes.DVD, true, QualityTypes.SDTV, false },
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV, true, QualityTypes.Bluray720p, false },
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV, true, QualityTypes.WEBDL720p, false },
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.Bluray720p, false },
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.HDTV720p, true, QualityTypes.WEBDL720p, false },
new object[] { QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false, QualityTypes.WEBDL720p, false },
new object[] { QualityTypes.SDTV, false, QualityTypes.SDTV, true, QualityTypes.SDTV, true },
new object[] { QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false, QualityTypes.WEBDL1080p, false }

View File

@ -24,16 +24,16 @@ public class ImportFileFixture : CoreTest
{
new object[] { QualityTypes.SDTV, false },
new object[] { QualityTypes.DVD, true },
new object[] { QualityTypes.HDTV, false }
new object[] { QualityTypes.HDTV720p, false }
};
private readonly long SIZE = 50.Megabytes();
private readonly long SIZE = 80.Megabytes();
public void With50MBFile()
public void With80MBFile()
{
Mocker.GetMock<DiskProvider>()
.Setup(d => d.GetSize(It.IsAny<String>()))
.Returns(50.Megabytes());
.Returns(80.Megabytes());
}
[Test]
@ -45,7 +45,7 @@ public void import_new_file_should_succeed()
var fakeEpisode = Builder<Episode>.CreateNew().Build();
//Mocks
With50MBFile();
With80MBFile();
Mocker.GetMock<MediaFileProvider>()
.Setup(p => p.Exists(It.IsAny<String>()))
@ -76,7 +76,7 @@ public void import_new_file_with_better_same_quality_should_succeed(QualityTypes
).Build();
With50MBFile();
With80MBFile();
Mocker.GetMock<EpisodeProvider>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
@ -102,7 +102,7 @@ public void import_new_file_episode_has_same_or_better_quality_should_skip(strin
.Build();
//Mocks
With50MBFile();
With80MBFile();
Mocker.GetMock<MediaFileProvider>()
.Setup(p => p.Exists(It.IsAny<String>()))
@ -128,7 +128,7 @@ public void import_unparsable_file_should_skip()
Mocker.GetMock<MediaFileProvider>()
.Setup(p => p.Exists(It.IsAny<String>())).Returns(false);
With50MBFile();
With80MBFile();
//Act
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -150,7 +150,7 @@ public void import_existing_file_should_skip()
.Setup(p => p.Exists(It.IsAny<String>()))
.Returns(true);
With50MBFile();
With80MBFile();
//Act
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -172,7 +172,7 @@ public void import_file_with_no_episode_in_db_should_skip()
Mocker.GetMock<DiskProvider>(MockBehavior.Strict)
.Setup(e => e.IsChildOfPath(fileName, fakeSeries.Path)).Returns(false);
With50MBFile();
With80MBFile();
Mocker.GetMock<MediaFileProvider>()
.Setup(p => p.Exists(It.IsAny<String>()))
@ -203,7 +203,7 @@ public void import_new_file_episode_has_better_quality_than_existing(string file
.Build();
//Mocks
With50MBFile();
With80MBFile();
Mocker.GetMock<MediaFileProvider>()
.Setup(p => p.Exists(It.IsAny<String>()))
@ -235,7 +235,7 @@ public void import_new_multi_part_file_episode_has_equal_or_better_quality_than_
.Build())
.Build();
With50MBFile();
With80MBFile();
Mocker.GetMock<MediaFileProvider>()
.Setup(p => p.Exists(It.IsAny<String>()))
@ -268,7 +268,7 @@ public void skip_import_new_multi_part_file_episode_existing_has_better_quality(
//Mocks
With50MBFile();
With80MBFile();
Mocker.GetMock<MediaFileProvider>()
.Setup(p => p.Exists(It.IsAny<String>()))
@ -306,7 +306,7 @@ public void import_new_multi_part_file_episode_replace_two_files()
.Build();
//Mocks
With50MBFile();
With80MBFile();
Mocker.GetMock<MediaFileProvider>()
.Setup(p => p.Exists(It.IsAny<String>()))
@ -337,7 +337,7 @@ public void import_new_episode_no_existing_episode_file()
.Build();
//Mocks
With50MBFile();
With80MBFile();
Mocker.GetMock<MediaFileProvider>()
.Setup(p => p.Exists(It.IsAny<String>()))
@ -406,7 +406,7 @@ public void should_set_parseResult_SceneSource_if_not_in_series_Path()
const string path = @"C:\Test\Unsorted TV\30 Rock\30.rock.s01e01.pilot.mkv";
With50MBFile();
With80MBFile();
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
.Returns(new List<Episode>());
@ -429,7 +429,7 @@ public void should_not_set_parseResult_SceneSource_if_in_series_Path()
const string path = @"C:\Test\TV\30 Rock\30.rock.s01e01.pilot.mkv";
With50MBFile();
With80MBFile();
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
.Returns(new List<Episode>());

View File

@ -183,7 +183,7 @@ public void is_in_queue_should_find_if_exact_full_season_release_is_in_queue()
new object[] { 1, new[] { 6 }, "Some other show", QualityTypes.Bluray1080p, true }, //Different series, same season, episode
new object[] { 1, new[] { 5 }, "Rock", QualityTypes.Bluray1080p, true }, //Similar series, same season, episodes
new object[] { 1, new[] { 5 }, "30 Rock", QualityTypes.Bluray720p, false }, //Same series, higher quality
new object[] { 1, new[] { 5 }, "30 Rock", QualityTypes.HDTV, true } //Same series, higher quality
new object[] { 1, new[] { 5 }, "30 Rock", QualityTypes.HDTV720p, true } //Same series, higher quality
};
[Test, TestCaseSource("DifferentEpisodeCases")]
@ -209,9 +209,9 @@ public void IsInQueue_should_not_find_diffrent_episode_queue(int season, int[] e
{
new object[] { 1, new[] { 5 }, "30 Rock", QualityTypes.SDTV, false }, //Same Series, lower quality
new object[] { 1, new[] { 5 }, "30 rocK", QualityTypes.SDTV, false }, //Same Series, different casing
new object[] { 1, new[] { 5 }, "30 RocK", QualityTypes.HDTV, false }, //Same Series, same quality
new object[] { 1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV, false }, //Same Series, same quality, one different episode
new object[] { 1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV, false }, //Same Series, same quality, one different episode
new object[] { 1, new[] { 5 }, "30 RocK", QualityTypes.HDTV720p, false }, //Same Series, same quality
new object[] { 1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV720p, false }, //Same Series, same quality, one different episode
new object[] { 1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV720p, false }, //Same Series, same quality, one different episode
new object[] { 4, new[] { 8 }, "Parks and Recreation", QualityTypes.WEBDL720p, false }, //Same Series, same quality
};
@ -237,9 +237,9 @@ public void IsInQueue_should_find_same_or_lower_quality_episode_queue(int season
public static object[] DuplicateItemsCases =
{
new object[] { 5, new[] { 13 }, "The Big Bang Theory", QualityTypes.SDTV, false }, //Same Series, lower quality
new object[] { 5, new[] { 13 }, "The Big Bang Theory", QualityTypes.HDTV, false }, //Same Series, same quality
new object[] { 5, new[] { 13 }, "The Big Bang Theory", QualityTypes.HDTV, true }, //Same Series, same quality
new object[] { 5, new[] { 13, 14 }, "The Big Bang Theory", QualityTypes.HDTV, false } //Same Series, same quality, one diffrent episode
new object[] { 5, new[] { 13 }, "The Big Bang Theory", QualityTypes.HDTV720p, false }, //Same Series, same quality
new object[] { 5, new[] { 13 }, "The Big Bang Theory", QualityTypes.HDTV720p, true }, //Same Series, same quality
new object[] { 5, new[] { 13, 14 }, "The Big Bang Theory", QualityTypes.HDTV720p, false } //Same Series, same quality, one diffrent episode
};
[Test, TestCaseSource("DuplicateItemsCases")]
@ -265,7 +265,7 @@ public void IsInQueue_should_find_items_marked_as_duplicate(int season, int[] ep
{
new object[] { 3, new[] { 14, 15 }, "My Name Is Earl", QualityTypes.Bluray720p, false },
new object[] { 3, new[] { 15 }, "My Name Is Earl", QualityTypes.DVD, false },
new object[] { 3, new[] { 14 }, "My Name Is Earl", QualityTypes.HDTV, false },
new object[] { 3, new[] { 14 }, "My Name Is Earl", QualityTypes.HDTV720p, false },
new object[] { 3, new[] { 15, 16 }, "My Name Is Earl", QualityTypes.SDTV, false }
};

View File

@ -25,9 +25,9 @@ public class DownloadProviderFixture : CoreTest
new object[] { 1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, false, "My Series Name - 1x02 - My Episode Title [DVD]" },
new object[] { 1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, true, "My Series Name - 1x02 - My Episode Title [DVD] [Proper]" },
new object[] { 1, new[] { 2 }, "", QualityTypes.DVD, true, "My Series Name - 1x02 - [DVD] [Proper]" },
new object[] { 1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, false, "My Series Name - 1x02-1x04 - My Episode Title [HDTV]" },
new object[] { 1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, true, "My Series Name - 1x02-1x04 - My Episode Title [HDTV] [Proper]" },
new object[] { 1, new[] { 2, 4 }, "", QualityTypes.HDTV, true, "My Series Name - 1x02-1x04 - [HDTV] [Proper]" },
new object[] { 1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV720p, false, "My Series Name - 1x02-1x04 - My Episode Title [HDTV-720p]" },
new object[] { 1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV720p, true, "My Series Name - 1x02-1x04 - My Episode Title [HDTV-720p] [Proper]" },
new object[] { 1, new[] { 2, 4 }, "", QualityTypes.HDTV720p, true, "My Series Name - 1x02-1x04 - [HDTV-720p] [Proper]" },
};
private void SetDownloadClient(DownloadClientType clientType)
@ -281,13 +281,13 @@ public void should_not_repeat_the_same_episode_title()
{
AirDate = DateTime.Now,
EpisodeNumbers = new List<int>{ 10, 11 },
Quality = new QualityModel(QualityTypes.HDTV, false),
Quality = new QualityModel(QualityTypes.HDTV720p, false),
SeasonNumber = 35,
Series = series,
Episodes = fakeEpisodes
};
Mocker.Resolve<DownloadProvider>().GetDownloadTitle(parsResult).Should().Be("My Series Name - 5x01-5x02 - My Episode Title [HDTV]");
Mocker.Resolve<DownloadProvider>().GetDownloadTitle(parsResult).Should().Be("My Series Name - 5x01-5x02 - My Episode Title [HDTV-720p]");
}
}
}

View File

@ -212,7 +212,7 @@ public void add_item()
var episode = Builder<Episode>.CreateNew().Build();
QualityTypes quality = QualityTypes.HDTV;
QualityTypes quality = QualityTypes.HDTV720p;
const bool proper = true;
var history = new History

View File

@ -111,7 +111,7 @@ public void Scan_series_should_skip_series_with_no_episodes()
}
[Test]
[TestCase("Law & Order: Criminal Intent - S10E07 - Icarus [HDTV]", "Law & Order- Criminal Intent - S10E07 - Icarus [HDTV]")]
[TestCase("Law & Order: Criminal Intent - S10E07 - Icarus [HDTV-720p]", "Law & Order- Criminal Intent - S10E07 - Icarus [HDTV-720p]")]
public void CleanFileName(string name, string expectedName)
{
//Act

View File

@ -52,10 +52,10 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV]", result);
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result);
}
[Test]
@ -79,10 +79,10 @@ public void GetNewFilename_Episode_Quality_1x05_Dash()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("15x06 - City Sushi [HDTV]", result);
Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result);
}
[Test]
@ -106,10 +106,10 @@ public void GetNewFilename_Series_Quality_01x05_Space()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South Park 05x06 [HDTV]", result);
Assert.AreEqual("South Park 05x06 [HDTV-720p]", result);
}
[Test]
@ -134,7 +134,7 @@ public void GetNewFilename_Series_s01e05_Space()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South Park s05e06", result);
@ -161,7 +161,7 @@ public void GetNewFilename_Series_Episode_s01e05_Periods()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
@ -188,10 +188,10 @@ public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV]", result);
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result);
}
[Test]
@ -216,7 +216,7 @@ public void GetNewFilename_S01E05_Dash()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("S15E06", result);
@ -250,10 +250,10 @@ public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV]", result);
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result);
}
[Test]
@ -284,10 +284,10 @@ public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV]", result);
Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result);
}
[Test]
@ -318,10 +318,10 @@ public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV]", result);
Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result);
}
[Test]
@ -352,7 +352,7 @@ public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result);
@ -386,7 +386,7 @@ public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
@ -420,7 +420,7 @@ public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("3x23x24", result);
@ -445,10 +445,10 @@ public void GetNewFilename_should_append_proper_when_proper_and_append_quality_i
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, true, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, true, new EpisodeFile());
//Assert
result.Should().Be("South Park - S15E06 - City Sushi [HDTV] [Proper]");
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]");
}
[Test]
@ -470,10 +470,10 @@ public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_q
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
result.Should().Be("South Park - S15E06 - City Sushi [HDTV]");
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
}
[Test]
@ -495,7 +495,7 @@ public void GetNewFilename_should_not_append_proper_when_proper_and_append_quali
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, true, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, true, new EpisodeFile());
//Assert
result.Should().Be("South Park - S15E06 - City Sushi");
@ -527,7 +527,7 @@ public void GetNewFilename_should_order_multiple_episode_files_in_numerical_orde
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
@ -554,10 +554,10 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV]", result);
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result);
}
[Test]
@ -581,10 +581,10 @@ public void GetNewFilename_Episode_Quality_1x05_Period()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("15x06.City Sushi [HDTV]", result);
Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result);
}
[Test]
@ -612,7 +612,7 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNull()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, episodeFile);
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, episodeFile);
//Assert
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
@ -643,7 +643,7 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV, false, episodeFile);
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, _series, QualityTypes.HDTV720p, false, episodeFile);
//Assert
result.Should().Be(episodeFile.SceneName);
@ -675,7 +675,7 @@ public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
@ -707,7 +707,7 @@ public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
@ -745,7 +745,7 @@ public void should_have_two_episodeTitles_when_distinct_count_is_two()
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, QualityTypes.HDTV, false, new EpisodeFile());
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, QualityTypes.HDTV720p, false, new EpisodeFile());
//Assert
result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World");
@ -776,8 +776,8 @@ public void should_use_airDate_if_series_isDaily()
.Build();
var result = Mocker.Resolve<MediaFileProvider>()
.GetNewFilename(episodes, series, QualityTypes.HDTV, false, new EpisodeFile());
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV]");
.GetNewFilename(episodes, series, QualityTypes.HDTV720p, false, new EpisodeFile());
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV-720p]");
}
[Test]
@ -805,7 +805,7 @@ public void should_use_airDate_if_series_isDaily_no_episode_title()
.Build();
var result = Mocker.Resolve<MediaFileProvider>()
.GetNewFilename(episodes, series, QualityTypes.HDTV, false, new EpisodeFile());
.GetNewFilename(episodes, series, QualityTypes.HDTV720p, false, new EpisodeFile());
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13");
}
@ -834,7 +834,7 @@ public void should_set_airdate_to_unknown_if_not_available()
.Build();
var result = Mocker.Resolve<MediaFileProvider>()
.GetNewFilename(episodes, series, QualityTypes.HDTV, false, new EpisodeFile());
.GetNewFilename(episodes, series, QualityTypes.HDTV720p, false, new EpisodeFile());
result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
}
}

View File

@ -29,11 +29,12 @@ public void SetupDefault_should_add_all_profiles()
//Assert
var types = Mocker.Resolve<QualityTypeProvider>().All();
types.Should().HaveCount(8);
types.Should().HaveCount(9);
types.Should().Contain(e => e.Name == "SDTV" && e.QualityTypeId == 1);
types.Should().Contain(e => e.Name == "DVD" && e.QualityTypeId == 2);
types.Should().Contain(e => e.Name == "WEBDL-480p" && e.QualityTypeId == 8);
types.Should().Contain(e => e.Name == "HDTV" && e.QualityTypeId == 4);
types.Should().Contain(e => e.Name == "HDTV-720p" && e.QualityTypeId == 4);
types.Should().Contain(e => e.Name == "HDTV-1080p" && e.QualityTypeId == 9);
types.Should().Contain(e => e.Name == "WEBDL-720p" && e.QualityTypeId == 5);
types.Should().Contain(e => e.Name == "WEBDL-1080p" && e.QualityTypeId == 3);
types.Should().Contain(e => e.Name == "Bluray720p" && e.QualityTypeId == 6);
@ -55,7 +56,7 @@ public void SetupDefault_already_exists_should_insert_missing()
//Assert
var types = Mocker.Resolve<QualityTypeProvider>().All();
types.Should().HaveCount(8);
types.Should().HaveCount(QualityTypes.All().Count - 1);
}
[Test]

View File

@ -147,7 +147,7 @@ public void processSearchResults_should_skip_if_series_is_null()
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(5)
.All()
.With(e => e.AirDate = DateTime.Today)
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV, false))
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false))
.Build();
WithNullSeries();
@ -168,7 +168,7 @@ public void processSearchResults_should_skip_if_series_is_mismatched()
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(5)
.All()
.With(e => e.AirDate = DateTime.Today)
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV, false))
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false))
.Build();
WithMisMatchedSeries();
@ -244,7 +244,7 @@ public void processSearchResults_should_skip_if_parseResult_does_not_have_airdat
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(5)
.All()
.With(e => e.AirDate = null)
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV, false))
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false))
.Build();
WithMatchingSeries();
@ -265,7 +265,7 @@ public void processSearchResults_should_skip_if_parseResult_airdate_does_not_mat
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(5)
.All()
.With(e => e.AirDate = DateTime.Today.AddDays(10))
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV, false))
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false))
.Build();
WithMatchingSeries();

View File

@ -183,7 +183,7 @@ public void processSearchResults_should_skip_if_series_is_null()
.All()
.With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumbers = new List<int> { 1 })
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV, false))
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false))
.Build();
WithNullSeries();
@ -206,7 +206,7 @@ public void processSearchResults_should_skip_if_series_is_mismatched()
.All()
.With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumbers = new List<int> { 1 })
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV, false))
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false))
.Build();
WithMisMatchedSeries();
@ -229,7 +229,7 @@ public void processSearchResults_should_skip_if_season_doesnt_match()
.All()
.With(e => e.SeasonNumber = 2)
.With(e => e.EpisodeNumbers = new List<int> { 1 })
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV, false))
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false))
.Build();
WithMatchingSeries();
@ -252,7 +252,7 @@ public void processSearchResults_should_skip_if_episodeNumber_doesnt_match()
.All()
.With(e => e.SeasonNumber = 1)
.With(e => e.EpisodeNumbers = new List<int> { 2 })
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV, false))
.With(e => e.Quality = new QualityModel(QualityTypes.HDTV720p, false))
.Build();
WithMatchingSeries();

View File

@ -26,7 +26,7 @@ public void Test_Storage()
{
Name = Guid.NewGuid().ToString(),
Cutoff = QualityTypes.SDTV,
Allowed = new List<QualityTypes> { QualityTypes.HDTV, QualityTypes.DVD },
Allowed = new List<QualityTypes> { QualityTypes.HDTV720p, QualityTypes.DVD },
};
//Act
@ -106,7 +106,7 @@ public void Test_Series_Quality()
{
Name = Guid.NewGuid().ToString(),
Cutoff = QualityTypes.SDTV,
Allowed = new List<QualityTypes> { QualityTypes.HDTV, QualityTypes.DVD },
Allowed = new List<QualityTypes> { QualityTypes.HDTV720p, QualityTypes.DVD },
};

View File

@ -17,7 +17,7 @@ public class QualityTypesTest : CoreTest
{
new object[] {1, QualityTypes.SDTV},
new object[] {2, QualityTypes.DVD},
new object[] {4, QualityTypes.HDTV},
new object[] {4, QualityTypes.HDTV720p},
new object[] {5, QualityTypes.WEBDL720p},
new object[] {6, QualityTypes.Bluray720p},
new object[] {7, QualityTypes.Bluray1080p}
@ -27,7 +27,7 @@ public class QualityTypesTest : CoreTest
{
new object[] {QualityTypes.SDTV, 1},
new object[] {QualityTypes.DVD, 2},
new object[] {QualityTypes.HDTV, 4},
new object[] {QualityTypes.HDTV720p, 4},
new object[] {QualityTypes.WEBDL720p, 5},
new object[] {QualityTypes.Bluray720p, 6},
new object[] {QualityTypes.Bluray1080p, 7}

View File

@ -8,7 +8,7 @@ public static long IgnoreFileSize
{
get
{
return 40.Megabytes();
return 70.Megabytes();
}
}
}

View File

@ -20,6 +20,8 @@ public enum LanguageType
Norwegian = 15,
Finnish = 16,
Turkish = 17,
Portuguese = 18
Portuguese = 18,
Flemish = 19,
Greek = 20
}
}

View File

@ -1,4 +1,4 @@
using System;
 using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@ -85,6 +85,8 @@ public static class Parser
private static readonly Regex MultiPartCleanupRegex = new Regex(@"\(\d+\)$", RegexOptions.Compiled);
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>ita|italian)|(?<german>german\b)|(?<flemish>flemish)|(?<greek>greek)(?:\W|_)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
internal static EpisodeParseResult ParsePath(string path)
{
var fileInfo = new FileInfo(path);
@ -312,9 +314,16 @@ internal static QualityModel ParseQuality(string name)
result.Quality = QualityTypes.WEBDL480p;
return result;
}
if (normalizedName.Contains("x264") || normalizedName.Contains("h264") || normalizedName.Contains("720p"))
{
result.Quality = QualityTypes.HDTV;
if(normalizedName.Contains("1080p"))
{
result.Quality = QualityTypes.HDTV1080p;
return result;
}
result.Quality = QualityTypes.HDTV720p;
return result;
}
//Based on extension
@ -346,7 +355,7 @@ internal static QualityModel ParseQuality(string name)
case ".mkv":
case ".ts":
{
result.Quality = QualityTypes.HDTV;
result.Quality = QualityTypes.HDTV720p;
break;
}
}
@ -360,7 +369,13 @@ internal static QualityModel ParseQuality(string name)
if (name.Contains("[HDTV]"))
{
result.Quality = QualityTypes.HDTV;
result.Quality = QualityTypes.HDTV720p;
return result;
}
if (normalizedName.Contains("hdtv") && normalizedName.Contains("1080p"))
{
result.Quality = QualityTypes.HDTV1080p;
return result;
}
@ -388,16 +403,6 @@ internal static LanguageType ParseLanguage(string title)
if (lowerTitle.Contains("spanish"))
return LanguageType.Spanish;
if (lowerTitle.Contains("german"))
{
//Make sure it doesn't contain Germany (Since we're not using REGEX for all this)
if (!lowerTitle.Contains("germany"))
return LanguageType.German;
}
if (lowerTitle.Contains("italian"))
return LanguageType.Italian;
if (lowerTitle.Contains("danish"))
return LanguageType.Danish;
@ -440,6 +445,20 @@ internal static LanguageType ParseLanguage(string title)
if (lowerTitle.Contains("portuguese"))
return LanguageType.Portuguese;
var match = LanguageRegex.Match(title);
if (match.Groups["italian"].Captures.Cast<Capture>().Any())
return LanguageType.Italian;
if (match.Groups["german"].Captures.Cast<Capture>().Any())
return LanguageType.German;
if (match.Groups["flemish"].Captures.Cast<Capture>().Any())
return LanguageType.Flemish;
if (match.Groups["greek"].Captures.Cast<Capture>().Any())
return LanguageType.Greek;
return LanguageType.English;
}

View File

@ -548,7 +548,7 @@ private bool GetValueBoolean(string key, bool defaultValue = false)
private int GetValueInt(string key, int defaultValue = 0)
{
return Convert.ToInt16(GetValue(key, defaultValue));
return Convert.ToInt32(GetValue(key, defaultValue));
}
public virtual string GetValue(string key, object defaultValue, bool persist = false)

View File

@ -110,7 +110,7 @@ public virtual EpisodeFile ImportFile(Series series, string filePath)
long size = _diskProvider.GetSize(filePath);
//Skip any file under 40MB - New samples don't even have sample in the name...
//Skip any file under 70MB - New samples don't even have sample in the name...
if (size < Constants.IgnoreFileSize)
{
Logger.Trace("[{0}] appears to be a sample. skipping.", filePath);

View File

@ -68,8 +68,8 @@ public virtual void SetupDefaultProfiles()
var hd = new QualityProfile
{
Name = "HD",
Allowed = new List<QualityTypes> { QualityTypes.HDTV, QualityTypes.WEBDL720p, QualityTypes.Bluray720p },
Cutoff = QualityTypes.HDTV
Allowed = new List<QualityTypes> { QualityTypes.HDTV720p, QualityTypes.WEBDL720p, QualityTypes.Bluray720p },
Cutoff = QualityTypes.HDTV720p
};
Add(sd);

View File

@ -96,11 +96,12 @@ public override bool Equals(object obj)
public static QualityTypes SDTV = new QualityTypes {Id = 1, Name = "SDTV", Weight = 1};
public static QualityTypes WEBDL480p = new QualityTypes { Id = 8, Name = "WEBDL-480p", Weight = 2 };
public static QualityTypes DVD = new QualityTypes { Id = 2, Name = "DVD", Weight = 3 };
public static QualityTypes HDTV = new QualityTypes { Id = 4, Name = "HDTV", Weight = 4 };
public static QualityTypes WEBDL720p = new QualityTypes { Id = 5, Name = "WEBDL-720p", Weight = 5 };
public static QualityTypes Bluray720p = new QualityTypes { Id = 6, Name = "Bluray720p", Weight = 6 };
public static QualityTypes WEBDL1080p = new QualityTypes { Id = 3, Name = "WEBDL-1080p", Weight = 7 };
public static QualityTypes Bluray1080p = new QualityTypes { Id = 7, Name = "Bluray1080p", Weight = 8 };
public static QualityTypes HDTV720p = new QualityTypes { Id = 4, Name = "HDTV-720p", Weight = 4 };
public static QualityTypes HDTV1080p = new QualityTypes { Id = 9, Name = "HDTV-1080p", Weight = 5 };
public static QualityTypes WEBDL720p = new QualityTypes { Id = 5, Name = "WEBDL-720p", Weight = 6 };
public static QualityTypes Bluray720p = new QualityTypes { Id = 6, Name = "Bluray720p", Weight = 7 };
public static QualityTypes WEBDL1080p = new QualityTypes { Id = 3, Name = "WEBDL-1080p", Weight = 8 };
public static QualityTypes Bluray1080p = new QualityTypes { Id = 7, Name = "Bluray1080p", Weight = 9 };
public static List<QualityTypes> All()
{
@ -110,7 +111,8 @@ public static List<QualityTypes> All()
SDTV,
WEBDL480p,
DVD,
HDTV,
HDTV720p,
HDTV1080p,
WEBDL720p,
WEBDL1080p,
Bluray720p,

View File

@ -283,7 +283,7 @@ public PartialViewResult GetQualityProfileView(int profileId)
model.Allowed = profile.Allowed;
model.Sdtv = profile.Allowed.Contains(QualityTypes.SDTV);
model.Dvd = profile.Allowed.Contains(QualityTypes.DVD);
model.Hdtv = profile.Allowed.Contains(QualityTypes.HDTV);
model.Hdtv = profile.Allowed.Contains(QualityTypes.HDTV720p);
model.Webdl720p = profile.Allowed.Contains(QualityTypes.WEBDL720p);
model.Webdl1080p = profile.Allowed.Contains(QualityTypes.WEBDL1080p);
model.Bluray720p = profile.Allowed.Contains(QualityTypes.Bluray720p);
@ -292,7 +292,7 @@ public PartialViewResult GetQualityProfileView(int profileId)
model.SdtvId = QualityTypes.SDTV.Id;
model.DvdId = QualityTypes.DVD.Id;
model.HdtvId = QualityTypes.HDTV.Id;
model.HdtvId = QualityTypes.HDTV720p.Id;
model.Webdl720pId = QualityTypes.WEBDL720p.Id;
model.Webdl1080pId = QualityTypes.WEBDL1080p.Id;
model.Bluray720pId = QualityTypes.Bluray720p.Id;
@ -494,7 +494,7 @@ public JsonResult SaveQuality(QualityModel data)
profile.Allowed.Add(QualityTypes.DVD);
if (profileModel.Hdtv)
profile.Allowed.Add(QualityTypes.HDTV);
profile.Allowed.Add(QualityTypes.HDTV720p);
if (profileModel.Webdl720p)
profile.Allowed.Add(QualityTypes.WEBDL720p);

View File

@ -1,4 +1,6 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.ServiceProcess;
using NLog;
using Ninject;
@ -19,11 +21,13 @@ public class ApplicationServer : ServiceBase
private readonly ProcessProvider _processProvider;
private readonly MonitoringProvider _monitoringProvider;
private readonly SecurityProvider _securityProvider;
private readonly DiskProvider _diskProvider;
[Inject]
public ApplicationServer(ConfigFileProvider configFileProvider, IISProvider iisProvider,
DebuggerProvider debuggerProvider, EnvironmentProvider environmentProvider,
ProcessProvider processProvider, MonitoringProvider monitoringProvider, SecurityProvider securityProvider)
ProcessProvider processProvider, MonitoringProvider monitoringProvider,
SecurityProvider securityProvider, DiskProvider diskProvider)
{
_configFileProvider = configFileProvider;
_iisProvider = iisProvider;
@ -32,6 +36,7 @@ public ApplicationServer(ConfigFileProvider configFileProvider, IISProvider iisP
_processProvider = processProvider;
_monitoringProvider = monitoringProvider;
_securityProvider = securityProvider;
_diskProvider = diskProvider;
}
public ApplicationServer()
@ -48,6 +53,14 @@ public virtual void Start()
{
_iisProvider.StopServer();
_securityProvider.MakeAccessible();
if(_securityProvider.IsCurrentUserAdmin())
{
var tempFiles = Path.Combine(RuntimeEnvironment.GetRuntimeDirectory(), "Temporary ASP.NET Files");
logger.Debug("Creating Temporary ASP.Net folder: {0}", tempFiles);
_diskProvider.CreateDirectory(tempFiles);
}
_iisProvider.StartServer();
_debuggerProvider.Attach();