aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api')
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs124
-rw-r--r--MediaBrowser.Api/Playback/Hls/BaseHlsService.cs13
-rw-r--r--MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs5
-rw-r--r--MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs43
-rw-r--r--MediaBrowser.Api/Playback/StreamState.cs72
-rw-r--r--MediaBrowser.Api/SessionsService.cs8
-rw-r--r--MediaBrowser.Api/UserLibrary/ArtistsService.cs8
-rw-r--r--MediaBrowser.Api/UserLibrary/UserLibraryService.cs28
-rw-r--r--MediaBrowser.Api/UserService.cs2
-rw-r--r--MediaBrowser.Api/WebSocket/SessionInfoWebSocketListener.cs8
10 files changed, 245 insertions, 66 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index a9aaab00c..612f73191 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -1,5 +1,4 @@
-using System.Text;
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
@@ -22,6 +21,7 @@ using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -937,8 +937,6 @@ namespace MediaBrowser.Api.Playback
ApiEntryPoint.Instance.OnTranscodeFailedToStart(outputPath, TranscodingJobType);
- state.LogFileStream.Dispose();
-
throw;
}
@@ -1096,23 +1094,12 @@ namespace MediaBrowser.Api.Playback
/// </summary>
/// <param name="process">The process.</param>
/// <param name="state">The state.</param>
- protected async void OnFfMpegProcessExited(Process process, StreamState state)
+ protected void OnFfMpegProcessExited(Process process, StreamState state)
{
- if (state.IsoMount != null)
- {
- state.IsoMount.Dispose();
- state.IsoMount = null;
- }
-
- if (state.StandardInputCancellationTokenSource != null)
- {
- state.StandardInputCancellationTokenSource.Cancel();
- }
+ state.Dispose();
var outputFilePath = GetOutputFilePath(state);
- state.LogFileStream.Dispose();
-
try
{
Logger.Info("FFMpeg exited with code {0} for {1}", process.ExitCode, outputFilePath);
@@ -1121,18 +1108,6 @@ namespace MediaBrowser.Api.Playback
{
Logger.Info("FFMpeg exited with an error for {0}", outputFilePath);
}
-
- if (!string.IsNullOrEmpty(state.LiveTvStreamId))
- {
- try
- {
- await LiveTvManager.CloseLiveStream(state.LiveTvStreamId, CancellationToken.None).ConfigureAwait(false);
- }
- catch (Exception ex)
- {
- Logger.ErrorException("Error closing live tv stream", ex);
- }
- }
}
protected double? GetFramerateParam(StreamState state)
@@ -1357,7 +1332,7 @@ namespace MediaBrowser.Api.Playback
request.AudioCodec = InferAudioCodec(url);
}
- var state = new StreamState
+ var state = new StreamState(LiveTvManager, Logger)
{
Request = request,
RequestedUrl = url
@@ -1393,7 +1368,7 @@ namespace MediaBrowser.Api.Playback
mediaUrl = streamInfo.Url;
}
- if (!string.IsNullOrEmpty(path) && File.Exists(path))
+ if (!string.IsNullOrEmpty(path))
{
state.MediaPath = path;
state.IsRemote = false;
@@ -1406,7 +1381,7 @@ namespace MediaBrowser.Api.Playback
state.RunTimeTicks = recording.RunTimeTicks;
- if (recording.RecordingInfo.Status == RecordingStatus.InProgress && !state.IsRemote)
+ if (recording.RecordingInfo.Status == RecordingStatus.InProgress)
{
await Task.Delay(1000, cancellationToken).ConfigureAwait(false);
}
@@ -1429,7 +1404,7 @@ namespace MediaBrowser.Api.Playback
state.LiveTvStreamId = streamInfo.Id;
- if (!string.IsNullOrEmpty(streamInfo.Path) && File.Exists(streamInfo.Path))
+ if (!string.IsNullOrEmpty(streamInfo.Path))
{
state.MediaPath = streamInfo.Path;
state.IsRemote = false;
@@ -1515,6 +1490,14 @@ namespace MediaBrowser.Api.Playback
}
}
+ if (state.AudioStream != null)
+ {
+ //if (CanStreamCopyAudio(request, state.AudioStream))
+ //{
+ // request.AudioCodec = "copy";
+ //}
+ }
+
return state;
}
@@ -1538,7 +1521,7 @@ namespace MediaBrowser.Api.Playback
}
// If client is requesting a specific video profile, it must match the source
- if (!string.IsNullOrEmpty(request.Profile) && !string.Equals(request.Profile, videoStream.Profile))
+ if (!string.IsNullOrEmpty(request.Profile) && !string.Equals(request.Profile, videoStream.Profile, StringComparison.OrdinalIgnoreCase))
{
return false;
}
@@ -1599,12 +1582,50 @@ namespace MediaBrowser.Api.Playback
return false;
}
}
- return false;
}
return SupportsAutomaticVideoStreamCopy;
}
+ private bool CanStreamCopyAudio(StreamRequest request, MediaStream audioStream)
+ {
+ // Source and target codecs must match
+ if (string.IsNullOrEmpty(request.AudioCodec) || !string.Equals(request.AudioCodec, audioStream.Codec, StringComparison.OrdinalIgnoreCase))
+ {
+ return false;
+ }
+
+ // Video bitrate must fall within requested value
+ if (request.AudioBitRate.HasValue)
+ {
+ if (!audioStream.BitRate.HasValue || audioStream.BitRate.Value > request.AudioBitRate.Value)
+ {
+ return false;
+ }
+ }
+
+ // Channels must fall within requested value
+ var channels = request.AudioChannels ?? request.MaxAudioChannels;
+ if (channels.HasValue)
+ {
+ if (!audioStream.Channels.HasValue || audioStream.Channels.Value > channels.Value)
+ {
+ return false;
+ }
+ }
+
+ // Sample rate must fall within requested value
+ if (request.AudioSampleRate.HasValue)
+ {
+ if (!audioStream.SampleRate.HasValue || audioStream.SampleRate.Value > request.AudioSampleRate.Value)
+ {
+ return false;
+ }
+ }
+
+ return SupportsAutomaticVideoStreamCopy;
+ }
+
protected virtual bool SupportsAutomaticVideoStreamCopy
{
get
@@ -1722,7 +1743,21 @@ namespace MediaBrowser.Api.Playback
// 0 = native, 1 = transcoded
var orgCi = isStaticallyStreamed ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1";
- const string dlnaflags = ";DLNA.ORG_FLAGS=01500000000000000000000000000000";
+ var flagValue = DlnaFlags.DLNA_ORG_FLAG_STREAMING_TRANSFER_MODE |
+ DlnaFlags.DLNA_ORG_FLAG_BACKGROUND_TRANSFERT_MODE |
+ DlnaFlags.DLNA_ORG_FLAG_DLNA_V15;
+
+ if (isStaticallyStreamed)
+ {
+ //flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_BYTE_BASED_SEEK;
+ }
+ else if (state.RunTimeTicks.HasValue)
+ {
+ //flagValue = flagValue | DlnaFlags.DLNA_ORG_FLAG_TIME_BASED_SEEK;
+ }
+
+ var dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}000000000000000000000000",
+ Enum.Format(typeof(DlnaFlags), flagValue, "x"));
if (!string.IsNullOrWhiteSpace(state.OrgPn))
{
@@ -1772,6 +1807,23 @@ namespace MediaBrowser.Api.Playback
}
}
+ [Flags]
+ private enum DlnaFlags
+ {
+ DLNA_ORG_FLAG_SENDER_PACED = (1 << 31),
+ DLNA_ORG_FLAG_TIME_BASED_SEEK = (1 << 30),
+ DLNA_ORG_FLAG_BYTE_BASED_SEEK = (1 << 29),
+ DLNA_ORG_FLAG_PLAY_CONTAINER = (1 << 28),
+ DLNA_ORG_FLAG_S0_INCREASE = (1 << 27),
+ DLNA_ORG_FLAG_SN_INCREASE = (1 << 26),
+ DLNA_ORG_FLAG_RTSP_PAUSE = (1 << 25),
+ DLNA_ORG_FLAG_STREAMING_TRANSFER_MODE = (1 << 24),
+ DLNA_ORG_FLAG_INTERACTIVE_TRANSFERT_MODE = (1 << 23),
+ DLNA_ORG_FLAG_BACKGROUND_TRANSFERT_MODE = (1 << 22),
+ DLNA_ORG_FLAG_CONNECTION_STALL = (1 << 21),
+ DLNA_ORG_FLAG_DLNA_V15 = (1 << 20),
+ };
+
private void AddTimeSeekResponseHeaders(StreamState state, IDictionary<string, string> responseHeaders)
{
var runtimeSeconds = TimeSpan.FromTicks(state.RunTimeTicks.Value).TotalSeconds.ToString(UsCulture);
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 1a190b75e..6e71e503f 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -93,10 +93,12 @@ namespace MediaBrowser.Api.Playback.Hls
if (!state.VideoRequest.VideoBitRate.HasValue && (string.IsNullOrEmpty(state.VideoRequest.VideoCodec) || !string.Equals(state.VideoRequest.VideoCodec, "copy", StringComparison.OrdinalIgnoreCase)))
{
+ state.Dispose();
throw new ArgumentException("A video bitrate is required");
}
if (!state.Request.AudioBitRate.HasValue && (string.IsNullOrEmpty(state.Request.AudioCodec) || !string.Equals(state.Request.AudioCodec, "copy", StringComparison.OrdinalIgnoreCase)))
{
+ state.Dispose();
throw new ArgumentException("An audio bitrate is required");
}
@@ -107,7 +109,16 @@ namespace MediaBrowser.Api.Playback.Hls
if (!File.Exists(playlist))
{
isPlaylistNewlyCreated = true;
- await StartFfMpeg(state, playlist).ConfigureAwait(false);
+
+ try
+ {
+ await StartFfMpeg(state, playlist).ConfigureAwait(false);
+ }
+ catch
+ {
+ state.Dispose();
+ throw;
+ }
}
else
{
diff --git a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
index 5d2dd07c7..2099bcd3a 100644
--- a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
+++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
@@ -103,7 +103,10 @@ namespace MediaBrowser.Api.Playback.Hls
.Where(i => i.IndexOf(normalizedPlaylistId, StringComparison.OrdinalIgnoreCase) != -1)
.ToList())
{
- ExtendPlaylistTimer(playlist);
+ if (!string.IsNullOrEmpty(playlist))
+ {
+ ExtendPlaylistTimer(playlist);
+ }
}
}
diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
index b4fe9a094..29ad3e500 100644
--- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
@@ -121,11 +121,19 @@ namespace MediaBrowser.Api.Playback.Progressive
var responseHeaders = new Dictionary<string, string>();
+ // Static remote stream
if (request.Static && state.IsRemote)
{
AddDlnaHeaders(state, responseHeaders, true);
- return GetStaticRemoteStreamResult(state.MediaPath, responseHeaders, isHeadRequest).Result;
+ try
+ {
+ return GetStaticRemoteStreamResult(state.MediaPath, responseHeaders, isHeadRequest).Result;
+ }
+ finally
+ {
+ state.Dispose();
+ }
}
var outputPath = GetOutputFilePath(state);
@@ -136,21 +144,47 @@ namespace MediaBrowser.Api.Playback.Progressive
AddDlnaHeaders(state, responseHeaders, isStatic);
+ // Static stream
if (request.Static)
{
var contentType = state.GetMimeType(state.MediaPath);
- return ResultFactory.GetStaticFileResult(Request, state.MediaPath, contentType, FileShare.Read, responseHeaders, isHeadRequest);
+ try
+ {
+ return ResultFactory.GetStaticFileResult(Request, state.MediaPath, contentType, FileShare.Read, responseHeaders, isHeadRequest);
+ }
+ finally
+ {
+ state.Dispose();
+ }
}
+ // Not static but transcode cache file exists
if (outputPathExists && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive))
{
var contentType = state.GetMimeType(outputPath);
- return ResultFactory.GetStaticFileResult(Request, outputPath, contentType, FileShare.Read, responseHeaders, isHeadRequest);
+ try
+ {
+ return ResultFactory.GetStaticFileResult(Request, outputPath, contentType, FileShare.Read, responseHeaders, isHeadRequest);
+ }
+ finally
+ {
+ state.Dispose();
+ }
+ }
+
+ // Need to start ffmpeg
+ try
+ {
+ return GetStreamResult(state, responseHeaders, isHeadRequest).Result;
}
+ catch
+ {
+ state.Dispose();
- return GetStreamResult(state, responseHeaders, isHeadRequest).Result;
+ throw;
+ }
}
/// <summary>
@@ -251,6 +285,7 @@ namespace MediaBrowser.Api.Playback.Progressive
else
{
ApiEntryPoint.Instance.OnTranscodeBeginRequest(outputPath, TranscodingJobType.Progressive);
+ state.Dispose();
}
var result = new ProgressiveStreamWriter(outputPath, Logger, FileSystem);
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs
index bde5fe30d..ce7d79917 100644
--- a/MediaBrowser.Api/Playback/StreamState.cs
+++ b/MediaBrowser.Api/Playback/StreamState.cs
@@ -1,15 +1,21 @@
using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
+using MediaBrowser.Model.Logging;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
namespace MediaBrowser.Api.Playback
{
- public class StreamState
+ public class StreamState : IDisposable
{
+ private readonly ILogger _logger;
+ private readonly ILiveTvManager _liveTvManager;
+
public string RequestedUrl { get; set; }
public StreamRequest Request { get; set; }
@@ -51,8 +57,6 @@ namespace MediaBrowser.Api.Playback
public bool HasMediaStreams { get; set; }
- public CancellationTokenSource StandardInputCancellationTokenSource { get; set; }
-
public string LiveTvStreamId { get; set; }
public int SegmentLength = 10;
@@ -63,6 +67,12 @@ namespace MediaBrowser.Api.Playback
public string AudioSync = "1";
public string VideoSync = "vfr";
+ public StreamState(ILiveTvManager liveTvManager, ILogger logger)
+ {
+ _liveTvManager = liveTvManager;
+ _logger = logger;
+ }
+
public string InputAudioSync { get; set; }
public string InputVideoSync { get; set; }
@@ -93,5 +103,61 @@ namespace MediaBrowser.Api.Playback
return MimeTypes.GetMimeType(outputPath);
}
+
+ public void Dispose()
+ {
+ DisposeLiveStream();
+ DisposeLogStream();
+ DisposeIsoMount();
+ }
+
+ private void DisposeLogStream()
+ {
+ if (LogFileStream != null)
+ {
+ try
+ {
+ LogFileStream.Dispose();
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error disposing log stream", ex);
+ }
+
+ LogFileStream = null;
+ }
+ }
+
+ private void DisposeIsoMount()
+ {
+ if (IsoMount != null)
+ {
+ try
+ {
+ IsoMount.Dispose();
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error disposing iso mount", ex);
+ }
+
+ IsoMount = null;
+ }
+ }
+
+ private async void DisposeLiveStream()
+ {
+ if (!string.IsNullOrEmpty(LiveTvStreamId))
+ {
+ try
+ {
+ await _liveTvManager.CloseLiveStream(LiveTvStreamId, CancellationToken.None).ConfigureAwait(false);
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error closing live tv stream", ex);
+ }
+ }
+ }
}
}
diff --git a/MediaBrowser.Api/SessionsService.cs b/MediaBrowser.Api/SessionsService.cs
index d1d0f742f..5c1c71641 100644
--- a/MediaBrowser.Api/SessionsService.cs
+++ b/MediaBrowser.Api/SessionsService.cs
@@ -245,18 +245,16 @@ namespace MediaBrowser.Api
/// </summary>
private readonly ISessionManager _sessionManager;
- private readonly IDtoService _dtoService;
private readonly IUserManager _userManager;
/// <summary>
/// Initializes a new instance of the <see cref="SessionsService" /> class.
/// </summary>
/// <param name="sessionManager">The session manager.</param>
- /// <param name="dtoService">The dto service.</param>
- public SessionsService(ISessionManager sessionManager, IDtoService dtoService, IUserManager userManager)
+ /// <param name="userManager">The user manager.</param>
+ public SessionsService(ISessionManager sessionManager, IUserManager userManager)
{
_sessionManager = sessionManager;
- _dtoService = dtoService;
_userManager = userManager;
}
@@ -289,7 +287,7 @@ namespace MediaBrowser.Api
}
}
- return ToOptimizedResult(result.Select(_dtoService.GetSessionInfoDto).ToList());
+ return ToOptimizedResult(result.Select(_sessionManager.GetSessionInfoDto).ToList());
}
public void Post(SendPlaystateCommand request)
diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs
index 9972ac3ef..5ca0d75ac 100644
--- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs
@@ -15,14 +15,12 @@ namespace MediaBrowser.Api.UserLibrary
/// <summary>
/// Class GetArtists
/// </summary>
- [Route("/Artists", "GET")]
- [Api(Description = "Gets all artists from a given item, folder, or the entire library")]
+ [Route("/Artists", "GET", Summary = "Gets all artists from a given item, folder, or the entire library")]
public class GetArtists : GetItemsByName
{
}
- [Route("/Artists/{Name}", "GET")]
- [Api(Description = "Gets an artist, by name")]
+ [Route("/Artists/{Name}", "GET", Summary = "Gets an artist, by name")]
public class GetArtist : IReturn<BaseItemDto>
{
/// <summary>
@@ -112,7 +110,7 @@ namespace MediaBrowser.Api.UserLibrary
protected override IEnumerable<MusicArtist> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items)
{
return items
- .OfType<Audio>()
+ .OfType<IHasArtist>()
.SelectMany(i => i.AllArtists)
.Distinct(StringComparer.OrdinalIgnoreCase)
.Select(name =>
diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
index a49f957f6..a7e5c71e7 100644
--- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
+++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs
@@ -257,6 +257,12 @@ namespace MediaBrowser.Api.UserLibrary
/// <value>The id.</value>
[ApiMember(Name = "QueueableMediaTypes", Description = "A list of media types that can be queued from this item, comma delimited. Audio,Video,Book,Game", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST", AllowMultiple = true)]
public string QueueableMediaTypes { get; set; }
+
+ [ApiMember(Name = "AudioStreamIndex", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
+ public int? AudioStreamIndex { get; set; }
+
+ [ApiMember(Name = "SubtitleStreamIndex", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
+ public int? SubtitleStreamIndex { get; set; }
}
/// <summary>
@@ -282,7 +288,7 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "MediaSourceId", Description = "The id of the MediaSource", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MediaSourceId { get; set; }
-
+
/// <summary>
/// Gets or sets the position ticks.
/// </summary>
@@ -295,6 +301,15 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "IsMuted", Description = "Indicates if the player is muted.", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "POST")]
public bool IsMuted { get; set; }
+
+ [ApiMember(Name = "AudioStreamIndex", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
+ public int? AudioStreamIndex { get; set; }
+
+ [ApiMember(Name = "SubtitleStreamIndex", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
+ public int? SubtitleStreamIndex { get; set; }
+
+ [ApiMember(Name = "VolumeLevel", Description = "Scale of 0-100", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
+ public int? VolumeLevel { get; set; }
}
/// <summary>
@@ -320,7 +335,7 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "MediaSourceId", Description = "The id of the MediaSource", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "DELETE")]
public string MediaSourceId { get; set; }
-
+
/// <summary>
/// Gets or sets the position ticks.
/// </summary>
@@ -737,7 +752,9 @@ namespace MediaBrowser.Api.UserLibrary
Item = item,
SessionId = GetSession(_sessionManager).Id,
QueueableMediaTypes = queueableMediaTypes.Split(',').ToList(),
- MediaSourceId = request.MediaSourceId
+ MediaSourceId = request.MediaSourceId,
+ AudioStreamIndex = request.AudioStreamIndex,
+ SubtitleStreamIndex = request.SubtitleStreamIndex
};
_sessionManager.OnPlaybackStart(info);
@@ -760,7 +777,10 @@ namespace MediaBrowser.Api.UserLibrary
IsMuted = request.IsMuted,
IsPaused = request.IsPaused,
SessionId = GetSession(_sessionManager).Id,
- MediaSourceId = request.MediaSourceId
+ MediaSourceId = request.MediaSourceId,
+ AudioStreamIndex = request.AudioStreamIndex,
+ SubtitleStreamIndex = request.SubtitleStreamIndex,
+ VolumeLevel = request.VolumeLevel
};
var task = _sessionManager.OnPlaybackProgress(info);
diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs
index 2f1b16107..87ee563be 100644
--- a/MediaBrowser.Api/UserService.cs
+++ b/MediaBrowser.Api/UserService.cs
@@ -323,7 +323,7 @@ namespace MediaBrowser.Api
var result = new AuthenticationResult
{
User = _dtoService.GetUserDto(user),
- SessionInfo = _dtoService.GetSessionInfoDto(session)
+ SessionInfo = _sessionMananger.GetSessionInfoDto(session)
};
return result;
diff --git a/MediaBrowser.Api/WebSocket/SessionInfoWebSocketListener.cs b/MediaBrowser.Api/WebSocket/SessionInfoWebSocketListener.cs
index 25acd613c..721d8976b 100644
--- a/MediaBrowser.Api/WebSocket/SessionInfoWebSocketListener.cs
+++ b/MediaBrowser.Api/WebSocket/SessionInfoWebSocketListener.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Common.Net;
-using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Session;
@@ -14,8 +13,6 @@ namespace MediaBrowser.Api.WebSocket
/// </summary>
class SessionInfoWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<SessionInfoDto>, object>
{
- private readonly IDtoService _dtoService;
-
/// <summary>
/// Gets the name.
/// </summary>
@@ -35,11 +32,10 @@ namespace MediaBrowser.Api.WebSocket
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="sessionManager">The session manager.</param>
- public SessionInfoWebSocketListener(ILogger logger, ISessionManager sessionManager, IDtoService dtoService)
+ public SessionInfoWebSocketListener(ILogger logger, ISessionManager sessionManager)
: base(logger)
{
_sessionManager = sessionManager;
- _dtoService = dtoService;
}
/// <summary>
@@ -49,7 +45,7 @@ namespace MediaBrowser.Api.WebSocket
/// <returns>Task{SystemInfo}.</returns>
protected override Task<IEnumerable<SessionInfoDto>> GetDataToSend(object state)
{
- return Task.FromResult(_sessionManager.Sessions.Where(i => i.IsActive).Select(_dtoService.GetSessionInfoDto));
+ return Task.FromResult(_sessionManager.Sessions.Where(i => i.IsActive).Select(_sessionManager.GetSessionInfoDto));
}
}
}