mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 13:57:14 -04:00
stub out channel mapper popup
This commit is contained in:
parent
32ba8721a2
commit
527014d73a
@ -226,4 +226,23 @@ namespace MediaBrowser.Controller.LiveTv
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task ResetTuner(string id, CancellationToken cancellationToken);
|
Task ResetTuner(string id, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface ISupportsNewTimerIds
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the timer asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info">The information.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task<string> CreateTimer(TimerInfo info, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the series timer asynchronous.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info">The information.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task<string> CreateSeriesTimer(SeriesTimerInfo info, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ using Microsoft.Win32;
|
|||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||||
{
|
{
|
||||||
public class EmbyTV : ILiveTvService, IHasRegistrationInfo, IDisposable
|
public class EmbyTV : ILiveTvService, ISupportsNewTimerIds, IHasRegistrationInfo, IDisposable
|
||||||
{
|
{
|
||||||
private readonly IApplicationHost _appHpst;
|
private readonly IApplicationHost _appHpst;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
@ -435,12 +435,22 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||||||
|
|
||||||
public Task CreateTimerAsync(TimerInfo info, CancellationToken cancellationToken)
|
public Task CreateTimerAsync(TimerInfo info, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
info.Id = Guid.NewGuid().ToString("N");
|
return CreateTimer(info, cancellationToken);
|
||||||
_timerProvider.Add(info);
|
|
||||||
return Task.FromResult(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
|
public Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return CreateSeriesTimer(info, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<string> CreateTimer(TimerInfo info, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
info.Id = Guid.NewGuid().ToString("N");
|
||||||
|
_timerProvider.Add(info);
|
||||||
|
return Task.FromResult(info.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<string> CreateSeriesTimer(SeriesTimerInfo info, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
info.Id = Guid.NewGuid().ToString("N");
|
info.Id = Guid.NewGuid().ToString("N");
|
||||||
|
|
||||||
@ -470,6 +480,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||||||
|
|
||||||
_seriesTimerProvider.Add(info);
|
_seriesTimerProvider.Add(info);
|
||||||
await UpdateTimersForSeriesTimer(epgData, info, false).ConfigureAwait(false);
|
await UpdateTimersForSeriesTimer(epgData, info, false).ConfigureAwait(false);
|
||||||
|
|
||||||
|
return info.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
|
public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
|
||||||
|
@ -506,8 +506,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<ScheduleDirect.ShowImages>> GetImageForPrograms(
|
private async Task<List<ScheduleDirect.ShowImages>> GetImageForPrograms(
|
||||||
ListingsProviderInfo info,
|
ListingsProviderInfo info,
|
||||||
List<string> programIds,
|
List<string> programIds,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var imageIdString = "[";
|
var imageIdString = "[";
|
||||||
@ -564,7 +564,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Stream responce = await Get(options, false, info).ConfigureAwait(false))
|
using (Stream responce = await Get(options, false, info).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
var root = _jsonSerializer.DeserializeFromStream<List<ScheduleDirect.Headends>>(responce);
|
var root = _jsonSerializer.DeserializeFromStream<List<ScheduleDirect.Headends>>(responce);
|
||||||
|
|
||||||
@ -666,58 +666,60 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<HttpResponseInfo> Post(HttpRequestOptions options,
|
private async Task<HttpResponseInfo> Post(HttpRequestOptions options,
|
||||||
bool enableRetry,
|
bool enableRetry,
|
||||||
ListingsProviderInfo providerInfo)
|
ListingsProviderInfo providerInfo)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await _httpClient.Post(options).ConfigureAwait(false);
|
return await _httpClient.Post(options).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (HttpException ex)
|
catch (HttpException ex)
|
||||||
{
|
{
|
||||||
_tokens.Clear();
|
_tokens.Clear();
|
||||||
|
|
||||||
if (!ex.StatusCode.HasValue || (int)ex.StatusCode.Value >= 500)
|
if (!ex.StatusCode.HasValue || (int)ex.StatusCode.Value >= 500)
|
||||||
{
|
{
|
||||||
enableRetry = false;
|
enableRetry = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enableRetry) {
|
if (!enableRetry)
|
||||||
throw;
|
{
|
||||||
}
|
throw;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var newToken = await GetToken (providerInfo, options.CancellationToken).ConfigureAwait (false);
|
var newToken = await GetToken(providerInfo, options.CancellationToken).ConfigureAwait(false);
|
||||||
options.RequestHeaders ["token"] = newToken;
|
options.RequestHeaders["token"] = newToken;
|
||||||
return await Post (options, false, providerInfo).ConfigureAwait (false);
|
return await Post(options, false, providerInfo).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Stream> Get(HttpRequestOptions options,
|
private async Task<Stream> Get(HttpRequestOptions options,
|
||||||
bool enableRetry,
|
bool enableRetry,
|
||||||
ListingsProviderInfo providerInfo)
|
ListingsProviderInfo providerInfo)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await _httpClient.Get(options).ConfigureAwait(false);
|
return await _httpClient.Get(options).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (HttpException ex)
|
catch (HttpException ex)
|
||||||
{
|
{
|
||||||
_tokens.Clear();
|
_tokens.Clear();
|
||||||
|
|
||||||
if (!ex.StatusCode.HasValue || (int)ex.StatusCode.Value >= 500)
|
if (!ex.StatusCode.HasValue || (int)ex.StatusCode.Value >= 500)
|
||||||
{
|
{
|
||||||
enableRetry = false;
|
enableRetry = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enableRetry) {
|
if (!enableRetry)
|
||||||
throw;
|
{
|
||||||
}
|
throw;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var newToken = await GetToken (providerInfo, options.CancellationToken).ConfigureAwait (false);
|
var newToken = await GetToken(providerInfo, options.CancellationToken).ConfigureAwait(false);
|
||||||
options.RequestHeaders ["token"] = newToken;
|
options.RequestHeaders["token"] = newToken;
|
||||||
return await Get (options, false, providerInfo).ConfigureAwait (false);
|
return await Get(options, false, providerInfo).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<string> GetTokenInternal(string username, string password,
|
private async Task<string> GetTokenInternal(string username, string password,
|
||||||
@ -734,7 +736,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
//_logger.Info("Obtaining token from Schedules Direct from addres: " + httpOptions.Url + " with body " +
|
//_logger.Info("Obtaining token from Schedules Direct from addres: " + httpOptions.Url + " with body " +
|
||||||
// httpOptions.RequestContent);
|
// httpOptions.RequestContent);
|
||||||
|
|
||||||
using (var responce = await Post(httpOptions, false, null).ConfigureAwait(false))
|
using (var responce = await Post(httpOptions, false, null).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
var root = _jsonSerializer.DeserializeFromStream<ScheduleDirect.Token>(responce.Content);
|
var root = _jsonSerializer.DeserializeFromStream<ScheduleDirect.Token>(responce.Content);
|
||||||
if (root.message == "OK")
|
if (root.message == "OK")
|
||||||
@ -816,7 +818,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var response = await Get(options, false, null).ConfigureAwait(false))
|
using (var response = await Get(options, false, null).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
var root = _jsonSerializer.DeserializeFromStream<ScheduleDirect.Lineups>(response);
|
var root = _jsonSerializer.DeserializeFromStream<ScheduleDirect.Lineups>(response);
|
||||||
|
|
||||||
@ -871,7 +873,63 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
|
|
||||||
public async Task<List<ChannelInfo>> GetChannels(ListingsProviderInfo info, CancellationToken cancellationToken)
|
public async Task<List<ChannelInfo>> GetChannels(ListingsProviderInfo info, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return new List<ChannelInfo>();
|
var listingsId = info.ListingsId;
|
||||||
|
if (string.IsNullOrWhiteSpace(listingsId))
|
||||||
|
{
|
||||||
|
throw new Exception("ListingsId required");
|
||||||
|
}
|
||||||
|
|
||||||
|
var token = await GetToken(info, cancellationToken);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(token))
|
||||||
|
{
|
||||||
|
throw new Exception("token required");
|
||||||
|
}
|
||||||
|
|
||||||
|
ClearPairCache(listingsId);
|
||||||
|
|
||||||
|
var httpOptions = new HttpRequestOptions()
|
||||||
|
{
|
||||||
|
Url = ApiUrl + "/lineups/" + listingsId,
|
||||||
|
UserAgent = UserAgent,
|
||||||
|
CancellationToken = cancellationToken,
|
||||||
|
LogErrorResponseBody = true,
|
||||||
|
// The data can be large so give it some extra time
|
||||||
|
TimeoutMs = 60000
|
||||||
|
};
|
||||||
|
|
||||||
|
httpOptions.RequestHeaders["token"] = token;
|
||||||
|
|
||||||
|
var list = new List<ChannelInfo>();
|
||||||
|
|
||||||
|
using (var response = await Get(httpOptions, true, info).ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
var root = _jsonSerializer.DeserializeFromStream<ScheduleDirect.Channel>(response);
|
||||||
|
_logger.Info("Found " + root.map.Count + " channels on the lineup on ScheduleDirect");
|
||||||
|
_logger.Info("Mapping Stations to Channel");
|
||||||
|
foreach (ScheduleDirect.Map map in root.map)
|
||||||
|
{
|
||||||
|
var channelNumber = map.logicalChannelNumber;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(channelNumber))
|
||||||
|
{
|
||||||
|
channelNumber = map.channel;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(channelNumber))
|
||||||
|
{
|
||||||
|
channelNumber = map.atscMajor + "." + map.atscMinor;
|
||||||
|
}
|
||||||
|
channelNumber = channelNumber.TrimStart('0');
|
||||||
|
|
||||||
|
list.Add(new ChannelInfo
|
||||||
|
{
|
||||||
|
Number = channelNumber,
|
||||||
|
Name = map.channel
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScheduleDirect
|
public class ScheduleDirect
|
||||||
|
@ -2013,7 +2013,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
var defaultValues = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false);
|
var defaultValues = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false);
|
||||||
info.Priority = defaultValues.Priority;
|
info.Priority = defaultValues.Priority;
|
||||||
|
|
||||||
await service.CreateTimerAsync(info, cancellationToken).ConfigureAwait(false);
|
string newTimerId = null;
|
||||||
|
var supportsNewTimerIds = service as ISupportsNewTimerIds;
|
||||||
|
if (supportsNewTimerIds != null)
|
||||||
|
{
|
||||||
|
newTimerId = await supportsNewTimerIds.CreateTimer(info, cancellationToken).ConfigureAwait(false);
|
||||||
|
newTimerId = _tvDtoService.GetInternalTimerId(timer.ServiceName, newTimerId).ToString("N");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await service.CreateTimerAsync(info, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
_lastRecordingRefreshTime = DateTime.MinValue;
|
_lastRecordingRefreshTime = DateTime.MinValue;
|
||||||
_logger.Info("New recording scheduled");
|
_logger.Info("New recording scheduled");
|
||||||
@ -2022,7 +2032,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
{
|
{
|
||||||
Argument = new TimerEventInfo
|
Argument = new TimerEventInfo
|
||||||
{
|
{
|
||||||
ProgramId = _tvDtoService.GetInternalProgramId(timer.ServiceName, info.ProgramId).ToString("N")
|
ProgramId = _tvDtoService.GetInternalProgramId(timer.ServiceName, info.ProgramId).ToString("N"),
|
||||||
|
Id = newTimerId
|
||||||
}
|
}
|
||||||
}, _logger);
|
}, _logger);
|
||||||
}
|
}
|
||||||
@ -2037,14 +2048,26 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
var defaultValues = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false);
|
var defaultValues = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false);
|
||||||
info.Priority = defaultValues.Priority;
|
info.Priority = defaultValues.Priority;
|
||||||
|
|
||||||
await service.CreateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false);
|
string newTimerId = null;
|
||||||
|
var supportsNewTimerIds = service as ISupportsNewTimerIds;
|
||||||
|
if (supportsNewTimerIds != null)
|
||||||
|
{
|
||||||
|
newTimerId = await supportsNewTimerIds.CreateSeriesTimer(info, cancellationToken).ConfigureAwait(false);
|
||||||
|
newTimerId = _tvDtoService.GetInternalSeriesTimerId(timer.ServiceName, newTimerId).ToString("N");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await service.CreateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
_lastRecordingRefreshTime = DateTime.MinValue;
|
_lastRecordingRefreshTime = DateTime.MinValue;
|
||||||
|
|
||||||
EventHelper.QueueEventIfNotNull(SeriesTimerCreated, this, new GenericEventArgs<TimerEventInfo>
|
EventHelper.QueueEventIfNotNull(SeriesTimerCreated, this, new GenericEventArgs<TimerEventInfo>
|
||||||
{
|
{
|
||||||
Argument = new TimerEventInfo
|
Argument = new TimerEventInfo
|
||||||
{
|
{
|
||||||
ProgramId = _tvDtoService.GetInternalProgramId(timer.ServiceName, info.ProgramId).ToString("N")
|
ProgramId = _tvDtoService.GetInternalProgramId(timer.ServiceName, info.ProgramId).ToString("N"),
|
||||||
|
Id = newTimerId
|
||||||
}
|
}
|
||||||
}, _logger);
|
}, _logger);
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,9 @@
|
|||||||
<Content Include="dashboard-ui\components\apphost.js">
|
<Content Include="dashboard-ui\components\apphost.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\components\channelmapper\channelmapper.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\components\chromecasthelpers.js">
|
<Content Include="dashboard-ui\components\chromecasthelpers.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
Loading…
Reference in New Issue
Block a user