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

Conflicts:
	NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
pull/4/head
Mark McDowall 13 years ago
commit 67299f0d97

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

@ -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

@ -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();
}
}
}

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

@ -39,32 +39,7 @@ namespace NzbDrone.Core.Test.Framework
return database; return database;
} }
public static DiskProvider GetStandardDisk(int seasons, int episodes) public static Series GetFakeSeries(int id, string title)
{
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)
{ {
return Builder<Series>.CreateNew() return Builder<Series>.CreateNew()
.With(c => c.SeriesId = id) .With(c => c.SeriesId = id)

@ -10,6 +10,8 @@ namespace NzbDrone.Core.Test.Framework
public void Setup() public void Setup()
{ {
ExceptionVerification.Reset(); ExceptionVerification.Reset();
} }
[TearDown] [TearDown]

@ -33,10 +33,10 @@ namespace NzbDrone.Core.Test
indexerProvider.SaveSettings(settings); indexerProvider.SaveSettings(settings);
//Assert //Assert
indexerProvider.GetAllISettings(); indexerProvider.All();
indexerProvider.GetAllISettings().Should().HaveCount(1); indexerProvider.All().Should().HaveCount(1);
indexerProvider.GetEnabledIndexers().Should().HaveCount(1); indexerProvider.GetEnabledIndexers().Should().HaveCount(1);
} }
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Test
//Assert //Assert
indexerProvider.GetAllISettings().Should().HaveCount(1); indexerProvider.All().Should().HaveCount(1);
indexerProvider.GetEnabledIndexers().Should().BeEmpty(); indexerProvider.GetEnabledIndexers().Should().BeEmpty();
} }
} }

@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>())) .Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName)); .Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build(); var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>() mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>())) .Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings); .Returns(fakeSettings);
@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test
{ {
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
mocker.Resolve<HttpProvider>(); mocker.Resolve<HttpProvider>();
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build(); var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>() mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>())) .Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings); .Returns(fakeSettings);
@ -100,7 +100,7 @@ namespace NzbDrone.Core.Test
const string summary = "My fake summary"; const string summary = "My fake summary";
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build(); var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>() mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>())) .Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings); .Returns(fakeSettings);
@ -127,7 +127,7 @@ namespace NzbDrone.Core.Test
const string summary = "My fake summary"; const string summary = "My fake summary";
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build(); var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>() mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>())) .Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings); .Returns(fakeSettings);
@ -150,7 +150,7 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
mocker.SetConstant(new HttpProvider()); mocker.SetConstant(new HttpProvider());
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build(); var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
mocker.GetMock<IndexerProvider>() mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>())) .Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings); .Returns(fakeSettings);

@ -50,6 +50,38 @@ namespace NzbDrone.Core.Test
Assert.AreEqual("write_log", logItem.Method); 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] [Test]
public void clearLog() public void clearLog()

@ -146,7 +146,7 @@ namespace NzbDrone.Core.Test
.Build(); .Build();
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
mocker.GetMock<ConfigProvider>().Setup(e => e.SeasonFolderFormat).Returns(seasonFolderFormat); mocker.GetMock<ConfigProvider>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
//Act //Act
var result = mocker.Resolve<MediaFileProvider>().CalculateFilePath(fakeSeries, 1, filename, ".mkv"); var result = mocker.Resolve<MediaFileProvider>().CalculateFilePath(fakeSeries, 1, filename, ".mkv");

@ -22,12 +22,12 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi") .With(e => e.Title = "City Sushi")
@ -49,12 +49,12 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi") .With(e => e.Title = "City Sushi")
@ -76,12 +76,12 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(1); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(1);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi") .With(e => e.Title = "City Sushi")
@ -103,12 +103,12 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
@ -131,12 +131,12 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi") .With(e => e.Title = "City Sushi")
@ -158,12 +158,12 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "City Sushi") .With(e => e.Title = "City Sushi")
@ -185,12 +185,12 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
@ -213,13 +213,13 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(3); fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(3);
var episodeOne = Builder<Episode>.CreateNew() var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)") .With(e => e.Title = "Strawberries and Cream (1)")
@ -247,13 +247,13 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2); fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
var episodeOne = Builder<Episode>.CreateNew() var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)") .With(e => e.Title = "Strawberries and Cream (1)")
@ -281,13 +281,13 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2); fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
var episodeOne = Builder<Episode>.CreateNew() var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)") .With(e => e.Title = "Strawberries and Cream (1)")
@ -315,13 +315,13 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(1); fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(1);
var episodeOne = Builder<Episode>.CreateNew() var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)") .With(e => e.Title = "Strawberries and Cream (1)")
@ -349,13 +349,13 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(true); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(0);
var episodeOne = Builder<Episode>.CreateNew() var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)") .With(e => e.Title = "Strawberries and Cream (1)")
@ -383,13 +383,13 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var fakeConfig = mocker.GetMock<ConfigProvider>(); var fakeConfig = mocker.GetMock<ConfigProvider>();
fakeConfig.SetupGet(c => c.SeriesName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false); fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false); fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0); fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true); fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2); fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
var episodeOne = Builder<Episode>.CreateNew() var episodeOne = Builder<Episode>.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)") .With(e => e.Title = "Strawberries and Cream (1)")

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

