aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Activity/ActivityRepository.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-09-22 01:54:57 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-09-22 01:54:57 -0400
commit2d29d903be8af52a953bf847e1f6b168fbb236cc (patch)
tree9b67efb87bb011c69115790441f11ed97cb9cad2 /Emby.Server.Implementations/Activity/ActivityRepository.cs
parente5f340d6b7c914428e6b68ec1bbfeb9e27234b32 (diff)
fixes #2904 - disabling transcoding for a user is not working
Diffstat (limited to 'Emby.Server.Implementations/Activity/ActivityRepository.cs')
-rw-r--r--Emby.Server.Implementations/Activity/ActivityRepository.cs21
1 files changed, 20 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs
index 3dcc50ba3..1ae8e5e66 100644
--- a/Emby.Server.Implementations/Activity/ActivityRepository.cs
+++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs
@@ -10,21 +10,40 @@ using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using SQLitePCL.pretty;
using MediaBrowser.Model.Extensions;
+using MediaBrowser.Model.IO;
namespace Emby.Server.Implementations.Activity
{
public class ActivityRepository : BaseSqliteRepository, IActivityRepository
{
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
+ protected IFileSystem FileSystem { get; private set; }
- public ActivityRepository(ILogger logger, IServerApplicationPaths appPaths)
+ public ActivityRepository(ILogger logger, IServerApplicationPaths appPaths, IFileSystem fileSystem)
: base(logger)
{
DbFilePath = Path.Combine(appPaths.DataPath, "activitylog.db");
+ FileSystem = fileSystem;
}
public void Initialize()
{
+ try
+ {
+ InitializeInternal();
+ }
+ catch (Exception ex)
+ {
+ Logger.ErrorException("Error loading database file. Will reset and retry.", ex);
+
+ FileSystem.DeleteFile(DbFilePath);
+
+ InitializeInternal();
+ }
+ }
+
+ private void InitializeInternal()
+ {
using (var connection = CreateConnection())
{
RunDefaultInitialization(connection);