Merge branch 'master' into userdb-efcore

# Conflicts:
#	Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
#	Emby.Server.Implementations/ApplicationHost.cs
#	Emby.Server.Implementations/Devices/DeviceManager.cs
#	Jellyfin.Server/Jellyfin.Server.csproj
#	Jellyfin.Server/Migrations/MigrationRunner.cs
#	MediaBrowser.Controller/Devices/IDeviceManager.cs
This commit is contained in:
Patrick Barron
2020-05-15 17:20:07 -04:00
87 changed files with 1002 additions and 2008 deletions

View File

@@ -1,3 +1,4 @@
using System;
using System.Threading;
using System.Threading.Tasks;
@@ -20,6 +21,6 @@ namespace MediaBrowser.Controller.Session
/// <summary>
/// Sends the message.
/// </summary>
Task SendMessage<T>(string name, string messageId, T data, ISessionController[] allControllers, CancellationToken cancellationToken);
Task SendMessage<T>(string name, Guid messageId, T data, CancellationToken cancellationToken);
}
}

View File

@@ -10,13 +10,23 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Session
{
/// <summary>
/// Class SessionInfo
/// Class SessionInfo.
/// </summary>
public class SessionInfo : IDisposable
public sealed class SessionInfo : IDisposable
{
private ISessionManager _sessionManager;
// 1 second
private const long ProgressIncrement = 10000000;
private readonly ISessionManager _sessionManager;
private readonly ILogger _logger;
private readonly object _progressLock = new object();
private Timer _progressTimer;
private PlaybackProgressInfo _lastProgressInfo;
private bool _disposed = false;
public SessionInfo(ISessionManager sessionManager, ILogger logger)
{
_sessionManager = sessionManager;
@@ -97,8 +107,6 @@ namespace MediaBrowser.Controller.Session
/// <value>The name of the device.</value>
public string DeviceName { get; set; }
public string DeviceType { get; set; }
/// <summary>
/// Gets or sets the now playing item.
/// </summary>
@@ -128,22 +136,6 @@ namespace MediaBrowser.Controller.Session
[JsonIgnore]
public ISessionController[] SessionControllers { get; set; }
/// <summary>
/// Gets or sets the supported commands.
/// </summary>
/// <value>The supported commands.</value>
public string[] SupportedCommands
{
get
{
if (Capabilities == null)
{
return new string[] { };
}
return Capabilities.SupportedCommands;
}
}
public TranscodingInfo TranscodingInfo { get; set; }
/// <summary>
@@ -215,6 +207,14 @@ namespace MediaBrowser.Controller.Session
}
}
public QueueItem[] NowPlayingQueue { get; set; }
public bool HasCustomDeviceName { get; set; }
public string PlaylistItemId { get; set; }
public string UserPrimaryImageTag { get; set; }
public Tuple<ISessionController, bool> EnsureController<T>(Func<SessionInfo, ISessionController> factory)
{
var controllers = SessionControllers.ToList();
@@ -258,10 +258,6 @@ namespace MediaBrowser.Controller.Session
return false;
}
private readonly object _progressLock = new object();
private Timer _progressTimer;
private PlaybackProgressInfo _lastProgressInfo;
public void StartAutomaticProgress(PlaybackProgressInfo progressInfo)
{
if (_disposed)
@@ -284,9 +280,6 @@ namespace MediaBrowser.Controller.Session
}
}
// 1 second
private const long ProgressIncrement = 10000000;
private async void OnProgressTimerCallback(object state)
{
if (_disposed)
@@ -345,8 +338,7 @@ namespace MediaBrowser.Controller.Session
}
}
private bool _disposed = false;
/// <inheritdoc />
public void Dispose()
{
_disposed = true;
@@ -358,30 +350,12 @@ namespace MediaBrowser.Controller.Session
foreach (var controller in controllers)
{
var disposable = controller as IDisposable;
if (disposable != null)
if (controller is IDisposable disposable)
{
_logger.LogDebug("Disposing session controller {0}", disposable.GetType().Name);
try
{
disposable.Dispose();
}
catch (Exception ex)
{
_logger.LogError(ex, "Error disposing session controller");
}
disposable.Dispose();
}
}
_sessionManager = null;
}
public QueueItem[] NowPlayingQueue { get; set; }
public bool HasCustomDeviceName { get; set; }
public string PlaylistItemId { get; set; }
public string ServerId { get; set; }
public string UserPrimaryImageTag { get; set; }
}
}