replace channel tabs

pull/702/head
Luke Pulverenti 9 years ago
parent 1279c6d8b5
commit b3de0249d8

@ -772,20 +772,6 @@ namespace MediaBrowser.Model.Dlna
} }
} }
// Look for supported embedded subs that we can just mux into the output
foreach (SubtitleProfile profile in subtitleProfiles)
{
if (!profile.SupportsLanguage(subtitleStream.Language))
{
continue;
}
if (profile.Method == SubtitleDeliveryMethod.Embed && subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format))
{
return profile;
}
}
return new SubtitleProfile return new SubtitleProfile
{ {
Method = SubtitleDeliveryMethod.Encode, Method = SubtitleDeliveryMethod.Encode,

@ -459,7 +459,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (!string.IsNullOrEmpty(rangeHeader)) if (!string.IsNullOrEmpty(rangeHeader))
{ {
return new RangeRequestWriter(rangeHeader, stream, contentType, isHeadRequest) return new RangeRequestWriter(rangeHeader, stream, contentType, isHeadRequest, _logger)
{ {
OnComplete = options.OnComplete OnComplete = options.OnComplete
}; };

@ -1,4 +1,5 @@
using ServiceStack.Web; using MediaBrowser.Model.Logging;
using ServiceStack.Web;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
@ -25,6 +26,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
private long TotalContentLength { get; set; } private long TotalContentLength { get; set; }
public Action OnComplete { get; set; } public Action OnComplete { get; set; }
private readonly ILogger _logger;
/// <summary> /// <summary>
/// The _options /// The _options
@ -61,7 +63,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// <param name="source">The source.</param> /// <param name="source">The source.</param>
/// <param name="contentType">Type of the content.</param> /// <param name="contentType">Type of the content.</param>
/// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param> /// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param>
public RangeRequestWriter(string rangeHeader, Stream source, string contentType, bool isHeadRequest) public RangeRequestWriter(string rangeHeader, Stream source, string contentType, bool isHeadRequest, ILogger logger)
{ {
if (string.IsNullOrEmpty(contentType)) if (string.IsNullOrEmpty(contentType))
{ {
@ -71,6 +73,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
RangeHeader = rangeHeader; RangeHeader = rangeHeader;
SourceStream = source; SourceStream = source;
IsHeadRequest = isHeadRequest; IsHeadRequest = isHeadRequest;
this._logger = logger;
ContentType = contentType; ContentType = contentType;
Options["Content-Type"] = contentType; Options["Content-Type"] = contentType;
@ -188,10 +191,15 @@ namespace MediaBrowser.Server.Implementations.HttpServer
} }
else else
{ {
CopyToInternal(source, responseStream, Convert.ToInt32(RangeLength)); CopyToInternal(source, responseStream, RangeLength);
} }
} }
} }
catch (Exception ex)
{
_logger.ErrorException("Error in range request writer", ex);
throw;
}
finally finally
{ {
if (OnComplete != null) if (OnComplete != null)
@ -201,7 +209,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
} }
} }
private void CopyToInternal(Stream source, Stream destination, int copyLength) private void CopyToInternal(Stream source, Stream destination, long copyLength)
{ {
const int bufferSize = 81920; const int bufferSize = 81920;
var array = new byte[bufferSize]; var array = new byte[bufferSize];
@ -210,7 +218,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{ {
var bytesToCopy = Math.Min(count, copyLength); var bytesToCopy = Math.Min(count, copyLength);
destination.Write(array, 0, bytesToCopy); destination.Write(array, 0, Convert.ToInt32(bytesToCopy));
copyLength -= bytesToCopy; copyLength -= bytesToCopy;

@ -51,6 +51,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return Task.FromResult<IEnumerable<MediaSourceInfo>>(new List<MediaSourceInfo>()); return Task.FromResult<IEnumerable<MediaSourceInfo>>(new List<MediaSourceInfo>());
} }
// Do not use a pipe here because Roku http requests to the server will fail, without any explicit error message.
private const char StreamIdDelimeter = '_';
private const string StreamIdDelimeterString = "|";
private async Task<IEnumerable<MediaSourceInfo>> GetMediaSourcesInternal(ILiveTvItem item, CancellationToken cancellationToken) private async Task<IEnumerable<MediaSourceInfo>> GetMediaSourcesInternal(ILiveTvItem item, CancellationToken cancellationToken)
{ {
IEnumerable<MediaSourceInfo> sources; IEnumerable<MediaSourceInfo> sources;
@ -89,7 +93,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
openKeys.Add(item.GetType().Name); openKeys.Add(item.GetType().Name);
openKeys.Add(item.Id.ToString("N")); openKeys.Add(item.Id.ToString("N"));
openKeys.Add(source.Id ?? string.Empty); openKeys.Add(source.Id ?? string.Empty);
source.OpenToken = string.Join("|", openKeys.ToArray()); source.OpenToken = string.Join(StreamIdDelimeterString, openKeys.ToArray());
// Dummy this up so that direct play checks can still run // Dummy this up so that direct play checks can still run
if (string.IsNullOrEmpty(source.Path) && source.Protocol == MediaProtocol.Http) if (string.IsNullOrEmpty(source.Path) && source.Protocol == MediaProtocol.Http)
@ -108,7 +112,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
MediaSourceInfo stream; MediaSourceInfo stream;
const bool isAudio = false; const bool isAudio = false;
var keys = openToken.Split(new[] { '|' }, 3); var keys = openToken.Split(new[] { StreamIdDelimeter }, 3);
var mediaSourceId = keys.Length >= 3 ? keys[2] : null; var mediaSourceId = keys.Length >= 3 ? keys[2] : null;
if (string.Equals(keys[0], typeof(LiveTvChannel).Name, StringComparison.OrdinalIgnoreCase)) if (string.Equals(keys[0], typeof(LiveTvChannel).Name, StringComparison.OrdinalIgnoreCase))

@ -90,15 +90,19 @@ namespace MediaBrowser.Server.Implementations.Sync
keyList.Add(provider.GetType().FullName.GetMD5().ToString("N")); keyList.Add(provider.GetType().FullName.GetMD5().ToString("N"));
keyList.Add(target.Id.GetMD5().ToString("N")); keyList.Add(target.Id.GetMD5().ToString("N"));
keyList.Add(item.Id); keyList.Add(item.Id);
mediaSource.OpenToken = string.Join("|", keyList.ToArray()); mediaSource.OpenToken = string.Join(StreamIdDelimeterString, keyList.ToArray());
} }
list.Add(mediaSource); list.Add(mediaSource);
} }
// Do not use a pipe here because Roku http requests to the server will fail, without any explicit error message.
private const char StreamIdDelimeter = '_';
private const string StreamIdDelimeterString = "|";
public async Task<MediaSourceInfo> OpenMediaSource(string openToken, CancellationToken cancellationToken) public async Task<MediaSourceInfo> OpenMediaSource(string openToken, CancellationToken cancellationToken)
{ {
var openKeys = openToken.Split(new[] { '|' }, 3); var openKeys = openToken.Split(new[] { StreamIdDelimeter }, 3);
var provider = _syncManager.ServerSyncProviders var provider = _syncManager.ServerSyncProviders
.FirstOrDefault(i => string.Equals(openKeys[0], i.GetType().FullName.GetMD5().ToString("N"), StringComparison.OrdinalIgnoreCase)); .FirstOrDefault(i => string.Equals(openKeys[0], i.GetType().FullName.GetMD5().ToString("N"), StringComparison.OrdinalIgnoreCase));

@ -517,9 +517,6 @@
<Content Include="dashboard-ui\channelsettings.html"> <Content Include="dashboard-ui\channelsettings.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\channelslatest.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\cinemamodeconfiguration.html"> <Content Include="dashboard-ui\cinemamodeconfiguration.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

Loading…
Cancel
Save