mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 09:49:00 +00:00
Merge branch 'master' of git://github.com/kayone/NzbDrone
This commit is contained in:
commit
5d7ecea046
5 changed files with 35 additions and 4 deletions
|
@ -79,7 +79,8 @@ public void GetBestQualityInHistory_single_result()
|
|||
|
||||
|
||||
var repo = MockLib.GetEmptyRepository();
|
||||
var history = Builder<History>.CreateNew().Build();
|
||||
var history = Builder<History>.CreateNew()
|
||||
.With(h => h.Quality = QualityTypes.Bluray720p).Build();
|
||||
repo.Add(history);
|
||||
mocker.SetConstant(repo);
|
||||
|
||||
|
@ -88,6 +89,7 @@ public void GetBestQualityInHistory_single_result()
|
|||
|
||||
//Assert
|
||||
Assert.IsNotNull(result);
|
||||
result.QualityType.Should().Be(QualityTypes.Bluray720p);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -20,7 +20,7 @@ static Connection()
|
|||
|
||||
public static string GetConnectionString(string path)
|
||||
{
|
||||
return String.Format("Data Source={0};Version=3;", path);
|
||||
return String.Format("Data Source={0};Version=3;Cache Size=30000;", path);
|
||||
}
|
||||
|
||||
public static String MainConnectionString
|
||||
|
|
28
NzbDrone.Core/Datastore/SqliteProvider.cs
Normal file
28
NzbDrone.Core/Datastore/SqliteProvider.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
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"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -164,6 +164,7 @@
|
|||
<Compile Include="Datastore\MigrationLogger.cs" />
|
||||
<Compile Include="Datastore\Migrations.cs" />
|
||||
<Compile Include="Datastore\RepositoryProvider.cs" />
|
||||
<Compile Include="Datastore\SqliteProvider.cs" />
|
||||
<Compile Include="Helpers\EpisodeRenameHelper.cs" />
|
||||
<Compile Include="Helpers\EpisodeSortingHelper.cs" />
|
||||
<Compile Include="Helpers\SceneNameHelper.cs" />
|
||||
|
|
|
@ -49,8 +49,8 @@ public virtual void Add(History item)
|
|||
|
||||
public virtual Quality GetBestQualityInHistory(long episodeId)
|
||||
{
|
||||
var history = AllItems().Where(c => c.EpisodeId == episodeId).Select(d => new Quality() { QualityType = d.Quality, Proper = d.IsProper }).ToList();
|
||||
history.Sort();
|
||||
var history = AllItems().Where(c => c.EpisodeId == episodeId).ToList().Select(d => new Quality(d.Quality, d.IsProper)).OrderBy(c => c);
|
||||
|
||||
return history.FirstOrDefault();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue