More config pages have been added. AJAX to save. Order with jquery sortable.

Some RssFeed Parsing has been implemented, it does not currently download items, still need to perform a more verbose episode check.
This commit is contained in:
markus101
2011-01-28 22:10:22 -08:00
parent 65ecd58111
commit da979639ba
145 changed files with 8384 additions and 113 deletions
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<generator>NZBMatrix.com RSS 2.0</generator>
<language>en</language>
<title>NZBMatrix</title>
<description>NZBMatrix.com RSS Feed - Usenet</description>
<link>http://nzbmatrix.com</link>
<copyright>Copyright 2010 NZBMatrix</copyright>
<pubDate>Fri, 23 Apr 2010 01:28:23 -0400</pubDate>
<item>
<title>24.S08E19.HDTV.XviD-LOL</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625437</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625437</link>
<description><![CDATA[<b>Name:</b> Craig Ferguson 2010 04 22 Jeffrey Dean Morgan HDTV XviD LMAO<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 424.85MB<br /><b>Added:</b> 2010-04-23 06:22:45]]></description>
<category>TV: Divx/Xvid</category>
<cattext>tv.divx/xvid</cattext>
<categoryid>6</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625437" length="445487513" type="application/x-nzb" />
</item>
<item>
<title>CSI.S10E20.HDTV.XviD-LOL</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625436</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625436</link>
<description><![CDATA[<b>Name:</b> Little People Big World S08E24 Brothers in Bavaria REPACK HDTV XviD MOMENTUM<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 208.22MB<br /><b>Added:</b> 2010-04-23 06:21:44]]></description>
<category>TV: Divx/Xvid</category>
<cattext>tv.divx/xvid</cattext>
<categoryid>6</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625436" length="218334494" type="application/x-nzb" />
</item>
<item>
<title>The.Daily.Show.2010.04.29.Michael.Caine.HDTV.XviD-FQM.nzb</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625435</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625435</link>
<description><![CDATA[<b>Name:</b> Lopez Tonight 2010 04 21 Zoe Saldana HDTV XviD MOMENTUM<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 424.31MB<br /><b>Added:</b> 2010-04-23 06:04:48]]></description>
<category>TV: Divx/Xvid</category>
<cattext>tv.divx/xvid</cattext>
<categoryid>6</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625435" length="444921282" type="application/x-nzb" />
</item>
<item>
<title>The Mentalist S02E20 720p HDTV x264 CTU</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625434</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625434</link>
<description><![CDATA[<b>Name:</b> The Mentalist S02E20 720p HDTV x264 CTU<br /><b>Category:</b> TV: HD<br /><b>Size:</b> 219.79MB<br /><b>Added:</b> 2010-04-23 05:57:50]]></description>
<category>TV: HD</category>
<cattext>tv.hd</cattext>
<categoryid>41</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625434" length="230466519" type="application/x-nzb" />
</item>
<item>
<title>24.S06E01.HDTV.XviD-LOL</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625433</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625433</link>
<description><![CDATA[<b>Name:</b> Jimmy Kimmel 2010 04 22 Chace Crawford HDTV XviD 2HD<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 433.32MB<br /><b>Added:</b> 2010-04-23 05:46:31]]></description>
<category>TV: Divx/Xvid</category>
<cattext>tv.divx/xvid</cattext>
<categoryid>6</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625433" length="454368952" type="application/x-nzb" />
</item>
<item>
<title>Bones.S05E19.HDTV.XviD-LOL</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625430</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625430</link>
<description><![CDATA[<b>Name:</b> Project Runway S07E14 WS DSR XviD MOMENTUM<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 430.59MB<br /><b>Added:</b> 2010-04-23 05:34:44]]></description>
<category>TV: Divx/Xvid</category>
<cattext>tv.divx/xvid</cattext>
<categoryid>6</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625430" length="451506339" type="application/x-nzb" />
</item>
<item>
<title>David Letterman 2010 04 22 David Spade HDTV XviD LMAO</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625402</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625402</link>
<description><![CDATA[<b>Name:</b> David Letterman 2010 04 22 David Spade HDTV XviD LMAO<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 416.25MB<br /><b>Added:</b> 2010-04-23 05:20:07]]></description>
<category>TV: Divx/Xvid</category>
<cattext>tv.divx/xvid</cattext>
<categoryid>6</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625402" length="436469760" type="application/x-nzb" />
</item>
<item>
<title>Jay Leno 2010 04 22 Jeff Corwin HDTV XviD LMAO</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625389</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625389</link>
<description><![CDATA[<b>Name:</b> Jay Leno 2010 04 22 Jeff Corwin HDTV XviD LMAO<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 417.51MB<br /><b>Added:</b> 2010-04-23 05:06:07]]></description>
<category>TV: Divx/Xvid</category>
<cattext>tv.divx/xvid</cattext>
<categoryid>6</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625389" length="437790965" type="application/x-nzb" />
</item>
<item>
<title>The Colbert Report 2010 04 22 Gorillaz HDTV XviD FQM</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625387</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625387</link>
<description><![CDATA[<b>Name:</b> The Colbert Report 2010 04 22 Gorillaz HDTV XviD FQM<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 216.94MB<br /><b>Added:</b> 2010-04-23 04:13:02]]></description>
<category>TV: Divx/Xvid</category>
<cattext>tv.divx/xvid</cattext>
<categoryid>6</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625387" length="227478077" type="application/x-nzb" />
</item>
<item>
<title>The Marriage Ref S01E08 HDTV XviD 2HD</title>
<guid>http://nzbmatrix.com/api-nzb-download.php?id=625386</guid>
<link>http://nzbmatrix.com/api-nzb-download.php?id=625386</link>
<description><![CDATA[<b>Name:</b> The Marriage Ref S01E08 HDTV XviD 2HD<br /><b>Category:</b> TV: Divx/Xvid<br /><b>Size:</b> 431.06MB<br /><b>Added:</b> 2010-04-23 04:11:08]]></description>
<category>TV: Divx/Xvid</category>
<cattext>tv.divx/xvid</cattext>
<categoryid>6</categoryid>
<enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=625386" length="451999170" type="application/x-nzb" />
</item>
</channel>
</rss>
+182
View File
@@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gallio.Framework;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using Moq;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
using SubSonic.Repository;
namespace NzbDrone.Core.Test
{
[TestFixture]
public class HistoryProviderTest
{
[Test]
public void AllItems()
{
//Setup
var indexer = new Indexer {Enabled = true, Name = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com"};
var series = new Series
{
SeriesId = 5656,
CleanTitle = "rock",
Monitored = true,
Overview = "Series Overview",
Quality = 1,
Title = "30 Rock",
Path = @"C:\Test\TV\30 Rock"
};
var season = new Season{SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true};
var episode = new Episode
{
AirDate = DateTime.Today.AddDays(-1),
EpisodeId = 1234,
EpisodeNumber = 5,
Language = "English",
Overview = "This is an Overview",
SeasonNumber = 1,
SeasonId = 4321,
Season = season,
SeriesId = 5656
};
var list = new List<History>();
list.Add(new History
{
Id = new int(),
Date = DateTime.Now,
IsProper = false,
Quality = 1,
Indexer = indexer,
Episode = episode,
EpisodeId = 1234
});
var repo = new Mock<IRepository>();
repo.Setup(r => r.All<History>()).Returns(list.AsQueryable());
var target = new HistoryProvider(repo.Object);
//Act
var result = target.AllItems();
//Assert
Assert.AreEqual(result.Count(), 1);
}
[Test]
public void Exists_True()
{
//Todo: This test fails... Moq Setup doesn't return the expected value
//Setup
var indexer = new Indexer { Enabled = true, Name = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com" };
var series = new Series
{
SeriesId = 5656,
CleanTitle = "rock",
Monitored = true,
Overview = "Series Overview",
Quality = 1,
Title = "30 Rock",
Path = @"C:\Test\TV\30 Rock"
};
var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true };
var episode = new Episode
{
AirDate = DateTime.Today.AddDays(-1),
EpisodeId = 1234,
EpisodeNumber = 5,
Language = "English",
Overview = "This is an Overview",
SeasonNumber = 1,
SeasonId = 4321,
Season = season,
SeriesId = 5656
};
var list = new List<History>();
list.Add(new History
{
Id = new int(),
Date = DateTime.Now,
IsProper = false,
Quality = 1,
Indexer = indexer,
Episode = episode,
EpisodeId = 1234
});
var proper = false;
var repo = new Mock<IRepository>();
repo.Setup(r => r.Exists<History>(h => h.EpisodeId == episode.EpisodeId && h.IsProper == proper)).Returns(true);
var target = new HistoryProvider(repo.Object);
//Act
var result = target.Exists(episode, false);
//Assert
Assert.AreEqual(result, true);
}
[Test]
public void Exists_False()
{
//Todo: This test fails... Moq Setup doesn't return the expected value
//Setup
var indexer = new Indexer { Enabled = true, Name = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com" };
var series = new Series
{
SeriesId = 5656,
CleanTitle = "rock",
Monitored = true,
Overview = "Series Overview",
Quality = 1,
Title = "30 Rock",
Path = @"C:\Test\TV\30 Rock"
};
var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true };
var episode = new Episode
{
AirDate = DateTime.Today.AddDays(-1),
EpisodeId = 1234,
EpisodeNumber = 5,
Language = "English",
Overview = "This is an Overview",
SeasonNumber = 1,
SeasonId = 4321,
Season = season,
SeriesId = 5656
};
var list = new List<History>();
list.Add(new History
{
Id = new int(),
Date = DateTime.Now,
IsProper = false,
Quality = 1,
Indexer = indexer,
Episode = episode,
EpisodeId = 1234
});
var repo = new Mock<IRepository>();
repo.Setup(r => r.Exists<History>(h => h.Episode == episode && h.IsProper == list[0].IsProper)).Returns(false);
var target = new HistoryProvider(repo.Object);
//Act
var result = target.Exists(episode, true);
//Assert
Assert.AreEqual(result, false);
}
}
}
+72
View File
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gallio.Framework;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using Moq;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
using SubSonic.Repository;
namespace NzbDrone.Core.Test
{
[TestFixture]
public class IndexerProviderTest
{
[Test]
public void AllIndexers()
{
//
// TODO: Add test logic here
//
//Setup
var list = new List<Indexer>();
list.Add(new Indexer{Name = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1});
list.Add(new Indexer{Name = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4});
list.Add(new Indexer{Name = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3});
list.Add(new Indexer{Name = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2});
var repo = new Mock<IRepository>();
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
var target = new IndexerProvider(repo.Object);
//Act
var result = target.AllIndexers();
//Assert
Assert.AreEqual(result.Last().Name, "Test2");
}
[Test]
public void EnabledIndexers()
{
//
// TODO: Add test logic here
//
//Setup
var list = new List<Indexer>();
list.Add(new Indexer { Name = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1 });
list.Add(new Indexer { Name = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4 });
list.Add(new Indexer { Name = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3 });
list.Add(new Indexer { Name = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 });
var repo = new Mock<IRepository>();
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
var target = new IndexerProvider(repo.Object);
//Act
var result = target.EnabledIndexers();
//Assert
Assert.AreEqual(result.First().Name, "Test1");
Assert.AreEqual(result.Last().Name, "Test3");
}
}
}
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
+13 -1
View File
@@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -52,6 +53,10 @@
<Reference Include="NLog">
<HintPath>..\NzbDrone.Core\Libraries\NLog.dll</HintPath>
</Reference>
<Reference Include="RSS.NET, Version=0.86.3627.40828, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libs\RSS.NET.dll</HintPath>
</Reference>
<Reference Include="SubSonic.Core, Version=3.0.0.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\NzbDrone.Core\Libraries\SubSonic.Core.dll</HintPath>
@@ -68,6 +73,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="HistoryProviderTest.cs" />
<Compile Include="MediaFileProviderTests.cs" />
<Compile Include="DbConfigControllerTest.cs" />
<Compile Include="EpisodeProviderTest.cs" />
@@ -80,8 +86,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QualityProfileTest.cs" />
<Compile Include="RepoTest.cs" />
<Compile Include="RssProviderTest.cs" />
<Compile Include="SabControllerTest.cs" />
<Compile Include="SeriesProviderTest.cs" />
<Compile Include="IndexerProviderTest.cs" />
<Compile Include="TvDbControllerTest.cs" />
</ItemGroup>
<ItemGroup>
@@ -91,6 +99,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Files\Feed.nzbmatrix.com.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Libs\FizzWare.NBuilder.dll" />
<Content Include="Files\Queue.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -102,8 +113,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Libs\Moq.dll" />
<Content Include="Libs\Moq.pdb" />
<Content Include="Libs\Moq.xml" />
<Content Include="Libs\RSS.NET.dll" />
<Content Include="Libs\RSS.NET.XML" />
<Content Include="Libs\System.Data.SQLite.DLL">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+34
View File
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Security.Policy;
using System.Text;
using Gallio.Framework;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using Moq;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
using Rss;
namespace NzbDrone.Core.Test
{
[TestFixture]
public class RssProviderTest
{
[Test]
public void GetFeed()
{
//Setup
var feedInfo = new FeedInfoModel("NzbMatrix", @"Files\Feed.nzbmatrix.com.xml");
var target = new RssProvider();
//Act
var enumerable = target.GetFeed(feedInfo);
var result = new List<RssItem>();
result.AddRange(enumerable);
//Assert
Assert.GreaterThan(result.Count, 1); //Assert that the number of Items in the feed is greater than 1
}
}
}