mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-10 23:29:53 +02:00
Merge branch 'kay.one' of github.com:NzbDrone/NzbDrone into markus
This commit is contained in:
commit
1498027192
3
.gitignore
vendored
3
.gitignore
vendored
@ -42,4 +42,5 @@ _rawPackage/
|
||||
NzbDrone.zip
|
||||
NzbDrone.sln.DotSettings.user*
|
||||
config.xml
|
||||
UpdateLogs/
|
||||
UpdateLogs/
|
||||
NzbDrone.Web/MediaCover
|
@ -85,9 +85,19 @@ public static string GetLogDbFileDbFile(this EnviromentProvider enviromentProvid
|
||||
return Path.Combine(enviromentProvider.GetAppDataPath(), LOG_DB_FILE);
|
||||
}
|
||||
|
||||
public static string GetMediaCoverPath(this EnviromentProvider enviromentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetWebRoot(), "MediaCover");
|
||||
}
|
||||
|
||||
public static string GetBannerPath(this EnviromentProvider enviromentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetWebRoot(), "Content", "Images", "Banners");
|
||||
return Path.Combine(enviromentProvider.GetMediaCoverPath(), "Banners");
|
||||
}
|
||||
|
||||
public static string GetFanArthPath(this EnviromentProvider enviromentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetMediaCoverPath(), "Fanarts");
|
||||
}
|
||||
|
||||
public static string GetCacheFolder(this EnviromentProvider enviromentProvider)
|
||||
|
@ -289,20 +289,41 @@ public void inti_should_removed_jobs_that_no_longer_exist()
|
||||
{
|
||||
IList<IJob> fakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(fakeJobs);
|
||||
|
||||
|
||||
WithRealDb();
|
||||
var deletedJob = Builder<JobDefinition>.CreateNew().Build();
|
||||
Db.Insert(deletedJob);
|
||||
var jobProvider = Mocker.Resolve<JobProvider>();
|
||||
|
||||
|
||||
//Act
|
||||
jobProvider.Initialize();
|
||||
|
||||
//Assert
|
||||
var registeredJobs = Db.Fetch<JobDefinition>();
|
||||
registeredJobs.Should().HaveCount(1);
|
||||
registeredJobs.Should().NotContain(c => c.Name == deletedJob.Name);
|
||||
registeredJobs.Should().NotContain(c => c.TypeName == deletedJob.TypeName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void inti_should_removed_jobs_that_no_longer_exist_even_with_same_name()
|
||||
{
|
||||
IList<IJob> fakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(fakeJobs);
|
||||
|
||||
WithRealDb();
|
||||
var deletedJob = Builder<JobDefinition>.CreateNew()
|
||||
.With(c => c.Name = fakeJob.Name).Build();
|
||||
|
||||
Db.Insert(deletedJob);
|
||||
var jobProvider = Mocker.Resolve<JobProvider>();
|
||||
|
||||
//Act
|
||||
jobProvider.Initialize();
|
||||
|
||||
//Assert
|
||||
var registeredJobs = Db.Fetch<JobDefinition>();
|
||||
registeredJobs.Should().HaveCount(1);
|
||||
registeredJobs.Should().NotContain(c => c.TypeName == deletedJob.TypeName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Data.Common;
|
||||
using System.Data.EntityClient;
|
||||
using System.Data.SqlServerCe;
|
||||
using MvcMiniProfiler;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using PetaPoco;
|
||||
@ -14,28 +12,22 @@ public class Connection
|
||||
{
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
|
||||
|
||||
public static void InitiFacotry()
|
||||
static Connection()
|
||||
{
|
||||
Database.Mapper = new CustomeMapper();
|
||||
|
||||
var dataSet = ConfigurationManager.GetSection("system.data") as System.Data.DataSet;
|
||||
dataSet.Tables[0].Rows.Add("Microsoft SQL Server Compact Data Provider 4.0"
|
||||
, "System.Data.SqlServerCe.4.0"
|
||||
, ".NET Framework Data Provider for Microsoft SQL Server Compact"
|
||||
, "System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
|
||||
var dataSet = ConfigurationManager.GetSection("system.data") as System.Data.DataSet;
|
||||
dataSet.Tables[0].Rows.Add("Microsoft SQL Server Compact Data Provider 4.0"
|
||||
, "System.Data.SqlServerCe.4.0"
|
||||
, ".NET Framework Data Provider for Microsoft SQL Server Compact"
|
||||
, "System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
|
||||
}
|
||||
|
||||
public Connection(EnviromentProvider enviromentProvider)
|
||||
{
|
||||
_enviromentProvider = enviromentProvider;
|
||||
}
|
||||
|
||||
static Connection()
|
||||
{
|
||||
Database.Mapper = new CustomeMapper();
|
||||
InitiFacotry();
|
||||
}
|
||||
|
||||
|
||||
public String MainConnectionString
|
||||
{
|
||||
get
|
||||
@ -54,7 +46,6 @@ public String LogConnectionString
|
||||
|
||||
public static string GetConnectionString(string path)
|
||||
{
|
||||
//return String.Format("Data Source={0};Version=3;Cache Size=30000;Pooling=true;Default Timeout=2", path);
|
||||
return String.Format("Data Source={0}", path);
|
||||
}
|
||||
|
||||
@ -73,8 +64,6 @@ public LogDbContext GetLogEfContext()
|
||||
return GetLogDbContext(LogConnectionString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static IDatabase GetPetaPocoDb(string connectionString, Boolean profiled = true)
|
||||
{
|
||||
MigrationsHelper.Run(connectionString, true);
|
||||
|
@ -76,7 +76,7 @@ public virtual void Initialize()
|
||||
|
||||
foreach (var currentJob in currentJobs)
|
||||
{
|
||||
if (!_jobs.Any(c => c.Name == currentJob.Name))
|
||||
if (!_jobs.Any(c => c.GetType().ToString() == currentJob.TypeName))
|
||||
{
|
||||
logger.Debug("Removing job from database '{0}'", currentJob.Name);
|
||||
_database.Delete(currentJob);
|
||||
|
@ -78,7 +78,7 @@
|
||||
|
||||
if(Model.HasBanner)
|
||||
{
|
||||
bannerUrl = "../../Content/Images/Banners/" + Model.SeriesId + ".jpg";
|
||||
bannerUrl = "../../MediaCover/Banners/" + Model.SeriesId + ".jpg";
|
||||
}
|
||||
}
|
||||
<img src="@bannerUrl" alt="Banner"/>
|
||||
|
Loading…
Reference in New Issue
Block a user