update elements

pull/702/head
Luke Pulverenti 9 years ago
parent 4c7f292ba8
commit dc5c15c60b

@ -101,6 +101,7 @@ namespace MediaBrowser.Dlna.PlayTo
} }
var uri = new Uri(location); var uri = new Uri(location);
_logger.Debug("Attempting to create PlayToController from location {0}", location);
var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger).ConfigureAwait(false); var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger).ConfigureAwait(false);
if (device.RendererCommands == null) if (device.RendererCommands == null)
@ -112,6 +113,7 @@ namespace MediaBrowser.Dlna.PlayTo
} }
} }
_logger.Debug("Logging session activity from location {0}", location);
var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, _appHost.ApplicationVersion.ToString(), device.Properties.UUID, device.Properties.Name, uri.OriginalString, null) var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, _appHost.ApplicationVersion.ToString(), device.Properties.UUID, device.Properties.Name, uri.OriginalString, null)
.ConfigureAwait(false); .ConfigureAwait(false);

@ -15,25 +15,19 @@ namespace MediaBrowser.Server.Implementations.Activity
{ {
public class ActivityRepository : BaseSqliteRepository, IActivityRepository public class ActivityRepository : BaseSqliteRepository, IActivityRepository
{ {
private IDbConnection _connection;
private readonly IServerApplicationPaths _appPaths;
private readonly CultureInfo _usCulture = new CultureInfo("en-US"); private readonly CultureInfo _usCulture = new CultureInfo("en-US");
private IDbCommand _saveActivityCommand; public ActivityRepository(ILogManager logManager, IServerApplicationPaths appPaths, IDbConnector connector)
: base(logManager, connector)
public ActivityRepository(ILogManager logManager, IServerApplicationPaths appPaths)
: base(logManager)
{ {
_appPaths = appPaths; DbFilePath = Path.Combine(appPaths.DataPath, "activitylog.db");
} }
public async Task Initialize(IDbConnector dbConnector) public async Task Initialize()
{ {
var dbFile = Path.Combine(_appPaths.DataPath, "activitylog.db"); using (var connection = await CreateConnection().ConfigureAwait(false))
{
_connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = {
string[] queries = {
"create table if not exists ActivityLogEntries (Id GUID PRIMARY KEY, Name TEXT, Overview TEXT, ShortOverview TEXT, Type TEXT, ItemId TEXT, UserId TEXT, DateCreated DATETIME, LogSeverity TEXT)", "create table if not exists ActivityLogEntries (Id GUID PRIMARY KEY, Name TEXT, Overview TEXT, ShortOverview TEXT, Type TEXT, ItemId TEXT, UserId TEXT, DateCreated DATETIME, LogSeverity TEXT)",
"create index if not exists idx_ActivityLogEntries on ActivityLogEntries(Id)", "create index if not exists idx_ActivityLogEntries on ActivityLogEntries(Id)",
@ -44,25 +38,8 @@ namespace MediaBrowser.Server.Implementations.Activity
"pragma shrink_memory" "pragma shrink_memory"
}; };
_connection.RunQueries(queries, Logger); connection.RunQueries(queries, Logger);
}
PrepareStatements();
}
private void PrepareStatements()
{
_saveActivityCommand = _connection.CreateCommand();
_saveActivityCommand.CommandText = "replace into ActivityLogEntries (Id, Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity) values (@Id, @Name, @Overview, @ShortOverview, @Type, @ItemId, @UserId, @DateCreated, @LogSeverity)";
_saveActivityCommand.Parameters.Add(_saveActivityCommand, "@Id");
_saveActivityCommand.Parameters.Add(_saveActivityCommand, "@Name");
_saveActivityCommand.Parameters.Add(_saveActivityCommand, "@Overview");
_saveActivityCommand.Parameters.Add(_saveActivityCommand, "@ShortOverview");
_saveActivityCommand.Parameters.Add(_saveActivityCommand, "@Type");
_saveActivityCommand.Parameters.Add(_saveActivityCommand, "@ItemId");
_saveActivityCommand.Parameters.Add(_saveActivityCommand, "@UserId");
_saveActivityCommand.Parameters.Add(_saveActivityCommand, "@DateCreated");
_saveActivityCommand.Parameters.Add(_saveActivityCommand, "@LogSeverity");
} }
private const string BaseActivitySelectText = "select Id, Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity from ActivityLogEntries"; private const string BaseActivitySelectText = "select Id, Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity from ActivityLogEntries";
@ -79,128 +56,145 @@ namespace MediaBrowser.Server.Implementations.Activity
throw new ArgumentNullException("entry"); throw new ArgumentNullException("entry");
} }
await WriteLock.WaitAsync().ConfigureAwait(false); using (var connection = await CreateConnection().ConfigureAwait(false))
{
using (var saveActivityCommand = connection.CreateCommand())
{
saveActivityCommand.CommandText = "replace into ActivityLogEntries (Id, Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity) values (@Id, @Name, @Overview, @ShortOverview, @Type, @ItemId, @UserId, @DateCreated, @LogSeverity)";
IDbTransaction transaction = null; saveActivityCommand.Parameters.Add(saveActivityCommand, "@Id");
saveActivityCommand.Parameters.Add(saveActivityCommand, "@Name");
saveActivityCommand.Parameters.Add(saveActivityCommand, "@Overview");
saveActivityCommand.Parameters.Add(saveActivityCommand, "@ShortOverview");
saveActivityCommand.Parameters.Add(saveActivityCommand, "@Type");
saveActivityCommand.Parameters.Add(saveActivityCommand, "@ItemId");
saveActivityCommand.Parameters.Add(saveActivityCommand, "@UserId");
saveActivityCommand.Parameters.Add(saveActivityCommand, "@DateCreated");
saveActivityCommand.Parameters.Add(saveActivityCommand, "@LogSeverity");
try IDbTransaction transaction = null;
{
transaction = _connection.BeginTransaction();
var index = 0; try
{
transaction = connection.BeginTransaction();
_saveActivityCommand.GetParameter(index++).Value = new Guid(entry.Id); var index = 0;
_saveActivityCommand.GetParameter(index++).Value = entry.Name;
_saveActivityCommand.GetParameter(index++).Value = entry.Overview;
_saveActivityCommand.GetParameter(index++).Value = entry.ShortOverview;
_saveActivityCommand.GetParameter(index++).Value = entry.Type;
_saveActivityCommand.GetParameter(index++).Value = entry.ItemId;
_saveActivityCommand.GetParameter(index++).Value = entry.UserId;
_saveActivityCommand.GetParameter(index++).Value = entry.Date;
_saveActivityCommand.GetParameter(index++).Value = entry.Severity.ToString();
_saveActivityCommand.Transaction = transaction; saveActivityCommand.GetParameter(index++).Value = new Guid(entry.Id);
saveActivityCommand.GetParameter(index++).Value = entry.Name;
saveActivityCommand.GetParameter(index++).Value = entry.Overview;
saveActivityCommand.GetParameter(index++).Value = entry.ShortOverview;
saveActivityCommand.GetParameter(index++).Value = entry.Type;
saveActivityCommand.GetParameter(index++).Value = entry.ItemId;
saveActivityCommand.GetParameter(index++).Value = entry.UserId;
saveActivityCommand.GetParameter(index++).Value = entry.Date;
saveActivityCommand.GetParameter(index++).Value = entry.Severity.ToString();
_saveActivityCommand.ExecuteNonQuery(); saveActivityCommand.Transaction = transaction;
transaction.Commit(); saveActivityCommand.ExecuteNonQuery();
}
catch (OperationCanceledException)
{
if (transaction != null)
{
transaction.Rollback();
}
throw; transaction.Commit();
} }
catch (Exception e) catch (OperationCanceledException)
{ {
Logger.ErrorException("Failed to save record:", e); if (transaction != null)
{
transaction.Rollback();
}
if (transaction != null) throw;
{ }
transaction.Rollback(); catch (Exception e)
} {
Logger.ErrorException("Failed to save record:", e);
throw; if (transaction != null)
} {
finally transaction.Rollback();
{ }
if (transaction != null)
{
transaction.Dispose();
}
WriteLock.Release(); throw;
}
finally
{
if (transaction != null)
{
transaction.Dispose();
}
}
}
} }
} }
public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit) public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit)
{ {
using (var cmd = _connection.CreateCommand()) using (var connection = CreateConnection(true).Result)
{ {
cmd.CommandText = BaseActivitySelectText; using (var cmd = connection.CreateCommand())
var whereClauses = new List<string>();
if (minDate.HasValue)
{ {
whereClauses.Add("DateCreated>=@DateCreated"); cmd.CommandText = BaseActivitySelectText;
cmd.Parameters.Add(cmd, "@DateCreated", DbType.Date).Value = minDate.Value;
}
var whereTextWithoutPaging = whereClauses.Count == 0 ? var whereClauses = new List<string>();
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray());
if (startIndex.HasValue && startIndex.Value > 0) if (minDate.HasValue)
{ {
var pagingWhereText = whereClauses.Count == 0 ? whereClauses.Add("DateCreated>=@DateCreated");
cmd.Parameters.Add(cmd, "@DateCreated", DbType.Date).Value = minDate.Value;
}
var whereTextWithoutPaging = whereClauses.Count == 0 ?
string.Empty : string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray()); " where " + string.Join(" AND ", whereClauses.ToArray());
whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM ActivityLogEntries {0} ORDER BY DateCreated DESC LIMIT {1})", if (startIndex.HasValue && startIndex.Value > 0)
pagingWhereText, {
startIndex.Value.ToString(_usCulture))); var pagingWhereText = whereClauses.Count == 0 ?
} string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray());
var whereText = whereClauses.Count == 0 ? whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM ActivityLogEntries {0} ORDER BY DateCreated DESC LIMIT {1})",
string.Empty : pagingWhereText,
" where " + string.Join(" AND ", whereClauses.ToArray()); startIndex.Value.ToString(_usCulture)));
}
cmd.CommandText += whereText; var whereText = whereClauses.Count == 0 ?
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray());
cmd.CommandText += " ORDER BY DateCreated DESC"; cmd.CommandText += whereText;
if (limit.HasValue) cmd.CommandText += " ORDER BY DateCreated DESC";
{
cmd.CommandText += " LIMIT " + limit.Value.ToString(_usCulture);
}
cmd.CommandText += "; select count (Id) from ActivityLogEntries" + whereTextWithoutPaging; if (limit.HasValue)
{
cmd.CommandText += " LIMIT " + limit.Value.ToString(_usCulture);
}
var list = new List<ActivityLogEntry>(); cmd.CommandText += "; select count (Id) from ActivityLogEntries" + whereTextWithoutPaging;
var count = 0;
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) var list = new List<ActivityLogEntry>();
{ var count = 0;
while (reader.Read())
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
{ {
list.Add(GetEntry(reader)); while (reader.Read())
{
list.Add(GetEntry(reader));
}
if (reader.NextResult() && reader.Read())
{
count = reader.GetInt32(0);
}
} }
if (reader.NextResult() && reader.Read()) return new QueryResult<ActivityLogEntry>()
{ {
count = reader.GetInt32(0); Items = list.ToArray(),
} TotalRecordCount = count
};
} }
return new QueryResult<ActivityLogEntry>()
{
Items = list.ToArray(),
TotalRecordCount = count
};
} }
} }
@ -260,19 +254,5 @@ namespace MediaBrowser.Server.Implementations.Activity
return info; return info;
} }
protected override void CloseConnection()
{
if (_connection != null)
{
if (_connection.IsOpen())
{
_connection.Close();
}
_connection.Dispose();
_connection = null;
}
}
} }
} }

