replace channel tabs

This commit is contained in:
Luke Pulverenti 2015-07-18 14:07:03 -04:00
parent 1279c6d8b5
commit b3de0249d8
6 changed files with 26 additions and 27 deletions

View file

@ -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
{
Method = SubtitleDeliveryMethod.Encode,

View file

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

View file

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

View file

@ -51,6 +51,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
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)
{
IEnumerable<MediaSourceInfo> sources;
@ -89,7 +93,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
openKeys.Add(item.GetType().Name);
openKeys.Add(item.Id.ToString("N"));
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
if (string.IsNullOrEmpty(source.Path) && source.Protocol == MediaProtocol.Http)
@ -108,7 +112,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
MediaSourceInfo stream;
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;
if (string.Equals(keys[0], typeof(LiveTvChannel).Name, StringComparison.OrdinalIgnoreCase))

View file

@ -90,15 +90,19 @@ namespace MediaBrowser.Server.Implementations.Sync
keyList.Add(provider.GetType().FullName.GetMD5().ToString("N"));
keyList.Add(target.Id.GetMD5().ToString("N"));
keyList.Add(item.Id);
mediaSource.OpenToken = string.Join("|", keyList.ToArray());
mediaSource.OpenToken = string.Join(StreamIdDelimeterString, keyList.ToArray());
}
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)
{
var openKeys = openToken.Split(new[] { '|' }, 3);
var openKeys = openToken.Split(new[] { StreamIdDelimeter }, 3);
var provider = _syncManager.ServerSyncProviders
.FirstOrDefault(i => string.Equals(openKeys[0], i.GetType().FullName.GetMD5().ToString("N"), StringComparison.OrdinalIgnoreCase));

View file

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