@ -56,7 +56,7 @@ namespace NzbDrone.Core.Test
[TestCase(@"z:\tv shows\robot chicken\Specials\S00E16 - Dear Consumer - SD TV.avi", 0, 16)] [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\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(@"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) public void PathParse_tests(string path, int season, int episode)
{ {
var result = Parser.ParsePath(path); var result = Parser.ParsePath(path);
@ -125,7 +125,7 @@ namespace NzbDrone.Core.Test
result.QualityType.Should().Be(qualityEnum); result.QualityType.Should().Be(qualityEnum);
} }
} }
[Timeout(1000)] [Timeout(1000)]
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", "WEEDS", 3, new[] { 1, 2, 3, 4, 5, 6 }, 6)] [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)] [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 @@ namespace NzbDrone.Core.Test
result.EpisodeNumbers.Count.Should().Be(count); result.EpisodeNumbers.Count.Should().Be(count);
} }
[TestCase("Conan 2011 04 18 Emma Roberts HDTV XviD BFF", "Conan", 2011, 04, 18)] [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 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)] [TestCase("The.Daily.Show.2010.10.11.Johnny.Knoxville.iTouch-MW", "The.Daily.Show", 2010, 10, 11)]
@ -165,7 +165,7 @@ namespace NzbDrone.Core.Test
Assert.IsNull(result.EpisodeNumbers); Assert.IsNull(result.EpisodeNumbers);
} }
[TestCase("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)] [TestCase("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)]
[TestCase("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)] [TestCase("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)]
[TestCase("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)] [TestCase("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)]
@ -176,7 +176,7 @@ namespace NzbDrone.Core.Test
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title)); result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
result.EpisodeNumbers.Count.Should().Be(0); result.EpisodeNumbers.Count.Should().Be(0);
} }
[TestCase("Conan", "conan")] [TestCase("Conan", "conan")]
[TestCase("The Tonight Show With Jay Leno", "tonightshowwithjayleno")] [TestCase("The Tonight Show With Jay Leno", "tonightshowwithjayleno")]
[TestCase("The.Daily.Show", "dailyshow")] [TestCase("The.Daily.Show", "dailyshow")]
@ -198,7 +198,7 @@ namespace NzbDrone.Core.Test
var result = Parser.NormalizePath(dirty); var result = Parser.NormalizePath(dirty);
result.Should().Be(clean); result.Should().Be(clean);
} }
[TestCase("CaPitAl", "capital")] [TestCase("CaPitAl", "capital")]
[TestCase("peri.od", "period")] [TestCase("peri.od", "period")]
[TestCase("this.^&%^**$%@#$!That", "thisthat")] [TestCase("this.^&%^**$%@#$!That", "thisthat")]
@ -209,7 +209,7 @@ namespace NzbDrone.Core.Test
result.Should().Be(clean); result.Should().Be(clean);
} }
[TestCase("the")] [TestCase("the")]
[TestCase("and")] [TestCase("and")]
[TestCase("or")] [TestCase("or")]

