mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-03 19:17:24 -05:00 
			
		
		
		
	added model classes for remote control
This commit is contained in:
		
							parent
							
								
									2b28320764
								
							
						
					
					
						commit
						35a7986b3f
					
				@ -1,4 +1,5 @@
 | 
				
			|||||||
using MediaBrowser.Controller.Session;
 | 
					using MediaBrowser.Controller.Dto;
 | 
				
			||||||
 | 
					using MediaBrowser.Controller.Session;
 | 
				
			||||||
using MediaBrowser.Model.Session;
 | 
					using MediaBrowser.Model.Session;
 | 
				
			||||||
using ServiceStack.ServiceHost;
 | 
					using ServiceStack.ServiceHost;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
@ -11,7 +12,7 @@ namespace MediaBrowser.Api
 | 
				
			|||||||
    /// </summary>
 | 
					    /// </summary>
 | 
				
			||||||
    [Route("/Sessions", "GET")]
 | 
					    [Route("/Sessions", "GET")]
 | 
				
			||||||
    [Api(("Gets a list of sessions"))]
 | 
					    [Api(("Gets a list of sessions"))]
 | 
				
			||||||
    public class GetSessions : IReturn<List<SessionInfo>>
 | 
					    public class GetSessions : IReturn<List<SessionInfoDto>>
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Gets or sets a value indicating whether this instance is recent.
 | 
					        /// Gets or sets a value indicating whether this instance is recent.
 | 
				
			||||||
@ -48,7 +49,7 @@ namespace MediaBrowser.Api
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = request.IsRecent ? _sessionManager.RecentConnections : _sessionManager.AllConnections;
 | 
					            var result = request.IsRecent ? _sessionManager.RecentConnections : _sessionManager.AllConnections;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return ToOptimizedResult(result.ToList());
 | 
					            return ToOptimizedResult(result.Select(SessionInfoDtoBuilder.GetSessionInfoDto).ToList());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -304,7 +304,7 @@ namespace MediaBrowser.Common.Plugins
 | 
				
			|||||||
                AssemblyFileName = AssemblyFileName,
 | 
					                AssemblyFileName = AssemblyFileName,
 | 
				
			||||||
                ConfigurationDateLastModified = ConfigurationDateLastModified,
 | 
					                ConfigurationDateLastModified = ConfigurationDateLastModified,
 | 
				
			||||||
                Description = Description,
 | 
					                Description = Description,
 | 
				
			||||||
                Id = Id.ToString(),
 | 
					                Id = Id.ToString("N"),
 | 
				
			||||||
                EnableAutoUpdate = Configuration.EnableAutoUpdate,
 | 
					                EnableAutoUpdate = Configuration.EnableAutoUpdate,
 | 
				
			||||||
                UpdateClass = Configuration.UpdateClass,
 | 
					                UpdateClass = Configuration.UpdateClass,
 | 
				
			||||||
                ConfigurationFileName = ConfigurationFileName
 | 
					                ConfigurationFileName = ConfigurationFileName
 | 
				
			||||||
 | 
				
			|||||||
