aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-10-25 14:34:31 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-10-25 14:34:31 -0400
commit5e8f74596384ff88a51b7ea03f0a5aae13cb766c (patch)
tree2d7a391b84edfaa642c0a0bd60d0cbf568bf71f8
parentc99d6c89971b34ac85852f0068f113bb49a25b22 (diff)
update tv data fetch
-rw-r--r--MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs10
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs4
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs28
3 files changed, 27 insertions, 15 deletions
diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
index 9622afb97..9ad04ebbd 100644
--- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
+++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
@@ -64,7 +64,7 @@ namespace MediaBrowser.Server.Implementations.Connect
using (var stream = await _httpClient.Get(new HttpRequestOptions
{
Url = ipLookupUrl,
- UserAgent = "Emby Server/" + _appHost.ApplicationVersion,
+ UserAgent = "Emby/" + _appHost.ApplicationVersion,
LogErrors = logErrors
}).ConfigureAwait(false))
@@ -73,7 +73,7 @@ namespace MediaBrowser.Server.Implementations.Connect
{
var address = await reader.ReadToEndAsync().ConfigureAwait(false);
- if (IsValid(address))
+ if (IsValid(address, ipLookupUrl))
{
((ConnectManager)_connectManager).OnWanAddressResolved(address);
CacheAddress(address);
@@ -122,7 +122,7 @@ namespace MediaBrowser.Server.Implementations.Connect
{
var endpoint = _fileSystem.ReadAllText(path, Encoding.UTF8);
- if (IsValid(endpoint))
+ if (IsValid(endpoint, "cache"))
{
((ConnectManager)_connectManager).OnWanAddressResolved(endpoint);
}
@@ -137,14 +137,14 @@ namespace MediaBrowser.Server.Implementations.Connect
}
}
- private bool IsValid(string address)
+ private bool IsValid(string address, string source)
{
IPAddress ipAddress;
var valid = IPAddress.TryParse(address, out ipAddress);
if (!valid)
{
- _logger.Error("{0} is not a valid ip address", address);
+ _logger.Error("{0} is not a valid ip address. Source: {1}", address, source);
}
return valid;
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index f4fd04f37..9f6e0ecce 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -429,6 +429,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
return await GetProgramsAsyncInternal(channelId, startDateUtc, endDateUtc, cancellationToken).ConfigureAwait(false);
}
+ catch (OperationCanceledException)
+ {
+ throw;
+ }
catch (Exception ex)
{
_logger.ErrorException("Error getting programs", ex);
diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index 04f55d16b..be2933be2 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -156,10 +156,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
// schedule.programID + " which says it has images? " +
// programDict[schedule.programID].hasImageArtwork);
- var imageIndex = images.FindIndex(i => i.programID == schedule.programID.Substring(0, 10));
- if (imageIndex > -1)
+ if (images != null)
{
- programDict[schedule.programID].images = GetProgramLogo(ApiUrl, images[imageIndex]);
+ var imageIndex = images.FindIndex(i => i.programID == schedule.programID.Substring(0, 10));
+ if (imageIndex > -1)
+ {
+ programDict[schedule.programID].images = GetProgramLogo(ApiUrl, images[imageIndex]);
+ }
}
programsInfo.Add(GetProgram(channelNumber, schedule, programDict[schedule.programID]));
@@ -410,7 +413,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
private string GetProgramLogo(string apiUrl, ScheduleDirect.ShowImages images)
{
- string url = "";
+ string url = null;
if (images.data != null)
{
var smallImages = images.data.Where(i => i.size == "Sm").ToList();
@@ -423,13 +426,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
logoIndex = 0;
}
- if (images.data[logoIndex].uri.Contains("http"))
- {
- url = images.data[logoIndex].uri;
- }
- else
+ var uri = images.data[logoIndex].uri;
+
+ if (!string.IsNullOrWhiteSpace(uri))
{
- url = apiUrl + "/image/" + images.data[logoIndex].uri;
+ if (uri.IndexOf("http", StringComparison.OrdinalIgnoreCase) != -1)
+ {
+ url = uri;
+ }
+ else
+ {
+ url = apiUrl + "/image/" + uri;
+ }
}
//_logger.Debug("URL for image is : " + url);
}