@ -1,6 +1,7 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions; using FluentAssertions;
@ -16,9 +17,6 @@ namespace NzbDrone.Core.Test
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
public class QualityProfileTest : TestBase public class QualityProfileTest : TestBase
{ {
///<summary>
/// Test_s the storage.
///</summary>
[Test] [Test]
public void Test_Storage() public void Test_Storage()
{ {
@ -73,7 +71,7 @@ namespace NzbDrone.Core.Test
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
var db = MockLib.GetEmptyDatabase(); var db = MockLib.GetEmptyDatabase();
mocker.SetConstant(db); mocker.SetConstant(db);
var testProfile = new QualityProfile var testProfile = new QualityProfile
{ {
Name = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString(),
@ -95,7 +93,7 @@ namespace NzbDrone.Core.Test
updated.Name.Should().Be(currentProfile.Name); updated.Name.Should().Be(currentProfile.Name);
updated.Cutoff.Should().Be(QualityTypes.Bluray720p); updated.Cutoff.Should().Be(QualityTypes.Bluray720p);
updated.AllowedString.Should().Be(currentProfile.AllowedString); updated.AllowedString.Should().Be(currentProfile.AllowedString);
} }
[Test] [Test]
@ -127,5 +125,47 @@ namespace NzbDrone.Core.Test
Assert.AreEqual(profileId, result[0].QualityProfileId); Assert.AreEqual(profileId, result[0].QualityProfileId);
Assert.AreEqual(testProfile.Name, profile.Name); 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);
}
} }
} }

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

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

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

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

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

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Datastore
EnsureDatabase(connetionString); EnsureDatabase(connetionString);
Logger.Info("Preparing run database migration"); Logger.Info("Preparing to run database migration");
try try
{ {
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Datastore
} }
catch (Exception e) catch (Exception e)
{ {
Logger.FatalException("An error has occured while migrating database", e); Logger.FatalException("An error has occurred while migrating database", e);
} }
} }

@ -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"));
}
}
}

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

@ -136,7 +136,7 @@ namespace NzbDrone.Core
return parsedEpisode; return parsedEpisode;
} }
} }
Logger.Warn("Unable to parse text into episode info. {0}", title); Logger.Warn("Unable to parse episode info. {0}", title);
return null; return null;
} }

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

