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

Merge branch 'master' of git://github.com/kayone/NzbDrone

Conflicts:
	NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
This commit is contained in:
Mark McDowall 2011-07-09 19:48:02 -07:00
commit 67299f0d97
80 changed files with 3341 additions and 1496 deletions

View File

@ -125,7 +125,7 @@
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:8989:" />
<binding protocol="http" bindingInformation="*:8980:" />
</bindings>
</site>
<applicationDefaults applicationPool="IISExpressAppPool" />

View File

@ -0,0 +1,30 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='nativrd2' version='1.0.0.0' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='browscap' version='1.0.0.0' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='rsca2' version='1.0.0.0' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*' />
</dependentAssembly>
</dependency>
</assembly>

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Test.Framework;
using Ninject;
namespace NzbDrone.Core.Test
{
[TestFixture]
// ReSharper disable InconsistentNaming
class CentralDispatchTest : TestBase
{
readonly IList<Type> indexers = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(IndexerBase))).ToList();
readonly IList<Type> jobs = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IJob))).ToList();
[Test]
public void InitAppTest()
{
CentralDispatch.NinjectKernel.Should().NotBeNull();
}
[Test]
public void Resolve_all_providers()
{
var providers = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.Name.EndsWith("Provider")).ToList();
providers.Should().NotBeEmpty();
foreach (var provider in providers)
{
Console.WriteLine("Resolving " + provider.Name);
CentralDispatch.NinjectKernel.Get(provider).Should().NotBeNull();
}
}
[Test]
public void All_jobs_should_be_registered()
{
//Assert
var registeredJobs = CentralDispatch.NinjectKernel.GetAll<IJob>();
jobs.Should().NotBeEmpty();
registeredJobs.Should().HaveSameCount(jobs);
}
[Test]
public void All_indexers_should_be_registered()
{
//Assert
var registeredIndexers = CentralDispatch.NinjectKernel.GetAll<IndexerBase>();
indexers.Should().NotBeEmpty();
registeredIndexers.Should().HaveSameCount(indexers);
}
[Test]
public void jobs_are_initialized()
{
CentralDispatch.NinjectKernel.Get<JobProvider>().All().Should().HaveSameCount(jobs);
}
[Test]
public void indexers_are_initialized()
{
CentralDispatch.NinjectKernel.Get<IndexerProvider>().All().Should().HaveSameCount(indexers);
}
[Test]
public void quality_profile_initialized()
{
CentralDispatch.NinjectKernel.Get<QualityProvider>().All().Should().HaveCount(2);
}
[Test]
public void get_version()
{
CentralDispatch.Version.Should().NotBeNull();
}
}
}

View File

@ -13,15 +13,7 @@ public class Fixtures
[TearDown]
public void TearDown()
{
var filesToDelete = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.sdf", SearchOption.AllDirectories);
foreach (var file in filesToDelete)
{
try
{
File.Delete(file);
}
catch{}
}
}
[SetUp]
@ -42,6 +34,17 @@ public void SetUp()
{
Console.WriteLine("Unable to configure logging. " + e);
}
var filesToDelete = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.sdf", SearchOption.AllDirectories);
foreach (var file in filesToDelete)
{
try
{
File.Delete(file);
}
catch { }
}
}
}
}

View File

@ -39,32 +39,7 @@ public static IDatabase GetEmptyDatabase(bool enableLogging = false, string file
return database;
}
public static DiskProvider GetStandardDisk(int seasons, int episodes)
{
var mock = new Mock<DiskProvider>();
mock.Setup(c => c.GetDirectories(It.IsAny<String>())).Returns(StandardSeries);
mock.Setup(c => c.FolderExists(It.Is<String>(d => StandardSeries.Contains(d)))).Returns(true);
foreach (var series in StandardSeries)
{
var file = new List<String>();
for (int s = 0; s < seasons; s++)
{
for (int e = 0; e < episodes; e++)
{
file.Add(String.Format("{0}\\Seasons {1}\\myepname.S{1:00}E{2:00}.avi", series, s, e));
}
}
string series1 = series;
mock.Setup(c => c.GetFiles(series1, "*.avi", SearchOption.AllDirectories)).Returns(file.ToArray());
}
return mock.Object;
}
public static Series GetFakeSeries(int id, string title)
public static Series GetFakeSeries(int id, string title)
{
return Builder<Series>.CreateNew()
.With(c => c.SeriesId = id)

View File

@ -10,6 +10,8 @@ public class TestBase
public void Setup()
{
ExceptionVerification.Reset();
}
[TearDown]

View File

@ -33,10 +33,10 @@ public void Init_indexer_test()
indexerProvider.SaveSettings(settings);
//Assert
indexerProvider.GetAllISettings();
indexerProvider.All();
indexerProvider.GetAllISettings().Should().HaveCount(1);
indexerProvider.All().Should().HaveCount(1);
indexerProvider.GetEnabledIndexers().Should().HaveCount(1);
}
@ -56,7 +56,7 @@ public void Init_indexer_with_disabled_job()
//Assert
indexerProvider.GetAllISettings().Should().HaveCount(1);
indexerProvider.All().Should().HaveCount(1);
indexerProvider.GetEnabledIndexers().Should().BeEmpty();
}
}

View File

@ -35,7 +35,7 @@ public void parse_feed_xml(string fileName, int warns)
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings);
@ -62,7 +62,7 @@ public void newzbin_rss_fetch()
{
var mocker = new AutoMoqer();
mocker.Resolve<HttpProvider>();
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings);
@ -100,7 +100,7 @@ public void custome_parser_partial_success(string title, int season, int episode
const string summary = "My fake summary";
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings);
@ -127,7 +127,7 @@ public void custome_parser_full_parse(string title)
const string summary = "My fake summary";
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings);
@ -150,7 +150,7 @@ public void downloadFeed()
var mocker = new AutoMoqer();
mocker.SetConstant(new HttpProvider());
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings);

View File

@ -50,6 +50,38 @@ public void write_log()
Assert.AreEqual("write_log", logItem.Method);
}
[Test]
public void write_long_log()
{
//setup
var message = String.Empty;
for (int i = 0; i < 100; i++)
{
message += Guid.NewGuid();
}
var db = MockLib.GetEmptyDatabase(true);
var sonicTarget = new DatabaseTarget(db);
LogManager.Configuration.AddTarget("DbLogger", sonicTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, sonicTarget));
LogManager.Configuration.Reload();
Logger Logger = LogManager.GetCurrentClassLogger();
//Act
Logger.Info(message);
//Assert
db.Fetch<Log>().Should().HaveCount(1);
var logItem = db.Fetch<Log>().First();
logItem.Message.Should().HaveLength(message.Length);
Assert.AreEqual(message, logItem.Message);
}
[Test]
public void clearLog()

View File

@ -146,7 +146,7 @@ public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int sea
.Build();
var mocker = new AutoMoqer();
mocker.GetMock<ConfigProvider>().Setup(e => e.SeasonFolderFormat).Returns(seasonFolderFormat);
mocker.GetMock<ConfigProvider>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
//Act
var result = mocker.Resolve<MediaFileProvider>().CalculateFilePath(fakeSeries, 1, filename, ".mkv");

View File

@ -22,12 +22,12 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi")
@ -49,12 +49,12 @@ public void GetNewFilename_Episode_Quality_1x05_Dash()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi")
@ -76,12 +76,12 @@ public void GetNewFilename_Series_Quality_01x05_Space()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(1);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(1);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi")
@ -103,12 +103,12 @@ public void GetNewFilename_Series_s01e05_Space()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew()
@ -131,12 +131,12 @@ public void GetNewFilename_Series_Episode_s01e05_Periods()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi")
@ -158,12 +158,12 @@ public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi")
@ -185,12 +185,12 @@ public void GetNewFilename_S01E05_Dash()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew()
@ -213,13 +213,13 @@ public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(3);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(3);
var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@ -247,13 +247,13 @@ public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@ -281,13 +281,13 @@ public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@ -315,13 +315,13 @@ public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(1);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(1);
var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@ -349,13 +349,13 @@ public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(0);
var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@ -383,13 +383,13 @@ public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2);
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")

View File

