fixes #2904 - disabling transcoding for a user is not working

This commit is contained in:
Luke Pulverenti
2017-09-22 01:54:57 -04:00
parent e5f340d6b7
commit 2d29d903be
7 changed files with 130 additions and 56 deletions

View File

@@ -19,12 +19,14 @@ namespace Emby.Server.Implementations.Data
public class SqliteDisplayPreferencesRepository : BaseSqliteRepository, IDisplayPreferencesRepository
{
private readonly IMemoryStreamFactory _memoryStreamProvider;
protected IFileSystem FileSystem { get; private set; }
public SqliteDisplayPreferencesRepository(ILogger logger, IJsonSerializer jsonSerializer, IApplicationPaths appPaths, IMemoryStreamFactory memoryStreamProvider)
public SqliteDisplayPreferencesRepository(ILogger logger, IJsonSerializer jsonSerializer, IApplicationPaths appPaths, IMemoryStreamFactory memoryStreamProvider, IFileSystem fileSystem)
: base(logger)
{
_jsonSerializer = jsonSerializer;
_memoryStreamProvider = memoryStreamProvider;
FileSystem = fileSystem;
DbFilePath = Path.Combine(appPaths.DataPath, "displaypreferences.db");
}
@@ -45,11 +47,27 @@ namespace Emby.Server.Implementations.Data
/// </summary>
private readonly IJsonSerializer _jsonSerializer;
public void Initialize()
{
try
{
InitializeInternal();
}
catch (Exception ex)
{
Logger.ErrorException("Error loading database file. Will reset and retry.", ex);
FileSystem.DeleteFile(DbFilePath);
InitializeInternal();
}
}
/// <summary>
/// Opens the connection to the database
/// </summary>
/// <returns>Task.</returns>
public void Initialize()
private void InitializeInternal()
{
using (var connection = CreateConnection())
{