aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Social/SharingRepository.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/Social/SharingRepository.cs
parente5f340d6b7c914428e6b68ec1bbfeb9e27234b32 (diff)
fixes #2904 - disabling transcoding for a user is not working
Diffstat (limited to 'Emby.Server.Implementations/Social/SharingRepository.cs')
-rw-r--r--Emby.Server.Implementations/Social/SharingRepository.cs24
1 files changed, 22 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Social/SharingRepository.cs b/Emby.Server.Implementations/Social/SharingRepository.cs
index f306e76c4..f0b8cbd30 100644
--- a/Emby.Server.Implementations/Social/SharingRepository.cs
+++ b/Emby.Server.Implementations/Social/SharingRepository.cs
@@ -7,22 +7,42 @@ using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Social;
using SQLitePCL.pretty;
using MediaBrowser.Model.Extensions;
+using MediaBrowser.Model.IO;
namespace Emby.Server.Implementations.Social
{
public class SharingRepository : BaseSqliteRepository, ISharingRepository
{
- public SharingRepository(ILogger logger, IApplicationPaths appPaths)
+ protected IFileSystem FileSystem { get; private set; }
+
+ public SharingRepository(ILogger logger, IApplicationPaths appPaths, IFileSystem fileSystem)
: base(logger)
{
+ FileSystem = fileSystem;
DbFilePath = Path.Combine(appPaths.DataPath, "shares.db");
}
+ 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())
{