aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-10-01 12:28:24 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-10-01 12:28:24 -0400
commit69888991f33a126d6ca413bbed04ecf3040e0b72 (patch)
treeeee0ae606166641439f329d35cbf2e90f1fe8adc
parentec7e90bcb7c8dff44f582ff7248316b9f022838e (diff)
update schedules direct
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs6
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs14
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs2
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs8
4 files changed, 23 insertions, 7 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 2ff48cd85..f913d0361 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -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,
diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index 161bcbf48..227d4ca18 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -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; }
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
index 5afe8f54a..d0881fb51 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
@@ -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;
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index 9cd706b53..e8ba12635 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -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>();