sync updates
This commit is contained in:
parent
7f537ad149
commit
0bd27381e0
|
@ -1,5 +1,4 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -75,12 +74,12 @@ namespace MediaBrowser.Controller.Net
|
|||
throw new ArgumentNullException("message");
|
||||
}
|
||||
|
||||
if (message.MessageType.Equals(Name + "Start", StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(message.MessageType, Name + "Start", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Start(message);
|
||||
}
|
||||
|
||||
if (message.MessageType.Equals(Name + "Stop", StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(message.MessageType, Name + "Stop", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Stop(message);
|
||||
}
|
||||
|
|
|
@ -430,14 +430,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
{
|
||||
var tuple = GetProvider(id);
|
||||
|
||||
try
|
||||
{
|
||||
await tuple.Item1.CloseMediaSource(tuple.Item2, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
|
||||
}
|
||||
await tuple.Item1.CloseMediaSource(tuple.Item2, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
LiveStreamInfo removed;
|
||||
if (_openStreams.TryRemove(id, out removed))
|
||||
|
|
|
@ -51,11 +51,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
|
||||
if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
var contentType = response.ContentType;
|
||||
|
||||
if (contentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Content;
|
||||
imageResponse.SetFormatFromMimeType(response.ContentType);
|
||||
imageResponse.SetFormatFromMimeType(contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -85,8 +85,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
get { return _services; }
|
||||
}
|
||||
|
||||
public ILiveTvService ActiveService { get; private set; }
|
||||
|
||||
private LiveTvOptions GetConfiguration()
|
||||
{
|
||||
return _config.GetConfiguration<LiveTvOptions>("livetv");
|
||||
|
@ -100,8 +98,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
{
|
||||
_services.AddRange(services);
|
||||
|
||||
ActiveService = _services.FirstOrDefault();
|
||||
|
||||
foreach (var service in _services)
|
||||
{
|
||||
service.DataSourceChanged += service_DataSourceChanged;
|
||||
|
@ -359,7 +355,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
if (info.RequiresClosing)
|
||||
{
|
||||
info.LiveStreamId = info.Id;
|
||||
var idPrefix = service.GetType().FullName.GetMD5().ToString("N") + "_";
|
||||
|
||||
info.LiveStreamId = idPrefix + info.Id;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -374,7 +372,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
if (info.RequiresClosing)
|
||||
{
|
||||
info.LiveStreamId = info.Id;
|
||||
var idPrefix = service.GetType().FullName.GetMD5().ToString("N") + "_";
|
||||
|
||||
info.LiveStreamId = idPrefix + info.Id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
var data = new LiveStreamData
|
||||
{
|
||||
Info = info,
|
||||
ConsumerCount = 1,
|
||||
IsChannel = isChannel,
|
||||
ItemId = id
|
||||
};
|
||||
|
@ -1788,7 +1787,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
class LiveStreamData
|
||||
{
|
||||
internal MediaSourceInfo Info;
|
||||
internal int ConsumerCount;
|
||||
internal string ItemId;
|
||||
internal bool IsChannel;
|
||||
}
|
||||
|
@ -1799,19 +1797,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
try
|
||||
{
|
||||
var service = ActiveService;
|
||||
var parts = id.Split(new[] { '_' }, 2);
|
||||
|
||||
var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N"), parts[0], StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (service == null)
|
||||
{
|
||||
throw new ArgumentException("Service not found.");
|
||||
}
|
||||
|
||||
id = parts[1];
|
||||
|
||||
LiveStreamData data;
|
||||
if (_openStreams.TryGetValue(id, out data))
|
||||
{
|
||||
if (data.ConsumerCount > 1)
|
||||
{
|
||||
data.ConsumerCount--;
|
||||
_logger.Info("Decrementing live stream client count.");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
_openStreams.TryRemove(id, out data);
|
||||
|
||||
_logger.Info("Closing live stream from {0}, stream Id: {1}", service.Name, id);
|
||||
|
@ -1892,6 +1889,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
Name = service.Name
|
||||
};
|
||||
|
||||
var tunerIdPrefix = service.GetType().FullName.GetMD5().ToString("N") + "_";
|
||||
|
||||
try
|
||||
{
|
||||
var statusInfo = await service.GetStatusInfoAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
@ -1913,7 +1912,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
channelName = channel == null ? null : channel.Name;
|
||||
}
|
||||
|
||||
return _tvDtoService.GetTunerInfoDto(service.Name, i, channelName);
|
||||
var dto = _tvDtoService.GetTunerInfoDto(service.Name, i, channelName);
|
||||
|
||||
dto.Id = tunerIdPrefix + dto.Id;
|
||||
|
||||
return dto;
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
|
@ -1966,7 +1969,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
/// <returns>Task.</returns>
|
||||
public Task ResetTuner(string id, CancellationToken cancellationToken)
|
||||
{
|
||||
return ActiveService.ResetTuner(id, cancellationToken);
|
||||
var parts = id.Split(new[] { '_' }, 2);
|
||||
|
||||
var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N"), parts[0], StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (service == null)
|
||||
{
|
||||
throw new ArgumentException("Service not found.");
|
||||
}
|
||||
|
||||
return service.ResetTuner(parts[1], cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<BaseItemDto> GetLiveTvFolder(string userId, CancellationToken cancellationToken)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Reflection;
|
||||
|
||||
//[assembly: AssemblyVersion("3.0.*")]
|
||||
[assembly: AssemblyVersion("3.0.5557.40000")]
|
||||
[assembly: AssemblyVersion("3.0.*")]
|
||||
//[assembly: AssemblyVersion("3.0.5557.40000")]
|
||||
|
|
Loading…
Reference in New Issue
Block a user