From 6341d986a95be928a85ecd81c08fefdc5c3ec3b6 Mon Sep 17 00:00:00 2001 From: dkanada Date: Sun, 2 Feb 2020 00:07:46 +0900 Subject: fix a few warnings --- MediaBrowser.Controller/Session/SessionInfo.cs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index acda6a416..964fc9b19 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -1,6 +1,5 @@ using System; using System.Linq; -using System.Text.Json.Serialization; using System.Threading; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; @@ -123,7 +122,6 @@ namespace MediaBrowser.Controller.Session /// Gets or sets the session controller. /// /// The session controller. - [JsonIgnore] public ISessionController[] SessionControllers { get; set; } /// @@ -245,11 +243,6 @@ namespace MediaBrowser.Controller.Session SessionControllers = controllers.ToArray(); } - public bool ContainsUser(string userId) - { - return ContainsUser(new Guid(userId)); - } - public bool ContainsUser(Guid userId) { if (UserId.Equals(userId)) -- cgit v1.2.3 From 1bc8ca25421dd3b66a58e1ff0938ee7874d8448e Mon Sep 17 00:00:00 2001 From: dkanada Date: Sun, 2 Feb 2020 00:16:11 +0900 Subject: add session view endpoint --- Emby.Server.Implementations/Session/SessionManager.cs | 10 +++++----- MediaBrowser.Api/Session/SessionsService.cs | 18 ++++++++++++++++++ MediaBrowser.Controller/Session/SessionInfo.cs | 2 ++ 3 files changed, 25 insertions(+), 5 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 659483a36..8e52f2415 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1686,18 +1686,18 @@ namespace Emby.Server.Implementations.Session throw new ArgumentNullException(nameof(itemId)); } - //var item = _libraryManager.GetItemById(new Guid(itemId)); + var item = _libraryManager.GetItemById(new Guid(itemId)); - //var info = GetItemInfo(item, null, null); + var info = GetItemInfo(item, null); - //ReportNowViewingItem(sessionId, info); + ReportNowViewingItem(sessionId, info); } public void ReportNowViewingItem(string sessionId, BaseItemDto item) { - //var session = GetSession(sessionId); + var session = GetSession(sessionId); - //session.NowViewingItem = item; + session.NowViewingItem = item; } public void ReportTranscodingInfo(string deviceId, TranscodingInfo info) diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs index 8e53490ff..df816927a 100644 --- a/MediaBrowser.Api/Session/SessionsService.cs +++ b/MediaBrowser.Api/Session/SessionsService.cs @@ -230,6 +230,17 @@ namespace MediaBrowser.Api.Session public string Id { get; set; } } + [Route("/Sessions/Viewing", "POST", Summary = "Reports that a session is viewing an item")] + [Authenticated] + public class ReportViewing : IReturnVoid + { + [ApiMember(Name = "SessionId", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] + public string SessionId { get; set; } + + [ApiMember(Name = "ItemId", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] + public string ItemId { get; set; } + } + [Route("/Sessions/Logout", "POST", Summary = "Reports that a session has ended")] [Authenticated] public class ReportSessionEnded : IReturnVoid @@ -536,5 +547,12 @@ namespace MediaBrowser.Api.Session _sessionManager.ReportCapabilities(request.Id, request); } + + public void Post(ReportViewing request) + { + request.SessionId = GetSession(_sessionContext).Id; + + _sessionManager.ReportNowViewingItem(request.SessionId, request.ItemId); + } } } diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 964fc9b19..7bc50eb41 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -106,6 +106,8 @@ namespace MediaBrowser.Controller.Session public BaseItem FullNowPlayingItem { get; set; } + public BaseItemDto NowViewingItem { get; set; } + /// /// Gets or sets the device id. /// -- cgit v1.2.3 From f93edb7ade68588f4e2e7e05932b3266105ea91a Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 4 Feb 2020 01:29:18 +0900 Subject: add code suggestions --- Emby.Server.Implementations/Session/SessionManager.cs | 2 +- MediaBrowser.Controller/Session/SessionInfo.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Controller') diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 8e52f2415..4aed226de 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1494,7 +1494,7 @@ namespace Emby.Server.Implementations.Session { Limit = 1, AccessToken = accessToken - }).Items[0]; + }).Items.FirstOrDefault(); if (existing != null) { diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 7bc50eb41..cc5160d77 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Text.Json.Serialization; using System.Threading; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Dto; @@ -124,6 +125,7 @@ namespace MediaBrowser.Controller.Session /// Gets or sets the session controller. /// /// The session controller. + [JsonIgnore] public ISessionController[] SessionControllers { get; set; } /// -- cgit v1.2.3 From a381eb884c61ce6661f6490f88e4af7430754dca Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Mon, 10 Feb 2020 10:26:28 +0100 Subject: add-some-xml-documentation --- .../Configuration/IConfigurationFactory.cs | 25 ++++++++++++++++++++++ .../Plugins/IServerEntryPoint.cs | 10 +++++++-- MediaBrowser.Model/Services/ApiMemberAttribute.cs | 3 +++ 3 files changed, 36 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Common/Configuration/IConfigurationFactory.cs b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs index 9b4ed772d..2b4b9b082 100644 --- a/MediaBrowser.Common/Configuration/IConfigurationFactory.cs +++ b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs @@ -6,20 +6,45 @@ using System.Collections.Generic; namespace MediaBrowser.Common.Configuration { + /// + /// Provides an interface to retrieve a configuration store. Classes with this interface are scanned for at + /// application start to dynamically register configuration for various modules/plugins. + /// public interface IConfigurationFactory { + /// + /// Get the configuration store for this module. + /// + /// The configuration store. IEnumerable GetConfigurations(); } + /// + /// Describes a single entry in the application configuration. + /// public class ConfigurationStore { + /// + /// Gets or sets the unique identifier for the configuration. + /// public string Key { get; set; } + /// + /// Gets or sets the type used to store the data for this configuration entry. + /// public Type ConfigurationType { get; set; } } + /// + /// A configuration store that can be validated. + /// public interface IValidatingConfiguration { + /// + /// Validation method to be invoked before saving the configuration. + /// + /// The old configuration. + /// The new configuration. void Validate(object oldConfig, object newConfig); } } diff --git a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs index e57929989..5b3173ef6 100644 --- a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs +++ b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs @@ -4,16 +4,22 @@ using System.Threading.Tasks; namespace MediaBrowser.Controller.Plugins { /// - /// Interface IServerEntryPoint + /// Represents an entry point for a module in the application. This interface is scanned for automatically and + /// provides a hook to initialize the module at application start. + /// The entry point can additionally be flagged as a pre-startup task by applying the + /// interface. /// public interface IServerEntryPoint : IDisposable { /// - /// Runs this instance. + /// Run the initialization for this module. This method is invoked at application start. /// Task RunAsync(); } + /// + /// Indicates that a should be invoked as a pre-startup task. + /// public interface IRunBeforeStartup { diff --git a/MediaBrowser.Model/Services/ApiMemberAttribute.cs b/MediaBrowser.Model/Services/ApiMemberAttribute.cs index 7267fce24..06a6713ee 100644 --- a/MediaBrowser.Model/Services/ApiMemberAttribute.cs +++ b/MediaBrowser.Model/Services/ApiMemberAttribute.cs @@ -5,6 +5,9 @@ using System; namespace MediaBrowser.Model.Services { + /// + /// Identifies a single API endpoint. + /// [AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)] public class ApiMemberAttribute : Attribute { -- cgit v1.2.3 From 33761c3658c7c2867cb55fb1c96d441c24e81f89 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Wed, 12 Feb 2020 14:08:06 +0100 Subject: Use "implement" instead of "apply" when referring to an interface --- MediaBrowser.Controller/Plugins/IServerEntryPoint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs index 5b3173ef6..1e8654c4d 100644 --- a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs +++ b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs @@ -6,7 +6,7 @@ namespace MediaBrowser.Controller.Plugins /// /// Represents an entry point for a module in the application. This interface is scanned for automatically and /// provides a hook to initialize the module at application start. - /// The entry point can additionally be flagged as a pre-startup task by applying the + /// The entry point can additionally be flagged as a pre-startup task by implementing the /// interface. /// public interface IServerEntryPoint : IDisposable -- cgit v1.2.3