@ -868,7 +868,7 @@ namespace MediaBrowser.Controller.Dto
 | 
				
			|||||||
                return GetClientItemId(indexFolder.Parent) + IndexFolderDelimeter + (indexFolder.IndexName ?? string.Empty) + IndexFolderDelimeter + indexFolder.Id;
 | 
					                return GetClientItemId(indexFolder.Parent) + IndexFolderDelimeter + (indexFolder.IndexName ?? string.Empty) + IndexFolderDelimeter + indexFolder.Id;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return item.Id.ToString();
 | 
					            return item.Id.ToString("N");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										45
									
								
								MediaBrowser.Controller/Dto/SessionInfoDtoBuilder.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								MediaBrowser.Controller/Dto/SessionInfoDtoBuilder.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,45 @@
 | 
				
			|||||||
 | 
					using MediaBrowser.Controller.Session;
 | 
				
			||||||
 | 
					using MediaBrowser.Model.Net;
 | 
				
			||||||
 | 
					using MediaBrowser.Model.Session;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace MediaBrowser.Controller.Dto
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Class SessionInfoDtoBuilder
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public static class SessionInfoDtoBuilder
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets the session info dto.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="session">The session.</param>
 | 
				
			||||||
 | 
					        /// <returns>SessionInfoDto.</returns>
 | 
				
			||||||
 | 
					        public static SessionInfoDto GetSessionInfoDto(SessionInfo session)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var dto = new SessionInfoDto
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Client = session.Client,
 | 
				
			||||||
 | 
					                DeviceId = session.DeviceId,
 | 
				
			||||||
 | 
					                DeviceName = session.DeviceName,
 | 
				
			||||||
 | 
					                Id = session.Id,
 | 
				
			||||||
 | 
					                LastActivityDate = session.LastActivityDate,
 | 
				
			||||||
 | 
					                NowPlayingPositionTicks = session.NowPlayingPositionTicks
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (session.NowPlayingItem != null)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                dto.NowPlayingItem = DtoBuilder.GetBaseItemInfo(session.NowPlayingItem);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (session.UserId.HasValue)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                dto.UserId = session.UserId.Value.ToString("N");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            dto.SupportsRemoteControl = session.WebSocket != null &&
 | 
				
			||||||
 | 
					                                        session.WebSocket.State == WebSocketState.Open;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return dto;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -41,7 +41,7 @@ namespace MediaBrowser.Controller.Dto
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            var dto = new UserDto
 | 
					            var dto = new UserDto
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Id = user.Id.ToString(),
 | 
					                Id = user.Id.ToString("N"),
 | 
				
			||||||
                Name = user.Name,
 | 
					                Name = user.Name,
 | 
				
			||||||
                HasPassword = !String.IsNullOrEmpty(user.Password),
 | 
					                HasPassword = !String.IsNullOrEmpty(user.Password),
 | 
				
			||||||
                LastActivityDate = user.LastActivityDate,
 | 
					                LastActivityDate = user.LastActivityDate,
 | 
				
			||||||
 | 
				
			|||||||
@ -70,6 +70,7 @@
 | 
				
			|||||||
      <Link>Properties\SharedVersion.cs</Link>
 | 
					      <Link>Properties\SharedVersion.cs</Link>
 | 
				
			||||||
    </Compile>
 | 
					    </Compile>
 | 
				
			||||||
    <Compile Include="Configuration\IServerConfigurationManager.cs" />
 | 
					    <Compile Include="Configuration\IServerConfigurationManager.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Dto\SessionInfoDtoBuilder.cs" />
 | 
				
			||||||
    <Compile Include="Session\ISessionManager.cs" />
 | 
					    <Compile Include="Session\ISessionManager.cs" />
 | 
				
			||||||
    <Compile Include="Drawing\ImageExtensions.cs" />
 | 
					    <Compile Include="Drawing\ImageExtensions.cs" />
 | 
				
			||||||
    <Compile Include="Drawing\ImageHeader.cs" />
 | 
					    <Compile Include="Drawing\ImageHeader.cs" />
 | 
				
			||||||
@ -191,6 +192,7 @@
 | 
				
			|||||||
    <Compile Include="Providers\FolderProviderFromXml.cs" />
 | 
					    <Compile Include="Providers\FolderProviderFromXml.cs" />
 | 
				
			||||||
    <Compile Include="Providers\ImageFromMediaLocationProvider.cs" />
 | 
					    <Compile Include="Providers\ImageFromMediaLocationProvider.cs" />
 | 
				
			||||||
    <Compile Include="Providers\MediaInfo\FFProbeVideoInfoProvider.cs" />
 | 
					    <Compile Include="Providers\MediaInfo\FFProbeVideoInfoProvider.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Session\SessionInfo.cs" />
 | 
				
			||||||
    <Compile Include="Sorting\IBaseItemComparer.cs" />
 | 
					    <Compile Include="Sorting\IBaseItemComparer.cs" />
 | 
				
			||||||
    <Compile Include="Sorting\IUserBaseItemComparer.cs" />
 | 
					    <Compile Include="Sorting\IUserBaseItemComparer.cs" />
 | 
				
			||||||
    <Compile Include="Updates\IInstallationManager.cs" />
 | 
					    <Compile Include="Updates\IInstallationManager.cs" />
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,8 @@
 | 
				
			|||||||
