Merge pull request #2181 from MediaBrowser/dev
always supply SeriesTimerId
This commit is contained in:
commit
54508f948d
|
@ -150,9 +150,10 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
{
|
{
|
||||||
var text = reader.ReadToEnd();
|
var text = reader.ReadToEnd();
|
||||||
|
|
||||||
|
text = text.Replace("#EXTM3U", "#EXTM3U\n#EXT-X-PLAYLIST-TYPE:EVENT");
|
||||||
|
|
||||||
var newDuration = "#EXT-X-TARGETDURATION:" + segmentLength.ToString(UsCulture);
|
var newDuration = "#EXT-X-TARGETDURATION:" + segmentLength.ToString(UsCulture);
|
||||||
|
|
||||||
// ffmpeg pads the reported length by a full second
|
|
||||||
text = text.Replace("#EXT-X-TARGETDURATION:" + (segmentLength + 1).ToString(UsCulture), newDuration, StringComparison.OrdinalIgnoreCase);
|
text = text.Replace("#EXT-X-TARGETDURATION:" + (segmentLength + 1).ToString(UsCulture), newDuration, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
|
|
|
@ -73,6 +73,10 @@ namespace MediaBrowser.Api.Playback
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (!RunTimeTicks.HasValue)
|
||||||
|
{
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var userAgent = UserAgent ?? string.Empty;
|
var userAgent = UserAgent ?? string.Empty;
|
||||||
|
@ -88,13 +92,13 @@ namespace MediaBrowser.Api.Playback
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RunTimeTicks.HasValue)
|
|
||||||
{
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!RunTimeTicks.HasValue)
|
||||||
|
{
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,6 +254,16 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public string ExternalSeriesId
|
||||||
|
{
|
||||||
|
get { return this.GetProviderId("ProviderExternalSeriesId"); }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.SetProviderId("ProviderExternalSeriesId", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the etag.
|
/// Gets or sets the etag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -763,7 +763,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||||
throw new ApplicationException("Tuner not found.");
|
throw new ApplicationException("Tuner not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Tuple<MediaSourceInfo, ITunerHost, SemaphoreSlim>> GetChannelStreamInternal(string channelId, CancellationToken cancellationToken)
|
private async Task<Tuple<MediaSourceInfo, ITunerHost, SemaphoreSlim>> GetChannelStreamInternal(string channelId, string streamId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_logger.Info("Streaming Channel " + channelId);
|
_logger.Info("Streaming Channel " + channelId);
|
||||||
|
|
||||||
|
@ -771,7 +771,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await hostInstance.GetChannelStream(channelId, null, cancellationToken).ConfigureAwait(false);
|
var result = await hostInstance.GetChannelStream(channelId, streamId, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return new Tuple<MediaSourceInfo, ITunerHost, SemaphoreSlim>(result.Item1, hostInstance, result.Item2);
|
return new Tuple<MediaSourceInfo, ITunerHost, SemaphoreSlim>(result.Item1, hostInstance, result.Item2);
|
||||||
}
|
}
|
||||||
|
@ -994,7 +994,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await GetChannelStreamInternal(timer.ChannelId, CancellationToken.None).ConfigureAwait(false);
|
var result = await GetChannelStreamInternal(timer.ChannelId, null, CancellationToken.None).ConfigureAwait(false);
|
||||||
isResourceOpen = true;
|
isResourceOpen = true;
|
||||||
semaphore = result.Item3;
|
semaphore = result.Item3;
|
||||||
var mediaStreamInfo = result.Item1;
|
var mediaStreamInfo = result.Item1;
|
||||||
|
|
|
@ -668,6 +668,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
|
|
||||||
item.EpisodeTitle = info.EpisodeTitle;
|
item.EpisodeTitle = info.EpisodeTitle;
|
||||||
item.ExternalId = info.Id;
|
item.ExternalId = info.Id;
|
||||||
|
item.ExternalSeriesId = info.SeriesId;
|
||||||
item.Genres = info.Genres;
|
item.Genres = info.Genres;
|
||||||
item.IsHD = info.IsHD;
|
item.IsHD = info.IsHD;
|
||||||
item.IsKids = info.IsKids;
|
item.IsKids = info.IsKids;
|
||||||
|
@ -903,8 +904,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
|
|
||||||
var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user);
|
var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user);
|
||||||
|
|
||||||
var list = new List<Tuple<BaseItemDto, string, string>>();
|
var list = new List<Tuple<BaseItemDto, string, string, string>>();
|
||||||
list.Add(new Tuple<BaseItemDto, string, string>(dto, program.ServiceName, program.ExternalId));
|
list.Add(new Tuple<BaseItemDto, string, string, string>(dto, program.ServiceName, program.ExternalId, program.ExternalSeriesId));
|
||||||
|
|
||||||
await AddRecordingInfo(list, cancellationToken).ConfigureAwait(false);
|
await AddRecordingInfo(list, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -1092,15 +1093,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddRecordingInfo(IEnumerable<Tuple<BaseItemDto, string, string>> programs, CancellationToken cancellationToken)
|
private async Task AddRecordingInfo(IEnumerable<Tuple<BaseItemDto, string, string, string>> programs, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var timers = new Dictionary<string, List<TimerInfo>>();
|
var timers = new Dictionary<string, List<TimerInfo>>();
|
||||||
|
var seriesTimers = new Dictionary<string, List<SeriesTimerInfo>>();
|
||||||
|
|
||||||
foreach (var programTuple in programs)
|
foreach (var programTuple in programs)
|
||||||
{
|
{
|
||||||
var program = programTuple.Item1;
|
var program = programTuple.Item1;
|
||||||
var serviceName = programTuple.Item2;
|
var serviceName = programTuple.Item2;
|
||||||
var externalProgramId = programTuple.Item3;
|
var externalProgramId = programTuple.Item3;
|
||||||
|
string externalSeriesId = programTuple.Item4;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(serviceName))
|
if (string.IsNullOrWhiteSpace(serviceName))
|
||||||
{
|
{
|
||||||
|
@ -1123,6 +1126,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
}
|
}
|
||||||
|
|
||||||
var timer = timerList.FirstOrDefault(i => string.Equals(i.ProgramId, externalProgramId, StringComparison.OrdinalIgnoreCase));
|
var timer = timerList.FirstOrDefault(i => string.Equals(i.ProgramId, externalProgramId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
var foundSeriesTimer = false;
|
||||||
|
|
||||||
if (timer != null)
|
if (timer != null)
|
||||||
{
|
{
|
||||||
|
@ -1133,8 +1137,38 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
{
|
{
|
||||||
program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(serviceName, timer.SeriesTimerId)
|
program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(serviceName, timer.SeriesTimerId)
|
||||||
.ToString("N");
|
.ToString("N");
|
||||||
|
|
||||||
|
foundSeriesTimer = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (foundSeriesTimer || string.IsNullOrWhiteSpace(externalSeriesId))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SeriesTimerInfo> seriesTimerList;
|
||||||
|
if (!seriesTimers.TryGetValue(serviceName, out seriesTimerList))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var tempTimers = await GetService(serviceName).GetSeriesTimersAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
seriesTimers[serviceName] = seriesTimerList = tempTimers.ToList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error getting series timer infos", ex);
|
||||||
|
seriesTimers[serviceName] = seriesTimerList = new List<SeriesTimerInfo>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var seriesTimer = seriesTimerList.FirstOrDefault(i => string.Equals(i.SeriesId, externalSeriesId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (seriesTimer != null)
|
||||||
|
{
|
||||||
|
program.SeriesTimerId = _tvDtoService.GetInternalSeriesTimerId(serviceName, seriesTimer.Id)
|
||||||
|
.ToString("N");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1659,7 +1693,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
|
|
||||||
public async Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> tuples, List<ItemFields> fields, User user = null)
|
public async Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> tuples, List<ItemFields> fields, User user = null)
|
||||||
{
|
{
|
||||||
var recordingTuples = new List<Tuple<BaseItemDto, string, string>>();
|
var recordingTuples = new List<Tuple<BaseItemDto, string, string, string>>();
|
||||||
|
|
||||||
foreach (var tuple in tuples)
|
foreach (var tuple in tuples)
|
||||||
{
|
{
|
||||||
|
@ -1727,7 +1761,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||||
dto.ServiceName = serviceName;
|
dto.ServiceName = serviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
recordingTuples.Add(new Tuple<BaseItemDto, string, string>(dto, serviceName, program.ExternalId));
|
recordingTuples.Add(new Tuple<BaseItemDto, string, string, string>(dto, serviceName, program.ExternalId, program.ExternalSeriesId));
|
||||||
}
|
}
|
||||||
|
|
||||||
await AddRecordingInfo(recordingTuples, CancellationToken.None).ConfigureAwait(false);
|
await AddRecordingInfo(recordingTuples, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user