mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 07:22:35 +01:00
Size is now parsed for each item in the feed.
QualityType added to database to allow saving of size limits. Fluent now uses longs for multiplication, to ensure it doesn't overflow.
This commit is contained in:
parent
f8ae95d36f
commit
e4f01ae0d4
82
NzbDrone.Core.Test/Files/RSS/SizeParsing/newzbin.xml
Normal file
82
NzbDrone.Core.Test/Files/RSS/SizeParsing/newzbin.xml
Normal file
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<rss version="2.0" xml:lang="en-GB"
|
||||
xmlns:report="http://www.newzbin.com/DTD/2007/feeds/report/">
|
||||
<channel>
|
||||
<title>www.newzbin.com (reports)</title>
|
||||
<link>http://www.newzbin.com/browse/category/p/tv/</link>
|
||||
<description>Newzbin Reports Feed</description>
|
||||
<pubDate>Mon, 25 Apr 2011 16:08:24 GMT</pubDate>
|
||||
<ttl>42</ttl>
|
||||
<generator>www.newzbin.com - Usenet Search</generator>
|
||||
<copyright>Copyright (c) 2002 - 2007 Newzbin Limited. All Rights Reserved.</copyright>
|
||||
<image>
|
||||
<url>http://www.newzbin.com/m/i/logo/newzbinv3.png</url>
|
||||
<link>http://www.newzbin.com/browse/category/p/tv/</link>
|
||||
<title>www.newzbin.com</title>
|
||||
<description>Visit Newzbin.com - The Ultimate In Usenet Indexing</description>
|
||||
</image>
|
||||
<item>
|
||||
<title>Rookie Blue - 1x10 - Big Nickel</title>
|
||||
<guid isPermaLink="true">http://www.newzbin.com/browse/post/6076287/</guid>
|
||||
<link>http://www.newzbin.com/browse/post/6076287/</link>
|
||||
<comments>http://www.newzbin.com/browse/post/6076287/#CommentsPH</comments>
|
||||
<description>
|
||||
<![CDATA[
|
||||
<ul>
|
||||
<li>
|
||||
ID: <a href="http://www.newzbin.com/browse/post/6076287">6076287</a>
|
||||
(<a
|
||||
href="http://www.newzbin.com/account/bookmarks/add/?ps_id=6076287">Bookmark</a>)
|
||||
(<a href="http://www.newzbin.com/browse/post/6076287/nzb/">NZB</a>)
|
||||
(<a href="http://www.newzbin.com/nfo/view/txt/373966350/">NFO</a>)
|
||||
(<a href="http://www.tvrage.com/Rookie_Blue/episodes/1064943067/1x10/">More Info</a>)
|
||||
(Size: 1,235.6MB)
|
||||
</li>
|
||||
<li>
|
||||
Attributes:
|
||||
Category - TV
|
||||
| Video Source - TV Cap, HDTV | Video Format - x264, 720p | Video Genre - Action/Adv, Crime, Drama, Family | Language - English, German
|
||||
</li>
|
||||
<li>Groups: alt.binaries.illuminaten</li>
|
||||
<li>Poster: AuToMaTiC <AuTo@Illuminatenboard.org></li>
|
||||
<li>PostDate: Sunday 06 Mar 2011, 01:05PM PDT</li>
|
||||
</ul> ]]>
|
||||
</description>
|
||||
<report:id>6076287</report:id>
|
||||
<report:category>TV</report:category>
|
||||
<report:attributes>
|
||||
<report:attribute type="Source">TV Cap</report:attribute>
|
||||
<report:attribute type="Source">HDTV</report:attribute>
|
||||
<report:attribute type="Video Fmt">x264</report:attribute>
|
||||
<report:attribute type="Video Fmt">720p</report:attribute>
|
||||
<report:attribute type="Video Genre">Action/Adv</report:attribute>
|
||||
<report:attribute type="Video Genre">Crime</report:attribute>
|
||||
<report:attribute type="Video Genre">Drama</report:attribute>
|
||||
<report:attribute type="Video Genre">Family</report:attribute>
|
||||
<report:attribute type="Language">English</report:attribute>
|
||||
<report:attribute type="Language">German</report:attribute>
|
||||
</report:attributes>
|
||||
<report:groups>
|
||||
<report:group>alt.binaries.illuminaten</report:group>
|
||||
</report:groups>
|
||||
<report:progress value="1">Report is complete</report:progress>
|
||||
<report:moreinfo>http://www.tvrage.com/Rookie_Blue/episodes/1064943067/1x10/</report:moreinfo>
|
||||
<report:nfo>
|
||||
<report:fileid>373966350</report:fileid>
|
||||
<report:filename>tvp-rookieblue-s01e10-720p.nfo</report:filename>
|
||||
<report:link>http://www.newzbin.com/nfo/view/txt/373966350/</report:link>
|
||||
</report:nfo>
|
||||
<report:nzb>http://www.newzbin.com/browse/post/6076287/nzb/</report:nzb>
|
||||
<report:poster>AuToMaTiC <AuTo@Illuminatenboard.org></report:poster>
|
||||
<report:size type="bytes">1295652290</report:size>
|
||||
<report:postdate>Sun, 06 Mar 2011 21:05:58 GMT</report:postdate>
|
||||
<report:stats>
|
||||
<report:views>2</report:views>
|
||||
<report:comments>0</report:comments>
|
||||
</report:stats>
|
||||
<enclosure url="http://www.newzbin.com/browse/post/6076287/nzb/"
|
||||
length="1295652290" type="application/x-nzb" />
|
||||
<pubDate>Mon, 25 Apr 2011 11:55:04 GMT</pubDate>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
23
NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbmatrix.xml
Normal file
23
NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbmatrix.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?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 2011 NZBMatrix</copyright>
|
||||
<pubDate>Wed, 14 Sep 2011 02:18:04 +0200</pubDate>
|
||||
<item>
|
||||
<title>House S04E11 720p HDTV x264 BAWLS</title>
|
||||
<guid>http://nzbmatrix.com/nzb-details.php?id=914522&hit=1</guid>
|
||||
<link>http://nzbmatrix.com/nzb-details.php?id=914522&hit=1</link>
|
||||
<description><![CDATA[<b>Name:</b> House S04E11 FRENCH 720p HDTV x264 BAWLS<br /><b>Category:</b> TV: HD<br /><b>Size:</b> 1.24 GB<br /><b>Added:</b> 2011-04-25 15:06:58<br /><b>Group:</b> alt.binaries.multimedia <BR /><b>NFO:</b> <a href="http://nzbmatrix.com/viewnfo.php?id=914522">View NFO</a> ]]></description>
|
||||
<category>TV: HD</category>
|
||||
<cattext>tv.hd</cattext>
|
||||
<categoryid>41</categoryid>
|
||||
<enclosure url="http://nzbmatrix.com/nzb-details.php?id=914522&hit=1" length="1335801937" type="application/x-nzb" />
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
27
NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbsorg.xml
Normal file
27
NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbsorg.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1" ?>
|
||||
<rss version="2.0" xmlns:report="http://www.newzbin.com/DTD/2007/feeds/report/">
|
||||
<channel>
|
||||
<title>All Categories - NZBs(dot)ORG RSS Feed</title>
|
||||
<link>http://nzbs.org/index.php?&catid=</link>
|
||||
<description>All Categories feed for NZBs(dot)ORG</description>
|
||||
<language>en-us</language>
|
||||
<item>
|
||||
<title>Shameless.S08E17.720p.HDTV.x264-BiA</title>
|
||||
|
||||
<pubDate>Wed, 14 Sep 2011 02:14:09 +0000</pubDate>
|
||||
<category>TV-x264</category>
|
||||
<link>http://nzbs.org/index.php?action=view&nzbid=750588</link>
|
||||
<description><![CDATA[<b>Category:</b> <a href="http://nzbs.org/index.php?action=browse&catid=14">TV-x264</a><br /><b>Size:</b> <a href="http://nzbs.org/index.php?action=view&nzbid=750588&filelist=1">1.67 GB</a><br /><b>Files:</b> 44 <small>(8 pars)</small><br /><b>Group:</b> a.b.teevee<br /><b>.NFO:</b> <a href="http://nzbs.org/index.php?action=view&nzbid=750588&nfo=1#nfo">View NFO</a><br /><b>Ext. Link:</b> <a href="http://www.tvrage.com/shows/id-5162">http://www.tvrage.com/shows/id-5162</a><br /><b>Posted:</b> Wed September 14th 00:00:15 UTC<br /><b><a href="http://nzbs.org/cart.php?action=rsstomynzbs&nzbid=750588&i=9695&h=92653d4053a322e123dbbb3da887c5c5">Add to My NZBs</a></b><br /><b><a href="http://nzbs.org/index.php?action=getnzb&nzbid=750588&i=9695&h=92653d4053a322e123dbbb3da887c5c5">Download NZB</a></b><br />]]></description>
|
||||
<guid>http://nzbs.org/index.php?action=view&nzbid=750588</guid>
|
||||
<report:id>750588</report:id>
|
||||
|
||||
<report:category parentID="1" id="14">TV-x264</report:category>
|
||||
<report:nzb>http://nzbs.org/index.php?action=getnzb&nzbid=750588&i=9695&h=92653d4053a322e123dbbb3da887c5c5</report:nzb>
|
||||
<report:poster><![CDATA[teevee@4u.net (teevee)]]></report:poster>
|
||||
<report:size type="bytes">1788245756</report:size>
|
||||
<report:postdate>Wed, 14 Sep 2011 00:00:15 +0000</report:postdate>
|
||||
|
||||
<report:moreinfo>http://www.tvrage.com/shows/id-5162</report:moreinfo>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
23
NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbsrus.xml
Normal file
23
NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbsrus.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1" ?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>NZBsRus.com</title>
|
||||
<description>This is the NZBs'R'US RSS feed.</description>
|
||||
<link>http://www.nzbsrus.com</link>
|
||||
<language>en-US</language>
|
||||
<ttl>5</ttl>
|
||||
|
||||
<item>
|
||||
<title>Shameless.S08E17.720p.HDTV.x264-BiA</title>
|
||||
<pubDate>Wed, 14 Sep 2011 01:06:49 am</pubDate>
|
||||
<category>TV - HD</category>
|
||||
<link>http://www.nzbsrus.com/nzbdownload_rss.php/457967/68614/4182562f71f29cd36b9e7495d00abcff/</link>
|
||||
<description>
|
||||
Size 1.67 GiB (42 files)
|
||||
Files: 34
|
||||
Par2s: 8
|
||||
|
||||
</description>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
@ -316,8 +316,72 @@ namespace NzbDrone.Core.Test
|
||||
result.Should().Be(clean);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void size_newzbin()
|
||||
{
|
||||
//Setup
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<HttpProvider>()
|
||||
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
||||
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\newzbin.xml"));
|
||||
|
||||
//Act
|
||||
var parseResults = mocker.Resolve<Newzbin>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
parseResults[0].Size.Should().Be(1295620506);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void size_nzbmatrix()
|
||||
{
|
||||
//Setup
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<HttpProvider>()
|
||||
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
||||
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbmatrix.xml"));
|
||||
|
||||
//Act
|
||||
var parseResults = mocker.Resolve<NzbMatrix>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
parseResults[0].Size.Should().Be(1331439862);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void size_nzbsorg()
|
||||
{
|
||||
//Setup
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<HttpProvider>()
|
||||
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
||||
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbsorg.xml"));
|
||||
|
||||
//Act
|
||||
var parseResults = mocker.Resolve<NzbsOrg>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
parseResults[0].Size.Should().Be(1793148846);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void size_nzbsrus()
|
||||
{
|
||||
//Setup
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
mocker.GetMock<HttpProvider>()
|
||||
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
||||
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbsrus.xml"));
|
||||
|
||||
//Act
|
||||
var parseResults = mocker.Resolve<NzbsRUs>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
parseResults[0].Size.Should().Be(1793148846);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -90,6 +90,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="BacklogSearchJobTest.cs" />
|
||||
<Compile Include="BannerDownloadJobTest.cs" />
|
||||
<Compile Include="QualityTypeProviderTest.cs" />
|
||||
<Compile Include="MisnamedProviderTest.cs" />
|
||||
<Compile Include="SeasonSearchJobTest.cs" />
|
||||
<Compile Include="SearchProviderTest_PartialSeason.cs" />
|
||||
@ -156,6 +157,18 @@
|
||||
<Content Include="Files\Categories_json.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Files\RSS\SizeParsing\newzbin.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Files\RSS\SizeParsing\nzbmatrix.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Files\RSS\SizeParsing\nzbsorg.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Files\RSS\SizeParsing\nzbsrus.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Framework\AutoMoq\License.txt" />
|
||||
<Content Include="Files\Feed.nzbmatrix.com.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
|
@ -338,5 +338,18 @@ namespace NzbDrone.Core.Test
|
||||
result.SeasonNumber.Should().Be(seasonNumber);
|
||||
result.FullSeason.Should().BeTrue();
|
||||
}
|
||||
|
||||
[TestCase("5.64 GB", 6055903887)]
|
||||
[TestCase("5.54 GiB", 5948529705)]
|
||||
[TestCase("398.62 MiB", 417983365)]
|
||||
[TestCase("7,162.1MB", 7510006170)]
|
||||
[TestCase("162.1MB", 169974170)]
|
||||
[TestCase("398.62 MB", 417983365)]
|
||||
public void parse_size(string sizeString, long expectedSize)
|
||||
{
|
||||
var result = Parser.GetReportSize(sizeString);
|
||||
|
||||
result.Should().Be(expectedSize);
|
||||
}
|
||||
}
|
||||
}
|
105
NzbDrone.Core.Test/QualityTypeProviderTest.cs
Normal file
105
NzbDrone.Core.Test/QualityTypeProviderTest.cs
Normal file
@ -0,0 +1,105 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class QualityTypeProviderTest : TestBase
|
||||
{
|
||||
[Test]
|
||||
public void SetupDefault_should_add_six_profiles()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<QualityTypeProvider>().SetupDefault();
|
||||
|
||||
//Assert
|
||||
var types = mocker.Resolve<QualityTypeProvider>().All();
|
||||
|
||||
types.Should().HaveCount(6);
|
||||
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 == "HDTV" && e.QualityTypeId == 4);
|
||||
types.Should().Contain(e => e.Name == "WEBDL" && e.QualityTypeId == 5);
|
||||
types.Should().Contain(e => e.Name == "Bluray720p" && e.QualityTypeId == 6);
|
||||
types.Should().Contain(e => e.Name == "Bluray1080p" && e.QualityTypeId == 7);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetupDefault_already_exists()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var fakeQualityType = Builder<QualityType>.CreateNew()
|
||||
.Build();
|
||||
|
||||
db.Insert(fakeQualityType);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<QualityTypeProvider>().SetupDefault();
|
||||
|
||||
//Assert
|
||||
var types = mocker.Resolve<QualityTypeProvider>().All();
|
||||
|
||||
types.Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetList_single_quality_type()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6)
|
||||
.Build();
|
||||
|
||||
var ids = new List<int> { 1 };
|
||||
|
||||
db.InsertMany(fakeQualityTypes);
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<QualityTypeProvider>().GetList(ids);
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(ids.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetList_multiple_quality_type()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6)
|
||||
.Build();
|
||||
|
||||
var ids = new List<int> { 1, 2 };
|
||||
|
||||
db.InsertMany(fakeQualityTypes);
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<QualityTypeProvider>().GetList(ids);
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(ids.Count);
|
||||
}
|
||||
}
|
||||
}
|
@ -61,6 +61,7 @@ namespace NzbDrone.Core
|
||||
LogConfiguration.StartDbLogging();
|
||||
|
||||
_kernel.Get<QualityProvider>().SetupDefaultProfiles();
|
||||
_kernel.Get<QualityTypeProvider>().SetupDefault();
|
||||
|
||||
BindExternalNotifications();
|
||||
BindIndexers();
|
||||
|
@ -12,6 +12,14 @@ namespace NzbDrone.Core.Datastore.Migrations
|
||||
{
|
||||
Database.AddColumn("Series", "Runtime", DbType.Int32, ColumnProperty.Null);
|
||||
Database.AddColumn("Series", "BannerUrl", DbType.String, ColumnProperty.Null);
|
||||
|
||||
Database.AddTable("QualityTypes", new[]
|
||||
{
|
||||
new Column("QualityTypeId", DbType.Int32, ColumnProperty.PrimaryKey),
|
||||
new Column("Name", DbType.String, ColumnProperty.NotNull),
|
||||
new Column("MinSize", DbType.Int64, ColumnProperty.NotNull),
|
||||
new Column("MaxSize", DbType.Int64, ColumnProperty.NotNull)
|
||||
});
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
|
@ -21,12 +21,12 @@ namespace NzbDrone.Core
|
||||
|
||||
public static Int64 Megabytes(this int megabytes)
|
||||
{
|
||||
return megabytes * 1048576;
|
||||
return megabytes * 1048576L;
|
||||
}
|
||||
|
||||
public static Int64 Gigabytes(this int gigabytes)
|
||||
{
|
||||
return gigabytes * 1073741824;
|
||||
return gigabytes * 1073741824L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ namespace NzbDrone.Core.Model
|
||||
|
||||
public bool FullSeason { get; set; }
|
||||
|
||||
public long Size { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (AirDate != null && EpisodeNumbers == null)
|
||||
|
@ -211,6 +211,7 @@
|
||||
<Compile Include="Providers\Jobs\RenameSeasonJob.cs" />
|
||||
<Compile Include="Providers\Jobs\SeasonSearchJob.cs" />
|
||||
<Compile Include="Providers\MisnamedProvider.cs" />
|
||||
<Compile Include="Providers\QualityTypeProvider.cs" />
|
||||
<Compile Include="Providers\SearchProvider.cs" />
|
||||
<Compile Include="Providers\Xbmc\ResourceManager.cs" />
|
||||
<Compile Include="Model\Xbmc\TvShowResult.cs" />
|
||||
@ -276,6 +277,7 @@
|
||||
<Compile Include="Instrumentation\Log.cs" />
|
||||
<Compile Include="Repository\History.cs" />
|
||||
<Compile Include="Repository\Config.cs" />
|
||||
<Compile Include="Repository\Quality\QualityType.cs" />
|
||||
<Compile Include="Repository\Quality\QualityProfile.cs" />
|
||||
<Compile Include="Repository\RootDir.cs" />
|
||||
<Compile Include="Repository\Quality\QualityTypes.cs" />
|
||||
@ -320,6 +322,7 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="NzbDrone.jpg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
|
File diff suppressed because one or more lines are too long
@ -96,6 +96,10 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
var languageString = Regex.Match(item.Summary.Text, @"Language - \w*", RegexOptions.IgnoreCase).Value;
|
||||
|
||||
currentResult.Language = Parser.ParseLanguage(languageString);
|
||||
|
||||
var sizeString = Regex.Match(item.Summary.Text, @"\(Size: \d*\,?\d+\.\d{1,2}\w{2}\)", RegexOptions.IgnoreCase).Value;
|
||||
|
||||
currentResult.Size = Parser.GetReportSize(sizeString);
|
||||
}
|
||||
return currentResult;
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Search;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
||||
@ -67,5 +69,15 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
return searchUrls;
|
||||
}
|
||||
|
||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||
{
|
||||
if (currentResult != null)
|
||||
{
|
||||
var sizeString = Regex.Match(item.Summary.Text, @"<b>Size:</b> \d+\.\d{1,2} \w{2}<br />", RegexOptions.IgnoreCase).Value;
|
||||
|
||||
currentResult.Size = Parser.GetReportSize(sizeString);
|
||||
}
|
||||
return currentResult;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Search;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
||||
@ -65,5 +67,15 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
return searchUrls;
|
||||
}
|
||||
|
||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||
{
|
||||
if (currentResult != null)
|
||||
{
|
||||
var sizeString = Regex.Match(item.Summary.Text, @">\d+\.\d{1,2} \w{2}</a>", RegexOptions.IgnoreCase).Value;
|
||||
|
||||
currentResult.Size = Parser.GetReportSize(sizeString);
|
||||
}
|
||||
return currentResult;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Search;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
||||
@ -41,5 +43,16 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||
{
|
||||
if (currentResult != null)
|
||||
{
|
||||
var sizeString = Regex.Match(item.Summary.Text, @"\d+\.\d{1,2} \w{3}", RegexOptions.IgnoreCase).Value;
|
||||
|
||||
currentResult.Size = Parser.GetReportSize(sizeString);
|
||||
}
|
||||
return currentResult;
|
||||
}
|
||||
}
|
||||
}
|
68
NzbDrone.Core/Providers/QualityTypeProvider.cs
Normal file
68
NzbDrone.Core/Providers/QualityTypeProvider.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using PetaPoco;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class QualityTypeProvider
|
||||
{
|
||||
private readonly IDatabase _database;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public QualityTypeProvider(IDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public virtual void Update(QualityType qualityType)
|
||||
{
|
||||
_database.Update(qualityType);
|
||||
}
|
||||
|
||||
public virtual void UpdateAll(List<QualityType> qualityTypes)
|
||||
{
|
||||
_database.UpdateMany(qualityTypes);
|
||||
}
|
||||
|
||||
public virtual List<QualityType> All()
|
||||
{
|
||||
return _database.Fetch<QualityType>();
|
||||
}
|
||||
|
||||
public virtual QualityType Get(int qualityTypeId)
|
||||
{
|
||||
return _database.Single<QualityType>(qualityTypeId);
|
||||
}
|
||||
|
||||
public virtual List<QualityType> GetList(List<int> qualityTypeIds)
|
||||
{
|
||||
var queryParams = String.Join(", ", qualityTypeIds);
|
||||
var query = String.Format("WHERE QualityTypeId IN ({0})", queryParams);
|
||||
|
||||
return _database.Fetch<QualityType>(query);
|
||||
}
|
||||
|
||||
public virtual void SetupDefault()
|
||||
{
|
||||
if (All().Count != 0)
|
||||
return;
|
||||
|
||||
Logger.Info("Setting up default quality types");
|
||||
|
||||
var qualityTypes = new List<QualityType>();
|
||||
qualityTypes.Add(new QualityType { QualityTypeId = 1, Name = "SDTV", MinSize = 0, MaxSize = 10.Gigabytes() });
|
||||
qualityTypes.Add(new QualityType { QualityTypeId = 2, Name = "DVD", MinSize = 0, MaxSize = 10.Gigabytes() });
|
||||
qualityTypes.Add(new QualityType { QualityTypeId = 4, Name = "HDTV", MinSize = 0, MaxSize = 10.Gigabytes() });
|
||||
qualityTypes.Add(new QualityType { QualityTypeId = 5, Name = "WEBDL", MinSize = 0, MaxSize = 10.Gigabytes() });
|
||||
qualityTypes.Add(new QualityType { QualityTypeId = 6, Name = "Bluray720p", MinSize = 0, MaxSize = 10.Gigabytes() });
|
||||
qualityTypes.Add(new QualityType { QualityTypeId = 7, Name = "Bluray1080p", MinSize = 0, MaxSize = 10.Gigabytes() });
|
||||
|
||||
_database.InsertMany(qualityTypes);
|
||||
}
|
||||
}
|
||||
}
|
24
NzbDrone.Core/Repository/Quality/QualityType.cs
Normal file
24
NzbDrone.Core/Repository/Quality/QualityType.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using PetaPoco;
|
||||
|
||||
namespace NzbDrone.Core.Repository.Quality
|
||||
{
|
||||
[TableName("QualityTypes")]
|
||||
[PrimaryKey("QualityTypeId", autoIncrement = false)]
|
||||
public class QualityType
|
||||
{
|
||||
public int QualityTypeId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public long MinSize { get; set; }
|
||||
public long MaxSize { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
}
|
@ -81,7 +81,6 @@
|
||||
|
||||
#banner-container
|
||||
{
|
||||
|
||||
width: 758px;
|
||||
height: 140px;
|
||||
padding: 0px;
|
||||
|
Loading…
Reference in New Issue
Block a user