@ -93,7 +93,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
NatUtility.UnhandledException += NatUtility_UnhandledException; NatUtility.UnhandledException += NatUtility_UnhandledException;
NatUtility.StartDiscovery(); NatUtility.StartDiscovery();
_timer = new PeriodicTimer(s => _createdRules = new List<string>(), null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); _timer = new PeriodicTimer(ClearCreatedRules, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
_ssdp.MessageReceived += _ssdp_MessageReceived; _ssdp.MessageReceived += _ssdp_MessageReceived;
@ -102,12 +102,43 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_isStarted = true; _isStarted = true;
} }
private void ClearCreatedRules(object state)
{
_createdRules = new List<string>();
_usnsHandled = new List<string>();
}
void _ssdp_MessageReceived(object sender, SsdpMessageEventArgs e) void _ssdp_MessageReceived(object sender, SsdpMessageEventArgs e)
{ {
var endpoint = e.EndPoint as IPEndPoint; var endpoint = e.EndPoint as IPEndPoint;
if (endpoint != null && e.LocalEndPoint != null) if (endpoint == null || e.LocalEndPoint == null)
{ {
return;
}
string usn;
if (!e.Headers.TryGetValue("USN", out usn)) usn = string.Empty;
string nt;
if (!e.Headers.TryGetValue("NT", out nt)) nt = string.Empty;
// Filter device type
if (usn.IndexOf("WANIPConnection:", StringComparison.OrdinalIgnoreCase) == -1 &&
nt.IndexOf("WANIPConnection:", StringComparison.OrdinalIgnoreCase) == -1 &&
usn.IndexOf("WANPPPConnection:", StringComparison.OrdinalIgnoreCase) == -1 &&
nt.IndexOf("WANPPPConnection:", StringComparison.OrdinalIgnoreCase) == -1)
{
return;
}
var identifier = string.IsNullOrWhiteSpace(usn) ? nt : usn;
if (!_usnsHandled.Contains(identifier))
{
_usnsHandled.Add(identifier);
_logger.Debug("Calling Nat.Handle on " + identifier);
NatUtility.Handle(e.LocalEndPoint.Address, e.Message, endpoint, NatProtocol.Upnp); NatUtility.Handle(e.LocalEndPoint.Address, e.Message, endpoint, NatProtocol.Upnp);
} }
} }
@ -151,6 +182,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
} }
private List<string> _createdRules = new List<string>(); private List<string> _createdRules = new List<string>();
private List<string> _usnsHandled = new List<string>();
private void CreateRules(INatDevice device) private void CreateRules(INatDevice device)
{ {
// On some systems the device discovered event seems to fire repeatedly // On some systems the device discovered event seems to fire repeatedly

@ -93,8 +93,15 @@ namespace MediaBrowser.Server.Implementations.IO
private async void OnTimerCallback(object state) private async void OnTimerCallback(object state)
{ {
List<string> paths;
lock (_timerLock)
{
paths = _affectedPaths.ToList();
}
// Extend the timer as long as any of the paths are still being written to. // Extend the timer as long as any of the paths are still being written to.
if (_affectedPaths.Any(IsFileLocked)) if (paths.Any(IsFileLocked))
{ {
Logger.Info("Timer extended."); Logger.Info("Timer extended.");
RestartTimer(); RestartTimer();
@ -108,7 +115,7 @@ namespace MediaBrowser.Server.Implementations.IO
try try
{ {
await ProcessPathChanges(_affectedPaths.ToList()).ConfigureAwait(false); await ProcessPathChanges(paths.ToList()).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

@ -16,9 +16,9 @@ namespace MediaBrowser.Server.Mono.Native
_logger = logger; _logger = logger;
} }
public Task<IDbConnection> Connect(string dbPath, int? cacheSize = null) public Task<IDbConnection> Connect(string dbPath, bool isReadOnly, bool enablePooling = false, int? cacheSize = null)
{ {
return SqliteExtensions.ConnectToDb(dbPath, cacheSize, _logger); return SqliteExtensions.ConnectToDb(dbPath, isReadOnly, enablePooling, cacheSize, _logger);
} }
} }
} }

@ -424,11 +424,11 @@ namespace MediaBrowser.Server.Startup.Common
UserRepository = await GetUserRepository().ConfigureAwait(false); UserRepository = await GetUserRepository().ConfigureAwait(false);
RegisterSingleInstance(UserRepository); RegisterSingleInstance(UserRepository);
var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LogManager, JsonSerializer, ApplicationPaths); var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LogManager, JsonSerializer, ApplicationPaths, NativeApp.GetDbConnector());
DisplayPreferencesRepository = displayPreferencesRepo; DisplayPreferencesRepository = displayPreferencesRepo;
RegisterSingleInstance(DisplayPreferencesRepository); RegisterSingleInstance(DisplayPreferencesRepository);
var itemRepo = new SqliteItemRepository(ServerConfigurationManager, JsonSerializer, LogManager); var itemRepo = new SqliteItemRepository(ServerConfigurationManager, JsonSerializer, LogManager, NativeApp.GetDbConnector());
ItemRepository = itemRepo; ItemRepository = itemRepo;
RegisterSingleInstance(ItemRepository); RegisterSingleInstance(ItemRepository);
@ -553,8 +553,8 @@ namespace MediaBrowser.Server.Startup.Common
RegisterSingleInstance(NativeApp.GetPowerManagement()); RegisterSingleInstance(NativeApp.GetPowerManagement());
var sharingRepo = new SharingRepository(LogManager, ApplicationPaths); var sharingRepo = new SharingRepository(LogManager, ApplicationPaths, NativeApp.GetDbConnector());
await sharingRepo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await sharingRepo.Initialize().ConfigureAwait(false);
RegisterSingleInstance<ISharingManager>(new SharingManager(sharingRepo, ServerConfigurationManager, LibraryManager, this)); RegisterSingleInstance<ISharingManager>(new SharingManager(sharingRepo, ServerConfigurationManager, LibraryManager, this));
RegisterSingleInstance<ISsdpHandler>(new SsdpHandler(LogManager.GetLogger("SsdpHandler"), ServerConfigurationManager, this)); RegisterSingleInstance<ISsdpHandler>(new SsdpHandler(LogManager.GetLogger("SsdpHandler"), ServerConfigurationManager, this));
@ -571,7 +571,7 @@ namespace MediaBrowser.Server.Startup.Common
SubtitleEncoder = new SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager); SubtitleEncoder = new SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager);
RegisterSingleInstance(SubtitleEncoder); RegisterSingleInstance(SubtitleEncoder);
await displayPreferencesRepo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await displayPreferencesRepo.Initialize().ConfigureAwait(false);
await ConfigureUserDataRepositories().ConfigureAwait(false); await ConfigureUserDataRepositories().ConfigureAwait(false);
await itemRepo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await itemRepo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false);
((LibraryManager)LibraryManager).ItemRepository = ItemRepository; ((LibraryManager)LibraryManager).ItemRepository = ItemRepository;
@ -670,9 +670,9 @@ namespace MediaBrowser.Server.Startup.Common
{ {
try try
{ {
var repo = new SqliteUserRepository(LogManager, ApplicationPaths, JsonSerializer); var repo = new SqliteUserRepository(LogManager, ApplicationPaths, JsonSerializer, NativeApp.GetDbConnector());
await repo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await repo.Initialize().ConfigureAwait(false);
return repo; return repo;
} }
@ -689,7 +689,7 @@ namespace MediaBrowser.Server.Startup.Common
/// <returns>Task{IUserRepository}.</returns> /// <returns>Task{IUserRepository}.</returns>
private async Task<IFileOrganizationRepository> GetFileOrganizationRepository() private async Task<IFileOrganizationRepository> GetFileOrganizationRepository()
{ {
var repo = new SqliteFileOrganizationRepository(LogManager, ServerConfigurationManager.ApplicationPaths); var repo = new SqliteFileOrganizationRepository(LogManager, ServerConfigurationManager.ApplicationPaths, NativeApp.GetDbConnector());
await repo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await repo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false);
@ -698,27 +698,27 @@ namespace MediaBrowser.Server.Startup.Common
private async Task<IAuthenticationRepository> GetAuthenticationRepository() private async Task<IAuthenticationRepository> GetAuthenticationRepository()
{ {
var repo = new AuthenticationRepository(LogManager, ServerConfigurationManager.ApplicationPaths); var repo = new AuthenticationRepository(LogManager, ServerConfigurationManager.ApplicationPaths, NativeApp.GetDbConnector());
await repo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await repo.Initialize().ConfigureAwait(false);
return repo; return repo;
} }
private async Task<IActivityRepository> GetActivityLogRepository() private async Task<IActivityRepository> GetActivityLogRepository()
{ {
var repo = new ActivityRepository(LogManager, ServerConfigurationManager.ApplicationPaths); var repo = new ActivityRepository(LogManager, ServerConfigurationManager.ApplicationPaths, NativeApp.GetDbConnector());
await repo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await repo.Initialize().ConfigureAwait(false);
return repo; return repo;
} }
private async Task<ISyncRepository> GetSyncRepository() private async Task<ISyncRepository> GetSyncRepository()
{ {
var repo = new SyncRepository(LogManager, JsonSerializer, ServerConfigurationManager.ApplicationPaths); var repo = new SyncRepository(LogManager, JsonSerializer, ServerConfigurationManager.ApplicationPaths, NativeApp.GetDbConnector());
await repo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await repo.Initialize().ConfigureAwait(false);
return repo; return repo;
} }
@ -729,9 +729,9 @@ namespace MediaBrowser.Server.Startup.Common
/// <returns>Task.</returns> /// <returns>Task.</returns>
private async Task ConfigureNotificationsRepository() private async Task ConfigureNotificationsRepository()
{ {
var repo = new SqliteNotificationsRepository(LogManager, ApplicationPaths); var repo = new SqliteNotificationsRepository(LogManager, ApplicationPaths, NativeApp.GetDbConnector());
await repo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await repo.Initialize().ConfigureAwait(false);
NotificationsRepository = repo; NotificationsRepository = repo;
@ -744,7 +744,7 @@ namespace MediaBrowser.Server.Startup.Common
/// <returns>Task.</returns> /// <returns>Task.</returns>
private async Task ConfigureUserDataRepositories() private async Task ConfigureUserDataRepositories()
{ {
var repo = new SqliteUserDataRepository(LogManager, ApplicationPaths); var repo = new SqliteUserDataRepository(LogManager, ApplicationPaths, NativeApp.GetDbConnector());
await repo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false); await repo.Initialize(NativeApp.GetDbConnector()).ConfigureAwait(false);

@ -16,18 +16,9 @@ namespace MediaBrowser.ServerApplication.Native
_logger = logger; _logger = logger;
} }
public async Task<IDbConnection> Connect(string dbPath, int? cacheSize = null) public Task<IDbConnection> Connect(string dbPath, bool isReadOnly, bool enablePooling = false, int? cacheSize = null)
{ {
try return SqliteExtensions.ConnectToDb(dbPath, isReadOnly, enablePooling, cacheSize, _logger);
{
return await SqliteExtensions.ConnectToDb(dbPath, cacheSize, _logger).ConfigureAwait(false);
}
catch (Exception ex)
{
_logger.ErrorException("Error opening database {0}", ex, dbPath);
throw;
}
} }
} }
} }

@ -342,7 +342,9 @@ namespace MediaBrowser.WebDashboard.Api
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase)) if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{ {
DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents"), "fonts"); DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "montserrat");
DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "opensans");
DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "roboto");
} }
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "jquery", "src"), true); _fileSystem.DeleteDirectory(Path.Combine(bowerPath, "jquery", "src"), true);

Loading…
Cancel
Save