using MediaBrowser.Model.Entities;
 | 
					using MediaBrowser.Common.Net;
 | 
				
			||||||
 | 
					using MediaBrowser.Controller.Entities;
 | 
				
			||||||
using System;
 | 
					using System;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MediaBrowser.Model.Session
 | 
					namespace MediaBrowser.Controller.Session
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /// <summary>
 | 
					    /// <summary>
 | 
				
			||||||
    /// Class SessionInfo
 | 
					    /// Class SessionInfo
 | 
				
			||||||
@ -18,7 +19,7 @@ namespace MediaBrowser.Model.Session
 | 
				
			|||||||
        /// Gets or sets the user id.
 | 
					        /// Gets or sets the user id.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <value>The user id.</value>
 | 
					        /// <value>The user id.</value>
 | 
				
			||||||
        public string UserId { get; set; }
 | 
					        public Guid? UserId { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Gets or sets the type of the client.
 | 
					        /// Gets or sets the type of the client.
 | 
				
			||||||
@ -42,7 +43,7 @@ namespace MediaBrowser.Model.Session
 | 
				
			|||||||
        /// Gets or sets the now playing item.
 | 
					        /// Gets or sets the now playing item.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <value>The now playing item.</value>
 | 
					        /// <value>The now playing item.</value>
 | 
				
			||||||
        public BaseItemInfo NowPlayingItem { get; set; }
 | 
					        public BaseItem NowPlayingItem { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Gets or sets the now playing position ticks.
 | 
					        /// Gets or sets the now playing position ticks.
 | 
				
			||||||
@ -55,5 +56,11 @@ namespace MediaBrowser.Model.Session
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <value>The device id.</value>
 | 
					        /// <value>The device id.</value>
 | 
				
			||||||
        public string DeviceId { get; set; }
 | 
					        public string DeviceId { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the web socket.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The web socket.</value>
 | 
				
			||||||
 | 
					        public IWebSocketConnection WebSocket { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -56,7 +56,9 @@
 | 
				
			|||||||
    <Compile Include="Querying\ArtistsQuery.cs" />
 | 
					    <Compile Include="Querying\ArtistsQuery.cs" />
 | 
				
			||||||
    <Compile Include="Querying\ItemsByNameQuery.cs" />
 | 
					    <Compile Include="Querying\ItemsByNameQuery.cs" />
 | 
				
			||||||
    <Compile Include="Entities\BaseItemInfo.cs" />
 | 
					    <Compile Include="Entities\BaseItemInfo.cs" />
 | 
				
			||||||
    <Compile Include="Session\SessionInfo.cs" />
 | 
					    <Compile Include="Session\BrowseRequest.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Session\PlayRequest.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Session\PlaystateRequest.cs" />
 | 
				
			||||||
    <Compile Include="Entities\ImageDownloadOptions.cs" />
 | 
					    <Compile Include="Entities\ImageDownloadOptions.cs" />
 | 
				
			||||||
    <Compile Include="Logging\ILogManager.cs" />
 | 
					    <Compile Include="Logging\ILogManager.cs" />
 | 
				
			||||||
    <Compile Include="MediaInfo\BlurayDiscInfo.cs" />
 | 
					    <Compile Include="MediaInfo\BlurayDiscInfo.cs" />
 | 
				
			||||||
@ -92,6 +94,7 @@
 | 
				
			|||||||
    <Compile Include="Search\SearchHintResult.cs" />
 | 
					    <Compile Include="Search\SearchHintResult.cs" />
 | 
				
			||||||
    <Compile Include="Serialization\IJsonSerializer.cs" />
 | 
					    <Compile Include="Serialization\IJsonSerializer.cs" />
 | 
				
			||||||
    <Compile Include="Serialization\IXmlSerializer.cs" />
 | 
					    <Compile Include="Serialization\IXmlSerializer.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Session\SessionInfoDto.cs" />
 | 
				
			||||||
    <Compile Include="Updates\CheckForUpdateResult.cs" />
 | 
					    <Compile Include="Updates\CheckForUpdateResult.cs" />
 | 
				
			||||||
    <Compile Include="Updates\PackageTargetSystem.cs" />
 | 
					    <Compile Include="Updates\PackageTargetSystem.cs" />
 | 
				
			||||||
    <Compile Include="Updates\InstallationInfo.cs" />
 | 
					    <Compile Include="Updates\InstallationInfo.cs" />
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										37
									
								
								MediaBrowser.Model/Session/BrowseRequest.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								MediaBrowser.Model/Session/BrowseRequest.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					namespace MediaBrowser.Model.Session
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Class BrowseRequest
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public class BrowseRequest
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Artist, Genre, Studio, Person, or any kind of BaseItem
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The type of the item.</value>
 | 
				
			||||||
 | 
					        public string ItemType { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Artist name, genre name, item Id, etc
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The item identifier.</value>
 | 
				
			||||||
 | 
					        public string ItemIdentifier { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the context (Movies, Music, Tv, etc)
 | 
				
			||||||
 | 
					        /// Applicable to genres, studios and persons only because the context of items and artists can be inferred.
 | 
				
			||||||
 | 
					        /// This is optional to supply and clients are free to ignore it.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The context.</value>
 | 
				
			||||||
 | 
					        public string Context { get; set; }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public class ItemContext
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public const string Music = "Music";
 | 
				
			||||||
 | 
					        public const string Movies = "Movies";
 | 
				
			||||||
 | 
					        public const string TvShows = "TvShows";
 | 
				
			||||||
 | 
					        public const string Games = "Games";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										46
									
								
								MediaBrowser.Model/Session/PlayRequest.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								MediaBrowser.Model/Session/PlayRequest.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,46 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					namespace MediaBrowser.Model.Session
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Class PlayRequest
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public class PlayRequest
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the item ids.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The item ids.</value>
 | 
				
			||||||
 | 
					        public string[] ItemIds { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the start position ticks that the first item should be played at
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The start position ticks.</value>
 | 
				
			||||||
 | 
					        public long? StartPositionTicks { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the play command.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The play command.</value>
 | 
				
			||||||
 | 
					        public PlayCommand PlayCommand { get; set; }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Enum PlayCommand
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public enum PlayCommand
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// The play now
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        PlayNow,
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// The play next
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        PlayNext,
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// The play last
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        PlayLast
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										53
									
								
								MediaBrowser.Model/Session/PlaystateRequest.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								MediaBrowser.Model/Session/PlaystateRequest.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					namespace MediaBrowser.Model.Session
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Class PlaystateRequest
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public class PlaystateRequest
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the command.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The command.</value>
 | 
				
			||||||
 | 
					        public PlaystateCommand Command { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the seek position.
 | 
				
			||||||
 | 
					        /// Only applicable to seek commands.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The seek position.</value>
 | 
				
			||||||
 | 
					        public long SeekPosition { get; set; }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Enum PlaystateCommand
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public enum PlaystateCommand
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// The stop
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        Stop,
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// The pause
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        Pause,
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// The unpause
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        Unpause,
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// The next track
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        NextTrack,
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// The previous track
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        PreviousTrack,
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// The seek
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        Seek
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										62
									
								
								MediaBrowser.Model/Session/SessionInfoDto.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								MediaBrowser.Model/Session/SessionInfoDto.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,62 @@
 | 
				
			|||||||
 | 
					using MediaBrowser.Model.Entities;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace MediaBrowser.Model.Session
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class SessionInfoDto
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the id.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The id.</value>
 | 
				
			||||||
 | 
					        public Guid Id { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the user id.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The user id.</value>
 | 
				
			||||||
 | 
					        public string UserId { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the type of the client.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The type of the client.</value>
 | 
				
			||||||
 | 
					        public string Client { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the last activity date.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The last activity date.</value>
 | 
				
			||||||
 | 
					        public DateTime LastActivityDate { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the name of the device.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The name of the device.</value>
 | 
				
			||||||
 | 
					        public string DeviceName { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the now playing item.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The now playing item.</value>
 | 
				
			||||||
 | 
					        public BaseItemInfo NowPlayingItem { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the now playing position ticks.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The now playing position ticks.</value>
 | 
				
			||||||
 | 
					        public long? NowPlayingPositionTicks { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets the device id.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value>The device id.</value>
 | 
				
			||||||
 | 
					        public string DeviceId { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets or sets a value indicating whether [supports remote control].
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <value><c>true</c> if [supports remote control]; otherwise, <c>false</c>.</value>
 | 
				
			||||||
 | 
					        public bool SupportsRemoteControl { get; set; }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -7,6 +7,7 @@ using MediaBrowser.Controller.Entities;
 | 
				
			|||||||
using MediaBrowser.Controller.Entities.Audio;
 | 
					using MediaBrowser.Controller.Entities.Audio;
 | 
				
			||||||
using MediaBrowser.Controller.Library;
 | 
					using MediaBrowser.Controller.Library;
 | 
				
			||||||
using MediaBrowser.Controller.Persistence;
 | 
					using MediaBrowser.Controller.Persistence;
 | 
				
			||||||
 | 
					using MediaBrowser.Controller.Session;
 | 
				
			||||||
using MediaBrowser.Model.Logging;
 | 
					using MediaBrowser.Model.Logging;
 | 
				
			||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Collections.Concurrent;
 | 
					using System.Collections.Concurrent;
 | 
				
			||||||
 | 
				
			|||||||
@ -216,7 +216,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            var filename = item.Album ?? string.Empty;
 | 
					            var filename = item.Album ?? string.Empty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            filename += album == null ? item.Id.ToString() + item.DateModified.Ticks : album.Id.ToString() + album.DateModified.Ticks;
 | 
					            filename += album == null ? item.Id.ToString("N") + item.DateModified.Ticks : album.Id.ToString() + album.DateModified.Ticks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var path = ImageCache.GetResourcePath(filename + "_primary", ".jpg");
 | 
					            var path = ImageCache.GetResourcePath(filename + "_primary", ".jpg");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -41,9 +41,6 @@ namespace MediaBrowser.Server.Implementations.Session
 | 
				
			|||||||
        private readonly ConcurrentDictionary<string, SessionInfo> _activeConnections =
 | 
					        private readonly ConcurrentDictionary<string, SessionInfo> _activeConnections =
 | 
				
			||||||
            new ConcurrentDictionary<string, SessionInfo>(StringComparer.OrdinalIgnoreCase);
 | 
					            new ConcurrentDictionary<string, SessionInfo>(StringComparer.OrdinalIgnoreCase);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private readonly ConcurrentDictionary<Guid, IWebSocketConnection> _websocketConnections =
 | 
					 | 
				
			||||||
         new ConcurrentDictionary<Guid, IWebSocketConnection>();
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Occurs when [playback start].
 | 
					        /// Occurs when [playback start].
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
@ -133,7 +130,7 @@ namespace MediaBrowser.Server.Implementations.Session
 | 
				
			|||||||
            var conn = GetConnection(clientType, deviceId, deviceName, user);
 | 
					            var conn = GetConnection(clientType, deviceId, deviceName, user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            conn.NowPlayingPositionTicks = currentPositionTicks;
 | 
					            conn.NowPlayingPositionTicks = currentPositionTicks;
 | 
				
			||||||
            conn.NowPlayingItem = DtoBuilder.GetBaseItemInfo(item);
 | 
					            conn.NowPlayingItem = item;
 | 
				
			||||||
            conn.LastActivityDate = DateTime.UtcNow;
 | 
					            conn.LastActivityDate = DateTime.UtcNow;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -149,7 +146,7 @@ namespace MediaBrowser.Server.Implementations.Session
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            var conn = GetConnection(clientType, deviceId, deviceName, user);
 | 
					            var conn = GetConnection(clientType, deviceId, deviceName, user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (conn.NowPlayingItem != null && conn.NowPlayingItem.Id.Equals(item.Id.ToString()))
 | 
					            if (conn.NowPlayingItem != null && conn.NowPlayingItem.Id == item.Id)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                conn.NowPlayingItem = null;
 | 
					                conn.NowPlayingItem = null;
 | 
				
			||||||
                conn.NowPlayingPositionTicks = null;
 | 
					                conn.NowPlayingPositionTicks = null;
 | 
				
			||||||
@ -177,7 +174,7 @@ namespace MediaBrowser.Server.Implementations.Session
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            connection.DeviceName = deviceName;
 | 
					            connection.DeviceName = deviceName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            connection.UserId = user == null ? null : user.Id.ToString();
 | 
					            connection.UserId = user == null ? (Guid?)null : user.Id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return connection;
 | 
					            return connection;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -366,7 +363,12 @@ namespace MediaBrowser.Server.Implementations.Session
 | 
				
			|||||||
        /// <param name="webSocket">The web socket.</param>
 | 
					        /// <param name="webSocket">The web socket.</param>
 | 
				
			||||||
        public void IdentifyWebSocket(Guid sessionId, IWebSocketConnection webSocket)
 | 
					        public void IdentifyWebSocket(Guid sessionId, IWebSocketConnection webSocket)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            _websocketConnections.AddOrUpdate(sessionId, webSocket, (key, existing) => webSocket);
 | 
					            var session = AllConnections.FirstOrDefault(i => i.Id == sessionId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (session != null)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                session.WebSocket = webSocket;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -326,7 +326,7 @@ namespace MediaBrowser.ServerApplication.EntryPoints
 | 
				
			|||||||
        /// <param name="e">The e.</param>
 | 
					        /// <param name="e">The e.</param>
 | 
				
			||||||
        void userManager_UserDeleted(object sender, GenericEventArgs<User> e)
 | 
					        void userManager_UserDeleted(object sender, GenericEventArgs<User> e)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            _serverManager.SendWebSocketMessage("UserDeleted", e.Argument.Id.ToString());
 | 
					            _serverManager.SendWebSocketMessage("UserDeleted", e.Argument.Id.ToString("N"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
 | 
				
			|||||||
@ -27,7 +27,7 @@ namespace MediaBrowser.WebDashboard.Api
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            Name = page.Name;
 | 
					            Name = page.Name;
 | 
				
			||||||
            ConfigurationPageType = page.ConfigurationPageType;
 | 
					            ConfigurationPageType = page.ConfigurationPageType;
 | 
				
			||||||
            PluginId = page.Plugin.Id.ToString();
 | 
					            PluginId = page.Plugin.Id.ToString("N");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -33,7 +33,7 @@ namespace MediaBrowser.WebDashboard.Api
 | 
				
			|||||||
        /// Gets or sets the active connections.
 | 
					        /// Gets or sets the active connections.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <value>The active connections.</value>
 | 
					        /// <value>The active connections.</value>
 | 
				
			||||||
        public SessionInfo[] ActiveConnections { get; set; }
 | 
					        public SessionInfoDto[] ActiveConnections { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Gets or sets the users.
 | 
					        /// Gets or sets the users.
 | 
				
			||||||
 | 
				
			|||||||
@ -210,7 +210,7 @@ namespace MediaBrowser.WebDashboard.Api
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            var dtoBuilder = new UserDtoBuilder(logger);
 | 
					            var dtoBuilder = new UserDtoBuilder(logger);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var tasks = userManager.Users.Where(u => connections.Any(c => new Guid(c.UserId) == u.Id)).Select(dtoBuilder.GetUserDto);
 | 
					            var tasks = userManager.Users.Where(u => connections.Any(c => c.UserId.HasValue && c.UserId.Value == u.Id)).Select(dtoBuilder.GetUserDto);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var users = await Task.WhenAll(tasks).ConfigureAwait(false);
 | 
					            var users = await Task.WhenAll(tasks).ConfigureAwait(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -224,7 +224,7 @@ namespace MediaBrowser.WebDashboard.Api
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                ApplicationUpdateTaskId = taskManager.ScheduledTasks.First(t => t.ScheduledTask.GetType().Name.Equals("SystemUpdateTask", StringComparison.OrdinalIgnoreCase)).Id,
 | 
					                ApplicationUpdateTaskId = taskManager.ScheduledTasks.First(t => t.ScheduledTask.GetType().Name.Equals("SystemUpdateTask", StringComparison.OrdinalIgnoreCase)).Id,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                ActiveConnections = connections,
 | 
					                ActiveConnections = connections.Select(SessionInfoDtoBuilder.GetSessionInfoDto).ToArray(),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Users = users.ToArray()
 | 
					                Users = users.ToArray()
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@
 | 
				
			|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
 | 
					<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
 | 
				
			||||||
    <metadata>
 | 
					    <metadata>
 | 
				
			||||||
        <id>MediaBrowser.Common.Internal</id>
 | 
					        <id>MediaBrowser.Common.Internal</id>
 | 
				
			||||||
        <version>3.0.94</version>
 | 
					        <version>3.0.97</version>
 | 
				
			||||||
        <title>MediaBrowser.Common.Internal</title>
 | 
					        <title>MediaBrowser.Common.Internal</title>
 | 
				
			||||||
        <authors>Luke</authors>
 | 
					        <authors>Luke</authors>
 | 
				
			||||||
        <owners>ebr,Luke,scottisafool</owners>
 | 
					        <owners>ebr,Luke,scottisafool</owners>
 | 
				
			||||||
@ -12,9 +12,9 @@
 | 
				
			|||||||
        <description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
 | 
					        <description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
 | 
				
			||||||
        <copyright>Copyright © Media Browser 2013</copyright>
 | 
					        <copyright>Copyright © Media Browser 2013</copyright>
 | 
				
			||||||
        <dependencies>
 | 
					        <dependencies>
 | 
				
			||||||
            <dependency id="MediaBrowser.Common" version="3.0.94" />
 | 
					            <dependency id="MediaBrowser.Common" version="3.0.97" />
 | 
				
			||||||
            <dependency id="NLog" version="2.0.1.2" />
 | 
					            <dependency id="NLog" version="2.0.1.2" />
 | 
				
			||||||
            <dependency id="ServiceStack.Text" version="3.9.94" />
 | 
					            <dependency id="ServiceStack.Text" version="3.9.97" />
 | 
				
			||||||
            <dependency id="SimpleInjector" version="2.2.1" />
 | 
					            <dependency id="SimpleInjector" version="2.2.1" />
 | 
				
			||||||
        </dependencies>
 | 
					        </dependencies>
 | 
				
			||||||
    </metadata>
 | 
					    </metadata>
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@
 | 
				
			|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 | 
					<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 | 
				
			||||||
    <metadata>
 | 
					    <metadata>
 | 
				
			||||||
        <id>MediaBrowser.Common</id>
 | 
					        <id>MediaBrowser.Common</id>
 | 
				
			||||||
        <version>3.0.94</version>
 | 
					        <version>3.0.97</version>
 | 
				
			||||||
        <title>MediaBrowser.Common</title>
 | 
					        <title>MediaBrowser.Common</title>
 | 
				
			||||||
        <authors>Media Browser Team</authors>
 | 
					        <authors>Media Browser Team</authors>
 | 
				
			||||||
        <owners>ebr,Luke,scottisafool</owners>
 | 
					        <owners>ebr,Luke,scottisafool</owners>
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@
 | 
				
			|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 | 
					<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 | 
				
			||||||
    <metadata>
 | 
					    <metadata>
 | 
				
			||||||
        <id>MediaBrowser.Server.Core</id>
 | 
					        <id>MediaBrowser.Server.Core</id>
 | 
				
			||||||
        <version>3.0.94</version>
 | 
					        <version>3.0.97</version>
 | 
				
			||||||
        <title>Media Browser.Server.Core</title>
 | 
					        <title>Media Browser.Server.Core</title>
 | 
				
			||||||
        <authors>Media Browser Team</authors>
 | 
					        <authors>Media Browser Team</authors>
 | 
				
			||||||
        <owners>ebr,Luke,scottisafool</owners>
 | 
					        <owners>ebr,Luke,scottisafool</owners>
 | 
				
			||||||
@ -12,7 +12,7 @@
 | 
				
			|||||||
        <description>Contains core components required to build plugins for Media Browser Server.</description>
 | 
					        <description>Contains core components required to build plugins for Media Browser Server.</description>
 | 
				
			||||||
        <copyright>Copyright © Media Browser 2013</copyright>
 | 
					        <copyright>Copyright © Media Browser 2013</copyright>
 | 
				
			||||||
        <dependencies>
 | 
					        <dependencies>
 | 
				
			||||||
            <dependency id="MediaBrowser.Common" version="3.0.94" />
 | 
					            <dependency id="MediaBrowser.Common" version="3.0.97" />
 | 
				
			||||||
        </dependencies>
 | 
					        </dependencies>
 | 
				
			||||||
    </metadata>
 | 
					    </metadata>
 | 
				
			||||||
    <files>
 | 
					    <files>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user