@ -190,25 +190,25 @@ namespace NzbDrone.Core.Providers.Core
set { SetValue("BlackholeDirectory", value); } set { SetValue("BlackholeDirectory", value); }
} }
public virtual bool SeriesName public virtual bool SortingIncludeSeriesName
{ {
get { return GetValueBoolean("Sorting_SeriesName", true); } get { return GetValueBoolean("Sorting_SeriesName", true); }
set { SetValue("Sorting_SeriesName", value); } set { SetValue("Sorting_SeriesName", value); }
} }
public virtual bool EpisodeName public virtual bool SortingIncludeEpisodeTitle
{ {
get { return GetValueBoolean("Sorting_EpisodeName", true); } get { return GetValueBoolean("Sorting_EpisodeName", true); }
set { SetValue("Sorting_EpisodeName", value); } 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); } set { SetValue("Sorting_ReplaceSpaces", value); }
} }
public virtual bool AppendQuality public virtual bool SortingAppendQuality
{ {
get { return GetValueBoolean("Sorting_AppendQaulity", true); } get { return GetValueBoolean("Sorting_AppendQaulity", true); }
set { SetValue("Sorting_AppendQaulity", value); } set { SetValue("Sorting_AppendQaulity", value); }
@ -216,30 +216,30 @@ namespace NzbDrone.Core.Providers.Core
public virtual bool UseSeasonFolder 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"); } get { return GetValue("Sorting_SeasonFolderFormat", "Season %s"); }
set { SetValue("Sorting_SeasonFolderFormat", value); } set { SetValue("Sorting_SeasonFolderFormat", value); }
} }
public virtual int SeparatorStyle public virtual int SortingSeparatorStyle
{ {
get { return GetValueInt("Sorting_SeparatorStyle"); } get { return GetValueInt("Sorting_SeparatorStyle"); }
set { SetValue("Sorting_SeparatorStyle", value); } set { SetValue("Sorting_SeparatorStyle", value); }
} }
public virtual int NumberStyle public virtual int SortingNumberStyle
{ {
get { return GetValueInt("Sorting_NumberStyle", 2); } get { return GetValueInt("Sorting_NumberStyle", 2); }
set { SetValue("Sorting_NumberStyle", value); } set { SetValue("Sorting_NumberStyle", value); }
} }
public virtual int MultiEpisodeStyle public virtual int SortingMultiEpisodeStyle
{ {
get { return GetValueInt("Sorting_MultiEpisodeStyle"); } get { return GetValueInt("Sorting_MultiEpisodeStyle"); }
set { SetValue("Sorting_MultiEpisodeStyle", value); } set { SetValue("Sorting_MultiEpisodeStyle", value); }

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -21,9 +22,14 @@ namespace NzbDrone.Core.Providers.Core
return Directory.GetDirectories(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) public virtual long GetSize(string path)

@ -135,7 +135,7 @@ namespace NzbDrone.Core.Providers
{ {
ep.EpisodeFileId = fileId; ep.EpisodeFileId = fileId;
_episodeProvider.UpdateEpisode(ep); _episodeProvider.UpdateEpisode(ep);
Logger.Debug("Linking file {0} to {1}", filePath, ep); Logger.Debug("Linking [{0}] > [{1}]", filePath, ep);
} }
@ -156,7 +156,7 @@ namespace NzbDrone.Core.Providers
_diskProvider.CreateDirectory(newFile.DirectoryName); _diskProvider.CreateDirectory(newFile.DirectoryName);
//Do the rename //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); _diskProvider.MoveFile(episodeFile.Path, newFile.FullName);
//Update the filename in the DB //Update the filename in the DB
@ -176,7 +176,7 @@ namespace NzbDrone.Core.Providers
{ {
if (!_diskProvider.FileExists(episodeFile.Path)) 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 //Set the EpisodeFileId for each episode attached to this file to 0
foreach (var episode in _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId)) foreach (var episode in _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId))
@ -196,7 +196,7 @@ namespace NzbDrone.Core.Providers
{ {
Logger.Debug("Scanning '{0}' for episodes", 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(); var mediaFileList = filesOnDisk.Where(c => MediaExtentions.Contains(Path.GetExtension(c).ToLower())).ToList();

@ -30,32 +30,32 @@ namespace NzbDrone.Core.Providers
public virtual IList<IndexerBase> GetEnabledIndexers() 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(); 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); Logger.Debug("Adding Indexer definitions for {0}", definitions.Name);
_database.Insert(settings); _database.Insert(definitions);
} }
else else
{ {
Logger.Debug("Updating Indexer settings for {0}", settings.Name); Logger.Debug("Updating Indexer definitions for {0}", definitions.Name);
_database.Update(settings); _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) public virtual void InitializeIndexers(IList<IndexerBase> indexers)
@ -64,14 +64,14 @@ namespace NzbDrone.Core.Providers
_indexers = indexers; _indexers = indexers;
var currentIndexers = GetAllISettings(); var currentIndexers = All();
foreach (var feedProvider in indexers) foreach (var feedProvider in indexers)
{ {
IndexerBase indexerLocal = feedProvider; IndexerBase indexerLocal = feedProvider;
if (!currentIndexers.Exists(c => c.IndexProviderType == indexerLocal.GetType().ToString())) if (!currentIndexers.Exists(c => c.IndexProviderType == indexerLocal.GetType().ToString()))
{ {
var settings = new IndexerSetting var settings = new IndexerDefinition
{ {
Enable = false, Enable = false,
IndexProviderType = indexerLocal.GetType().ToString(), IndexProviderType = indexerLocal.GetType().ToString(),

@ -44,7 +44,7 @@ namespace NzbDrone.Core.Providers.Jobs
_seriesProvider.DeleteSeries(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) catch (Exception e)
{ {

@ -53,11 +53,11 @@ namespace NzbDrone.Core.Providers.Jobs
{ {
notification.CurrentMessage = string.Format("Scanning disk for '{0}'", series.Title); notification.CurrentMessage = string.Format("Scanning disk for '{0}'", series.Title);
_diskScanProvider.Scan(series); _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) 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);
} }
} }
} }

@ -73,6 +73,8 @@ namespace NzbDrone.Core.Providers.Jobs
var updatedSeries = _seriesProvider.GetSeries(currentSeries.SeriesId); var updatedSeries = _seriesProvider.GetSeries(currentSeries.SeriesId);
AutoIgnoreSeasons(updatedSeries.SeriesId); AutoIgnoreSeasons(updatedSeries.SeriesId);
notification.CurrentMessage = String.Format("{0} was successfully imported", updatedSeries.Title);
} }
catch (Exception e) catch (Exception e)
{ {

@ -40,26 +40,26 @@ namespace NzbDrone.Core.Providers.Jobs
/// Returns a list of all registered jobs /// Returns a list of all registered jobs
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual List<JobSetting> All() public virtual List<JobDefinition> All()
{ {
return _database.Fetch<JobSetting>().ToList(); return _database.Fetch<JobDefinition>().ToList();
} }
/// <summary> /// <summary>
/// Creates/Updates settings for a job /// Creates/Updates definitions for a job
/// </summary> /// </summary>
/// <param name="settings">Settings to be created/updated</param> /// <param name="definitions">Settings to be created/updated</param>
public virtual void SaveSettings(JobSetting settings) public virtual void SaveSettings(JobDefinition definitions)
{ {
if (settings.Id == 0) if (definitions.Id == 0)
{ {
Logger.Trace("Adding job settings for {0}", settings.Name); Logger.Trace("Adding job definitions for {0}", definitions.Name);
_database.Insert(settings); _database.Insert(definitions);
} }
else else
{ {
Logger.Trace("Updating job settings for {0}", settings.Name); Logger.Trace("Updating job definitions for {0}", definitions.Name);
_database.Update(settings); _database.Update(definitions);
} }
} }
@ -73,7 +73,7 @@ namespace NzbDrone.Core.Providers.Jobs
{ {
if (_isRunning) 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; return false;
} }
_isRunning = true; _isRunning = true;
@ -112,19 +112,19 @@ namespace NzbDrone.Core.Providers.Jobs
/// <remarks>Job is only added to the queue if same job with the same targetId doesn't already exist in the queue.</remarks> /// <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) 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) lock (Queue)
{ {
var queueTuple = new Tuple<Type, int>(jobType, targetId); var queueTuple = new Tuple<Type, int>(jobType, targetId);
if (Queue.Contains(queueTuple)) 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; return false;
} }
Queue.Add(queueTuple); 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 @@ namespace NzbDrone.Core.Providers.Jobs
{ {
if (_isRunning) if (_isRunning)
{ {
Logger.Trace("Queue is already running. Ignoring request."); Logger.Trace("Queue is already running. No need to start it up.");
return true; return true;
} }
_isRunning = true; _isRunning = true;
@ -150,7 +150,7 @@ namespace NzbDrone.Core.Providers.Jobs
} }
catch (Exception e) catch (Exception e)
{ {
Logger.ErrorException("Error has occured in queue processor thread", e); Logger.ErrorException("Error has occurred in queue processor thread", e);
} }
finally finally
{ {
@ -164,7 +164,7 @@ namespace NzbDrone.Core.Providers.Jobs
} }
else 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; return true;
} }
@ -230,7 +230,7 @@ namespace NzbDrone.Core.Providers.Jobs
var jobImplementation = _jobs.Where(t => t.GetType() == jobType).FirstOrDefault(); var jobImplementation = _jobs.Where(t => t.GetType() == jobType).FirstOrDefault();
if (jobImplementation == null) 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; return;
} }
@ -240,7 +240,7 @@ namespace NzbDrone.Core.Providers.Jobs
{ {
try 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(); var sw = Stopwatch.StartNew();
@ -252,12 +252,12 @@ namespace NzbDrone.Core.Providers.Jobs
settings.Success = true; settings.Success = true;
sw.Stop(); 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); sw.Elapsed.Seconds);
} }
catch (Exception e) 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.Status = ProgressNotificationStatus.Failed;
_notification.CurrentMessage = jobImplementation.Name + " Failed."; _notification.CurrentMessage = jobImplementation.Name + " Failed.";
@ -286,7 +286,7 @@ namespace NzbDrone.Core.Providers.Jobs
var timerProviderLocal = timer; var timerProviderLocal = timer;
if (!currentTimer.Exists(c => c.TypeName == timerProviderLocal.GetType().ToString())) if (!currentTimer.Exists(c => c.TypeName == timerProviderLocal.GetType().ToString()))
{ {
var settings = new JobSetting var settings = new JobDefinition
{ {
Enable = timerProviderLocal.DefaultInterval > 0, Enable = timerProviderLocal.DefaultInterval > 0,
TypeName = timer.GetType().ToString(), TypeName = timer.GetType().ToString(),

@ -31,7 +31,7 @@ namespace NzbDrone.Core.Providers.Jobs
public string Name public string Name
{ {
get { return "Post Download Media File Scan"; } get { return "Drop folder monitor"; }
} }
public int DefaultInterval public int DefaultInterval
@ -41,56 +41,60 @@ namespace NzbDrone.Core.Providers.Jobs
public virtual void Start(ProgressNotification notification, int targetId) public virtual void Start(ProgressNotification notification, int targetId)
{ {
Logger.Debug("Starting New Download Scan Job");
var dropFolder = _configProvider.SabDropDirectory; var dropFolder = _configProvider.SabDropDirectory;
if (String.IsNullOrWhiteSpace(dropFolder)) if (String.IsNullOrWhiteSpace(dropFolder))
{ {
Logger.Debug("Skipping drop folder scan. No drop folder is defined."); Logger.Debug("No drop folder is defined. Skipping.");
return; return;
} }
if (!_diskProvider.FolderExists(dropFolder)) 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; return;
} }
foreach (var subfolder in _diskProvider.GetDirectories(dropFolder)) foreach (var subfolder in _diskProvider.GetDirectories(dropFolder))
{ {
var subfolderInfo = new DirectoryInfo(subfolder); try
if (subfolderInfo.Name.StartsWith("_UNPACK_", StringComparison.CurrentCultureIgnoreCase))
{ {
Logger.Info("Folder [{0}] is still being unpacked. skipping.", subfolder); var subfolderInfo = new DirectoryInfo(subfolder);
continue;
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)
if (subfolderInfo.Name.StartsWith("_FAILED_", StringComparison.CurrentCultureIgnoreCase))
{ {
Logger.Info("Folder [{0}] is marked as failed. skipping.", subfolder); Logger.ErrorException("An error has occurred while importing " + subfolder, e);
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 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");
} }
} }
} }

@ -69,10 +69,12 @@ namespace NzbDrone.Core.Providers.Jobs
} }
catch (Exception e) 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";
} }
} }
} }

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Providers.Jobs
public string Name public string Name
{ {
get { return "Update Info"; } get { return "Update Episode Info"; }
} }
public int DefaultInterval public int DefaultInterval

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

