Merge branch 'markus101'
Conflicts: NzbDrone.Core.Test/SeriesProviderTest.cs NzbDrone.Core/Providers/MediaFileProvider.cs NzbDrone.Core/Providers/SeriesProvider.cs
This commit is contained in:
commit
3cccb5858a
|
@ -247,6 +247,9 @@ namespace NzbDrone.Core.Test
|
|||
mocker.GetMock<InventoryProvider>()
|
||||
.Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false);
|
||||
|
||||
mocker.GetMock<SceneNameMappingProvider>()
|
||||
.Setup(s => s.GetSceneName(It.IsAny<int>())).Returns("");
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId);
|
||||
|
||||
|
@ -295,6 +298,9 @@ namespace NzbDrone.Core.Test
|
|||
mocker.GetMock<InventoryProvider>()
|
||||
.Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false);
|
||||
|
||||
mocker.GetMock<SceneNameMappingProvider>()
|
||||
.Setup(s => s.GetSceneName(71256)).Returns("The Daily Show");
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId);
|
||||
|
||||
|
@ -347,7 +353,10 @@ namespace NzbDrone.Core.Test
|
|||
.Returns(indexers);
|
||||
|
||||
mocker.GetMock<InventoryProvider>()
|
||||
.Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false);
|
||||
.Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false);;
|
||||
|
||||
mocker.GetMock<SceneNameMappingProvider>()
|
||||
.Setup(s => s.GetSceneName(It.IsAny<int>())).Returns("");
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId);
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace NzbDrone.Core.Test
|
|||
* Unreported.World.Chinas.Lost.Sons.WS.PDTV.XviD-FTP
|
||||
*/
|
||||
|
||||
|
||||
[TestCase("Sonny.With.a.Chance.S02E15", "Sonny.With.a.Chance", 2, 15)]
|
||||
[TestCase("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 3)]
|
||||
[TestCase("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 13)]
|
||||
|
@ -132,6 +131,10 @@ namespace NzbDrone.Core.Test
|
|||
[TestCase("White.Collar.2x04.2x05.720p.BluRay-FUTV", "White.Collar", 2, new[] { 4, 5 }, 2)]
|
||||
[TestCase("Desperate.Housewives.S07E22E23.720p.HDTV.X264-DIMENSION", "Desperate.Housewives", 7, new[] { 22, 23 }, 2)]
|
||||
//[Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] { 1, 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].mkv", "Desparate Housewives", 7, new[] { 22, 23 }, 2)]
|
||||
[TestCase("Desparate Housewives - S07E22 - S07E23 - And Lots of Security.. [HDTV].mkv", "Desparate Housewives", 7, new[] { 22, 23 }, 2)]
|
||||
[TestCase("S03E01.S03E02.720p.HDTV.X264-DIMENSION", "", 3, new[] { 1, 2 }, 2)]
|
||||
public void episode_multipart_parse(string postTitle, string title, int season, int[] episodes, int count)
|
||||
{
|
||||
var result = Parser.ParseEpisodeInfo(postTitle);
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using SubSonic.Repository;
|
||||
using TvdbLib.Data;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
|
@ -13,20 +21,92 @@ namespace NzbDrone.Core.Test
|
|||
// ReSharper disable InconsistentNaming
|
||||
public class SceneNameHelperTest : TestBase
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void GetIdByName_exists()
|
||||
public void GetSceneName_exists()
|
||||
{
|
||||
var id = SceneNameHelper.GetIdByName("CSI New York");
|
||||
id.Should().Be(73696);
|
||||
//Setup
|
||||
var fakeMap = Builder<SceneNameMapping>.CreateNew()
|
||||
.With(f => f.SeriesId = 12345)
|
||||
.With(f => f.SceneName = "Law and Order")
|
||||
.Build();
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<IRepository>()
|
||||
.Setup(f => f.Single<SceneNameMapping>(It.IsAny<Expression<Func<SceneNameMapping, bool>>>()))
|
||||
.Returns(fakeMap);
|
||||
|
||||
//Act
|
||||
var sceneName = mocker.Resolve<SceneNameMappingProvider>().GetSceneName(fakeMap.SeriesId);
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(fakeMap.SceneName, sceneName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetSeriesId_exists()
|
||||
{
|
||||
//Setup
|
||||
var fakeMap = Builder<SceneNameMapping>.CreateNew()
|
||||
.With(f => f.SeriesId = 12345)
|
||||
.With(f => f.SceneName = "Law and Order")
|
||||
.With(f => f.SceneName = "laworder")
|
||||
.Build();
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<IRepository>()
|
||||
.Setup(f => f.Single<SceneNameMapping>(It.IsAny<Expression<Func<SceneNameMapping, bool>>>()))
|
||||
.Returns(fakeMap);
|
||||
|
||||
//Act
|
||||
var seriesId = mocker.Resolve<SceneNameMappingProvider>().GetSeriesId(fakeMap.SceneCleanName);
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(fakeMap.SeriesId, seriesId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetTitleById_exists()
|
||||
public void GetSceneName_null()
|
||||
{
|
||||
var title = SceneNameHelper.GetTitleById(71256);
|
||||
title.Should().Be("The Daily Show");
|
||||
//Setup
|
||||
var fakeMap = Builder<SceneNameMapping>.CreateNew()
|
||||
.With(f => f.SeriesId = 12345)
|
||||
.With(f => f.SceneName = "Law and Order")
|
||||
.Build();
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<IRepository>()
|
||||
.Setup(f => f.Single<SceneNameMapping>(It.IsAny<Expression<Func<SceneNameMapping, bool>>>()));
|
||||
|
||||
//Act
|
||||
var sceneName = mocker.Resolve<SceneNameMappingProvider>().GetSceneName(fakeMap.SeriesId);
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(null, sceneName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetSeriesId_null()
|
||||
{
|
||||
//Setup
|
||||
var fakeMap = Builder<SceneNameMapping>.CreateNew()
|
||||
.With(f => f.SeriesId = 12345)
|
||||
.With(f => f.SceneName = "Law and Order")
|
||||
.With(f => f.SceneName = "laworder")
|
||||
.Build();
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<IRepository>()
|
||||
.Setup(f => f.Single<SceneNameMapping>(It.IsAny<Expression<Func<SceneNameMapping, bool>>>()));
|
||||
|
||||
//Act
|
||||
var seriesId = mocker.Resolve<SceneNameMappingProvider>().GetSeriesId(fakeMap.SceneCleanName);
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(null, seriesId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -96,6 +96,7 @@ namespace NzbDrone.Core
|
|||
_kernel.Bind<IJob>().To<EpisodeSearchJob>().InTransientScope();
|
||||
_kernel.Bind<IJob>().To<RenameEpisodeJob>().InTransientScope();
|
||||
_kernel.Bind<IJob>().To<PostDownloadScanJob>().InTransientScope();
|
||||
_kernel.Bind<IJob>().To<UpdateSceneMappingsJob>().InTransientScope();
|
||||
|
||||
_kernel.Get<JobProvider>().Initialize();
|
||||
_kernel.Get<WebTimer>().StartTimer(30);
|
||||
|
|
|
@ -66,6 +66,7 @@ namespace NzbDrone.Core.Datastore
|
|||
repository.Single<QualityProfile>(1);
|
||||
repository.Single<History>(1);
|
||||
repository.Single<IndexerSetting>(1);
|
||||
repository.Single<SceneNameMapping>(1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.Helpers
|
||||
{
|
||||
public static class SceneNameHelper
|
||||
{
|
||||
//Todo: Move this to a publically available location (so updates can be applied without releasing a new version of NzbDrone)
|
||||
//Todo: GoogleDocs? WCF Web Services on NzbDrone.com?
|
||||
private static readonly Dictionary<String, Int32> SeriesIdLookupList = new Dictionary<string, int>();
|
||||
private static readonly Dictionary<Int32, String> SceneNameLookupList = new Dictionary<Int32, String>();
|
||||
|
||||
|
||||
static SceneNameHelper()
|
||||
{
|
||||
//These values are used to match report titles parsed out of RSS to a series in the DB
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("CSI"), 72546);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("CSI New York"), 73696);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("CSI NY"), 73696);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Archer"), 110381);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Life After People The Series"), 83897);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Life After People"), 83897);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Kitchen Nightmares US"), 80552);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Daily Show"), 71256);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Daily Show with Jon Stewart"), 71256);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order SVU"), 75692);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order Special Victims Unit"), 75692);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order Criminal Intent"), 71489);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order CI"), 71489);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Dancing With The Stars US"), 79590);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Craig Ferguson"), 73387);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Jimmy Fallon"), 85355);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("David Letterman"), 75088);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Big Brother US"), 76706);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Colony"), 105521);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Colony US"), 105521);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Americas Funniest Home Videos"), 76235);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("AFHV"), 76235);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Childrens Hospital US"), 139941);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Childrens Hospital"), 139941);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Merlin"), 83123);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Merlin 2008"), 83123);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("WWE Monday Night RAW"), 76779);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Shit My Dad Says"), 164951);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Genius with Dave Gorman"), 83714);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order LA"), 168161);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Star Trek TOS"), 77526);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Star Trek DS9"), 72073);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Ellen Degeneres"), 72194);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Drinking Made Easy"), 195831);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Zane Lampreys Drinking Made Easy"), 195831);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Poirot"), 76133);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Agatha Christies Poirot"), 76133);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Real World Road Rules Challenge"), 70870);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Challenge Cutthroat"), 70870);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("This Old House Program"), 77444);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("60 Minutes US"), 73290);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Conan"), 194751);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Conan 2010"), 194751);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Carlos 2010"), 164451);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Babalon 5"), 70726);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Babalon5"), 70726);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Genius"), 83714);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Genius With Dave Gormand"), 83714);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Come Fly With Me 2010"), 212571);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Border Security"), 81563);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Border Security Australias Frontline"), 81563);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Silent Library US"), 172381);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Sci-Fi Science"), 131791);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Frontline"), 80646);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Frontline US"), 80646);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("RBT AU"), 189931);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("House"), 73255);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("House MD"), 73255);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Office"), 73244);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Office US"), 73244);
|
||||
|
||||
//These values are used when doing an indexer search.
|
||||
SceneNameLookupList.Add(72546, "CSI"); //CSI
|
||||
SceneNameLookupList.Add(73696, "CSI"); //CSI NY
|
||||
SceneNameLookupList.Add(110381, "Archer");
|
||||
SceneNameLookupList.Add(83897, "Life After People");
|
||||
SceneNameLookupList.Add(80552, "Kitchen Nightmares US");
|
||||
SceneNameLookupList.Add(71256, "The Daily Show"); //The Daily Show with Jon Stewart
|
||||
SceneNameLookupList.Add(75692, "Law and Order"); //SVU
|
||||
SceneNameLookupList.Add(71489, "Law and Order");//CI
|
||||
SceneNameLookupList.Add(79590, "Dancing With The Stars US");
|
||||
SceneNameLookupList.Add(73387, "Craig Ferguson");
|
||||
SceneNameLookupList.Add(85355, "Jimmy Fallon");
|
||||
SceneNameLookupList.Add(75088, "David Letterman");
|
||||
SceneNameLookupList.Add(76706, "Big Brother US");
|
||||
SceneNameLookupList.Add(105521, "The Colony");
|
||||
SceneNameLookupList.Add(76235, "Americas Funniest Home Videos");
|
||||
SceneNameLookupList.Add(139941, "Childrens Hospital");
|
||||
SceneNameLookupList.Add(83123, "Merlin");
|
||||
SceneNameLookupList.Add(76779, "WWE Monday Night RAW");
|
||||
SceneNameLookupList.Add(164951, "Shit My Dad Says");
|
||||
SceneNameLookupList.Add(168161, "Law and Order LA");
|
||||
SceneNameLookupList.Add(77526, "Star Trek TOS");
|
||||
SceneNameLookupList.Add(72073, "Star Trek DS9");
|
||||
SceneNameLookupList.Add(72194, "Ellen Degeneres");
|
||||
SceneNameLookupList.Add(195831, "Drinking Made Easy");//Zane Lampreys Drinking Made Easy
|
||||
SceneNameLookupList.Add(76133, "Poirot"); //Agatha Christies Poirot
|
||||
SceneNameLookupList.Add(70870, "The Real World Road Rules Challenge");
|
||||
SceneNameLookupList.Add(77444, "This Old House Program");
|
||||
SceneNameLookupList.Add(73290, "60 Minutes US");
|
||||
SceneNameLookupList.Add(194751, "Conan");
|
||||
SceneNameLookupList.Add(164451, "Carlos 2010");
|
||||
SceneNameLookupList.Add(70726, "Babalon"); //5
|
||||
SceneNameLookupList.Add(83714, "Genius"); //Genius With Dave Gormand
|
||||
SceneNameLookupList.Add(212571, "Come Fly With Me 2010");
|
||||
SceneNameLookupList.Add(81563, "Border Security");
|
||||
SceneNameLookupList.Add(172381, "Silent Library US");
|
||||
SceneNameLookupList.Add(131791, "Sci-Fi Science");
|
||||
SceneNameLookupList.Add(80646, "Frontline");
|
||||
SceneNameLookupList.Add(189931, "RBT AU");
|
||||
SceneNameLookupList.Add(73255, "House");
|
||||
SceneNameLookupList.Add(73244, "The Office");
|
||||
}
|
||||
|
||||
|
||||
public static Nullable<Int32> GetIdByName(string cleanSeriesName)
|
||||
{
|
||||
int id;
|
||||
|
||||
if (SeriesIdLookupList.TryGetValue(Parser.NormalizeTitle(cleanSeriesName), out id))
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String GetTitleById(int seriesId)
|
||||
{
|
||||
string title;
|
||||
|
||||
if (SceneNameLookupList.TryGetValue(seriesId, out title))
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -181,7 +181,6 @@
|
|||
<Compile Include="Helpers\EpisodeRenameHelper.cs" />
|
||||
<Compile Include="Helpers\EpisodeSortingHelper.cs" />
|
||||
<Compile Include="Helpers\FileSizeFormatHelpercs.cs" />
|
||||
<Compile Include="Helpers\SceneNameHelper.cs" />
|
||||
<Compile Include="Instrumentation\LogProvider.cs" />
|
||||
<Compile Include="Instrumentation\SubsonicTarget.cs" />
|
||||
<Compile Include="Instrumentation\ExceptioneerTarget.cs" />
|
||||
|
@ -199,6 +198,7 @@
|
|||
<Compile Include="Providers\Indexer\SyndicationFeedXmlReader.cs" />
|
||||
<Compile Include="Providers\AutoConfigureProvider.cs" />
|
||||
<Compile Include="Providers\Indexer\NzbMatrix.cs" />
|
||||
<Compile Include="Providers\Jobs\UpdateSceneMappingsJob.cs" />
|
||||
<Compile Include="Providers\Jobs\PostDownloadScanJob.cs" />
|
||||
<Compile Include="Providers\Jobs\RenameEpisodeJob.cs" />
|
||||
<Compile Include="Providers\Jobs\EpisodeSearchJob.cs" />
|
||||
|
@ -211,6 +211,7 @@
|
|||
<Compile Include="Providers\Jobs\IJob.cs" />
|
||||
<Compile Include="Providers\Jobs\RssSyncJob.cs" />
|
||||
<Compile Include="Providers\Jobs\UpdateInfoJob.cs" />
|
||||
<Compile Include="Providers\SceneNameMappingProvider.cs" />
|
||||
<Compile Include="Providers\StatsProvider.cs" />
|
||||
<Compile Include="Repository\ExternalNotificationSetting.cs" />
|
||||
<Compile Include="Repository\JobSetting.cs" />
|
||||
|
@ -253,6 +254,7 @@
|
|||
<Compile Include="Repository\Quality\QualityProfile.cs" />
|
||||
<Compile Include="Repository\RootDir.cs" />
|
||||
<Compile Include="Repository\Quality\QualityTypes.cs" />
|
||||
<Compile Include="Repository\SceneNameMapping.cs" />
|
||||
<Compile Include="Repository\Series.cs" />
|
||||
<Compile Include="CentralDispatch.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
|
@ -14,24 +14,39 @@ namespace NzbDrone.Core
|
|||
|
||||
private static readonly Regex[] ReportTitleRegex = new[]
|
||||
{
|
||||
//Episodes with airdate
|
||||
new Regex(@"^(?<title>.+?)?\W*(?<airyear>\d{4})\W+(?<airmonth>\d{2})\W+(?<airday>\d{2})\W?(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
new Regex(@"^(?<title>.+?)(?:\WS?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s){1,2}(?<episode>\d{1,2}(?!\d+)))+)+\W?(?!\\)",
|
||||
|
||||
//Multi-Part episodes without a title (S01E05.S01E06)
|
||||
new Regex(@"^(?:\W*S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s){1,2}(?<episode>\d{1,2}(?!\d+)))+){2,}\W?(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
new Regex(@"^(?<title>.*?)?(?:\W?S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s){1,2}(?<episode>\d{1,2}(?!\d+)))+)+\W?(?!\\)",
|
||||
|
||||
//Single episodes or multi-episode (S01E05E06, S01E05-06, etc)
|
||||
new Regex(@"^(?<title>.+?)(?:\W+S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s){1,2}(?<episode>\d{1,2}(?!\d+)))+)+\W?(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
|
||||
//No Title - Single episodes or multi-episode (S01E05E06, S01E05-06, etc)
|
||||
new Regex(@"^(?:\W?S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s){1,2}(?<episode>\d{1,2}(?!\d+)))+\W*)+\W?(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
|
||||
//Supports 103/113 naming
|
||||
new Regex(@"^(?<title>.+?)?\W?(?:\W(?<season>\d+)(?<episode>\d{2}))+\W?(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled), //Supports 103/113 naming
|
||||
new Regex(@"^(?<title>.*?)?(?:\W?S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|to)+(?<episode>\d+))+)+\W?(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
|
||||
//Episodes over 99 (3-digits or more)
|
||||
new Regex(@"^(?<title>.*?)(?:\W?S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|to)+(?<episode>\d+))+)+\W?(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
|
||||
//Supports Season only releases
|
||||
new Regex(@"^(?<title>.*?)\W(?:S|Season\W?)?(?<season>\d{1,2}(?!\d+))+\W?(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled) //Supports Season only releases
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled)
|
||||
};
|
||||
|
||||
private static readonly Regex NormalizeRegex = new Regex(@"((^|\W)(a|an|the|and|or|of)($|\W))|\W|\b(?!(?:19\d{2}|20\d{2}))\d+\b",
|
||||
private static readonly Regex NormalizeRegex = new Regex(@"((^|\W)(a|an|the|and|or|of)($|\W))|\W|(?:(?<=[^0-9]+)|\b)(?!(?:19\d{2}|20\d{2}))\d+(?=[^0-9ip]+|\b)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex SimpleTitleRegex = new Regex(@"480[i|p]|720[i|p]|1080[i|p]|[x|h]264|\\|\/|\<|\>|\?|\*|\:|\|",
|
||||
private static readonly Regex SimpleTitleRegex = new Regex(@"480[i|p]|720[i|p]|1080[i|p]|[x|h]264|\<|\>|\?|\*|\:|\|",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
/// <summary>
|
||||
|
@ -203,19 +218,19 @@ namespace NzbDrone.Core
|
|||
Logger.Trace("Trying to parse quality for {0}", name);
|
||||
|
||||
name = name.Trim();
|
||||
var normilizedName = NormalizeTitle(name);
|
||||
var normalizedName = NormalizeTitle(name);
|
||||
var result = new Quality { QualityType = QualityTypes.Unknown };
|
||||
result.Proper = normilizedName.Contains("proper");
|
||||
result.Proper = normalizedName.Contains("proper");
|
||||
|
||||
if (normilizedName.Contains("dvd") || normilizedName.Contains("bdrip") || normilizedName.Contains("brrip"))
|
||||
if (normalizedName.Contains("dvd") || normalizedName.Contains("bdrip") || normalizedName.Contains("brrip"))
|
||||
{
|
||||
result.QualityType = QualityTypes.DVD;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (normilizedName.Contains("xvid") || normilizedName.Contains("divx"))
|
||||
if (normalizedName.Contains("xvid") || normalizedName.Contains("divx"))
|
||||
{
|
||||
if (normilizedName.Contains("bluray"))
|
||||
if (normalizedName.Contains("bluray"))
|
||||
{
|
||||
result.QualityType = QualityTypes.DVD;
|
||||
return result;
|
||||
|
@ -225,15 +240,15 @@ namespace NzbDrone.Core
|
|||
return result;
|
||||
}
|
||||
|
||||
if (normilizedName.Contains("bluray"))
|
||||
if (normalizedName.Contains("bluray"))
|
||||
{
|
||||
if (normilizedName.Contains("720p"))
|
||||
if (normalizedName.Contains("720p"))
|
||||
{
|
||||
result.QualityType = QualityTypes.Bluray720p;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (normilizedName.Contains("1080p"))
|
||||
if (normalizedName.Contains("1080p"))
|
||||
{
|
||||
result.QualityType = QualityTypes.Bluray1080p;
|
||||
return result;
|
||||
|
@ -242,12 +257,12 @@ namespace NzbDrone.Core
|
|||
result.QualityType = QualityTypes.Bluray720p;
|
||||
return result;
|
||||
}
|
||||
if (normilizedName.Contains("webdl"))
|
||||
if (normalizedName.Contains("webdl"))
|
||||
{
|
||||
result.QualityType = QualityTypes.WEBDL;
|
||||
return result;
|
||||
}
|
||||
if (normilizedName.Contains("x264") || normilizedName.Contains("h264") || normilizedName.Contains("720p"))
|
||||
if (normalizedName.Contains("x264") || normalizedName.Contains("h264") || normalizedName.Contains("720p"))
|
||||
{
|
||||
result.QualityType = QualityTypes.HDTV;
|
||||
return result;
|
||||
|
@ -284,7 +299,7 @@ namespace NzbDrone.Core
|
|||
}
|
||||
}
|
||||
|
||||
if (normilizedName.Contains("sdtv") || (result.QualityType == QualityTypes.Unknown && normilizedName.Contains("hdtv")))
|
||||
if (normalizedName.Contains("sdtv") || (result.QualityType == QualityTypes.Unknown && normalizedName.Contains("hdtv")))
|
||||
{
|
||||
result.QualityType = QualityTypes.SDTV;
|
||||
return result;
|
||||
|
|
|
@ -17,17 +17,19 @@ namespace NzbDrone.Core.Providers.Jobs
|
|||
private readonly DownloadProvider _downloadProvider;
|
||||
private readonly IndexerProvider _indexerProvider;
|
||||
private readonly EpisodeProvider _episodeProvider;
|
||||
|
||||
private readonly SceneNameMappingProvider _sceneNameMappingProvider;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public EpisodeSearchJob(InventoryProvider inventoryProvider, DownloadProvider downloadProvider, IndexerProvider indexerProvider, EpisodeProvider episodeProvider)
|
||||
public EpisodeSearchJob(InventoryProvider inventoryProvider, DownloadProvider downloadProvider,
|
||||
IndexerProvider indexerProvider, EpisodeProvider episodeProvider,
|
||||
SceneNameMappingProvider sceneNameMappingProvider)
|
||||
{
|
||||
_inventoryProvider = inventoryProvider;
|
||||
_downloadProvider = downloadProvider;
|
||||
_indexerProvider = indexerProvider;
|
||||
_episodeProvider = episodeProvider;
|
||||
_sceneNameMappingProvider = sceneNameMappingProvider;
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
@ -58,7 +60,7 @@ namespace NzbDrone.Core.Providers.Jobs
|
|||
var indexers = _indexerProvider.GetEnabledIndexers();
|
||||
var reports = new List<EpisodeParseResult>();
|
||||
|
||||
var title = SceneNameHelper.GetTitleById(series.SeriesId);
|
||||
var title = _sceneNameMappingProvider.GetSceneName(series.SeriesId);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(title))
|
||||
{
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Providers.Jobs
|
||||
{
|
||||
public class UpdateSceneMappingsJob : IJob
|
||||
{
|
||||
private readonly SceneNameMappingProvider _sceneNameMappingProvider;
|
||||
|
||||
public UpdateSceneMappingsJob(SceneNameMappingProvider sceneNameMappingProvider)
|
||||
{
|
||||
_sceneNameMappingProvider = sceneNameMappingProvider;
|
||||
}
|
||||
|
||||
public UpdateSceneMappingsJob()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Update Scene Mappings"; }
|
||||
}
|
||||
|
||||
public int DefaultInterval
|
||||
{
|
||||
get { return 720; } //Every 12 hours
|
||||
}
|
||||
|
||||
public virtual void Start(ProgressNotification notification, int targetId)
|
||||
{
|
||||
notification.CurrentMessage = "Updating Scene Mappings";
|
||||
if (_sceneNameMappingProvider.UpdateMappings())
|
||||
notification.CurrentMessage = "Scene Mappings Completed";
|
||||
|
||||
else
|
||||
notification.CurrentMessage = "Scene Mappings Failed";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MvcMiniProfiler;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Helpers;
|
||||
|
@ -206,16 +205,13 @@ namespace NzbDrone.Core.Providers
|
|||
|
||||
public virtual Tuple<int, int> GetEpisodeFilesCount(int seriesId)
|
||||
{
|
||||
using (MiniProfiler.Current.Step("GetEpisodeFilesCount:" + seriesId))
|
||||
{
|
||||
var allEpisodes = _episodeProvider.GetEpisodeBySeries(seriesId);
|
||||
var allEpisodes = _episodeProvider.GetEpisodeBySeries(seriesId).ToList();
|
||||
|
||||
var episodeTotal = allEpisodes.Where(e => !e.Ignored && e.AirDate <= DateTime.Today && e.AirDate.Year > 1900).ToList();
|
||||
var avilableEpisodes = episodeTotal.Where(e => e.EpisodeFileId > 0).ToList();
|
||||
|
||||
return new Tuple<int, int>(avilableEpisodes.Count, episodeTotal.Count);
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> GetMediaFileList(string path)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using SubSonic.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class SceneNameMappingProvider
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly IRepository _repository;
|
||||
private readonly HttpProvider _httpProvider;
|
||||
|
||||
public SceneNameMappingProvider(IRepository repository, HttpProvider httpProvider)
|
||||
{
|
||||
_repository = repository;
|
||||
_httpProvider = httpProvider;
|
||||
}
|
||||
|
||||
public SceneNameMappingProvider()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual bool UpdateMappings()
|
||||
{
|
||||
try
|
||||
{
|
||||
var mapping = _httpProvider.DownloadString("http://vps.nzbdrone.com/SceneNameMappings.csv");
|
||||
var newMaps = new List<SceneNameMapping>();
|
||||
|
||||
using (var reader = new StringReader(mapping))
|
||||
{
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
var split = line.Split(',');
|
||||
var seriesId = 0;
|
||||
Int32.TryParse(split[1], out seriesId);
|
||||
|
||||
var map = new SceneNameMapping();
|
||||
map.SceneCleanName = split[0];
|
||||
map.SeriesId = seriesId;
|
||||
map.SceneName = split[2];
|
||||
|
||||
newMaps.Add(map);
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Debug("Deleting all existing Scene Mappings.");
|
||||
_repository.DeleteMany<SceneNameMapping>(GetAll());
|
||||
|
||||
Logger.Debug("Adding Scene Mappings");
|
||||
_repository.AddMany(newMaps);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.InfoException("Failed to Update Scene Mappings", ex);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual List<SceneNameMapping> GetAll()
|
||||
{
|
||||
return _repository.All<SceneNameMapping>().ToList();
|
||||
}
|
||||
|
||||
public virtual string GetSceneName(int seriesId)
|
||||
{
|
||||
var item = _repository.Single<SceneNameMapping>(s => s.SeriesId == seriesId);
|
||||
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
return item.SceneName;
|
||||
}
|
||||
|
||||
public virtual Nullable<Int32> GetSeriesId(string cleanName)
|
||||
{
|
||||
var item = _repository.Single<SceneNameMapping>(s => s.SceneCleanName == cleanName);
|
||||
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
return item.SeriesId;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,9 +3,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using PetaPoco;
|
||||
|
@ -18,15 +16,19 @@ namespace NzbDrone.Core.Providers
|
|||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private readonly TvDbProvider _tvDbProvider;
|
||||
private readonly SceneNameMappingProvider _sceneNameMappingProvider;
|
||||
private readonly IDatabase _database;
|
||||
private readonly QualityProvider _qualityProvider;
|
||||
private static readonly Regex TimeRegex = new Regex(@"^(?<time>\d+:?\d*)\W*(?<meridiem>am|pm)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
[Inject]
|
||||
public SeriesProvider(ConfigProvider configProviderProvider, TvDbProvider tvDbProviderProvider, IDatabase database, QualityProvider qualityProvider)
|
||||
public SeriesProvider(IDatabase database, ConfigProvider configProviderProvider, QualityProvider qualityProvider,
|
||||
TvDbProvider tvDbProviderProvider, SceneNameMappingProvider sceneNameMappingProvider)
|
||||
{
|
||||
_database = database;
|
||||
_configProvider = configProviderProvider;
|
||||
_tvDbProvider = tvDbProviderProvider;
|
||||
_database = database;
|
||||
_sceneNameMappingProvider = sceneNameMappingProvider;
|
||||
|
||||
_qualityProvider = qualityProvider;
|
||||
}
|
||||
|
||||
|
@ -107,7 +109,7 @@ namespace NzbDrone.Core.Providers
|
|||
{
|
||||
var normalizeTitle = Parser.NormalizeTitle(title);
|
||||
|
||||
var seriesId = SceneNameHelper.GetIdByName(normalizeTitle);
|
||||
var seriesId = _sceneNameMappingProvider.GetSeriesId(normalizeTitle);
|
||||
if (seriesId != null)
|
||||
{
|
||||
return GetSeries(seriesId.Value);
|
||||
|
@ -159,13 +161,11 @@ namespace NzbDrone.Core.Providers
|
|||
/// <summary>
|
||||
/// Cleans up the AirsTime Component from TheTVDB since it can be garbage that comes in.
|
||||
/// </summary>
|
||||
/// <param name = "input">The TVDB AirsTime</param>
|
||||
/// <param name = "rawTime">The TVDB AirsTime</param>
|
||||
/// <returns>String that contains the AirTimes</returns>
|
||||
private string CleanAirsTime(string inputTime)
|
||||
private static string CleanAirsTime(string rawTime)
|
||||
{
|
||||
Regex timeRegex = new Regex(@"^(?<time>\d+:?\d*)\W*(?<meridiem>am|pm)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
var match = timeRegex.Match(inputTime);
|
||||
var match = TimeRegex.Match(rawTime);
|
||||
var time = match.Groups["time"].Value;
|
||||
var meridiem = match.Groups["meridiem"].Value;
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SubSonic.SqlGeneration.Schema;
|
||||
|
||||
namespace NzbDrone.Core.Repository
|
||||
{
|
||||
public class SceneNameMapping
|
||||
{
|
||||
[SubSonicPrimaryKey]
|
||||
public virtual string SceneCleanName { get; set; }
|
||||
|
||||
public virtual int SeriesId { get; set; }
|
||||
|
||||
public virtual string SceneName { get; set; }
|
||||
}
|
||||
}
|
|
@ -187,8 +187,15 @@ namespace NzbDrone.Web.Controllers
|
|||
[HttpPost]
|
||||
public JsonResult SaveRootDir(int id, string path)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(path))
|
||||
return new JsonResult { Data = "failed" };
|
||||
|
||||
try
|
||||
{
|
||||
if (id == 0)
|
||||
id = _rootFolderProvider.Add(new RootDir { Path = path });
|
||||
|
||||
else
|
||||
_rootFolderProvider.Update(new RootDir { Id = id, Path = path });
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -199,30 +206,33 @@ namespace NzbDrone.Web.Controllers
|
|||
return new JsonResult { Data = "failed" };
|
||||
}
|
||||
|
||||
return new JsonResult { Data = "ok" };
|
||||
return new JsonResult { Data = id };
|
||||
}
|
||||
|
||||
public PartialViewResult AddRootDir()
|
||||
{
|
||||
var rootDir = new RootDir { Path = String.Empty };
|
||||
var model = new RootDirModel
|
||||
{
|
||||
Id = 0,
|
||||
Path = "",
|
||||
SelectList = new SelectList(new List<string> { "" }, "")
|
||||
};
|
||||
|
||||
var id = _rootFolderProvider.Add(rootDir);
|
||||
rootDir.Id = id;
|
||||
|
||||
var model = new RootDirModel();
|
||||
model.Id = rootDir.Id;
|
||||
model.Path = rootDir.Path;
|
||||
model.SelectList = new SelectList(new List<string> { rootDir.Path }, rootDir.Path);
|
||||
ViewData["guid"] = Guid.NewGuid();
|
||||
|
||||
return PartialView("RootDir", model);
|
||||
}
|
||||
|
||||
public ActionResult GetRootDirView(RootDir rootDir)
|
||||
{
|
||||
var model = new RootDirModel();
|
||||
model.Id = rootDir.Id;
|
||||
model.Path = rootDir.Path;
|
||||
model.SelectList = new SelectList(new List<string> { rootDir.Path }, rootDir.Path);
|
||||
var model = new RootDirModel
|
||||
{
|
||||
Id = rootDir.Id,
|
||||
Path = rootDir.Path,
|
||||
SelectList = new SelectList(new List<string> { rootDir.Path }, rootDir.Path)
|
||||
};
|
||||
|
||||
ViewData["guid"] = Guid.NewGuid();
|
||||
|
||||
return PartialView("RootDir", model);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using NzbDrone.Core.Model;
|
||||
|
@ -44,20 +45,30 @@ namespace NzbDrone.Web.Controllers
|
|||
//TODO: possible subsonic bug, IQuarible causes some issues so ToList() is called
|
||||
//https://github.com/subsonic/SubSonic-3.0/issues/263
|
||||
|
||||
var history = _historyProvider.AllItems().ToList().Select(h => new HistoryModel
|
||||
var historyDb = _historyProvider.AllItems().ToList();
|
||||
|
||||
var history = new List<HistoryModel>();
|
||||
|
||||
foreach (var item in historyDb)
|
||||
{
|
||||
HistoryId = h.HistoryId,
|
||||
SeasonNumber = h.Episode.SeasonNumber,
|
||||
EpisodeNumber = h.Episode.EpisodeNumber,
|
||||
EpisodeTitle = h.Episode.Title,
|
||||
EpisodeOverview = h.Episode.Overview,
|
||||
SeriesTitle = h.Episode.Series.Title,
|
||||
NzbTitle = h.NzbTitle,
|
||||
Quality = h.Quality.ToString(),
|
||||
IsProper = h.IsProper,
|
||||
Date = h.Date,
|
||||
Indexer = h.Indexer
|
||||
var episode = item.Episode;
|
||||
var series = episode.Series;
|
||||
|
||||
history.Add(new HistoryModel
|
||||
{
|
||||
HistoryId = item.HistoryId,
|
||||
SeasonNumber = episode.SeasonNumber,
|
||||
EpisodeNumber = episode.EpisodeNumber,
|
||||
EpisodeTitle = episode.Title,
|
||||
EpisodeOverview = episode.Overview,
|
||||
SeriesTitle = series.Title,
|
||||
NzbTitle = item.NzbTitle,
|
||||
Quality = item.Quality.ToString(),
|
||||
IsProper = item.IsProper,
|
||||
Date = item.Date,
|
||||
Indexer = item.Indexer
|
||||
});
|
||||
}
|
||||
|
||||
return View(new GridModel(history));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
@ -27,17 +28,25 @@ namespace NzbDrone.Web.Controllers
|
|||
[GridAction]
|
||||
public ActionResult _AjaxBindingYesterday()
|
||||
{
|
||||
var upcoming = _upcomingEpisodesProvider.Yesterday().Select(e => new UpcomingEpisodeModel
|
||||
var upcomingDb = _upcomingEpisodesProvider.Yesterday();
|
||||
var upcoming = new List<UpcomingEpisodeModel>();
|
||||
|
||||
foreach (var item in upcomingDb)
|
||||
{
|
||||
SeriesId = e.Series.SeriesId,
|
||||
EpisodeId = e.EpisodeId,
|
||||
SeriesName = e.Series.Title,
|
||||
SeasonNumber = e.SeasonNumber,
|
||||
EpisodeNumber = e.EpisodeNumber,
|
||||
Title = e.Title,
|
||||
Overview = e.Overview,
|
||||
AirDate = e.AirDate.Add(Convert.ToDateTime(e.Series.AirTimes).TimeOfDay)
|
||||
var series = item.Series;
|
||||
|
||||
upcoming.Add(new UpcomingEpisodeModel
|
||||
{
|
||||
SeriesId = series.SeriesId,
|
||||
EpisodeId = item.EpisodeId,
|
||||
SeriesName = series.Title,
|
||||
SeasonNumber = item.SeasonNumber,
|
||||
EpisodeNumber = item.EpisodeNumber,
|
||||
Title = item.Title,
|
||||
Overview = item.Overview,
|
||||
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
|
||||
});
|
||||
}
|
||||
|
||||
return View(new GridModel(upcoming));
|
||||
}
|
||||
|
@ -45,16 +54,25 @@ namespace NzbDrone.Web.Controllers
|
|||
[GridAction]
|
||||
public ActionResult _AjaxBindingToday()
|
||||
{
|
||||
var upcoming = _upcomingEpisodesProvider.Today().Select(e => new UpcomingEpisodeModel
|
||||
var upcomingDb = _upcomingEpisodesProvider.Today();
|
||||
var upcoming = new List<UpcomingEpisodeModel>();
|
||||
|
||||
foreach (var item in upcomingDb)
|
||||
{
|
||||
SeriesId = e.Series.SeriesId,
|
||||
SeriesName = e.Series.Title,
|
||||
SeasonNumber = e.SeasonNumber,
|
||||
EpisodeNumber = e.EpisodeNumber,
|
||||
Title = e.Title,
|
||||
Overview = e.Overview,
|
||||
AirDate = e.AirDate.Add(Convert.ToDateTime(e.Series.AirTimes).TimeOfDay)
|
||||
var series = item.Series;
|
||||
|
||||
upcoming.Add(new UpcomingEpisodeModel
|
||||
{
|
||||
SeriesId = series.SeriesId,
|
||||
EpisodeId = item.EpisodeId,
|
||||
SeriesName = series.Title,
|
||||
SeasonNumber = item.SeasonNumber,
|
||||
EpisodeNumber = item.EpisodeNumber,
|
||||
Title = item.Title,
|
||||
Overview = item.Overview,
|
||||
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
|
||||
});
|
||||
}
|
||||
|
||||
return View(new GridModel(upcoming));
|
||||
}
|
||||
|
@ -62,16 +80,25 @@ namespace NzbDrone.Web.Controllers
|
|||
[GridAction]
|
||||
public ActionResult _AjaxBindingTomorrow()
|
||||
{
|
||||
var upcoming = _upcomingEpisodesProvider.Tomorrow().Select(e => new UpcomingEpisodeModel
|
||||
var upcomingDb = _upcomingEpisodesProvider.Tomorrow();
|
||||
var upcoming = new List<UpcomingEpisodeModel>();
|
||||
|
||||
foreach (var item in upcomingDb)
|
||||
{
|
||||
SeriesId = e.Series.SeriesId,
|
||||
SeriesName = e.Series.Title,
|
||||
SeasonNumber = e.SeasonNumber,
|
||||
EpisodeNumber = e.EpisodeNumber,
|
||||
Title = e.Title,
|
||||
Overview = e.Overview,
|
||||
AirDate = e.AirDate.Add(Convert.ToDateTime(e.Series.AirTimes).TimeOfDay)
|
||||
var series = item.Series;
|
||||
|
||||
upcoming.Add(new UpcomingEpisodeModel
|
||||
{
|
||||
SeriesId = series.SeriesId,
|
||||
EpisodeId = item.EpisodeId,
|
||||
SeriesName = series.Title,
|
||||
SeasonNumber = item.SeasonNumber,
|
||||
EpisodeNumber = item.EpisodeNumber,
|
||||
Title = item.Title,
|
||||
Overview = item.Overview,
|
||||
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
|
||||
});
|
||||
}
|
||||
|
||||
return View(new GridModel(upcoming));
|
||||
}
|
||||
|
@ -79,16 +106,25 @@ namespace NzbDrone.Web.Controllers
|
|||
[GridAction]
|
||||
public ActionResult _AjaxBindingWeek()
|
||||
{
|
||||
var upcoming = _upcomingEpisodesProvider.Week().Select(e => new UpcomingEpisodeModel
|
||||
var upcomingDb = _upcomingEpisodesProvider.Week();
|
||||
var upcoming = new List<UpcomingEpisodeModel>();
|
||||
|
||||
foreach (var item in upcomingDb)
|
||||
{
|
||||
SeriesId = e.Series.SeriesId,
|
||||
SeriesName = e.Series.Title,
|
||||
SeasonNumber = e.SeasonNumber,
|
||||
EpisodeNumber = e.EpisodeNumber,
|
||||
Title = e.Title,
|
||||
Overview = e.Overview,
|
||||
AirDate = e.AirDate.Add(Convert.ToDateTime(e.Series.AirTimes).TimeOfDay)
|
||||
var series = item.Series;
|
||||
|
||||
upcoming.Add(new UpcomingEpisodeModel
|
||||
{
|
||||
SeriesId = series.SeriesId,
|
||||
EpisodeId = item.EpisodeId,
|
||||
SeriesName = series.Title,
|
||||
SeasonNumber = item.SeasonNumber,
|
||||
EpisodeNumber = item.EpisodeNumber,
|
||||
Title = item.Title,
|
||||
Overview = item.Overview,
|
||||
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
|
||||
});
|
||||
}
|
||||
|
||||
return View(new GridModel(upcoming));
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
}
|
||||
</div>
|
||||
<button onclick="reloadExistingSeries()" style="padding: 2px 10px 2px 10px; margin: 5px; margin-bottom: 10px;">Refresh Unmapped</button>
|
||||
<span id="reloadAjax" style="display: none"><img src="../../Content/Images/ajax-loader.gif" width="22px" height="22px" style="margin-bottom: -6px;"/></span>
|
||||
</div>
|
||||
</text>);
|
||||
}).Render();
|
||||
|
@ -132,11 +133,12 @@
|
|||
|
||||
var deleteRootDirUrl = '@Url.Action("DeleteRootDir", "AddSeries")';
|
||||
|
||||
function deleteRootDir(id) {
|
||||
sendDeleteToServer(id);
|
||||
function deleteRootDir(guid) {
|
||||
var id = $('#id_' + guid).val();
|
||||
sendDeleteToServer(id, guid);
|
||||
}
|
||||
|
||||
function sendDeleteToServer(id) {
|
||||
function sendDeleteToServer(id, guid) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: deleteRootDirUrl,
|
||||
|
@ -145,15 +147,16 @@
|
|||
alert("Sorry! We could not delete your Root Directory at this time. " + error);
|
||||
},
|
||||
success: function () {
|
||||
$("#rootDir_" + id).remove();
|
||||
$("#rootDir_" + guid).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var saveRootDirUrl = '@Url.Action("SaveRootDir", "AddSeries")';
|
||||
|
||||
function saveRootDir(id) {
|
||||
var path = $("#path_" + id).data("tComboBox").value();
|
||||
function saveRootDir(guid) {
|
||||
var path = $("#path_" + guid).data("tComboBox").value();
|
||||
var id = $("#id_" + guid).val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
@ -163,13 +166,20 @@
|
|||
alert("Sorry! We could not save " + path + " at this time. " + error);
|
||||
},
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
if (data != 'ok')
|
||||
if (data == 'failed')
|
||||
alert("An error occurred while saving Root Directory: " + path);
|
||||
else {
|
||||
$("#id_" + guid).val(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function reloadExistingSeries() {
|
||||
$('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")');
|
||||
$('#reloadAjax').show();
|
||||
$('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")',
|
||||
function (responseText, textStatus, XMLHttpRequest) {
|
||||
$('#reloadAjax').hide();
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -4,10 +4,10 @@
|
|||
Layout = null;
|
||||
}
|
||||
|
||||
<div class="rootDirSection" id="rootDir_@(Model.Id)" style="padding: 7px; padding-left: 3px;">
|
||||
<div class="rootDirSection" id="rootDir_@(ViewData["guid"])" style="padding: 7px; padding-left: 3px;">
|
||||
<fieldset style="padding: 5px; height: 40px;">
|
||||
@{Html.Telerik().ComboBox()
|
||||
.Name("path_" + Model.Id)
|
||||
.Name("path_" + ViewData["guid"])
|
||||
.BindTo(Model.SelectList)
|
||||
.DataBinding(binding => binding.Ajax().Select("_autoCompletePath", "Directory").Delay(400).Cache(false))
|
||||
.Filterable(f => f.FilterMode(AutoCompleteFilterMode.StartsWith))
|
||||
|
@ -16,10 +16,10 @@
|
|||
.Render();}
|
||||
|
||||
|
||||
<a href="#RemoveRootDir" class="deleteRow" onclick="deleteRootDir(@Model.Id); return false;">
|
||||
<a href="#RemoveRootDir" class="deleteRow" onclick="deleteRootDir('@ViewData["guid"]'); return false;">
|
||||
<img src="../../Content/Images/X.png" alt="Delete" width="20px" height="20px" style="vertical-align: middle; margin-top: 7px;"/></a>
|
||||
<button style="padding: 2px 10px 2px 10px; vertical-align: middle; margin: 0px; margin-top: 7px;" onclick="saveRootDir(@Model.Id)">Save</button>
|
||||
<button style="padding: 2px 10px 2px 10px; vertical-align: middle; margin: 0px; margin-top: 7px;" onclick="saveRootDir('@ViewData["guid"]')">Save</button>
|
||||
|
||||
@Html.HiddenFor(x => x.Id, new { id = "id_" + Model.Id })
|
||||
@Html.HiddenFor(x => x.Id, new { id = "id_" + ViewData["guid"] })
|
||||
</fieldset>
|
||||
</div>
|
|
@ -0,0 +1,58 @@
|
|||
csinewyork,73696,CSI
|
||||
csiny,73696,CSI
|
||||
archer,110381,Archer
|
||||
lifeafterpeopleseries,83897,Life After People
|
||||
lifeafterpeople,83897,Life After People
|
||||
kitchennightmaresus,80552,Kitchen Nightmares US
|
||||
dailyshow,71256,The Daily Show
|
||||
dailyshowwithjonstewart,71256,The Daily Show
|
||||
lawordersvu,75692,Law and Order SVU
|
||||
laworderspecialvictimsunit,75692,Law and Order
|
||||
lawordercriminalintent,71489,Law and Order
|
||||
laworderci,71489,Law and Order
|
||||
dancingwithstarsus,79590,Dancing With The Stars
|
||||
craigferguson,73387,Craig Ferguson
|
||||
jimmyfallon,85355,Jimmy Fallon
|
||||
davidletterman,75088,David Letterman
|
||||
bigbrotherus,76706,Big Brother
|
||||
colony,105521,The Colony
|
||||
colonyus,105521,The Colony
|
||||
americasfunniesthomevideos,76235,Americas Funniest Home Videos
|
||||
afhv,76235,Americas Funniest Home Videos
|
||||
childrenshospitalus,139941,Childrens Hospital
|
||||
childrenshospital,139941,Childrens Hospital
|
||||
merlin,83123,Merlin
|
||||
merlin2008,83123,Merlin
|
||||
wwemondaynightraw,76779,WWE Monday Night RAW
|
||||
shitmydadsays,164951,Shit My Dad Says
|
||||
geniuswithdavegorman,83714,Genius with Dave Gorman
|
||||
laworderla,168161,Law and Order
|
||||
startrektos,77526,Star Trek TOS
|
||||
startrekds,72073,Star Trek DS9
|
||||
ellendegeneres,72194,Ellen Degeneres
|
||||
drinkingmadeeasy,195831,Drinking Made Easy
|
||||
zanelampreysdrinkingmadeeasy,195831,Drinking Made Easy
|
||||
poirot,76133,Poirot
|
||||
agathachristiespoirot,76133,Poirot
|
||||
realworldroadruleschallenge,70870,The Real World Road Rules Challenge
|
||||
challengecutthroat,70870,The Challenge Cutthroat
|
||||
thisoldhouseprogram,77444,This Old House Program
|
||||
minutesus,73290,60 Minutes
|
||||
conan,194751,Conan
|
||||
conan2010,194751,Conan
|
||||
carlos2010,164451,Carlos 2010
|
||||
babalon,70726,Babalon
|
||||
genius,83714,Genius
|
||||
geniuswithdavegormand,83714,Genius With Dave Gormand
|
||||
comeflywithme2010,212571,Come Fly With Me 2010
|
||||
bordersecurity,81563,Border Security
|
||||
bordersecurityaustraliasfrontline,81563,Border Security Australias Frontline
|
||||
silentlibraryus,172381,Silent Library US
|
||||
scifiscience,131791,Sci Fi Science
|
||||
frontline,80646,Frontline
|
||||
frontlineus,80646,Frontline
|
||||
rbtau,189931,RBT AU
|
||||
house,73255,House
|
||||
housemd,73255,House
|
||||
office,73244,The Office
|
||||
officeus,73244,The Office
|
|
Loading…
Reference in New Issue