@ -56,6 +56,9 @@
<Reference Include="Moq, Version=4.0.10827.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\packages\Ninject.2.2.1.4\lib\net40-Full\Ninject.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Libraries\NLog.dll</HintPath>
@ -86,6 +89,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="EventClientProviderTest.cs" />
<Compile Include="CentralDispatchTest.cs" />
<Compile Include="XbmcProviderTest.cs" />
<Compile Include="DiskScanProviderTest.cs" />
<Compile Include="EpisodeProviderTest_GetEpisodesByParseResult.cs" />

View File

@ -56,7 +56,7 @@ public void ParseTitle_single(string postTitle, string title, int seasonNumber,
[TestCase(@"z:\tv shows\robot chicken\Specials\S00E16 - Dear Consumer - SD TV.avi", 0, 16)]
[TestCase(@"D:\shares\TV Shows\Parks And Recreation\Season 2\S02E21 - 94 Meetings - 720p TV.mkv", 2, 21)]
[TestCase(@"D:\shares\TV Shows\Battlestar Galactica (2003)\Season 2\S02E21.avi", 2, 21)]
[TestCase("C:/Test/TV/Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)]
[TestCase("C:/Test/TV/Chuck.4x05.HDTV.XviD-LOL", 4, 5)]
public void PathParse_tests(string path, int season, int episode)
{
var result = Parser.ParsePath(path);
@ -125,7 +125,7 @@ public void parsing_our_own_quality_enum()
result.QualityType.Should().Be(qualityEnum);
}
}
[Timeout(1000)]
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", "WEEDS", 3, new[] { 1, 2, 3, 4, 5, 6 }, 6)]
[TestCase("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Men", 1, new[] { 3, 4 }, 2)]
@ -148,7 +148,7 @@ public void TitleParse_multi(string postTitle, string title, int season, int[] e
result.EpisodeNumbers.Count.Should().Be(count);
}
[TestCase("Conan 2011 04 18 Emma Roberts HDTV XviD BFF", "Conan", 2011, 04, 18)]
[TestCase("The Tonight Show With Jay Leno 2011 04 15 1080i HDTV DD5 1 MPEG2 TrollHD", "The Tonight Show With Jay Leno", 2011, 04, 15)]
[TestCase("The.Daily.Show.2010.10.11.Johnny.Knoxville.iTouch-MW", "The.Daily.Show", 2010, 10, 11)]
@ -165,7 +165,7 @@ public void episode_daily_parse(string postTitle, string title, int year, int mo
Assert.IsNull(result.EpisodeNumbers);
}
[TestCase("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)]
[TestCase("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)]
[TestCase("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)]
@ -176,7 +176,7 @@ public void full_season_release_parse(string postTitle, string title, int season
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
result.EpisodeNumbers.Count.Should().Be(0);
}
[TestCase("Conan", "conan")]
[TestCase("The Tonight Show With Jay Leno", "tonightshowwithjayleno")]
[TestCase("The.Daily.Show", "dailyshow")]
@ -198,7 +198,7 @@ public void Normalize_Path(string dirty, string clean)
var result = Parser.NormalizePath(dirty);
result.Should().Be(clean);
}
[TestCase("CaPitAl", "capital")]
[TestCase("peri.od", "period")]
[TestCase("this.^&%^**$%@#$!That", "thisthat")]
@ -209,7 +209,7 @@ public void Normalize_Title(string dirty, string clean)
result.Should().Be(clean);
}
[TestCase("the")]
[TestCase("and")]
[TestCase("or")]

View File

@ -1,6 +1,7 @@
// ReSharper disable RedundantUsingDirective
using System;
using System.Collections.Generic;
using System.Linq;
using AutoMoq;
using FizzWare.NBuilder;
using FluentAssertions;
@ -16,9 +17,6 @@ namespace NzbDrone.Core.Test
// ReSharper disable InconsistentNaming
public class QualityProfileTest : TestBase
{
///<summary>
/// Test_s the storage.
///</summary>
[Test]
public void Test_Storage()
{
@ -73,7 +71,7 @@ public void Update_Success()
var mocker = new AutoMoqer();
var db = MockLib.GetEmptyDatabase();
mocker.SetConstant(db);
var testProfile = new QualityProfile
{
Name = Guid.NewGuid().ToString(),
@ -95,7 +93,7 @@ public void Update_Success()
updated.Name.Should().Be(currentProfile.Name);
updated.Cutoff.Should().Be(QualityTypes.Bluray720p);
updated.AllowedString.Should().Be(currentProfile.AllowedString);
}
[Test]
@ -127,5 +125,47 @@ public void Test_Series_Quality()
Assert.AreEqual(profileId, result[0].QualityProfileId);
Assert.AreEqual(testProfile.Name, profile.Name);
}
[Test]
public void SetupInitial_should_add_two_profiles()
{
var mocker = new AutoMoqer();
var db = MockLib.GetEmptyDatabase();
mocker.SetConstant(db);
//Act
mocker.Resolve<QualityProvider>().SetupDefaultProfiles();
//Assert
var profiles = mocker.Resolve<QualityProvider>().All();
profiles.Should().HaveCount(2);
profiles.Should().Contain(e => e.Name == "HD");
profiles.Should().Contain(e => e.Name == "SD");
}
[Test]
//This confirms that new profiles are added only if no other profiles exists.
//We don't want to keep adding them back if a user deleted them on purpose.
public void SetupInitial_should_skip_if_any_profile_exists()
{
var mocker = new AutoMoqer();
var db = MockLib.GetEmptyDatabase();
mocker.SetConstant(db);
var fakeProfile = Builder<QualityProfile>.CreateNew().Build();
//Act
mocker.Resolve<QualityProvider>().Add(fakeProfile);
mocker.Resolve<QualityProvider>().SetupDefaultProfiles();
//Assert
var profiles = mocker.Resolve<QualityProvider>().All();
profiles.Should().HaveCount(1);
}
}
}

View File

@ -11,43 +11,39 @@ namespace NzbDrone.Core.Test
public class QualityTest : TestBase
{
[Test]
[Ignore("No supported asserts are available")]
public void Icomparer_greater_test()
{
var first = new Quality(QualityTypes.DVD, true);
var second = new Quality(QualityTypes.Bluray1080p, true);
//Assert.GreaterThan(second, first);
second.Should().BeGreaterThan(first);
}
[Test]
[Ignore("No supported asserts are available")]
public void Icomparer_greater_proper()
{
var first = new Quality(QualityTypes.Bluray1080p, false);
var second = new Quality(QualityTypes.Bluray1080p, true);
//Assert.GreaterThan(second, first);
second.Should().BeGreaterThan(first);
}
[Test]
[Ignore("No supported asserts are available")]
public void Icomparer_lesser()
{
var first = new Quality(QualityTypes.DVD, true);
var second = new Quality(QualityTypes.Bluray1080p, true);
//Assert.LessThan(first, second);
first.Should().BeLessThan(second);
}
[Test]
[Ignore("No supported asserts are available")]
public void Icomparer_lesser_proper()
{
var first = new Quality(QualityTypes.DVD, false);
var second = new Quality(QualityTypes.DVD, true);
//Assert.LessThan(first, second);
first.Should().BeLessThan(second);
}
[Test]
@ -86,7 +82,7 @@ public void not_equal_operand()
var first = new Quality(QualityTypes.Bluray1080p, true);
var second = new Quality(QualityTypes.Bluray1080p, true);
Assert.IsFalse(first != second);
(first != second).Should().BeFalse();
}
[Test]

View File

@ -7,4 +7,5 @@
<package id="Unity" version="2.1.505.0" />
<package id="NUnit" version="2.5.10.11092" />
<package id="SqlServerCompact" version="4.0.8482.1" />
<package id="Ninject" version="2.2.1.4" />
</packages>

View File

@ -2,6 +2,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web.Hosting;
using Ninject;
using NLog;
@ -21,6 +22,12 @@ public static class CentralDispatch
private static readonly Object KernelLock = new object();
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public static Version Version
{
get { return Assembly.GetExecutingAssembly().GetName().Version; }
}
public static String AppPath
{
get
@ -45,7 +52,7 @@ public static StandardKernel NinjectKernel
}
}
private static void InitializeApp()
public static void InitializeApp()
{
BindKernel();
@ -60,7 +67,7 @@ private static void InitializeApp()
BindExternalNotifications();
}
public static void BindKernel()
private static void BindKernel()
{
lock (KernelLock)
{

View File

@ -67,7 +67,7 @@ public void Warn(string format, params object[] args)
public void Trace(string format, params object[] args)
{
Logger.Trace(format, args);
//Logger.Trace(format, args);
}
}
}

View File

@ -5,8 +5,8 @@
namespace NzbDrone.Core.Datastore.Migrations
{
[Migration(20110622)]
public class Migration20110622 : Migration
[Migration(20110707)]
public class Migration20110707 : Migration
{
public override void Up()
{
@ -16,11 +16,11 @@ public override void Up()
new Column("Title", DbType.String, ColumnProperty.Null),
new Column("CleanTitle", DbType.String, ColumnProperty.Null),
new Column("Status", DbType.String, ColumnProperty.Null),
new Column("Overview", DbType.String, ColumnProperty.Null),
new Column("Overview", DbType.String,4000, ColumnProperty.Null),
new Column("AirsDayOfWeek", DbType.Int32, ColumnProperty.Null),
new Column("AirTimes", DbType.String, ColumnProperty.Null),
new Column("Language", DbType.String, ColumnProperty.Null),
new Column("Path", DbType.String, ColumnProperty.NotNull),
new Column("Path", DbType.String,4000, ColumnProperty.NotNull),
new Column("Monitored", DbType.Boolean, ColumnProperty.NotNull),
new Column("QualityProfileId", DbType.Int32, ColumnProperty.NotNull),
new Column("SeasonFolder", DbType.Boolean, ColumnProperty.NotNull),
@ -35,8 +35,8 @@ public override void Up()
new Column("SeriesId", DbType.Int32, ColumnProperty.NotNull),
new Column("SeasonNumber", DbType.Int32, ColumnProperty.NotNull),
new Column("EpisodeNumber", DbType.Int32, ColumnProperty.NotNull),
new Column("Title", DbType.String, ColumnProperty.Null),
new Column("Overview", DbType.String, ColumnProperty.Null),
new Column("Title", DbType.String,100, ColumnProperty.Null),
new Column("Overview", DbType.String,4000, ColumnProperty.Null),
new Column("Ignored", DbType.Boolean, ColumnProperty.NotNull),
new Column("EpisodeFileId", DbType.Int32, ColumnProperty.Null),
new Column("AirDate", DbType.DateTime, ColumnProperty.Null),
@ -61,7 +61,7 @@ public override void Up()
new Column("EpisodeFileId", DbType.Int32,
ColumnProperty.PrimaryKeyWithIdentity),
new Column("SeriesId", DbType.Int32, ColumnProperty.NotNull),
new Column("Path", DbType.String, ColumnProperty.NotNull),
new Column("Path", DbType.String,4000, ColumnProperty.NotNull),
new Column("Quality", DbType.Int32, ColumnProperty.NotNull),
new Column("Proper", DbType.Int32, ColumnProperty.NotNull),
new Column("Size", DbType.Int64, ColumnProperty.NotNull),
@ -107,7 +107,7 @@ public override void Up()
Database.AddTable("RootDirs", new[]
{
new Column("Id", DbType.Int32, ColumnProperty.PrimaryKeyWithIdentity),
new Column("Path", DbType.String, ColumnProperty.NotNull)
new Column("Path", DbType.String, 4000, ColumnProperty.NotNull)
});
Database.AddTable("ExternalNotificationSettings", new[]
@ -118,7 +118,7 @@ public override void Up()
new Column("Name", DbType.String, ColumnProperty.NotNull)
});
Database.AddTable("JobSettings", new[]
Database.AddTable("JobDefinitions", new[]
{
new Column("Id", DbType.Int32, ColumnProperty.PrimaryKeyWithIdentity),
new Column("Enable", DbType.Boolean, ColumnProperty.NotNull),
@ -140,16 +140,16 @@ public override void Up()
Database.AddTable("Logs", new[]
{
new Column("LogId", DbType.Int64, ColumnProperty.PrimaryKeyWithIdentity),
new Column("Message", DbType.String, ColumnProperty.NotNull),
new Column("Message", DbType.String,4000, ColumnProperty.NotNull),
new Column("Time", DbType.DateTime, ColumnProperty.NotNull),
new Column("Logger", DbType.String, ColumnProperty.NotNull),
new Column("Method", DbType.String, ColumnProperty.NotNull),
new Column("Exception", DbType.String, ColumnProperty.Null),
new Column("Exception", DbType.String,4000, ColumnProperty.Null),
new Column("ExceptionType", DbType.String, ColumnProperty.Null),
new Column("Level", DbType.String, ColumnProperty.NotNull)
});
Database.AddTable("IndexerSettings", new[]
Database.AddTable("IndexerDefinitions", new[]
{
new Column("Id", DbType.Int32, ColumnProperty.PrimaryKeyWithIdentity),
new Column("Enable", DbType.Boolean, ColumnProperty.NotNull),

View File

@ -20,7 +20,7 @@ public static void Run(string connetionString, bool trace)
EnsureDatabase(connetionString);
Logger.Info("Preparing run database migration");
Logger.Info("Preparing to run database migration");
try
{
@ -46,7 +46,7 @@ public static void Run(string connetionString, bool trace)
}
catch (Exception e)
{
Logger.FatalException("An error has occured while migrating database", e);
Logger.FatalException("An error has occurred while migrating database", e);
}
}

View File

@ -1,25 +0,0 @@
using System;
using Migrator.Framework;
using Migrator.Providers.SQLite;
namespace NzbDrone.Core.Datastore
{
class SqliteProvider
{
private readonly ITransformationProvider _dataBase;
public SqliteProvider(string connectionString)
{
_dataBase = new SQLiteTransformationProvider(new SQLiteDialect(), connectionString);
}
public int GetPageSize()
{
return Convert.ToInt32(_dataBase.ExecuteScalar("PRAGMA cache_size"));
}
}
}

View File

@ -138,9 +138,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Libraries\Migrator.NET\Migrator.Providers.dll</HintPath>
</Reference>
<Reference Include="MvcMiniProfiler, Version=2.1.4183.14740, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="MvcMiniProfiler, Version=1.4.4195.37960, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MiniProfiler.1.3\lib\MvcMiniProfiler.dll</HintPath>
<HintPath>..\packages\MiniProfiler.1.4\lib\MvcMiniProfiler.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\packages\Ninject.2.2.1.4\lib\net40-Full\Ninject.dll</HintPath>
@ -176,8 +176,7 @@
<Compile Include="Datastore\MigrationLogger.cs" />
<Compile Include="Datastore\MigrationsHelper.cs" />
<Compile Include="Datastore\CustomeMapper.cs" />
<Compile Include="Datastore\Migrations\Migration20110622.cs" />
<Compile Include="Datastore\SqliteProvider.cs" />
<Compile Include="Datastore\Migrations\Migration20110707.cs" />
<Compile Include="Fluent.cs" />
<Compile Include="Helpers\EpisodeSortingHelper.cs" />
<Compile Include="Helpers\FileSizeFormatHelpercs.cs" />
@ -226,8 +225,8 @@
<Compile Include="Providers\SceneMappingProvider.cs" />
<Compile Include="Providers\Xbmc\EventClientProvider.cs" />
<Compile Include="Repository\ExternalNotificationSetting.cs" />
<Compile Include="Repository\JobSetting.cs" />
<Compile Include="Repository\IndexerSetting.cs" />
<Compile Include="Repository\JobDefinition.cs" />
<Compile Include="Repository\IndexerDefinition.cs" />
<Compile Include="Model\EpisodeParseResult.cs" />
<Compile Include="Model\EpisodeRenameModel.cs" />
<Compile Include="Model\EpisodeSortingType.cs" />

View File

@ -136,7 +136,7 @@ internal static EpisodeParseResult ParseTitle(string title)
return parsedEpisode;
}
}
Logger.Warn("Unable to parse text into episode info. {0}", title);
Logger.Warn("Unable to parse episode info. {0}", title);
return null;
}

View File

@ -50,5 +50,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0.*")]
[assembly: AssemblyVersion("0.5.0.*")]
[assembly: InternalsVisibleTo("NzbDrone.Core.Test")]

View File

@ -190,25 +190,25 @@ public virtual String BlackholeDirectory
set { SetValue("BlackholeDirectory", value); }
}
public virtual bool SeriesName
public virtual bool SortingIncludeSeriesName
{
get { return GetValueBoolean("Sorting_SeriesName", true); }
set { SetValue("Sorting_SeriesName", value); }
}
public virtual bool EpisodeName
public virtual bool SortingIncludeEpisodeTitle
{
get { return GetValueBoolean("Sorting_EpisodeName", true); }
set { SetValue("Sorting_EpisodeName", value); }
}
public virtual bool ReplaceSpaces
public virtual bool SortingReplaceSpaces
{
get { return GetValueBoolean("Sorting_ReplaceSpaces", true); }
get { return GetValueBoolean("Sorting_ReplaceSpaces"); }
set { SetValue("Sorting_ReplaceSpaces", value); }
}
public virtual bool AppendQuality
public virtual bool SortingAppendQuality
{
get { return GetValueBoolean("Sorting_AppendQaulity", true); }
set { SetValue("Sorting_AppendQaulity", value); }
@ -216,30 +216,30 @@ public virtual bool AppendQuality
public virtual bool UseSeasonFolder
{
get { return GetValueBoolean("Sorting_SeasonFolder", true); }
get { return GetValueBoolean("UseSeasonFolder", true); }
set { SetValue("Sorting_SeasonFolder", value); }
set { SetValue("UseSeasonFolder", value); }
}
public virtual string SeasonFolderFormat
public virtual string SortingSeasonFolderFormat
{
get { return GetValue("Sorting_SeasonFolderFormat", "Season %s"); }
set { SetValue("Sorting_SeasonFolderFormat", value); }
}
public virtual int SeparatorStyle
public virtual int SortingSeparatorStyle
{
get { return GetValueInt("Sorting_SeparatorStyle"); }
set { SetValue("Sorting_SeparatorStyle", value); }
}
public virtual int NumberStyle
public virtual int SortingNumberStyle
{
get { return GetValueInt("Sorting_NumberStyle", 2); }
set { SetValue("Sorting_NumberStyle", value); }
}
public virtual int MultiEpisodeStyle
public virtual int SortingMultiEpisodeStyle
{
get { return GetValueInt("Sorting_MultiEpisodeStyle"); }
set { SetValue("Sorting_MultiEpisodeStyle", value); }

View File

@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
@ -21,9 +22,14 @@ public virtual string[] GetDirectories(string path)
return Directory.GetDirectories(path);
}
public virtual string[] GetFiles(string path, string pattern, SearchOption searchOption)
public virtual string[] GetFiles(string path, SearchOption searchOption)
{
return Directory.GetFiles(path, pattern, searchOption);
return Directory.GetFiles(path, "*.*", searchOption);
}
public virtual long GetDirectorySize(string path)
{
return GetFiles(path, SearchOption.AllDirectories).Sum(e => new FileInfo(e).Length);
}
public virtual long GetSize(string path)

View File

@ -135,7 +135,7 @@ public virtual EpisodeFile ImportFile(Series series, string filePath)
{
ep.EpisodeFileId = fileId;
_episodeProvider.UpdateEpisode(ep);
Logger.Debug("Linking file {0} to {1}", filePath, ep);
Logger.Debug("Linking [{0}] > [{1}]", filePath, ep);
}
@ -156,7 +156,7 @@ public virtual bool MoveEpisodeFile(EpisodeFile episodeFile)
_diskProvider.CreateDirectory(newFile.DirectoryName);
//Do the rename
Logger.Debug("Moving file [{0}] > [{1}]", episodeFile.Path, newFile.FullName);
Logger.Debug("Moving [{0}] > [{1}]", episodeFile.Path, newFile.FullName);
_diskProvider.MoveFile(episodeFile.Path, newFile.FullName);
//Update the filename in the DB
@ -176,7 +176,7 @@ public virtual void CleanUp(IList<EpisodeFile> files)
{
if (!_diskProvider.FileExists(episodeFile.Path))
{
Logger.Trace("File {0} no longer exists on disk. removing from database.", episodeFile.Path);
Logger.Trace("File [{0}] no longer exists on disk. removing from db", episodeFile.Path);
//Set the EpisodeFileId for each episode attached to this file to 0
foreach (var episode in _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId))
@ -196,7 +196,7 @@ private List<string> GetVideoFiles(string path)
{
Logger.Debug("Scanning '{0}' for episodes", path);
var filesOnDisk = _diskProvider.GetFiles(path, "*.*", SearchOption.AllDirectories);
var filesOnDisk = _diskProvider.GetFiles(path, SearchOption.AllDirectories);
var mediaFileList = filesOnDisk.Where(c => MediaExtentions.Contains(Path.GetExtension(c).ToLower())).ToList();

View File

@ -30,32 +30,32 @@ public IndexerProvider()
public virtual IList<IndexerBase> GetEnabledIndexers()
{
var all = GetAllISettings();
var all = All();
return _indexers.Where(i => all.Exists(c => c.IndexProviderType == i.GetType().ToString() && c.Enable)).ToList();
}
public virtual List<IndexerSetting> GetAllISettings()
public virtual List<IndexerDefinition> All()
{
return _database.Fetch<IndexerSetting>();
return _database.Fetch<IndexerDefinition>();
}
public virtual void SaveSettings(IndexerSetting settings)
public virtual void SaveSettings(IndexerDefinition definitions)
{
if (settings.Id == 0)
if (definitions.Id == 0)
{
Logger.Debug("Adding Indexer settings for {0}", settings.Name);
_database.Insert(settings);
Logger.Debug("Adding Indexer definitions for {0}", definitions.Name);
_database.Insert(definitions);
}
else
{
Logger.Debug("Updating Indexer settings for {0}", settings.Name);
_database.Update(settings);
Logger.Debug("Updating Indexer definitions for {0}", definitions.Name);
_database.Update(definitions);
}
}
public virtual IndexerSetting GetSettings(Type type)
public virtual IndexerDefinition GetSettings(Type type)
{
return _database.Single<IndexerSetting>("WHERE IndexProviderType = @0", type.ToString());
return _database.Single<IndexerDefinition>("WHERE IndexProviderType = @0", type.ToString());
}
public virtual void InitializeIndexers(IList<IndexerBase> indexers)
@ -64,14 +64,14 @@ public virtual void InitializeIndexers(IList<IndexerBase> indexers)
_indexers = indexers;
var currentIndexers = GetAllISettings();
var currentIndexers = All();
foreach (var feedProvider in indexers)
{
IndexerBase indexerLocal = feedProvider;
if (!currentIndexers.Exists(c => c.IndexProviderType == indexerLocal.GetType().ToString()))
{
var settings = new IndexerSetting
var settings = new IndexerDefinition
{
Enable = false,
IndexProviderType = indexerLocal.GetType().ToString(),

View File

@ -44,7 +44,7 @@ private void DeleteSeries(ProgressNotification notification, int seriesId)
_seriesProvider.DeleteSeries(seriesId);
notification.CurrentMessage = String.Format("Successfully deleted '{0}'", title);
notification.CurrentMessage = String.Format("Successfully deleted '{0}' from database", title);
}
catch (Exception e)
{

View File

@ -53,11 +53,11 @@ public virtual void Start(ProgressNotification notification, int targetId)
{
notification.CurrentMessage = string.Format("Scanning disk for '{0}'", series.Title);
_diskScanProvider.Scan(series);
notification.CurrentMessage = string.Format("Media File Scan completed for '{0}'", series.Title);
notification.CurrentMessage = string.Format("Disk Scan completed for '{0}'", series.Title);
}
catch (Exception e)
{
Logger.ErrorException("An error has occured while scanning " + series.Title, e);
Logger.ErrorException("An error has occurred while scanning " + series.Title, e);
}
}
}

View File

@ -73,6 +73,8 @@ private void ScanSeries(ProgressNotification notification)
var updatedSeries = _seriesProvider.GetSeries(currentSeries.SeriesId);
AutoIgnoreSeasons(updatedSeries.SeriesId);
notification.CurrentMessage = String.Format("{0} was successfully imported", updatedSeries.Title);
}
catch (Exception e)
{

View File

@ -40,26 +40,26 @@ public JobProvider() { }
/// Returns a list of all registered jobs
/// </summary>
/// <returns></returns>
public virtual List<JobSetting> All()
public virtual List<JobDefinition> All()
{
return _database.Fetch<JobSetting>().ToList();
return _database.Fetch<JobDefinition>().ToList();
}
/// <summary>
/// Creates/Updates settings for a job
/// Creates/Updates definitions for a job
/// </summary>
/// <param name="settings">Settings to be created/updated</param>
public virtual void SaveSettings(JobSetting settings)
/// <param name="definitions">Settings to be created/updated</param>
public virtual void SaveSettings(JobDefinition definitions)
{
if (settings.Id == 0)
if (definitions.Id == 0)
{
Logger.Trace("Adding job settings for {0}", settings.Name);
_database.Insert(settings);
Logger.Trace("Adding job definitions for {0}", definitions.Name);
_database.Insert(definitions);
}
else
{
Logger.Trace("Updating job settings for {0}", settings.Name);
_database.Update(settings);
Logger.Trace("Updating job definitions for {0}", definitions.Name);
_database.Update(definitions);
}
}
@ -73,7 +73,7 @@ public virtual bool RunScheduled()
{
if (_isRunning)
{
Logger.Info("Another instance of this job is already running. Ignoring request.");
Logger.Trace("Queue is already running. Ignoring scheduler's request.");
return false;
}
_isRunning = true;
@ -112,19 +112,19 @@ public virtual bool RunScheduled()
/// <remarks>Job is only added to the queue if same job with the same targetId doesn't already exist in the queue.</remarks>
public virtual bool QueueJob(Type jobType, int targetId = 0)
{
Logger.Debug("Adding job ({0}:{1}) to the queue", jobType, targetId);
Logger.Debug("Adding [{0}:{1}] to the queue", jobType.Name, targetId);
lock (Queue)
{
var queueTuple = new Tuple<Type, int>(jobType, targetId);
if (Queue.Contains(queueTuple))
{
Logger.Info("Job ({0}:{1}) already exists in queue. Skipping.", jobType, targetId);
Logger.Info("[{0}:{1}] already exists in job queue. Skipping.", jobType.Name, targetId);
return false;
}
Queue.Add(queueTuple);
Logger.Trace("Job ({0}:{1}) added to the queue", jobType, targetId);
Logger.Trace("Job [{0}:{1}] added to the queue", jobType.Name, targetId);
}
@ -132,7 +132,7 @@ public virtual bool QueueJob(Type jobType, int targetId = 0)
{
if (_isRunning)
{
Logger.Trace("Queue is already running. Ignoring request.");
Logger.Trace("Queue is already running. No need to start it up.");
return true;
}
_isRunning = true;
@ -150,7 +150,7 @@ public virtual bool QueueJob(Type jobType, int targetId = 0)
}
catch (Exception e)
{
Logger.ErrorException("Error has occured in queue processor thread", e);
Logger.ErrorException("Error has occurred in queue processor thread", e);
}
finally
{
@ -164,7 +164,7 @@ public virtual bool QueueJob(Type jobType, int targetId = 0)
}
else
{
Logger.Warn("Execution lock has has fucked up. Thread still active. Ignoring request.");
Logger.Error("Execution lock has fucked up. Thread still active. Ignoring request.");
return true;
}
@ -230,7 +230,7 @@ private void Execute(Type jobType, int targetId = 0)
var jobImplementation = _jobs.Where(t => t.GetType() == jobType).FirstOrDefault();
if (jobImplementation == null)
{
Logger.Error("Unable to locate implementation for '{0}'. Make sure its properly registered.", jobType.ToString());
Logger.Error("Unable to locate implementation for '{0}'. Make sure it is properly registered.", jobType);
return;
}
@ -240,7 +240,7 @@ private void Execute(Type jobType, int targetId = 0)
{
try
{
Logger.Debug("Starting job '{0}'. Last execution {1}", settings.Name, settings.LastExecution);
Logger.Debug("Starting '{0}' job. Last execution {1}", settings.Name, settings.LastExecution);
var sw = Stopwatch.StartNew();
@ -252,12 +252,12 @@ private void Execute(Type jobType, int targetId = 0)
settings.Success = true;
sw.Stop();
Logger.Debug("Job '{0}' successfully completed in {1} seconds", jobImplementation.Name, sw.Elapsed.Minutes,
Logger.Debug("Job '{0}' successfully completed in {1}.{2} seconds.", jobImplementation.Name, sw.Elapsed.Seconds, sw.Elapsed.Milliseconds / 100,
sw.Elapsed.Seconds);
}
catch (Exception e)
{
Logger.ErrorException("An error has occurred while executing timer job " + jobImplementation.Name, e);
Logger.ErrorException("An error has occurred while executing job " + jobImplementation.Name, e);
_notification.Status = ProgressNotificationStatus.Failed;
_notification.CurrentMessage = jobImplementation.Name + " Failed.";
@ -286,7 +286,7 @@ public virtual void Initialize()
var timerProviderLocal = timer;
if (!currentTimer.Exists(c => c.TypeName == timerProviderLocal.GetType().ToString()))
{
var settings = new JobSetting
var settings = new JobDefinition
{
Enable = timerProviderLocal.DefaultInterval > 0,
TypeName = timer.GetType().ToString(),

View File

@ -31,7 +31,7 @@ public PostDownloadScanJob()
public string Name
{
get { return "Post Download Media File Scan"; }
get { return "Drop folder monitor"; }
}
public int DefaultInterval
@ -41,56 +41,60 @@ public int DefaultInterval
public virtual void Start(ProgressNotification notification, int targetId)
{
Logger.Debug("Starting New Download Scan Job");
var dropFolder = _configProvider.SabDropDirectory;
if (String.IsNullOrWhiteSpace(dropFolder))
{
Logger.Debug("Skipping drop folder scan. No drop folder is defined.");
Logger.Debug("No drop folder is defined. Skipping.");
return;
}
if (!_diskProvider.FolderExists(dropFolder))
{
Logger.Warn("Unable to Scan for New Downloads - folder Doesn't exist: {0}", dropFolder);
Logger.Warn("Unable to Scan for New Downloads - folder Doesn't exist: [{0}]", dropFolder);
return;
}
foreach (var subfolder in _diskProvider.GetDirectories(dropFolder))
{
var subfolderInfo = new DirectoryInfo(subfolder);
if (subfolderInfo.Name.StartsWith("_UNPACK_", StringComparison.CurrentCultureIgnoreCase))
try
{
Logger.Info("Folder [{0}] is still being unpacked. skipping.", subfolder);
continue;
}
var subfolderInfo = new DirectoryInfo(subfolder);
if (subfolderInfo.Name.StartsWith("_FAILED_", StringComparison.CurrentCultureIgnoreCase))
if (subfolderInfo.Name.StartsWith("_UNPACK_", StringComparison.CurrentCultureIgnoreCase))
{
Logger.Debug("Folder [{0}] is still being unpacked. skipping.", subfolder);
continue;
}
if (subfolderInfo.Name.StartsWith("_FAILED_", StringComparison.CurrentCultureIgnoreCase))
{
Logger.Debug("Folder [{0}] is marked as failed. skipping.", subfolder);
continue;
}
//Parse the Folder name
var seriesName = Parser.ParseSeriesName(subfolderInfo.Name);
var series = _seriesProvider.FindSeries(seriesName);
if (series == null)
{
Logger.Warn("Unable to Import new download, series doesn't exist in database.");
return;
}
var importedFiles = _diskScanProvider.Scan(series, subfolder);
importedFiles.ForEach(file => _diskScanProvider.MoveEpisodeFile(file));
//Delete the folder only if all files were removed
if (_diskProvider.GetFiles(subfolder, SearchOption.AllDirectories).Length == 0)
_diskProvider.DeleteFolder(subfolder, false);
}
catch (Exception e)
{
Logger.Info("Folder [{0}] is marked as failed. skipping.", subfolder);
continue;
Logger.ErrorException("An error has occurred while importing " + subfolder, e);
}
//Parse the Folder name
var seriesName = Parser.ParseSeriesName(subfolderInfo.Name);
var series = _seriesProvider.FindSeries(seriesName);
if (series == null)
{
Logger.Warn("Unable to Import new download, series is not being watched");
return;
}
var importedFiles = _diskScanProvider.Scan(series, subfolder);
importedFiles.ForEach(file => _diskScanProvider.MoveEpisodeFile(file));
//Delete the folder only if all files were removed
if (_diskProvider.GetFiles(subfolder, "*.*", SearchOption.AllDirectories).Length == 0)
_diskProvider.DeleteFolder(subfolder, false);
}
Logger.Debug("New Download Scan Job completed successfully");
}
}
}

View File

@ -69,10 +69,12 @@ public void Start(ProgressNotification notification, int targetId)
}
catch (Exception e)
{
Logger.ErrorException("An error has occured while processing parse result items from " + episodeParseResult, e);
Logger.ErrorException("An error has occurred while processing parse result items from " + episodeParseResult, e);
}
}
notification.CurrentMessage = "RSS Sync Completed";
}
}
}

View File

@ -25,7 +25,7 @@ public UpdateInfoJob()
public string Name
{
get { return "Update Info"; }
get { return "Update Episode Info"; }
}
public int DefaultInterval

View File

@ -83,7 +83,7 @@ public virtual FileInfo CalculateFilePath(Series series, int seasonNumber, strin
string path = series.Path;
if (series.SeasonFolder)
{
var seasonFolder = _configProvider.SeasonFolderFormat
var seasonFolder = _configProvider.SortingSeasonFolderFormat
.Replace("%0s", seasonNumber.ToString("00"))
.Replace("%s", seasonNumber.ToString());
@ -115,7 +115,7 @@ LEFT OUTER JOIN EpisodeFiles
public virtual int DeleteOrphaned()
{
Logger.Trace("Deleting orphaned files.");
Logger.Trace("Deleting orphan files.");
var updated = _database.Execute(@"DELETE FROM EpisodeFiles
WHERE EpisodeFileId IN
@ -126,22 +126,23 @@ LEFT OUTER JOIN Episodes
if (updated > 0)
{
Logger.Debug("Removed {0} orphaned files.", updated);
Logger.Debug("Removed {0} orphan file(s) from database.S", updated);
}
return updated;
}
public virtual string GetNewFilename(IList<Episode> episodes, string seriesTitle, QualityTypes quality)
{
var separatorStyle = EpisodeSortingHelper.GetSeparatorStyle(_configProvider.SeparatorStyle);
var numberStyle = EpisodeSortingHelper.GetNumberStyle(_configProvider.NumberStyle);
var separatorStyle = EpisodeSortingHelper.GetSeparatorStyle(_configProvider.SortingSeparatorStyle);
var numberStyle = EpisodeSortingHelper.GetNumberStyle(_configProvider.SortingNumberStyle);
string episodeNames = episodes[0].Title;
string result = String.Empty;
if (_configProvider.SeriesName)
if (_configProvider.SortingIncludeSeriesName)
{
result += seriesTitle + separatorStyle.Pattern;
}
@ -150,7 +151,7 @@ public virtual string GetNewFilename(IList<Episode> episodes, string seriesTitle
if (episodes.Count > 1)
{
var multiEpisodeStyle = EpisodeSortingHelper.GetMultiEpisodeStyle(_configProvider.MultiEpisodeStyle);
var multiEpisodeStyle = EpisodeSortingHelper.GetMultiEpisodeStyle(_configProvider.SortingMultiEpisodeStyle);
foreach (var episode in episodes.OrderBy(e => e.EpisodeNumber).Skip(1))
{
@ -174,19 +175,19 @@ public virtual string GetNewFilename(IList<Episode> episodes, string seriesTitle
.Replace("%x", numberStyle.EpisodeSeparator)
.Replace("%p", separatorStyle.Pattern);
if (_configProvider.EpisodeName)
if (_configProvider.SortingIncludeEpisodeTitle)
{
episodeNames = episodeNames.TrimEnd(' ', '+');
result += separatorStyle.Pattern + episodeNames;
}
if (_configProvider.AppendQuality)
if (_configProvider.SortingAppendQuality)
result += String.Format(" [{0}]", quality);
if (_configProvider.ReplaceSpaces)
if (_configProvider.SortingReplaceSpaces)
result = result.Replace(' ', '.');
Logger.Trace("New File Name is: {0}", result.Trim());
Logger.Trace("New File Name is: [{0}]", result.Trim());
return CleanFilename(result.Trim());
}

View File

@ -44,7 +44,7 @@ public virtual void Delete(int profileId)
_database.Delete<QualityProfile>(profileId);
}
public virtual List<QualityProfile> GetAllProfiles()
public virtual List<QualityProfile> All()
{
var profiles = _database.Fetch<QualityProfile>().ToList();
@ -58,9 +58,10 @@ public virtual QualityProfile Get(int profileId)
public virtual void SetupDefaultProfiles()
{
Logger.Info("Setting up default quality profiles");
if (All().Count != 0)
return;
var profiles = GetAllProfiles();
Logger.Info("Setting up default quality profiles");
var sd = new QualityProfile { Name = "SD", Allowed = new List<QualityTypes> { QualityTypes.SDTV, QualityTypes.DVD }, Cutoff = QualityTypes.SDTV };
@ -71,23 +72,9 @@ public virtual void SetupDefaultProfiles()
Cutoff = QualityTypes.HDTV
};
//Add or Update SD
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", sd.Name));
var sdDb = profiles.Where(p => p.Name == sd.Name).FirstOrDefault();
if (sdDb == null)
{
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", sd.Name));
Add(sd);
}
Add(sd);
Add(hd);
//Add or Update HD
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", hd.Name));
var hdDb = profiles.Where(p => p.Name == hd.Name).FirstOrDefault();
if (hdDb == null)
{
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", hd.Name));
Add(hd);
}
}
}
}

View File

@ -22,7 +22,7 @@ public SceneMappingProvider(IDatabase database, HttpProvider httpProvider)
public SceneMappingProvider()
{
}
public virtual bool UpdateMappings()
@ -38,7 +38,7 @@ public virtual bool UpdateMappings()
while ((line = reader.ReadLine()) != null)
{
var split = line.Split(',');
var seriesId = 0;
int seriesId;
Int32.TryParse(split[1], out seriesId);
var map = new SceneMapping();

View File

@ -109,7 +109,7 @@ public virtual void AddSeries(string path, int tvDbSeriesId, int qualityProfileI
repoSeries.Monitored = true; //New shows should be monitored
repoSeries.QualityProfileId = qualityProfileId;
if (qualityProfileId == 0)
repoSeries.QualityProfileId = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", "1"));
repoSeries.QualityProfileId = _configProvider.DefaultQualityProfile;
repoSeries.SeasonFolder = _configProvider.UseSeasonFolder;

View File

@ -3,9 +3,9 @@
namespace NzbDrone.Core.Repository
{
[TableName("IndexerSettings")]
[TableName("IndexerDefinitions")]
[PrimaryKey("Id", autoIncrement = true)]
public class IndexerSetting
public class IndexerDefinition
{
public int Id { get; set; }

View File

@ -3,9 +3,9 @@
namespace NzbDrone.Core.Repository
{
[TableName("JobSettings")]
[TableName("JobDefinitions")]
[PrimaryKey("Id", autoIncrement = true)]
public class JobSetting
public class JobDefinition
{
public Int32 Id { get; set; }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Ninject" version="2.2.1.4" />
<package id="MiniProfiler" version="1.3" />
<package id="SqlServerCompact" version="4.0.8482.1" />
<package id="MiniProfiler" version="1.4" />
</packages>

View File

@ -223,3 +223,10 @@ select
display: block;
height: 25px;
}
.dialog
{
margin-left: auto;
margin-right: auto;
}

View File

@ -8,4 +8,11 @@
.yui3-aclist-item-active
{
background: #065EFE !important;
}
}
/*jQuery UI*/
.ui-widget-header
{
font-weight: normal;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -50,7 +50,7 @@
*
* http://docs.jquery.com/UI/Theming/API
*
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=&fwDefault=normal&fsDefault=&cornerRadius=0px&bgColorHeader=0b3e6f&bgTextureHeader=01_flat.png&bgImgOpacityHeader=0&borderColorHeader=0b3e6f&fcHeader=f6f6f6&iconColorHeader=98d2fb&bgColorContent=111111&bgTextureContent=01_flat.png&bgImgOpacityContent=20&borderColorContent=000000&fcContent=d9d9d9&iconColorContent=9ccdfc&bgColorDefault=333333&bgTextureDefault=01_flat.png&bgImgOpacityDefault=20&borderColorDefault=333333&fcDefault=ffffff&iconColorDefault=9ccdfc&bgColorHover=00498f&bgTextureHover=01_flat.png&bgImgOpacityHover=40&borderColorHover=222222&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=00498f&bgTextureActive=01_flat.png&bgImgOpacityActive=40&borderColorActive=222222&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=0b58a2&bgTextureHighlight=08_diagonals_thick.png&bgImgOpacityHighlight=30&borderColorHighlight=052f57&fcHighlight=ffffff&iconColorHighlight=ffffff&bgColorError=a32d00&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=30&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffffff&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=&fwDefault=normal&fsDefault=&cornerRadius=1px&bgColorHeader=065efe&bgTextureHeader=01_flat.png&bgImgOpacityHeader=0&borderColorHeader=065efe&fcHeader=f6f6f6&iconColorHeader=98d2fb&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=20&borderColorContent=a8a8a8&fcContent=&iconColorContent=9ccdfc&bgColorDefault=333333&bgTextureDefault=01_flat.png&bgImgOpacityDefault=20&borderColorDefault=a8a8a8&fcDefault=ffffff&iconColorDefault=9ccdfc&bgColorHover=065efe&bgTextureHover=01_flat.png&bgImgOpacityHover=40&borderColorHover=a8a8a8&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=065efe&bgTextureActive=01_flat.png&bgImgOpacityActive=40&borderColorActive=a8a8a8&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=065efe&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=30&borderColorHighlight=065efe&fcHighlight=ffffff&iconColorHighlight=ffffff&bgColorError=a32d00&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=30&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffffff&bgColorOverlay=000000&bgTextureOverlay=11_white_lines.png&bgImgOpacityOverlay=10&opacityOverlay=60&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=0px%20
*/
@ -59,24 +59,24 @@
.ui-widget { font-family: ; font-size: ; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: ; font-size: 1em; }
.ui-widget-content { border: 1px solid #000000; background: #111111 url(images/ui-bg_flat_20_111111_40x100.png) 50% 50% repeat-x; color: #d9d9d9; }
.ui-widget-content a { color: #d9d9d9; }
.ui-widget-header { border: 1px solid #0b3e6f; background: #0b3e6f url(images/ui-bg_flat_0_0b3e6f_40x100.png) 50% 50% repeat-x; color: #f6f6f6; font-weight: bold; }
.ui-widget-content { border: 1px solid #a8a8a8; background: #ffffff url(images/ui-bg_flat_20_ffffff_40x100.png) 50% 50% repeat-x; color: #; }
.ui-widget-content a { color: #; }
.ui-widget-header { border: 1px solid #065efe; background: #065efe url(images/ui-bg_flat_0_065efe_40x100.png) 50% 50% repeat-x; color: #f6f6f6; font-weight: bold; }
.ui-widget-header a { color: #f6f6f6; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #333333; background: #333333 url(images/ui-bg_flat_20_333333_40x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; }
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #a8a8a8; background: #333333 url(images/ui-bg_flat_20_333333_40x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #ffffff; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #222222; background: #00498f url(images/ui-bg_flat_40_00498f_40x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #a8a8a8; background: #065efe url(images/ui-bg_flat_40_065efe_40x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; }
.ui-state-hover a, .ui-state-hover a:hover { color: #ffffff; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #222222; background: #00498f url(images/ui-bg_flat_40_00498f_40x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #a8a8a8; background: #065efe url(images/ui-bg_flat_40_065efe_40x100.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #ffffff; text-decoration: none; }
.ui-widget :active { outline: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #052f57; background: #0b58a2 url(images/ui-bg_diagonals-thick_30_0b58a2_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #065efe; background: #065efe url(images/ui-bg_flat_30_065efe_40x100.png) 50% 50% repeat-x; color: #ffffff; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #ffffff; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #a32d00 url(images/ui-bg_diagonals-thick_30_a32d00_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
@ -280,14 +280,14 @@
----------------------------------*/
/* Corner radius */
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; -khtml-border-top-left-radius: 0px; border-top-left-radius: 0px; }
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 0px; -webkit-border-top-right-radius: 0px; -khtml-border-top-right-radius: 0px; border-top-right-radius: 0px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 0px; -webkit-border-bottom-left-radius: 0px; -khtml-border-bottom-left-radius: 0px; border-bottom-left-radius: 0px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 0px; -webkit-border-bottom-right-radius: 0px; -khtml-border-bottom-right-radius: 0px; border-bottom-right-radius: 0px; }
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 1px; -webkit-border-top-left-radius: 1px; -khtml-border-top-left-radius: 1px; border-top-left-radius: 1px; }
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 1px; -webkit-border-top-right-radius: 1px; -khtml-border-top-right-radius: 1px; border-top-right-radius: 1px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 1px; -webkit-border-bottom-left-radius: 1px; -khtml-border-bottom-left-radius: 1px; border-bottom-left-radius: 1px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 1px; -webkit-border-bottom-right-radius: 1px; -khtml-border-bottom-right-radius: 1px; border-bottom-right-radius: 1px; }
/* Overlays */
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
.ui-widget-overlay { background: #000000 url(images/ui-bg_white-lines_10_000000_40x100.png) 50% 50% repeat; opacity: .60;filter:Alpha(Opacity=60); }
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 0px ; -khtml-border-radius: 0px ; -webkit-border-radius: 0px ; border-radius: 0px ; }/*
* jQuery UI Resizable 1.8.14
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)

View File

@ -49,17 +49,12 @@ public JsonResult ScanNewSeries()
public ActionResult AddNew()
{
var rootDirs = _rootFolderProvider.GetAll().Select(r =>
new RootDirModel
{
Path = r.Path,
CleanPath = r.Path.Replace(Path.DirectorySeparatorChar, '|').Replace(Path.VolumeSeparatorChar, '^').Replace('\'', '`')
});
ViewData["RootDirs"] = rootDirs.ToList();
ViewData["DirSep"] = Path.DirectorySeparatorChar.ToString().Replace(Path.DirectorySeparatorChar, '|');
ViewData["RootDirs"] = _rootFolderProvider.GetAll().Select(c => c.Path).OrderBy(e => e).ToList();
var defaultQuality = _configProvider.DefaultQualityProfile;
var qualityProfiles = _qualityProvider.GetAllProfiles();
var qualityProfiles = _qualityProvider.All();
ViewData["qualityList"] = qualityProfiles;
ViewData["quality"] = new SelectList(
qualityProfiles,
@ -74,7 +69,7 @@ public ActionResult Index()
{
var rootDirs = _rootFolderProvider.GetAll();
var profiles = _qualityProvider.GetAllProfiles();
var profiles = _qualityProvider.All();
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality);
ViewData["qualities"] = selectList;
@ -111,7 +106,7 @@ public ActionResult RenderPartial(string path)
ViewData["javaPath"] = path.Replace(Path.DirectorySeparatorChar, '|').Replace(Path.VolumeSeparatorChar, '^').Replace('\'', '`');
var defaultQuality = _configProvider.DefaultQualityProfile;
var qualityProfiles = _qualityProvider.GetAllProfiles();
var qualityProfiles = _qualityProvider.All();
ViewData["quality"] = new SelectList(
qualityProfiles,

View File

@ -41,7 +41,7 @@ public SeriesController(SeriesProvider seriesProvider,
public ActionResult Index()
{
var profiles = _qualityProvider.GetAllProfiles();
var profiles = _qualityProvider.All();
ViewData["SelectList"] = new SelectList(profiles, "QualityProfileId", "Name");
return View();

View File

@ -116,7 +116,7 @@ public ActionResult Quality()
ViewData["Qualities"] = qualityTypes;
var profiles = _qualityProvider.GetAllProfiles().ToList();
var profiles = _qualityProvider.All().ToList();
foreach (var qualityProfile in profiles)
{
@ -157,15 +157,15 @@ public ActionResult EpisodeSorting()
{
var model = new EpisodeSortingModel();
model.SeriesName = _configProvider.SeriesName;
model.EpisodeName = _configProvider.EpisodeName;
model.ReplaceSpaces = _configProvider.ReplaceSpaces;
model.AppendQuality = _configProvider.AppendQuality;
model.SeriesName = _configProvider.SortingIncludeSeriesName;
model.EpisodeName = _configProvider.SortingIncludeEpisodeTitle;
model.ReplaceSpaces = _configProvider.SortingReplaceSpaces;
model.AppendQuality = _configProvider.SortingAppendQuality;
model.SeasonFolders = _configProvider.UseSeasonFolder;
model.SeasonFolderFormat = _configProvider.SeasonFolderFormat;
model.SeparatorStyle = _configProvider.SeparatorStyle;
model.NumberStyle = _configProvider.NumberStyle;
model.MultiEpisodeStyle = _configProvider.MultiEpisodeStyle;
model.SeasonFolderFormat = _configProvider.SortingSeasonFolderFormat;
model.SeparatorStyle = _configProvider.SortingSeparatorStyle;
model.NumberStyle = _configProvider.SortingNumberStyle;
model.MultiEpisodeStyle = _configProvider.SortingMultiEpisodeStyle;
model.SeparatorStyles = new SelectList(EpisodeSortingHelper.GetSeparatorStyles(), "Id", "Name");
model.NumberStyles = new SelectList(EpisodeSortingHelper.GetNumberStyles(), "Id", "Name");
@ -223,7 +223,7 @@ public ActionResult SubMenu()
public QualityModel GetUpdatedProfileList()
{
var profiles = _qualityProvider.GetAllProfiles().ToList();
var profiles = _qualityProvider.All().ToList();
var defaultQualityQualityProfileId =
Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].QualityProfileId));
var selectList = new SelectList(profiles, "QualityProfileId", "Name");
@ -423,15 +423,15 @@ public ActionResult SaveEpisodeSorting(EpisodeSortingModel data)
if (ModelState.IsValid)
{
_configProvider.SeriesName = data.SeriesName;
_configProvider.EpisodeName = data.EpisodeName;
_configProvider.ReplaceSpaces = data.ReplaceSpaces;
_configProvider.AppendQuality = data.AppendQuality;
_configProvider.SortingIncludeSeriesName = data.SeriesName;
_configProvider.SortingIncludeEpisodeTitle = data.EpisodeName;
_configProvider.SortingReplaceSpaces = data.ReplaceSpaces;
_configProvider.SortingAppendQuality = data.AppendQuality;
_configProvider.UseSeasonFolder = data.SeasonFolders;
_configProvider.SeasonFolderFormat = data.SeasonFolderFormat;
_configProvider.SeparatorStyle = data.SeparatorStyle;
_configProvider.NumberStyle = data.NumberStyle;
_configProvider.MultiEpisodeStyle = data.MultiEpisodeStyle;
_configProvider.SortingSeasonFolderFormat = data.SeasonFolderFormat;
_configProvider.SortingSeparatorStyle = data.SeparatorStyle;
_configProvider.SortingNumberStyle = data.NumberStyle;
_configProvider.SortingMultiEpisodeStyle = data.MultiEpisodeStyle;
basicNotification.Title = SETTINGS_SAVED;
_notificationProvider.Register(basicNotification);

View File

@ -33,7 +33,7 @@ public ActionResult Jobs()
public ActionResult Indexers()
{
return View(_indexerProvider.GetAllISettings());
return View(_indexerProvider.All());
}

View File

@ -50,9 +50,9 @@
<HintPath>..\Libraries\MVC3\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvcMiniProfiler, Version=2.1.4183.14740, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="MvcMiniProfiler, Version=1.4.4195.37960, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MiniProfiler.1.3\lib\MvcMiniProfiler.dll</HintPath>
<HintPath>..\packages\MiniProfiler.1.4\lib\MvcMiniProfiler.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\packages\Ninject.2.2.1.4\lib\net40-Full\Ninject.dll</HintPath>

View File

@ -34,4 +34,4 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.2.0.*")]
[assembly: AssemblyVersion("0.5.0.*")]

View File

@ -1,22 +1,11 @@
@using NzbDrone.Web.Models
@{
Layout = null;
}
@using System.Collections
@using NzbDrone.Web.Models
@{ Layout = null; }
<div>
<fieldset>
<legend>Root Directory</legend>
@{int d = 0;
foreach (var dir in ViewData["RootDirs"] as List<RootDirModel>)
{
<div>
@Html.RadioButton("selectedRootDir", dir.CleanPath, d == 0, new { @class = "dirList examplePart", id = "dirRadio_" + d })
@Html.Label(dir.Path)
@{ d++; }
</div>
}
}
</fieldset>
@Html.Label("Root Directory")
@Html.DropDownList("rootDirList", new SelectList((IList)ViewData["RootDirs"]))
@Html.Label("Quality")
@Html.DropDownList("qualityList", new SelectList((IList)ViewData["QualityList"], "QualityProfileId", "Name"))
</div>
<br />
<div>

View File

@ -1,45 +1,40 @@
@model List<RootDir>
@using NzbDrone.Core.Repository
@section HeaderContent
{
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui-min.js"></script>
}
@section TitleContent{
Add Series
}
@section MainContent{
@{ Html.Telerik().Window()
.Name("Window")
.Title("Add New Series")
.Modal(true)
.Buttons(b => b.Close())
.Width(500)
.Height(200)
.Visible(false)
.Draggable(true)
.Resizable(resizing => resizing.Enabled(false))
.LoadContentFrom("AddNew", "AddSeries")
.Render();
}
<div style="padding-bottom: 10px; padding-top: 15px;">
<button onclick="openAddNewSeries(); return false;" class="listButton" style="margin-left: 5px">
Add New</button>
@Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList)ViewData["qualities"]).HtmlAttributes(
new { style = "width: 100px; margin-left:224px;" }).ClientEvents(events => events.OnChange("masterChanged"))
<div id="addNewWindow" class="dialog">
@{ Html.RenderAction("AddNew", "AddSeries"); }
</div>
@{Html.RenderAction("RootDir");}
<div id="existingSeries">
<div style="padding-bottom: 10px; padding-top: 15px;">
<button onclick="openAddNewSeries(); return false;" class="listButton" style="margin-left: 5px">
Add New</button>
@Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList)ViewData["qualities"]).HtmlAttributes(
new { style = "width: 100px; margin-left:224px;" }).ClientEvents(events => events.OnChange("masterChanged"))
</div>
@{ Html.RenderAction("AddExisting", "AddSeries"); }
</div>
}
@section Scripts
{
<script type="text/javascript">
$(document).ready(function () {
$("#addNewWindow").dialog({
title: 'add new series',
height: '500',
width: '700',
modal: true
});
});
function openAddNewSeries() {
var window = $('#Window').data('tWindow');
window.center().open();

View File

@ -2,7 +2,7 @@
@using NzbDrone.Web.Models;
@model IEnumerable<NzbDrone.Core.Repository.Series>
@section TitleContent{
Series
NZBDrone
}
<style>
/* progress bar container */

View File

@ -1,2 +1,5 @@
<div>RSS Sync: </div>
<div style="display:none" id="syncTimer" class="timer">@ViewData["RssTimer"]</div>
@using NzbDrone.Core
<div>
NZBDrone (@CentralDispatch.Version)
</div>

View File

@ -1,4 +1,4 @@
@model IEnumerable<NzbDrone.Core.Repository.IndexerSetting>
@model IEnumerable<NzbDrone.Core.Repository.IndexerDefinition>
@section TitleContent{
Indexers
}

View File

@ -1,4 +1,4 @@
@model IEnumerable<NzbDrone.Core.Repository.JobSetting>
@model IEnumerable<NzbDrone.Core.Repository.JobDefinition>
@section TitleContent{
Jobs
}

View File

@ -7,6 +7,6 @@
<package id="jQuery.vsdoc" version="1.6" />
<package id="jQuery.Validation" version="1.8.0.1" />
<package id="jQuery" version="1.6.1" />
<package id="MiniProfiler" version="1.3" />
<package id="SqlServerCompact" version="4.0.8482.1" />
<package id="MiniProfiler" version="1.4" />
</packages>

View File

@ -103,7 +103,7 @@ private static void AppDomainException(object excepion)
Console.WriteLine("EPIC FAIL: {0}", excepion);
Logger.Fatal("EPIC FAIL: {0}", excepion);
#if Release
#if RELEASE
new Client
{
ApiKey = "43BBF60A-EB2A-4C1C-B09E-422ADF637265",

View File

@ -36,4 +36,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0.*")]
[assembly: AssemblyVersion("0.5.0.*")]

View File

@ -4,6 +4,6 @@
<supportedRuntime version="v4.0" />
</startup>
<appSettings>
<add key="port" value="8989" />
<add key="port" value="8980" />
</appSettings>
</configuration>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.