@ -44,7 +44,7 @@ namespace NzbDrone.Core.Providers
_database.Delete<QualityProfile>(profileId); _database.Delete<QualityProfile>(profileId);
} }
public virtual List<QualityProfile> GetAllProfiles() public virtual List<QualityProfile> All()
{ {
var profiles = _database.Fetch<QualityProfile>().ToList(); var profiles = _database.Fetch<QualityProfile>().ToList();
@ -58,9 +58,10 @@ namespace NzbDrone.Core.Providers
public virtual void SetupDefaultProfiles() 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 }; var sd = new QualityProfile { Name = "SD", Allowed = new List<QualityTypes> { QualityTypes.SDTV, QualityTypes.DVD }, Cutoff = QualityTypes.SDTV };
@ -71,23 +72,9 @@ namespace NzbDrone.Core.Providers
Cutoff = QualityTypes.HDTV Cutoff = QualityTypes.HDTV
}; };
//Add or Update SD Add(sd);
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", sd.Name)); Add(hd);
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 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);
}
} }
} }
} }

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

@ -109,7 +109,7 @@ namespace NzbDrone.Core.Providers
repoSeries.Monitored = true; //New shows should be monitored repoSeries.Monitored = true; //New shows should be monitored
repoSeries.QualityProfileId = qualityProfileId; repoSeries.QualityProfileId = qualityProfileId;
if (qualityProfileId == 0) if (qualityProfileId == 0)
repoSeries.QualityProfileId = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", "1")); repoSeries.QualityProfileId = _configProvider.DefaultQualityProfile;
repoSeries.SeasonFolder = _configProvider.UseSeasonFolder; repoSeries.SeasonFolder = _configProvider.UseSeasonFolder;

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

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

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

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

