mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
commit
4a1d01be03
@ -1,4 +1,5 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
using System;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -44,10 +45,10 @@ namespace MediaBrowser.Controller.Dto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fills the synchronize information.
|
/// Fills the synchronize information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dtos">The dtos.</param>
|
/// <param name="tuples">The tuples.</param>
|
||||||
/// <param name="options">The options.</param>
|
/// <param name="options">The options.</param>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
void FillSyncInfo(IEnumerable<IHasSyncInfo> dtos, DtoOptions options, User user);
|
void FillSyncInfo(IEnumerable<Tuple<BaseItem, BaseItemDto>> tuples, DtoOptions options, User user);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the base item dto.
|
/// Gets the base item dto.
|
||||||
|
@ -53,6 +53,11 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CanDownload()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public int? Width { get; set; }
|
public int? Width { get; set; }
|
||||||
public int? Height { get; set; }
|
public int? Height { get; set; }
|
||||||
public string CameraMake { get; set; }
|
public string CameraMake { get; set; }
|
||||||
|
@ -329,7 +329,6 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <param name="parentId">The parent identifier.</param>
|
/// <param name="parentId">The parent identifier.</param>
|
||||||
/// <param name="viewType">Type of the view.</param>
|
/// <param name="viewType">Type of the view.</param>
|
||||||
/// <param name="sortName">Name of the sort.</param>
|
/// <param name="sortName">Name of the sort.</param>
|
||||||
/// <param name="uniqueId">The unique identifier.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task<UserView>.</returns>
|
/// <returns>Task<UserView>.</returns>
|
||||||
Task<UserView> GetNamedView(User user,
|
Task<UserView> GetNamedView(User user,
|
||||||
|
@ -99,7 +99,7 @@ namespace MediaBrowser.Providers.People
|
|||||||
|
|
||||||
var requestCount = _requestCount;
|
var requestCount = _requestCount;
|
||||||
|
|
||||||
if (requestCount >= 5)
|
if (requestCount >= 10)
|
||||||
{
|
{
|
||||||
//_logger.Debug("Throttling Tmdb people");
|
//_logger.Debug("Throttling Tmdb people");
|
||||||
|
|
||||||
|
@ -14,19 +14,17 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Activity
|
namespace MediaBrowser.Server.Implementations.Activity
|
||||||
{
|
{
|
||||||
public class ActivityRepository : IActivityRepository, IDisposable
|
public class ActivityRepository : BaseSqliteRepository, IActivityRepository
|
||||||
{
|
{
|
||||||
private IDbConnection _connection;
|
private IDbConnection _connection;
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1);
|
|
||||||
private readonly IServerApplicationPaths _appPaths;
|
private readonly IServerApplicationPaths _appPaths;
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
private IDbCommand _saveActivityCommand;
|
private IDbCommand _saveActivityCommand;
|
||||||
|
|
||||||
public ActivityRepository(ILogger logger, IServerApplicationPaths appPaths)
|
public ActivityRepository(ILogManager logManager, IServerApplicationPaths appPaths)
|
||||||
|
: base(logManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +32,7 @@ namespace MediaBrowser.Server.Implementations.Activity
|
|||||||
{
|
{
|
||||||
var dbFile = Path.Combine(_appPaths.DataPath, "activitylog.db");
|
var dbFile = Path.Combine(_appPaths.DataPath, "activitylog.db");
|
||||||
|
|
||||||
_connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false);
|
_connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false);
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
@ -47,7 +45,7 @@ namespace MediaBrowser.Server.Implementations.Activity
|
|||||||
"pragma shrink_memory"
|
"pragma shrink_memory"
|
||||||
};
|
};
|
||||||
|
|
||||||
_connection.RunQueries(queries, _logger);
|
_connection.RunQueries(queries, Logger);
|
||||||
|
|
||||||
PrepareStatements();
|
PrepareStatements();
|
||||||
}
|
}
|
||||||
@ -82,7 +80,7 @@ namespace MediaBrowser.Server.Implementations.Activity
|
|||||||
throw new ArgumentNullException("entry");
|
throw new ArgumentNullException("entry");
|
||||||
}
|
}
|
||||||
|
|
||||||
await _writeLock.WaitAsync().ConfigureAwait(false);
|
await WriteLock.WaitAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
IDbTransaction transaction = null;
|
IDbTransaction transaction = null;
|
||||||
|
|
||||||
@ -119,7 +117,7 @@ namespace MediaBrowser.Server.Implementations.Activity
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Failed to save record:", e);
|
Logger.ErrorException("Failed to save record:", e);
|
||||||
|
|
||||||
if (transaction != null)
|
if (transaction != null)
|
||||||
{
|
{
|
||||||
@ -135,7 +133,7 @@ namespace MediaBrowser.Server.Implementations.Activity
|
|||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeLock.Release();
|
WriteLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,45 +262,17 @@ namespace MediaBrowser.Server.Implementations.Activity
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override void CloseConnection()
|
||||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
{
|
||||||
Dispose(true);
|
if (_connection != null)
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly object _disposeLock = new object();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases unmanaged and - optionally - managed resources.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
|
||||||
protected virtual void Dispose(bool dispose)
|
|
||||||
{
|
|
||||||
if (dispose)
|
|
||||||
{
|
{
|
||||||
try
|
if (_connection.IsOpen())
|
||||||
{
|
{
|
||||||
lock (_disposeLock)
|
_connection.Close();
|
||||||
{
|
}
|
||||||
if (_connection != null)
|
|
||||||
{
|
|
||||||
if (_connection.IsOpen())
|
|
||||||
{
|
|
||||||
_connection.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
_connection.Dispose();
|
_connection.Dispose();
|
||||||
_connection = null;
|
_connection = null;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.ErrorException("Error disposing database", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,17 +212,17 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
}).Items;
|
}).Items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FillSyncInfo(IEnumerable<IHasSyncInfo> dtos, DtoOptions options, User user)
|
public void FillSyncInfo(IEnumerable<Tuple<BaseItem, BaseItemDto>> tuples, DtoOptions options, User user)
|
||||||
{
|
{
|
||||||
if (options.Fields.Contains(ItemFields.SyncInfo))
|
if (options.Fields.Contains(ItemFields.SyncInfo))
|
||||||
{
|
{
|
||||||
var syncProgress = GetSyncedItemProgress(options);
|
var syncProgress = GetSyncedItemProgress(options);
|
||||||
|
|
||||||
foreach (var dto in dtos)
|
foreach (var tuple in tuples)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(dto.Id);
|
var item = tuple.Item1;
|
||||||
|
|
||||||
FillSyncInfo(dto, item, syncProgress, options, user);
|
FillSyncInfo(tuple.Item2, item, syncProgress, options, user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1592,18 +1592,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
|
|
||||||
var internalResult = await GetInternalRecordings(query, cancellationToken).ConfigureAwait(false);
|
var internalResult = await GetInternalRecordings(query, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var returnArray = internalResult.Items
|
var tuples = internalResult.Items
|
||||||
.Select(i => _dtoService.GetBaseItemDto(i, options, user))
|
.Select(i => new Tuple<BaseItem, BaseItemDto>(i, _dtoService.GetBaseItemDto(i, options, user)))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
_dtoService.FillSyncInfo(returnArray, new DtoOptions(), user);
|
_dtoService.FillSyncInfo(tuples, new DtoOptions(), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new QueryResult<BaseItemDto>
|
return new QueryResult<BaseItemDto>
|
||||||
{
|
{
|
||||||
Items = returnArray,
|
Items = tuples.Select(i => i.Item2).ToArray(),
|
||||||
TotalRecordCount = internalResult.TotalRecordCount
|
TotalRecordCount = internalResult.TotalRecordCount
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1684,6 +1684,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_lastRecordingRefreshTime = DateTime.MinValue;
|
||||||
|
|
||||||
// This is the responsibility of the live tv service
|
// This is the responsibility of the live tv service
|
||||||
await _libraryManager.DeleteItem((BaseItem)recording, new DeleteOptions
|
await _libraryManager.DeleteItem((BaseItem)recording, new DeleteOptions
|
||||||
{
|
{
|
||||||
|
@ -51,9 +51,9 @@
|
|||||||
<Reference Include="Interfaces.IO">
|
<Reference Include="Interfaces.IO">
|
||||||
<HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath>
|
<HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MediaBrowser.Naming, Version=1.0.5877.22335, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MediaBrowser.Naming, Version=1.0.5884.23751, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.46\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.47\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MoreLinq">
|
<Reference Include="MoreLinq">
|
||||||
<HintPath>..\packages\morelinq.1.4.0\lib\net35\MoreLinq.dll</HintPath>
|
<HintPath>..\packages\morelinq.1.4.0\lib\net35\MoreLinq.dll</HintPath>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Data;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Persistence
|
namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
{
|
{
|
||||||
@ -14,12 +16,48 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
Logger = logManager.GetLogger(GetType().Name);
|
Logger = logManager.GetLogger(GetType().Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _disposed;
|
||||||
|
protected void CheckDisposed()
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
throw new ObjectDisposedException(GetType().Name + " has been disposed and cannot be accessed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
_disposed = true;
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async Task Vacuum(IDbConnection connection)
|
||||||
|
{
|
||||||
|
CheckDisposed();
|
||||||
|
|
||||||
|
await WriteLock.WaitAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var cmd = connection.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "vacuum";
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.ErrorException("Failed to vacuum:", e);
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
WriteLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly object _disposeLock = new object();
|
private readonly object _disposeLock = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -26,12 +26,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class SQLiteItemRepository
|
/// Class SQLiteItemRepository
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SqliteItemRepository : IItemRepository
|
public class SqliteItemRepository : BaseSqliteRepository, IItemRepository
|
||||||
{
|
{
|
||||||
private IDbConnection _connection;
|
private IDbConnection _connection;
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
private readonly TypeMapper _typeMapper = new TypeMapper();
|
private readonly TypeMapper _typeMapper = new TypeMapper();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -96,6 +94,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
/// jsonSerializer
|
/// jsonSerializer
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public SqliteItemRepository(IApplicationPaths appPaths, IJsonSerializer jsonSerializer, ILogManager logManager)
|
public SqliteItemRepository(IApplicationPaths appPaths, IJsonSerializer jsonSerializer, ILogManager logManager)
|
||||||
|
: base(logManager)
|
||||||
{
|
{
|
||||||
if (appPaths == null)
|
if (appPaths == null)
|
||||||
{
|
{
|
||||||
@ -110,8 +109,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
|
|
||||||
_criticReviewsPath = Path.Combine(_appPaths.DataPath, "critic-reviews");
|
_criticReviewsPath = Path.Combine(_appPaths.DataPath, "critic-reviews");
|
||||||
|
|
||||||
_logger = logManager.GetLogger(GetType().Name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string ChaptersTableName = "Chapters2";
|
private const string ChaptersTableName = "Chapters2";
|
||||||
@ -124,7 +121,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
{
|
{
|
||||||
var dbFile = Path.Combine(_appPaths.DataPath, "library.db");
|
var dbFile = Path.Combine(_appPaths.DataPath, "library.db");
|
||||||
|
|
||||||
_connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false);
|
_connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false);
|
||||||
|
|
||||||
var createMediaStreamsTableCommand
|
var createMediaStreamsTableCommand
|
||||||
= "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, IsCabac BIT NULL, CodecTag TEXT NULL, Comment TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
|
= "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, IsCabac BIT NULL, CodecTag TEXT NULL, Comment TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
|
||||||
@ -158,76 +155,76 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
"pragma shrink_memory"
|
"pragma shrink_memory"
|
||||||
};
|
};
|
||||||
|
|
||||||
_connection.RunQueries(queries, _logger);
|
_connection.RunQueries(queries, Logger);
|
||||||
|
|
||||||
_connection.AddColumn(_logger, "AncestorIds", "AncestorIdText", "Text");
|
_connection.AddColumn(Logger, "AncestorIds", "AncestorIdText", "Text");
|
||||||
|
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "Path", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "Path", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "StartDate", "DATETIME");
|
_connection.AddColumn(Logger, "TypedBaseItems", "StartDate", "DATETIME");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "EndDate", "DATETIME");
|
_connection.AddColumn(Logger, "TypedBaseItems", "EndDate", "DATETIME");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "ChannelId", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "ChannelId", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsMovie", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsMovie", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsSports", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsSports", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsKids", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsKids", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "CommunityRating", "Float");
|
_connection.AddColumn(Logger, "TypedBaseItems", "CommunityRating", "Float");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "CustomRating", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "CustomRating", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IndexNumber", "INT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IndexNumber", "INT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsLocked", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsLocked", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "Name", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "Name", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "OfficialRating", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "OfficialRating", "Text");
|
||||||
|
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "MediaType", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "MediaType", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "Overview", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "Overview", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "ParentIndexNumber", "INT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "ParentIndexNumber", "INT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "PremiereDate", "DATETIME");
|
_connection.AddColumn(Logger, "TypedBaseItems", "PremiereDate", "DATETIME");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "ProductionYear", "INT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "ProductionYear", "INT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "ParentId", "GUID");
|
_connection.AddColumn(Logger, "TypedBaseItems", "ParentId", "GUID");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "Genres", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "Genres", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "ParentalRatingValue", "INT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "ParentalRatingValue", "INT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "SchemaVersion", "INT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "SchemaVersion", "INT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "SortName", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "SortName", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "RunTimeTicks", "BIGINT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "RunTimeTicks", "BIGINT");
|
||||||
|
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "OfficialRatingDescription", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "OfficialRatingDescription", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "HomePageUrl", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "HomePageUrl", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "VoteCount", "INT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "VoteCount", "INT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "DisplayMediaType", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "DisplayMediaType", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "DateCreated", "DATETIME");
|
_connection.AddColumn(Logger, "TypedBaseItems", "DateCreated", "DATETIME");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "DateModified", "DATETIME");
|
_connection.AddColumn(Logger, "TypedBaseItems", "DateModified", "DATETIME");
|
||||||
|
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "ForcedSortName", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "ForcedSortName", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsOffline", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsOffline", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "LocationType", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "LocationType", "Text");
|
||||||
|
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsSeries", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsSeries", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsLive", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsLive", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsNews", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsNews", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsPremiere", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsPremiere", "BIT");
|
||||||
|
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "EpisodeTitle", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "EpisodeTitle", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsRepeat", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsRepeat", "BIT");
|
||||||
|
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "PreferredMetadataLanguage", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "PreferredMetadataLanguage", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "PreferredMetadataCountryCode", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "PreferredMetadataCountryCode", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsHD", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsHD", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "ExternalEtag", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "ExternalEtag", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "DateLastRefreshed", "DATETIME");
|
_connection.AddColumn(Logger, "TypedBaseItems", "DateLastRefreshed", "DATETIME");
|
||||||
|
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "DateLastSaved", "DATETIME");
|
_connection.AddColumn(Logger, "TypedBaseItems", "DateLastSaved", "DATETIME");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsInMixedFolder", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsInMixedFolder", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "LockedFields", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "LockedFields", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "Studios", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "Studios", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "Audio", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "Audio", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "ExternalServiceId", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "ExternalServiceId", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "Tags", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "Tags", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsFolder", "BIT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "IsFolder", "BIT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "InheritedParentalRatingValue", "INT");
|
_connection.AddColumn(Logger, "TypedBaseItems", "InheritedParentalRatingValue", "INT");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "UnratedType", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "UnratedType", "Text");
|
||||||
_connection.AddColumn(_logger, "TypedBaseItems", "TopParentId", "Text");
|
_connection.AddColumn(Logger, "TypedBaseItems", "TopParentId", "Text");
|
||||||
|
|
||||||
PrepareStatements();
|
PrepareStatements();
|
||||||
|
|
||||||
new MediaStreamColumns(_connection, _logger).AddColumns();
|
new MediaStreamColumns(_connection, Logger).AddColumns();
|
||||||
|
|
||||||
var chapterDbFile = Path.Combine(_appPaths.DataPath, "chapters.db");
|
var chapterDbFile = Path.Combine(_appPaths.DataPath, "chapters.db");
|
||||||
if (File.Exists(chapterDbFile))
|
if (File.Exists(chapterDbFile))
|
||||||
@ -256,11 +253,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
"REPLACE INTO mediastreams("+columns+") SELECT "+columns+" FROM MediaInfoOld.mediastreams;"
|
"REPLACE INTO mediastreams("+columns+") SELECT "+columns+" FROM MediaInfoOld.mediastreams;"
|
||||||
};
|
};
|
||||||
|
|
||||||
_connection.RunQueries(queries, _logger);
|
_connection.RunQueries(queries, Logger);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error migrating media info database", ex);
|
Logger.ErrorException("Error migrating media info database", ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -280,11 +277,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
"REPLACE INTO "+ChaptersTableName+"(ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath) SELECT ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath FROM ChaptersOld.Chapters;"
|
"REPLACE INTO "+ChaptersTableName+"(ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath) SELECT ItemId, ChapterIndex, StartPositionTicks, Name, ImagePath FROM ChaptersOld.Chapters;"
|
||||||
};
|
};
|
||||||
|
|
||||||
_connection.RunQueries(queries, _logger);
|
_connection.RunQueries(queries, Logger);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error migrating chapter database", ex);
|
Logger.ErrorException("Error migrating chapter database", ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -300,15 +297,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error deleting file {0}", ex, file);
|
Logger.ErrorException("Error deleting file {0}", ex, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The _write lock
|
|
||||||
/// </summary>
|
|
||||||
private readonly SemaphoreSlim _writeLock = new SemaphoreSlim(1, 1);
|
|
||||||
|
|
||||||
private readonly string[] _retriveItemColumns =
|
private readonly string[] _retriveItemColumns =
|
||||||
{
|
{
|
||||||
"type",
|
"type",
|
||||||
@ -583,7 +575,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
|
||||||
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
IDbTransaction transaction = null;
|
IDbTransaction transaction = null;
|
||||||
|
|
||||||
@ -761,7 +753,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Failed to save items:", e);
|
Logger.ErrorException("Failed to save items:", e);
|
||||||
|
|
||||||
if (transaction != null)
|
if (transaction != null)
|
||||||
{
|
{
|
||||||
@ -777,7 +769,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeLock.Release();
|
WriteLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,7 +813,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
if (type == null)
|
if (type == null)
|
||||||
{
|
{
|
||||||
_logger.Debug("Unknown type {0}", typeString);
|
Logger.Debug("Unknown type {0}", typeString);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -836,7 +828,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
catch (SerializationException ex)
|
catch (SerializationException ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error deserializing item", ex);
|
Logger.ErrorException("Error deserializing item", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@ -1237,7 +1229,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
IDbTransaction transaction = null;
|
IDbTransaction transaction = null;
|
||||||
|
|
||||||
@ -1284,7 +1276,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Failed to save chapters:", e);
|
Logger.ErrorException("Failed to save chapters:", e);
|
||||||
|
|
||||||
if (transaction != null)
|
if (transaction != null)
|
||||||
{
|
{
|
||||||
@ -1300,62 +1292,21 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeLock.Release();
|
WriteLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override void CloseConnection()
|
||||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
{
|
||||||
Dispose(true);
|
if (_connection != null)
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly object _disposeLock = new object();
|
|
||||||
|
|
||||||
private bool _disposed;
|
|
||||||
private void CheckDisposed()
|
|
||||||
{
|
|
||||||
if (_disposed)
|
|
||||||
{
|
{
|
||||||
throw new ObjectDisposedException(GetType().Name + " has been disposed and cannot be accessed.");
|
if (_connection.IsOpen())
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases unmanaged and - optionally - managed resources.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
|
||||||
protected virtual void Dispose(bool dispose)
|
|
||||||
{
|
|
||||||
if (dispose)
|
|
||||||
{
|
|
||||||
_disposed = true;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
lock (_disposeLock)
|
_connection.Close();
|
||||||
{
|
|
||||||
_writeLock.Wait();
|
|
||||||
|
|
||||||
if (_connection != null)
|
|
||||||
{
|
|
||||||
if (_connection.IsOpen())
|
|
||||||
{
|
|
||||||
_connection.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
_connection.Dispose();
|
|
||||||
_connection = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.ErrorException("Error disposing database", ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_connection.Dispose();
|
||||||
|
_connection = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1399,7 +1350,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
cmd.Parameters.Add(cmd, "@ParentId", DbType.Guid).Value = parentId;
|
cmd.Parameters.Add(cmd, "@ParentId", DbType.Guid).Value = parentId;
|
||||||
|
|
||||||
//_logger.Debug(cmd.CommandText);
|
//Logger.Debug(cmd.CommandText);
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
||||||
{
|
{
|
||||||
@ -1474,7 +1425,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
cmd.CommandText += " LIMIT " + query.Limit.Value.ToString(CultureInfo.InvariantCulture);
|
cmd.CommandText += " LIMIT " + query.Limit.Value.ToString(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
//_logger.Debug(cmd.CommandText);
|
//Logger.Debug(cmd.CommandText);
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
||||||
{
|
{
|
||||||
@ -1526,7 +1477,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
cmd.CommandText += "; select count (guid) from TypedBaseItems" + whereTextWithoutPaging;
|
cmd.CommandText += "; select count (guid) from TypedBaseItems" + whereTextWithoutPaging;
|
||||||
|
|
||||||
_logger.Debug(cmd.CommandText);
|
Logger.Debug(cmd.CommandText);
|
||||||
|
|
||||||
var list = new List<BaseItem>();
|
var list = new List<BaseItem>();
|
||||||
var count = 0;
|
var count = 0;
|
||||||
@ -1609,7 +1560,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
var list = new List<Guid>();
|
var list = new List<Guid>();
|
||||||
|
|
||||||
_logger.Debug(cmd.CommandText);
|
Logger.Debug(cmd.CommandText);
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
|
||||||
{
|
{
|
||||||
@ -1662,7 +1613,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
var list = new List<Tuple<Guid, string>>();
|
var list = new List<Tuple<Guid, string>>();
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
_logger.Debug(cmd.CommandText);
|
Logger.Debug(cmd.CommandText);
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
|
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
|
||||||
{
|
{
|
||||||
@ -1731,7 +1682,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
var list = new List<Guid>();
|
var list = new List<Guid>();
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
_logger.Debug(cmd.CommandText);
|
Logger.Debug(cmd.CommandText);
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
|
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
|
||||||
{
|
{
|
||||||
@ -2075,7 +2026,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
IDbTransaction transaction = null;
|
IDbTransaction transaction = null;
|
||||||
|
|
||||||
@ -2107,7 +2058,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error running query:", e);
|
Logger.ErrorException("Error running query:", e);
|
||||||
|
|
||||||
if (transaction != null)
|
if (transaction != null)
|
||||||
{
|
{
|
||||||
@ -2123,7 +2074,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeLock.Release();
|
WriteLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2168,7 +2119,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
|
||||||
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
IDbTransaction transaction = null;
|
IDbTransaction transaction = null;
|
||||||
|
|
||||||
@ -2219,7 +2170,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Failed to save children:", e);
|
Logger.ErrorException("Failed to save children:", e);
|
||||||
|
|
||||||
if (transaction != null)
|
if (transaction != null)
|
||||||
{
|
{
|
||||||
@ -2235,7 +2186,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeLock.Release();
|
WriteLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2253,7 +2204,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
|
||||||
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
IDbTransaction transaction = null;
|
IDbTransaction transaction = null;
|
||||||
|
|
||||||
@ -2292,7 +2243,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Failed to save children:", e);
|
Logger.ErrorException("Failed to save children:", e);
|
||||||
|
|
||||||
if (transaction != null)
|
if (transaction != null)
|
||||||
{
|
{
|
||||||
@ -2308,7 +2259,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeLock.Release();
|
WriteLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2482,7 +2433,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
var cancellationToken = CancellationToken.None;
|
var cancellationToken = CancellationToken.None;
|
||||||
|
|
||||||
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
IDbTransaction transaction = null;
|
IDbTransaction transaction = null;
|
||||||
|
|
||||||
@ -2528,7 +2479,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Failed to save people:", e);
|
Logger.ErrorException("Failed to save people:", e);
|
||||||
|
|
||||||
if (transaction != null)
|
if (transaction != null)
|
||||||
{
|
{
|
||||||
@ -2544,7 +2495,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeLock.Release();
|
WriteLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2631,7 +2582,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
await _writeLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
IDbTransaction transaction = null;
|
IDbTransaction transaction = null;
|
||||||
|
|
||||||
@ -2703,7 +2654,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Failed to save media streams:", e);
|
Logger.ErrorException("Failed to save media streams:", e);
|
||||||
|
|
||||||
if (transaction != null)
|
if (transaction != null)
|
||||||
{
|
{
|
||||||
@ -2719,7 +2670,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeLock.Release();
|
WriteLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,6 +491,11 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
|
|
||||||
public bool SupportsSync(BaseItem item)
|
public bool SupportsSync(BaseItem item)
|
||||||
{
|
{
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("item");
|
||||||
|
}
|
||||||
|
|
||||||
if (item is Playlist)
|
if (item is Playlist)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -64,7 +64,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
|
|
||||||
_connection.AddColumn(Logger, "SyncJobs", "Profile", "TEXT");
|
_connection.AddColumn(Logger, "SyncJobs", "Profile", "TEXT");
|
||||||
_connection.AddColumn(Logger, "SyncJobs", "Bitrate", "INT");
|
_connection.AddColumn(Logger, "SyncJobs", "Bitrate", "INT");
|
||||||
|
|
||||||
PrepareStatements();
|
PrepareStatements();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,24 +800,6 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _disposed;
|
|
||||||
private void CheckDisposed()
|
|
||||||
{
|
|
||||||
if (_disposed)
|
|
||||||
{
|
|
||||||
throw new ObjectDisposedException(GetType().Name + " has been disposed and cannot be accessed.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool dispose)
|
|
||||||
{
|
|
||||||
if (dispose)
|
|
||||||
{
|
|
||||||
_disposed = true;
|
|
||||||
}
|
|
||||||
base.Dispose(dispose);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CloseConnection()
|
protected override void CloseConnection()
|
||||||
{
|
{
|
||||||
if (_connection != null)
|
if (_connection != null)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<package id="CommonIO" version="1.0.0.7" targetFramework="net45" />
|
<package id="CommonIO" version="1.0.0.7" targetFramework="net45" />
|
||||||
<package id="Emby.XmlTv" version="1.0.0.46" targetFramework="net45" />
|
<package id="Emby.XmlTv" version="1.0.0.46" targetFramework="net45" />
|
||||||
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
|
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
|
||||||
<package id="MediaBrowser.Naming" version="1.0.0.46" targetFramework="net45" />
|
<package id="MediaBrowser.Naming" version="1.0.0.47" targetFramework="net45" />
|
||||||
<package id="Mono.Nat" version="1.2.24.0" targetFramework="net45" />
|
<package id="Mono.Nat" version="1.2.24.0" targetFramework="net45" />
|
||||||
<package id="morelinq" version="1.4.0" targetFramework="net45" />
|
<package id="morelinq" version="1.4.0" targetFramework="net45" />
|
||||||
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
|
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
|
||||||
|
@ -692,7 +692,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
|
|
||||||
private async Task<IActivityRepository> GetActivityLogRepository()
|
private async Task<IActivityRepository> GetActivityLogRepository()
|
||||||
{
|
{
|
||||||
var repo = new ActivityRepository(LogManager.GetLogger("ActivityRepository"), ServerConfigurationManager.ApplicationPaths);
|
var repo = new ActivityRepository(LogManager, ServerConfigurationManager.ApplicationPaths);
|
||||||
|
|
||||||
await repo.Initialize().ConfigureAwait(false);
|
await repo.Initialize().ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -2185,6 +2185,9 @@
|
|||||||
<None Include="dashboard-ui\strings\html\zh-HK.json">
|
<None Include="dashboard-ui\strings\html\zh-HK.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="dashboard-ui\strings\javascript\id.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="dashboard-ui\strings\javascript\ko.json">
|
<None Include="dashboard-ui\strings\javascript\ko.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user