added ability to track web sockets per session

This commit is contained in:
Luke Pulverenti
2013-05-09 13:38:02 -04:00
parent f57cec4cff
commit e1f8c18b51
23 changed files with 664 additions and 401 deletions

View File

@@ -832,6 +832,7 @@ namespace MediaBrowser.Controller.Dto
{
Id = GetClientItemId(item),
Name = item.Name,
MediaType = item.MediaType,
Type = item.GetType().Name,
IsFolder = item.IsFolder,
RunTimeTicks = item.RunTimeTicks
@@ -844,16 +845,6 @@ namespace MediaBrowser.Controller.Dto
info.PrimaryImageTag = Kernel.Instance.ImageManager.GetImageCacheTag(item, ImageType.Primary, imagePath);
}
if (item.BackdropImagePaths != null && item.BackdropImagePaths.Count > 0)
{
imagePath = item.BackdropImagePaths[0];
if (!string.IsNullOrEmpty(imagePath))
{
info.BackdropImageTag = Kernel.Instance.ImageManager.GetImageCacheTag(item, ImageType.Backdrop, imagePath);
}
}
return info;
}

View File

@@ -683,7 +683,7 @@ namespace MediaBrowser.Controller.Entities
/// Loads local trailers from the file system
/// </summary>
/// <returns>List{Video}.</returns>
private List<Trailer> LoadLocalTrailers()
private IEnumerable<Trailer> LoadLocalTrailers()
{
if (LocationType != LocationType.FileSystem)
{
@@ -746,7 +746,7 @@ namespace MediaBrowser.Controller.Entities
/// Loads the theme songs.
/// </summary>
/// <returns>List{Audio.Audio}.</returns>
private List<Audio.Audio> LoadThemeSongs()
private IEnumerable<Audio.Audio> LoadThemeSongs()
{
if (LocationType != LocationType.FileSystem)
{
@@ -809,7 +809,7 @@ namespace MediaBrowser.Controller.Entities
/// Loads the video backdrops.
/// </summary>
/// <returns>List{Video}.</returns>
private List<Video> LoadThemeVideos()
private IEnumerable<Video> LoadThemeVideos()
{
if (LocationType != LocationType.FileSystem)
{

View File

@@ -1,6 +1,5 @@
using MediaBrowser.Common.Events;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Connectivity;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -19,12 +18,6 @@ namespace MediaBrowser.Controller.Library
/// <value>The users.</value>
IEnumerable<User> Users { get; }
/// <summary>
/// Gets the active connections.
/// </summary>
/// <value>The active connections.</value>
IEnumerable<ClientConnectionInfo> RecentConnections { get; }
/// <summary>
/// Occurs when [playback start].
/// </summary>
@@ -67,17 +60,6 @@ namespace MediaBrowser.Controller.Library
/// <exception cref="System.ArgumentNullException">user</exception>
Task<bool> AuthenticateUser(User user, string password);
/// <summary>
/// Logs the user activity.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="clientType">Type of the client.</param>
/// <param name="deviceId">The device id.</param>
/// <param name="deviceName">Name of the device.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException">user</exception>
Task LogUserActivity(User user, string clientType, string deviceId, string deviceName);
/// <summary>
/// Refreshes metadata for each user
/// </summary>
@@ -122,43 +104,6 @@ namespace MediaBrowser.Controller.Library
/// <exception cref="System.ArgumentException"></exception>
Task DeleteUser(User user);
/// <summary>
/// Used to report that playback has started for an item
/// </summary>
/// <param name="user">The user.</param>
/// <param name="item">The item.</param>
/// <param name="clientType">Type of the client.</param>
/// <param name="deviceId">The device id.</param>
/// <param name="deviceName">Name of the device.</param>
/// <exception cref="System.ArgumentNullException"></exception>
void OnPlaybackStart(User user, BaseItem item, string clientType, string deviceId, string deviceName);
/// <summary>
/// Used to report playback progress for an item
/// </summary>
/// <param name="user">The user.</param>
/// <param name="item">The item.</param>
/// <param name="positionTicks">The position ticks.</param>
/// <param name="clientType">Type of the client.</param>
/// <param name="deviceId">The device id.</param>
/// <param name="deviceName">Name of the device.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
Task OnPlaybackProgress(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName);
/// <summary>
/// Used to report that playback has ended for an item
/// </summary>
/// <param name="user">The user.</param>
/// <param name="item">The item.</param>
/// <param name="positionTicks">The position ticks.</param>
/// <param name="clientType">Type of the client.</param>
/// <param name="deviceId">The device id.</param>
/// <param name="deviceName">Name of the device.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
Task OnPlaybackStopped(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName);
/// <summary>
/// Resets the password.
/// </summary>

View File

@@ -70,6 +70,7 @@
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Configuration\IServerConfigurationManager.cs" />
<Compile Include="Session\ISessionManager.cs" />
<Compile Include="Drawing\ImageExtensions.cs" />
<Compile Include="Drawing\ImageHeader.cs" />
<Compile Include="Drawing\ImageManager.cs" />

View File

@@ -0,0 +1,90 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Controller.Session
{
/// <summary>
/// Interface ISessionManager
/// </summary>
public interface ISessionManager
{
/// <summary>
/// Occurs when [playback start].
/// </summary>
event EventHandler<PlaybackProgressEventArgs> PlaybackStart;
/// <summary>
/// Occurs when [playback progress].
/// </summary>
event EventHandler<PlaybackProgressEventArgs> PlaybackProgress;
/// <summary>
/// Occurs when [playback stopped].
/// </summary>
event EventHandler<PlaybackProgressEventArgs> PlaybackStopped;
/// <summary>
/// Gets all connections.
/// </summary>
/// <value>All connections.</value>
IEnumerable<SessionInfo> AllConnections { get; }
/// <summary>
/// Gets the active connections.
/// </summary>
/// <value>The active connections.</value>
IEnumerable<SessionInfo> RecentConnections { get; }
/// <summary>
/// Logs the user activity.
/// </summary>
/// <param name="clientType">Type of the client.</param>
/// <param name="deviceId">The device id.</param>
/// <param name="deviceName">Name of the device.</param>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException">user</exception>
Task LogConnectionActivity(string clientType, string deviceId, string deviceName, User user);
/// <summary>
/// Used to report that playback has started for an item
/// </summary>
/// <param name="user">The user.</param>
/// <param name="item">The item.</param>
/// <param name="clientType">Type of the client.</param>
/// <param name="deviceId">The device id.</param>
/// <param name="deviceName">Name of the device.</param>
/// <exception cref="System.ArgumentNullException"></exception>
void OnPlaybackStart(User user, BaseItem item, string clientType, string deviceId, string deviceName);
/// <summary>
/// Used to report playback progress for an item
/// </summary>
/// <param name="user">The user.</param>
/// <param name="item">The item.</param>
/// <param name="positionTicks">The position ticks.</param>
/// <param name="clientType">Type of the client.</param>
/// <param name="deviceId">The device id.</param>
/// <param name="deviceName">Name of the device.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
Task OnPlaybackProgress(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName);
/// <summary>
/// Used to report that playback has ended for an item
/// </summary>
/// <param name="user">The user.</param>
/// <param name="item">The item.</param>
/// <param name="positionTicks">The position ticks.</param>
/// <param name="clientType">Type of the client.</param>
/// <param name="deviceId">The device id.</param>
/// <param name="deviceName">Name of the device.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
Task OnPlaybackStopped(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName);
}
}