@ -8,4 +8,11 @@
.yui3-aclist-item-active .yui3-aclist-item-active
{ {
background: #065EFE !important; 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

@ -50,7 +50,7 @@
* *
* http://docs.jquery.com/UI/Theming/API * 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 { font-family: ; font-size: ; }
.ui-widget .ui-widget { font-size: 1em; } .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 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 { 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: #d9d9d9; } .ui-widget-content a { color: #; }
.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-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; } .ui-widget-header a { color: #f6f6f6; }
/* Interaction states /* 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-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-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-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #ffffff; text-decoration: none; }
.ui-widget :active { outline: none; } .ui-widget :active { outline: none; }
/* Interaction Cues /* 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-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, .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; } .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 */ /* 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-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: 0px; -webkit-border-top-right-radius: 0px; -khtml-border-top-right-radius: 0px; border-top-right-radius: 0px; } .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: 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-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: 0px; -webkit-border-bottom-right-radius: 0px; -khtml-border-bottom-right-radius: 0px; border-bottom-right-radius: 0px; } .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 */ /* 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-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: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* .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 * jQuery UI Resizable 1.8.14
* *
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)

@ -49,17 +49,12 @@ namespace NzbDrone.Web.Controllers
public ActionResult AddNew() public ActionResult AddNew()
{ {
var rootDirs = _rootFolderProvider.GetAll().Select(r => ViewData["RootDirs"] = _rootFolderProvider.GetAll().Select(c => c.Path).OrderBy(e => e).ToList();
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, '|');
var defaultQuality = _configProvider.DefaultQualityProfile; var defaultQuality = _configProvider.DefaultQualityProfile;
var qualityProfiles = _qualityProvider.GetAllProfiles(); var qualityProfiles = _qualityProvider.All();
ViewData["qualityList"] = qualityProfiles;
ViewData["quality"] = new SelectList( ViewData["quality"] = new SelectList(
qualityProfiles, qualityProfiles,
@ -74,7 +69,7 @@ namespace NzbDrone.Web.Controllers
{ {
var rootDirs = _rootFolderProvider.GetAll(); var rootDirs = _rootFolderProvider.GetAll();
var profiles = _qualityProvider.GetAllProfiles(); var profiles = _qualityProvider.All();
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile); var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality); var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality);
ViewData["qualities"] = selectList; ViewData["qualities"] = selectList;
@ -111,7 +106,7 @@ namespace NzbDrone.Web.Controllers
ViewData["javaPath"] = path.Replace(Path.DirectorySeparatorChar, '|').Replace(Path.VolumeSeparatorChar, '^').Replace('\'', '`'); ViewData["javaPath"] = path.Replace(Path.DirectorySeparatorChar, '|').Replace(Path.VolumeSeparatorChar, '^').Replace('\'', '`');
var defaultQuality = _configProvider.DefaultQualityProfile; var defaultQuality = _configProvider.DefaultQualityProfile;
var qualityProfiles = _qualityProvider.GetAllProfiles(); var qualityProfiles = _qualityProvider.All();
ViewData["quality"] = new SelectList( ViewData["quality"] = new SelectList(
qualityProfiles, qualityProfiles,

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

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

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

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

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

@ -1,22 +1,11 @@
@using NzbDrone.Web.Models @using System.Collections
@{ @using NzbDrone.Web.Models
Layout = null; @{ Layout = null; }
}
<div> <div>
<fieldset> @Html.Label("Root Directory")
<legend>Root Directory</legend> @Html.DropDownList("rootDirList", new SelectList((IList)ViewData["RootDirs"]))
@{int d = 0; @Html.Label("Quality")
@Html.DropDownList("qualityList", new SelectList((IList)ViewData["QualityList"], "QualityProfileId", "Name"))
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>
</div> </div>
<br /> <br />
<div> <div>

@ -1,45 +1,40 @@
@model List<RootDir> @model List<RootDir>
@using NzbDrone.Core.Repository @using NzbDrone.Core.Repository
@section HeaderContent @section HeaderContent
{ {
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui-min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui-min.js"></script>
} }
@section TitleContent{ @section TitleContent{
Add Series Add Series
} }
@section MainContent{ @section MainContent{
@{ Html.Telerik().Window() <div id="addNewWindow" class="dialog">
.Name("Window") @{ Html.RenderAction("AddNew", "AddSeries"); }
.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> </div>
@{Html.RenderAction("RootDir");} @{Html.RenderAction("RootDir");}
<div id="existingSeries"> <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"); } @{ Html.RenderAction("AddExisting", "AddSeries"); }
</div> </div>
} }
@section Scripts @section Scripts
{ {
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () {
$("#addNewWindow").dialog({
title: 'add new series',
height: '500',
width: '700',
modal: true
});
});
function openAddNewSeries() { function openAddNewSeries() {
var window = $('#Window').data('tWindow'); var window = $('#Window').data('tWindow');
window.center().open(); window.center().open();

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

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

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

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

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

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

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

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