fix a few warnings

This commit is contained in:
dkanada 2020-02-02 00:07:46 +09:00
parent b3811a9498
commit 6341d986a9
5 changed files with 19 additions and 34 deletions

View file

@ -67,15 +67,15 @@ namespace Emby.Server.Implementations.Session
public event EventHandler<GenericEventArgs<AuthenticationResult>> AuthenticationSucceeded; public event EventHandler<GenericEventArgs<AuthenticationResult>> AuthenticationSucceeded;
/// <summary> /// <summary>
/// Occurs when [playback start]. /// Occurs when playback has started.
/// </summary> /// </summary>
public event EventHandler<PlaybackProgressEventArgs> PlaybackStart; public event EventHandler<PlaybackProgressEventArgs> PlaybackStart;
/// <summary> /// <summary>
/// Occurs when [playback progress]. /// Occurs when playback has progressed.
/// </summary> /// </summary>
public event EventHandler<PlaybackProgressEventArgs> PlaybackProgress; public event EventHandler<PlaybackProgressEventArgs> PlaybackProgress;
/// <summary> /// <summary>
/// Occurs when [playback stopped]. /// Occurs when playback has stopped.
/// </summary> /// </summary>
public event EventHandler<PlaybackStopEventArgs> PlaybackStopped; public event EventHandler<PlaybackStopEventArgs> PlaybackStopped;
@ -685,7 +685,7 @@ namespace Emby.Server.Implementations.Session
} }
/// <summary> /// <summary>
/// Used to report playback progress for an item /// Used to report playback progress for an item.
/// </summary> /// </summary>
/// <returns>Task.</returns> /// <returns>Task.</returns>
public async Task OnPlaybackProgress(PlaybackProgressInfo info, bool isAutomated) public async Task OnPlaybackProgress(PlaybackProgressInfo info, bool isAutomated)
@ -1435,14 +1435,13 @@ namespace Emby.Server.Implementations.Session
DeviceId = deviceId, DeviceId = deviceId,
UserId = user.Id, UserId = user.Id,
Limit = 1 Limit = 1
}).Items.FirstOrDefault(); }).Items.FirstOrDefault();
var allExistingForDevice = _authRepo.Get(new AuthenticationInfoQuery var allExistingForDevice = _authRepo.Get(
{ new AuthenticationInfoQuery
DeviceId = deviceId {
DeviceId = deviceId
}).Items; }).Items;
foreach (var auth in allExistingForDevice) foreach (var auth in allExistingForDevice)
{ {
@ -1499,8 +1498,7 @@ namespace Emby.Server.Implementations.Session
{ {
Limit = 1, Limit = 1,
AccessToken = accessToken AccessToken = accessToken
}).Items[0];
}).Items.FirstOrDefault();
if (existing != null) if (existing != null)
{ {
@ -1708,7 +1706,8 @@ namespace Emby.Server.Implementations.Session
public void ReportTranscodingInfo(string deviceId, TranscodingInfo info) public void ReportTranscodingInfo(string deviceId, TranscodingInfo info)
{ {
var session = Sessions.FirstOrDefault(i => string.Equals(i.DeviceId, deviceId)); var session = Sessions.FirstOrDefault(i =>
string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase));
if (session != null) if (session != null)
{ {
@ -1723,8 +1722,9 @@ namespace Emby.Server.Implementations.Session
public SessionInfo GetSession(string deviceId, string client, string version) public SessionInfo GetSession(string deviceId, string client, string version)
{ {
return Sessions.FirstOrDefault(i => string.Equals(i.DeviceId, deviceId) && return Sessions.FirstOrDefault(i =>
string.Equals(i.Client, client)); string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase)
&& string.Equals(i.Client, client, StringComparison.OrdinalIgnoreCase));
} }
public SessionInfo GetSessionByAuthenticationToken(AuthenticationInfo info, string deviceId, string remoteEndpoint, string appVersion) public SessionInfo GetSessionByAuthenticationToken(AuthenticationInfo info, string deviceId, string remoteEndpoint, string appVersion)

View file

@ -276,7 +276,7 @@ namespace MediaBrowser.Api.Session
public class SessionsService : BaseApiService public class SessionsService : BaseApiService
{ {
/// <summary> /// <summary>
/// The _session manager. /// The session manager.
/// </summary> /// </summary>
private readonly ISessionManager _sessionManager; private readonly ISessionManager _sessionManager;
@ -438,14 +438,12 @@ namespace MediaBrowser.Api.Session
public Task Post(SendSystemCommand request) public Task Post(SendSystemCommand request)
{ {
var name = request.Command; var name = request.Command;
if (Enum.TryParse(name, true, out GeneralCommandType commandType)) if (Enum.TryParse(name, true, out GeneralCommandType commandType))
{ {
name = commandType.ToString(); name = commandType.ToString();
} }
var currentSession = GetSession(_sessionContext); var currentSession = GetSession(_sessionContext);
var command = new GeneralCommand var command = new GeneralCommand
{ {
Name = name, Name = name,
@ -518,16 +516,13 @@ namespace MediaBrowser.Api.Session
{ {
request.Id = GetSession(_sessionContext).Id; request.Id = GetSession(_sessionContext).Id;
} }
_sessionManager.ReportCapabilities(request.Id, new ClientCapabilities _sessionManager.ReportCapabilities(request.Id, new ClientCapabilities
{ {
PlayableMediaTypes = SplitValue(request.PlayableMediaTypes, ','), PlayableMediaTypes = SplitValue(request.PlayableMediaTypes, ','),
SupportedCommands = SplitValue(request.SupportedCommands, ','), SupportedCommands = SplitValue(request.SupportedCommands, ','),
SupportsMediaControl = request.SupportsMediaControl, SupportsMediaControl = request.SupportsMediaControl,
SupportsSync = request.SupportsSync, SupportsSync = request.SupportsSync,
SupportsPersistentIdentifier = request.SupportsPersistentIdentifier SupportsPersistentIdentifier = request.SupportsPersistentIdentifier
}); });
} }
@ -538,6 +533,7 @@ namespace MediaBrowser.Api.Session
{ {
request.Id = GetSession(_sessionContext).Id; request.Id = GetSession(_sessionContext).Id;
} }
_sessionManager.ReportCapabilities(request.Id, request); _sessionManager.ReportCapabilities(request.Id, request);
} }
} }

View file

@ -103,10 +103,6 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "MediaSourceId", Description = "The id of the MediaSource", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "MediaSourceId", Description = "The id of the MediaSource", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MediaSourceId { get; set; } public string MediaSourceId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="UpdateUserItemRating" /> is likes.
/// </summary>
/// <value><c>true</c> if likes; otherwise, <c>false</c>.</value>
[ApiMember(Name = "CanSeek", Description = "Indicates if the client can seek", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "POST")] [ApiMember(Name = "CanSeek", Description = "Indicates if the client can seek", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "POST")]
public bool CanSeek { get; set; } public bool CanSeek { get; set; }

View file

@ -240,7 +240,7 @@ namespace MediaBrowser.Api
public class UserService : BaseApiService public class UserService : BaseApiService
{ {
/// <summary> /// <summary>
/// The _user manager /// The user manager.
/// </summary> /// </summary>
private readonly IUserManager _userManager; private readonly IUserManager _userManager;
private readonly ISessionManager _sessionMananger; private readonly ISessionManager _sessionMananger;

View file

@ -1,6 +1,5 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Text.Json.Serialization;
using System.Threading; using System.Threading;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
@ -123,7 +122,6 @@ namespace MediaBrowser.Controller.Session
/// Gets or sets the session controller. /// Gets or sets the session controller.
/// </summary> /// </summary>
/// <value>The session controller.</value> /// <value>The session controller.</value>
[JsonIgnore]
public ISessionController[] SessionControllers { get; set; } public ISessionController[] SessionControllers { get; set; }
/// <summary> /// <summary>
@ -245,11 +243,6 @@ namespace MediaBrowser.Controller.Session
SessionControllers = controllers.ToArray(); SessionControllers = controllers.ToArray();
} }
public bool ContainsUser(string userId)
{
return ContainsUser(new Guid(userId));
}
public bool ContainsUser(Guid userId) public bool ContainsUser(Guid userId)
{ {
if (UserId.Equals(userId)) if (UserId.Equals(userId))