update video player layout
This commit is contained in:
parent
b1dd6365da
commit
608ebf4829
|
@ -324,6 +324,35 @@ namespace MediaBrowser.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Kills the transcoding jobs.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceId">The device identifier.</param>
|
||||||
|
/// <param name="outputPath">The output path.</param>
|
||||||
|
/// <param name="deleteMode">The delete mode.</param>
|
||||||
|
/// <exception cref="System.ArgumentNullException">deviceId</exception>
|
||||||
|
internal void KillTranscodingJobs(string deviceId, string outputPath, FileDeleteMode deleteMode)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(deviceId))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("deviceId");
|
||||||
|
}
|
||||||
|
|
||||||
|
var jobs = new List<TranscodingJob>();
|
||||||
|
|
||||||
|
lock (_activeTranscodingJobs)
|
||||||
|
{
|
||||||
|
// This is really only needed for HLS.
|
||||||
|
// Progressive streams can stop on their own reliably
|
||||||
|
jobs.AddRange(_activeTranscodingJobs.Where(i => string.Equals(deviceId, i.DeviceId, StringComparison.OrdinalIgnoreCase) && string.Equals(outputPath, i.Path, StringComparison.OrdinalIgnoreCase)));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var job in jobs)
|
||||||
|
{
|
||||||
|
KillTranscodingJob(job, deleteMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kills the transcoding job.
|
/// Kills the transcoding job.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -443,6 +472,8 @@ namespace MediaBrowser.Api
|
||||||
.Where(f => f.IndexOf(name, StringComparison.OrdinalIgnoreCase) != -1)
|
.Where(f => f.IndexOf(name, StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
Exception e = null;
|
||||||
|
|
||||||
foreach (var file in filesToDelete)
|
foreach (var file in filesToDelete)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -452,9 +483,15 @@ namespace MediaBrowser.Api
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
e = ex;
|
||||||
Logger.ErrorException("Error deleting HLS file {0}", ex, file);
|
Logger.ErrorException("Error deleting HLS file {0}", ex, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e != null)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,11 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
var outputFileExtension = GetOutputFileExtension(state);
|
var outputFileExtension = GetOutputFileExtension(state);
|
||||||
|
|
||||||
return Path.Combine(folder, GetCommandLineArguments("dummy\\dummy", state, false).GetMD5() + (outputFileExtension ?? string.Empty).ToLower());
|
var data = GetCommandLineArguments("dummy\\dummy", state, false);
|
||||||
|
|
||||||
|
data += "-" + (state.Request.DeviceId ?? string.Empty);
|
||||||
|
|
||||||
|
return Path.Combine(folder, data.GetMD5().ToString("N") + (outputFileExtension ?? string.Empty).ToLower());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||||
|
@ -772,7 +776,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="state">The state.</param>
|
/// <param name="state">The state.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
protected string GetInputArgument(StreamState state)
|
protected virtual string GetInputArgument(StreamState state)
|
||||||
{
|
{
|
||||||
var protocol = state.InputProtocol;
|
var protocol = state.InputProtocol;
|
||||||
|
|
||||||
|
@ -789,6 +793,58 @@ namespace MediaBrowser.Api.Playback
|
||||||
return MediaEncoder.GetInputArgument(inputPath, protocol);
|
return MediaEncoder.GetInputArgument(inputPath, protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task AcquireResources(StreamState state, CancellationTokenSource cancellationTokenSource)
|
||||||
|
{
|
||||||
|
if (state.VideoType == VideoType.Iso && state.IsoType.HasValue && IsoManager.CanMount(state.MediaPath))
|
||||||
|
{
|
||||||
|
state.IsoMount = await IsoManager.Mount(state.MediaPath, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(state.MediaPath))
|
||||||
|
{
|
||||||
|
if (string.Equals(state.ItemType, typeof(LiveTvChannel).Name))
|
||||||
|
{
|
||||||
|
var streamInfo = await LiveTvManager.GetChannelStream(state.Request.Id, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||||
|
|
||||||
|
state.LiveTvStreamId = streamInfo.Id;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(streamInfo.Path))
|
||||||
|
{
|
||||||
|
state.MediaPath = streamInfo.Path;
|
||||||
|
state.InputProtocol = MediaProtocol.File;
|
||||||
|
|
||||||
|
await Task.Delay(1000, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrEmpty(streamInfo.Url))
|
||||||
|
{
|
||||||
|
state.MediaPath = streamInfo.Url;
|
||||||
|
state.InputProtocol = MediaProtocol.Http;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (string.Equals(state.ItemType, typeof(LiveTvVideoRecording).Name) ||
|
||||||
|
string.Equals(state.ItemType, typeof(LiveTvAudioRecording).Name))
|
||||||
|
{
|
||||||
|
var streamInfo = await LiveTvManager.GetRecordingStream(state.Request.Id, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||||
|
|
||||||
|
state.LiveTvStreamId = streamInfo.Id;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(streamInfo.Path))
|
||||||
|
{
|
||||||
|
state.MediaPath = streamInfo.Path;
|
||||||
|
state.InputProtocol = MediaProtocol.File;
|
||||||
|
|
||||||
|
await Task.Delay(1000, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrEmpty(streamInfo.Url))
|
||||||
|
{
|
||||||
|
state.MediaPath = streamInfo.Url;
|
||||||
|
state.InputProtocol = MediaProtocol.Http;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Starts the FFMPEG.
|
/// Starts the FFMPEG.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -806,10 +862,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
|
Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
|
||||||
|
|
||||||
if (state.VideoType == VideoType.Iso && state.IsoType.HasValue && IsoManager.CanMount(state.MediaPath))
|
await AcquireResources(state, cancellationTokenSource).ConfigureAwait(false);
|
||||||
{
|
|
||||||
state.IsoMount = await IsoManager.Mount(state.MediaPath, cancellationTokenSource.Token).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
var commandLineArgs = GetCommandLineArguments(outputPath, state, true);
|
var commandLineArgs = GetCommandLineArguments(outputPath, state, true);
|
||||||
|
|
||||||
|
@ -1363,6 +1416,8 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
List<MediaStream> mediaStreams = null;
|
List<MediaStream> mediaStreams = null;
|
||||||
|
|
||||||
|
state.ItemType = item.GetType().Name;
|
||||||
|
|
||||||
if (item is ILiveTvRecording)
|
if (item is ILiveTvRecording)
|
||||||
{
|
{
|
||||||
var recording = await LiveTvManager.GetInternalRecording(request.Id, cancellationToken).ConfigureAwait(false);
|
var recording = await LiveTvManager.GetInternalRecording(request.Id, cancellationToken).ConfigureAwait(false);
|
||||||
|
@ -1379,16 +1434,8 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
mediaStreams = source.MediaStreams;
|
mediaStreams = source.MediaStreams;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(path) && string.IsNullOrWhiteSpace(mediaUrl))
|
// Just to prevent this from being null and causing other methods to fail
|
||||||
{
|
state.MediaPath = string.Empty;
|
||||||
var streamInfo = await LiveTvManager.GetRecordingStream(request.Id, cancellationToken).ConfigureAwait(false);
|
|
||||||
|
|
||||||
state.LiveTvStreamId = streamInfo.Id;
|
|
||||||
mediaStreams = streamInfo.MediaStreams;
|
|
||||||
|
|
||||||
path = streamInfo.Path;
|
|
||||||
mediaUrl = streamInfo.Url;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(path))
|
if (!string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
|
@ -1421,30 +1468,16 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
state.VideoType = VideoType.VideoFile;
|
state.VideoType = VideoType.VideoFile;
|
||||||
state.IsInputVideo = string.Equals(channel.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase);
|
state.IsInputVideo = string.Equals(channel.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase);
|
||||||
|
mediaStreams = new List<MediaStream>();
|
||||||
var streamInfo = await LiveTvManager.GetChannelStream(request.Id, cancellationToken).ConfigureAwait(false);
|
|
||||||
|
|
||||||
state.LiveTvStreamId = streamInfo.Id;
|
|
||||||
mediaStreams = streamInfo.MediaStreams;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(streamInfo.Path))
|
|
||||||
{
|
|
||||||
state.MediaPath = streamInfo.Path;
|
|
||||||
state.InputProtocol = MediaProtocol.File;
|
|
||||||
|
|
||||||
await Task.Delay(1000, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else if (!string.IsNullOrEmpty(streamInfo.Url))
|
|
||||||
{
|
|
||||||
state.MediaPath = streamInfo.Url;
|
|
||||||
state.InputProtocol = MediaProtocol.Http;
|
|
||||||
}
|
|
||||||
|
|
||||||
state.ReadInputAtNativeFramerate = true;
|
state.ReadInputAtNativeFramerate = true;
|
||||||
state.OutputAudioSync = "1000";
|
state.OutputAudioSync = "1000";
|
||||||
state.DeInterlace = true;
|
state.DeInterlace = true;
|
||||||
state.InputVideoSync = "-1";
|
state.InputVideoSync = "-1";
|
||||||
state.InputAudioSync = "1";
|
state.InputAudioSync = "1";
|
||||||
|
|
||||||
|
// Just to prevent this from being null and causing other methods to fail
|
||||||
|
state.MediaPath = string.Empty;
|
||||||
}
|
}
|
||||||
else if (item is IChannelMediaItem)
|
else if (item is IChannelMediaItem)
|
||||||
{
|
{
|
||||||
|
@ -1500,7 +1533,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
AttachMediaStreamInfo(state, mediaStreams, videoRequest, url);
|
AttachMediaStreamInfo(state, mediaStreams, videoRequest, url);
|
||||||
|
|
||||||
state.SegmentLength = state.ReadInputAtNativeFramerate ? 5 : 10;
|
state.SegmentLength = state.ReadInputAtNativeFramerate ? 5 : 7;
|
||||||
state.HlsListSize = state.ReadInputAtNativeFramerate ? 100 : 1440;
|
state.HlsListSize = state.ReadInputAtNativeFramerate ? 100 : 1440;
|
||||||
|
|
||||||
var container = Path.GetExtension(state.RequestedUrl);
|
var container = Path.GetExtension(state.RequestedUrl);
|
||||||
|
@ -1928,7 +1961,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
videoRequest.Height = null;
|
videoRequest.Height = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string GetInputModifier(StreamState state)
|
protected string GetInputModifier(StreamState state, bool genPts = true)
|
||||||
{
|
{
|
||||||
var inputModifier = string.Empty;
|
var inputModifier = string.Empty;
|
||||||
|
|
||||||
|
@ -1948,9 +1981,9 @@ namespace MediaBrowser.Api.Playback
|
||||||
inputModifier += " " + GetFastSeekCommandLineParameter(state.Request);
|
inputModifier += " " + GetFastSeekCommandLineParameter(state.Request);
|
||||||
inputModifier = inputModifier.Trim();
|
inputModifier = inputModifier.Trim();
|
||||||
|
|
||||||
if (state.VideoRequest != null)
|
if (state.VideoRequest != null && genPts)
|
||||||
{
|
{
|
||||||
inputModifier += " -fflags genpts";
|
inputModifier += " -fflags +genpts";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(state.InputAudioSync))
|
if (!string.IsNullOrEmpty(state.InputAudioSync))
|
||||||
|
|
|
@ -272,7 +272,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
// If isEncoding is true we're actually starting ffmpeg
|
// If isEncoding is true we're actually starting ffmpeg
|
||||||
var startNumberParam = isEncoding ? GetStartNumber(state).ToString(UsCulture) : "0";
|
var startNumberParam = isEncoding ? GetStartNumber(state).ToString(UsCulture) : "0";
|
||||||
|
|
||||||
var args = string.Format("{0} {1} -i {2} -map_metadata -1 -threads {3} {4} {5} {6} -hls_time {7} -start_number {8} -hls_list_size {9} -y \"{10}\"",
|
var args = string.Format("{0} {1} -i {2} -map_metadata -1 -threads {3} {4} {5} -sc_threshold 0 {6} -hls_time {7} -start_number {8} -hls_list_size {9} -y \"{10}\"",
|
||||||
itsOffset,
|
itsOffset,
|
||||||
inputModifier,
|
inputModifier,
|
||||||
GetInputArgument(state),
|
GetInputArgument(state),
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
/// <value>The start time ticks.</value>
|
/// <value>The start time ticks.</value>
|
||||||
[ApiMember(Name = "StartTimeTicks", Description = "Optional. Specify a starting offset, in ticks. 1 tick = 10000 ms", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "StartTimeTicks", Description = "Optional. Specify a starting offset, in ticks. 1 tick = 10000 ms", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
|
||||||
public long? StartTimeTicks { get; set; }
|
public long? StartTimeTicks { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the audio bit rate.
|
/// Gets or sets the audio bit rate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -94,6 +94,10 @@ namespace MediaBrowser.Api.Playback
|
||||||
public bool EnableMpegtsM2TsMode { get; set; }
|
public bool EnableMpegtsM2TsMode { get; set; }
|
||||||
public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
|
public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
|
||||||
|
|
||||||
|
public long? EncodingDurationTicks { get; set; }
|
||||||
|
|
||||||
|
public string ItemType { get; set; }
|
||||||
|
|
||||||
public string GetMimeType(string outputPath)
|
public string GetMimeType(string outputPath)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(MimeType))
|
if (!string.IsNullOrEmpty(MimeType))
|
||||||
|
|
|
@ -88,10 +88,10 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId.Value);
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList(), user);
|
return DtoService.GetBaseItemDto(item, fields.ToList(), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList());
|
return DtoService.GetBaseItemDto(item, fields.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -76,10 +76,10 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId.Value);
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList(), user);
|
return DtoService.GetBaseItemDto(item, fields.ToList(), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList());
|
return DtoService.GetBaseItemDto(item, fields.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -81,10 +81,10 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId.Value);
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList(), user);
|
return DtoService.GetBaseItemDto(item, fields.ToList(), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList());
|
return DtoService.GetBaseItemDto(item, fields.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -76,10 +76,10 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId.Value);
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList(), user);
|
return DtoService.GetBaseItemDto(item, fields.ToList(), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList());
|
return DtoService.GetBaseItemDto(item, fields.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -93,10 +93,10 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId.Value);
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList(), user);
|
return DtoService.GetBaseItemDto(item, fields.ToList(), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList());
|
return DtoService.GetBaseItemDto(item, fields.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -78,10 +78,10 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId.Value);
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList(), user);
|
return DtoService.GetBaseItemDto(item, fields.ToList(), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList());
|
return DtoService.GetBaseItemDto(item, fields.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -78,10 +78,10 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId.Value);
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList(), user);
|
return DtoService.GetBaseItemDto(item, fields.ToList(), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DtoService.GetItemByNameDto(item, fields.ToList());
|
return DtoService.GetBaseItemDto(item, fields.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -49,16 +49,6 @@ namespace MediaBrowser.Controller.Dto
|
||||||
/// <returns>Task{BaseItemDto}.</returns>
|
/// <returns>Task{BaseItemDto}.</returns>
|
||||||
BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null);
|
BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the item by name dto.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="fields">The fields.</param>
|
|
||||||
/// <param name="user">The user.</param>
|
|
||||||
/// <returns>BaseItemDto.</returns>
|
|
||||||
BaseItemDto GetItemByNameDto<T>(T item, List<ItemFields> fields, User user = null)
|
|
||||||
where T : BaseItem, IItemByName;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the chapter information dto.
|
/// Gets the chapter information dto.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -3,13 +3,13 @@ using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.LiveTv;
|
using MediaBrowser.Model.LiveTv;
|
||||||
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.LiveTv
|
namespace MediaBrowser.Controller.LiveTv
|
||||||
{
|
{
|
||||||
public class LiveTvChannel : BaseItem, IItemByName, IHasMediaSources
|
public class LiveTvChannel : BaseItem, IHasMediaSources
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user data key.
|
/// Gets the user data key.
|
||||||
|
|
|
@ -289,7 +289,8 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
throw new InvalidOperationException("Unable to find service");
|
throw new InvalidOperationException("Unable to find service");
|
||||||
}
|
}
|
||||||
|
|
||||||
await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, AvCommands.BuildPost(command, service.ServiceType, url, dictionary), header)
|
var post = AvCommands.BuildPost(command, service.ServiceType, url, dictionary);
|
||||||
|
await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, post, header)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
await Task.Delay(50).ConfigureAwait(false);
|
await Task.Delay(50).ConfigureAwait(false);
|
||||||
|
@ -315,31 +316,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
return SecurityElement.Escape(value);
|
return SecurityElement.Escape(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetNextAvTransport(string value, string header, string metaData)
|
|
||||||
{
|
|
||||||
var command = AvCommands.ServiceActions.FirstOrDefault(c => c.Name == "SetNextAVTransportURI");
|
|
||||||
if (command == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var dictionary = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{"NextURI", value},
|
|
||||||
{"NextURIMetaData", CreateDidlMeta(metaData)}
|
|
||||||
};
|
|
||||||
|
|
||||||
var service = Properties.Services.FirstOrDefault(s => s.ServiceType == ServiceAvtransportType);
|
|
||||||
|
|
||||||
if (service == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Unable to find service");
|
|
||||||
}
|
|
||||||
|
|
||||||
await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, AvCommands.BuildPost(command, service.ServiceType, value, dictionary), header)
|
|
||||||
.ConfigureAwait(false);
|
|
||||||
|
|
||||||
RestartTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SetPlay()
|
public async Task SetPlay()
|
||||||
{
|
{
|
||||||
var command = AvCommands.ServiceActions.FirstOrDefault(c => c.Name == "Play");
|
var command = AvCommands.ServiceActions.FirstOrDefault(c => c.Name == "Play");
|
||||||
|
|
|
@ -165,12 +165,12 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
|
|
||||||
private string BuildArgumentXml(Argument argument, string value, string commandParameter = "")
|
private string BuildArgumentXml(Argument argument, string value, string commandParameter = "")
|
||||||
{
|
{
|
||||||
var state = StateVariables.FirstOrDefault(a => a.Name == argument.RelatedStateVariable);
|
var state = StateVariables.FirstOrDefault(a => string.Equals(a.Name, argument.RelatedStateVariable, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (state != null)
|
if (state != null)
|
||||||
{
|
{
|
||||||
var sendValue = (state.AllowedValues.FirstOrDefault(a => a == commandParameter) ??
|
var sendValue = state.AllowedValues.FirstOrDefault(a => string.Equals(a, commandParameter, StringComparison.OrdinalIgnoreCase)) ??
|
||||||
state.AllowedValues.FirstOrDefault()) ??
|
state.AllowedValues.FirstOrDefault() ??
|
||||||
value;
|
value;
|
||||||
|
|
||||||
return string.Format("<{0} xmlns:dt=\"urn:schemas-microsoft-com:datatypes\" dt:dt=\"{1}\">{2}</{0}>", argument.Name, state.DataType ?? "string", sendValue);
|
return string.Format("<{0} xmlns:dt=\"urn:schemas-microsoft-com:datatypes\" dt:dt=\"{1}\">{2}</{0}>", argument.Name, state.DataType ?? "string", sendValue);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,26 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||||
/// <returns>Task{DtoBaseItem}.</returns>
|
/// <returns>Task{DtoBaseItem}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||||
public BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)
|
public BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)
|
||||||
|
{
|
||||||
|
var byName = item as IItemByName;
|
||||||
|
|
||||||
|
if (byName != null)
|
||||||
|
{
|
||||||
|
var libraryItems = user != null ?
|
||||||
|
user.RootFolder.GetRecursiveChildren(user) :
|
||||||
|
_libraryManager.RootFolder.RecursiveChildren;
|
||||||
|
|
||||||
|
var dto = GetBaseItemDtoInternal(item, fields, user);
|
||||||
|
|
||||||
|
SetItemByNameInfo(item, dto, byName.GetTaggedItems(libraryItems).ToList(), user);
|
||||||
|
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetBaseItemDtoInternal(item, fields, user, owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
|
@ -141,20 +161,18 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseItemDto GetItemByNameDto<T>(T item, List<ItemFields> fields, User user = null)
|
|
||||||
where T : BaseItem, IItemByName
|
|
||||||
{
|
|
||||||
var libraryItems = user != null ? user.RootFolder.GetRecursiveChildren(user) :
|
|
||||||
_libraryManager.RootFolder.RecursiveChildren;
|
|
||||||
|
|
||||||
return GetItemByNameDto(item, fields, item.GetTaggedItems(libraryItems).ToList(), user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseItemDto GetItemByNameDto<T>(T item, List<ItemFields> fields, List<BaseItem> taggedItems, User user = null)
|
public BaseItemDto GetItemByNameDto<T>(T item, List<ItemFields> fields, List<BaseItem> taggedItems, User user = null)
|
||||||
where T : BaseItem, IItemByName
|
where T : BaseItem, IItemByName
|
||||||
{
|
{
|
||||||
var dto = GetBaseItemDto(item, fields, user);
|
var dto = GetBaseItemDtoInternal(item, fields, user);
|
||||||
|
|
||||||
|
SetItemByNameInfo(item, dto, taggedItems, user);
|
||||||
|
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetItemByNameInfo(BaseItem item, BaseItemDto dto, List<BaseItem> taggedItems, User user = null)
|
||||||
|
{
|
||||||
if (item is MusicArtist || item is MusicGenre)
|
if (item is MusicArtist || item is MusicGenre)
|
||||||
{
|
{
|
||||||
dto.AlbumCount = taggedItems.Count(i => i is MusicAlbum);
|
dto.AlbumCount = taggedItems.Count(i => i is MusicAlbum);
|
||||||
|
@ -181,8 +199,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.ChildCount = taggedItems.Count;
|
dto.ChildCount = taggedItems.Count;
|
||||||
|
|
||||||
return dto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Model.Logging;
|
using System.Globalization;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -45,7 +46,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
|
|
||||||
//log.AppendLine("Headers: " + string.Join(",", response.Headers.AllKeys.Select(k => k + "=" + response.Headers[k])));
|
//log.AppendLine("Headers: " + string.Join(",", response.Headers.AllKeys.Select(k => k + "=" + response.Headers[k])));
|
||||||
|
|
||||||
var responseTime = string.Format(". Response time: {0} ms", duration.TotalMilliseconds);
|
var responseTime = string.Format(". Response time: {0} ms. Content length: {1} bytes.", duration.TotalMilliseconds, response.ContentLength64.ToString(CultureInfo.InvariantCulture));
|
||||||
|
|
||||||
var msg = "HTTP Response " + statusCode + " to " + endPoint + responseTime;
|
var msg = "HTTP Response " + statusCode + " to " + endPoint + responseTime;
|
||||||
|
|
||||||
|
|
|
@ -668,7 +668,6 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
{
|
{
|
||||||
"site.css",
|
"site.css",
|
||||||
"chromecast.css",
|
"chromecast.css",
|
||||||
"contextmenu.css",
|
|
||||||
"mediaplayer.css",
|
"mediaplayer.css",
|
||||||
"mediaplayer-video.css",
|
"mediaplayer-video.css",
|
||||||
"librarymenu.css",
|
"librarymenu.css",
|
||||||
|
|
|
@ -113,9 +113,6 @@
|
||||||
<Content Include="dashboard-ui\css\chromecast.css">
|
<Content Include="dashboard-ui\css\chromecast.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="dashboard-ui\css\contextmenu.css">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="dashboard-ui\css\icons.css">
|
<Content Include="dashboard-ui\css\icons.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user