updated nuget
This commit is contained in:
parent
c8e4889ac7
commit
715119b525
|
@ -217,6 +217,9 @@ namespace MediaBrowser.Api
|
|||
|
||||
[ApiMember(Name = "SupportedCommands", Description = "A list of supported remote control commands, comma delimited", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||
public string SupportedCommands { get; set; }
|
||||
|
||||
[ApiMember(Name = "SupportsMediaControl", Description = "Determines whether media can be played remotely.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "POST")]
|
||||
public bool SupportsMediaControl { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -258,6 +261,8 @@ namespace MediaBrowser.Api
|
|||
|
||||
if (request.ControllableByUserId.HasValue)
|
||||
{
|
||||
result = result.Where(i => i.SupportsMediaControl);
|
||||
|
||||
var user = _userManager.GetUserById(request.ControllableByUserId.Value);
|
||||
|
||||
if (!user.Configuration.EnableRemoteControlOfOtherUsers)
|
||||
|
@ -407,7 +412,9 @@ namespace MediaBrowser.Api
|
|||
{
|
||||
PlayableMediaTypes = request.PlayableMediaTypes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(),
|
||||
|
||||
SupportedCommands = request.SupportedCommands.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList()
|
||||
SupportedCommands = request.SupportedCommands.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(),
|
||||
|
||||
SupportsMediaControl = request.SupportsMediaControl
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -351,18 +351,21 @@ namespace MediaBrowser.Common.Implementations.IO
|
|||
throw new ArgumentNullException("to");
|
||||
}
|
||||
|
||||
path = path.Replace(from, to, StringComparison.OrdinalIgnoreCase);
|
||||
var newPath = path.Replace(from, to, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (!string.Equals(newPath, path))
|
||||
{
|
||||
if (to.IndexOf('/') != -1)
|
||||
{
|
||||
path = path.Replace('\\', '/');
|
||||
newPath = path.Replace('\\', '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
path = path.Replace('/', '\\');
|
||||
newPath = path.Replace('/', '\\');
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
return newPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,11 @@ namespace MediaBrowser.Common.Net
|
|||
/// </summary>
|
||||
public interface IWebSocket : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when [closed].
|
||||
/// </summary>
|
||||
event EventHandler<EventArgs> Closed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the state.
|
||||
/// </summary>
|
||||
|
|
|
@ -7,6 +7,11 @@ namespace MediaBrowser.Common.Net
|
|||
{
|
||||
public interface IWebSocketConnection : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when [closed].
|
||||
/// </summary>
|
||||
event EventHandler<EventArgs> Closed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
|
|
|
@ -13,6 +13,12 @@ namespace MediaBrowser.Controller.Session
|
|||
/// <value><c>true</c> if this instance is session active; otherwise, <c>false</c>.</value>
|
||||
bool IsSessionActive { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether [supports media remote control].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [supports media remote control]; otherwise, <c>false</c>.</value>
|
||||
bool SupportsMediaControl { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sends the play command.
|
||||
/// </summary>
|
||||
|
|
|
@ -139,6 +139,19 @@ namespace MediaBrowser.Controller.Session
|
|||
}
|
||||
}
|
||||
|
||||
public bool SupportsMediaControl
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SessionController != null)
|
||||
{
|
||||
return SessionController.SupportsMediaControl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsUser(Guid userId)
|
||||
{
|
||||
return (UserId ?? Guid.Empty) == UserId || AdditionalUsers.Any(i => userId == new Guid(i.UserId));
|
||||
|
|
|
@ -46,6 +46,11 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
}
|
||||
}
|
||||
|
||||
public bool SupportsMediaControl
|
||||
{
|
||||
get { return IsSessionActive; }
|
||||
}
|
||||
|
||||
private Timer _updateTimer;
|
||||
|
||||
public PlayToController(SessionInfo session, ISessionManager sessionManager, IItemRepository itemRepository, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IDtoService dtoService, IImageProcessor imageProcessor, SsdpHandler ssdpHandler, string serverAddress)
|
||||
|
|
|
@ -306,7 +306,9 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
GeneralCommandType.Unmute.ToString(),
|
||||
GeneralCommandType.ToggleMute.ToString(),
|
||||
GeneralCommandType.SetVolume.ToString()
|
||||
}
|
||||
},
|
||||
|
||||
SupportsMediaControl = true
|
||||
});
|
||||
|
||||
_logger.Info("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
public class LiveTvOptions
|
||||
{
|
||||
public int? GuideDays { get; set; }
|
||||
public string ActiveService { get; set; }
|
||||
}
|
||||
}
|
|
@ -8,6 +8,8 @@ namespace MediaBrowser.Model.Session
|
|||
|
||||
public List<string> SupportedCommands { get; set; }
|
||||
|
||||
public bool SupportsMediaControl { get; set; }
|
||||
|
||||
public SessionCapabilities()
|
||||
{
|
||||
PlayableMediaTypes = new List<string>();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Net.WebSockets;
|
||||
|
@ -19,6 +20,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public event EventHandler<EventArgs> Closed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the web socket.
|
||||
/// </summary>
|
||||
|
@ -97,6 +100,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
if (bytes == null)
|
||||
{
|
||||
// Connection closed
|
||||
EventHelper.FireEventIfNotNull(Closed, this, EventArgs.Empty, _logger);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
{
|
||||
_services.AddRange(services);
|
||||
|
||||
SetActiveService(_services.FirstOrDefault());
|
||||
SetActiveService(_config.Configuration.LiveTvOptions.ActiveService);
|
||||
}
|
||||
|
||||
private void SetActiveService(string name)
|
||||
{
|
||||
var service = _services.FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase)) ??
|
||||
_services.FirstOrDefault();
|
||||
|
||||
SetActiveService(service);
|
||||
}
|
||||
|
||||
private void SetActiveService(ILiveTvService service)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
@ -14,6 +15,8 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
|||
/// </summary>
|
||||
public class WebSocketConnection : IWebSocketConnection
|
||||
{
|
||||
public event EventHandler<EventArgs> Closed;
|
||||
|
||||
/// <summary>
|
||||
/// The _socket
|
||||
/// </summary>
|
||||
|
@ -96,6 +99,13 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
|||
_socket.OnReceive = OnReceiveInternal;
|
||||
RemoteEndPoint = remoteEndPoint;
|
||||
_logger = logger;
|
||||
|
||||
socket.Closed += socket_Closed;
|
||||
}
|
||||
|
||||
void socket_Closed(object sender, EventArgs e)
|
||||
{
|
||||
EventHelper.FireEventIfNotNull(Closed, this, EventArgs.Empty, _logger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -45,6 +45,11 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||
}
|
||||
}
|
||||
|
||||
public bool SupportsMediaControl
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
private Task SendMessage(object obj, CancellationToken cancellationToken)
|
||||
{
|
||||
var json = _json.SerializeToString(obj);
|
||||
|
|
|
@ -1164,7 +1164,7 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||
SupportedCommands = session.SupportedCommands,
|
||||
UserName = session.UserName,
|
||||
NowPlayingItem = session.NowPlayingItem,
|
||||
|
||||
SupportsRemoteControl = session.SupportsMediaControl,
|
||||
PlayState = session.PlayState
|
||||
};
|
||||
|
||||
|
|
|
@ -138,10 +138,10 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||
|
||||
if (controller == null)
|
||||
{
|
||||
controller = new WebSocketController(session, _appHost, _logger);
|
||||
controller = new WebSocketController(session, _appHost, _logger, _sessionManager);
|
||||
}
|
||||
|
||||
controller.Sockets.Add(message.Connection);
|
||||
controller.AddWebSocket(message.Connection);
|
||||
|
||||
session.SessionController = controller;
|
||||
}
|
||||
|
|
|
@ -17,16 +17,19 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||
public class WebSocketController : ISessionController
|
||||
{
|
||||
public SessionInfo Session { get; private set; }
|
||||
public List<IWebSocketConnection> Sockets { get; private set; }
|
||||
public IReadOnlyList<IWebSocketConnection> Sockets { get; private set; }
|
||||
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public WebSocketController(SessionInfo session, IServerApplicationHost appHost, ILogger logger)
|
||||
private readonly ISessionManager _sessionManager;
|
||||
|
||||
public WebSocketController(SessionInfo session, IServerApplicationHost appHost, ILogger logger, ISessionManager sessionManager)
|
||||
{
|
||||
Session = session;
|
||||
_appHost = appHost;
|
||||
_logger = logger;
|
||||
_sessionManager = sessionManager;
|
||||
Sockets = new List<IWebSocketConnection>();
|
||||
}
|
||||
|
||||
|
@ -38,6 +41,11 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||
}
|
||||
}
|
||||
|
||||
public bool SupportsMediaControl
|
||||
{
|
||||
get { return GetActiveSockets().Any(); }
|
||||
}
|
||||
|
||||
private IEnumerable<IWebSocketConnection> GetActiveSockets()
|
||||
{
|
||||
return Sockets
|
||||
|
@ -45,6 +53,28 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||
.Where(i => i.State == WebSocketState.Open);
|
||||
}
|
||||
|
||||
public void AddWebSocket(IWebSocketConnection connection)
|
||||
{
|
||||
var sockets = Sockets.ToList();
|
||||
sockets.Add(connection);
|
||||
|
||||
Sockets = sockets;
|
||||
|
||||
connection.Closed += connection_Closed;
|
||||
}
|
||||
|
||||
void connection_Closed(object sender, EventArgs e)
|
||||
{
|
||||
var capabilities = new SessionCapabilities
|
||||
{
|
||||
PlayableMediaTypes = Session.PlayableMediaTypes,
|
||||
SupportedCommands = Session.SupportedCommands,
|
||||
SupportsMediaControl = SupportsMediaControl
|
||||
};
|
||||
|
||||
_sessionManager.ReportCapabilities(Session.Id, capabilities);
|
||||
}
|
||||
|
||||
private IWebSocketConnection GetActiveSocket()
|
||||
{
|
||||
var socket = GetActiveSockets()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Alchemy.Classes;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
|
@ -18,6 +19,8 @@ namespace MediaBrowser.Server.Implementations.WebSocket
|
|||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public event EventHandler<EventArgs> Closed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the web socket.
|
||||
/// </summary>
|
||||
|
@ -66,6 +69,8 @@ namespace MediaBrowser.Server.Implementations.WebSocket
|
|||
private void OnDisconnected(UserContext context)
|
||||
{
|
||||
_disconnected = true;
|
||||
|
||||
EventHelper.FireEventIfNotNull(Closed, this, EventArgs.Empty, _logger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.366</version>
|
||||
<version>3.0.367</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.366" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.367" />
|
||||
<dependency id="NLog" version="2.1.0" />
|
||||
<dependency id="SimpleInjector" version="2.5.0" />
|
||||
<dependency id="sharpcompress" version="0.10.2" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.366</version>
|
||||
<version>3.0.367</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.366</version>
|
||||
<version>3.0.367</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.366" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.367" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user