update schedules direct
This commit is contained in:
parent
ec7e90bcb7
commit
69888991f3
|
@ -26,6 +26,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
|
@ -673,14 +674,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
recordPath = Path.Combine(recordPath, recordingFileName);
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(recordPath));
|
||||
|
||||
var recording = _recordingProvider.GetAll().FirstOrDefault(x => string.Equals(x.ProgramId, info.Id, StringComparison.OrdinalIgnoreCase));
|
||||
var recordingId = info.Id.GetMD5().ToString("N");
|
||||
var recording = _recordingProvider.GetAll().FirstOrDefault(x => string.Equals(x.Id, recordingId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (recording == null)
|
||||
{
|
||||
recording = new RecordingInfo
|
||||
{
|
||||
ChannelId = info.ChannelId,
|
||||
Id = Guid.NewGuid().ToString("N"),
|
||||
Id = recordingId,
|
||||
StartDate = info.StartDate,
|
||||
EndDate = info.EndDate,
|
||||
Genres = info.Genres,
|
||||
|
|
|
@ -200,7 +200,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
_logger.Info("Mapping Stations to Channel");
|
||||
foreach (ScheduleDirect.Map map in root.map)
|
||||
{
|
||||
var channel = (map.channel ?? (map.atscMajor + "." + map.atscMinor)).TrimStart('0');
|
||||
var channel = map.logicalChannelNumber;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(channel))
|
||||
{
|
||||
channel = map.channel;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(channel))
|
||||
{
|
||||
channel = (map.atscMajor + "." + map.atscMinor);
|
||||
}
|
||||
channel = channel.TrimStart('0');
|
||||
|
||||
_logger.Debug("Found channel: " + channel + " in Schedules Direct");
|
||||
var schChannel = root.stations.FirstOrDefault(item => item.stationID == map.stationID);
|
||||
|
||||
|
@ -741,6 +752,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
{
|
||||
public string stationID { get; set; }
|
||||
public string channel { get; set; }
|
||||
public string logicalChannelNumber { get; set; }
|
||||
public int uhfVhf { get; set; }
|
||||
public int atscMajor { get; set; }
|
||||
public int atscMinor { get; set; }
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
|
|||
var list = result.ToList();
|
||||
Logger.Debug("Channels from {0}: {1}", tuner.Url, JsonSerializer.SerializeToString(list));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(key))
|
||||
if (!string.IsNullOrWhiteSpace(key) && list.Count > 0)
|
||||
{
|
||||
cache = cache ?? new ChannelCache();
|
||||
cache.Date = DateTime.UtcNow;
|
||||
|
|
|
@ -86,7 +86,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
Url = string.Format("{0}/", GetApiUrl(info, false)),
|
||||
CancellationToken = cancellationToken,
|
||||
CacheLength = TimeSpan.FromDays(1),
|
||||
CacheMode = CacheMode.Unconditional
|
||||
CacheMode = CacheMode.Unconditional,
|
||||
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds)
|
||||
}))
|
||||
{
|
||||
using (var sr = new StreamReader(stream, System.Text.Encoding.UTF8))
|
||||
|
@ -101,7 +102,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return model;
|
||||
}
|
||||
|
||||
public async Task<List<LiveTvTunerInfo>> GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken)
|
||||
|
@ -111,7 +112,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
using (var stream = await _httpClient.Get(new HttpRequestOptions()
|
||||
{
|
||||
Url = string.Format("{0}/tuners.html", GetApiUrl(info, false)),
|
||||
CancellationToken = cancellationToken
|
||||
CancellationToken = cancellationToken,
|
||||
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds)
|
||||
}))
|
||||
{
|
||||
var tuners = new List<LiveTvTunerInfo>();
|
||||
|
|
Loading…
Reference in New Issue
Block a user