update xmltv

This commit is contained in:
Luke Pulverenti
2016-06-28 00:47:30 -04:00
parent c1e83beeac
commit bbdd2c5f6a
4 changed files with 77 additions and 40 deletions

View File

@@ -11,6 +11,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Emby.XmlTv.Classes;
using Emby.XmlTv.Entities;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
@@ -109,12 +110,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
return results.Select(p => new ProgramInfo()
{
ChannelId = p.ChannelId,
EndDate = p.EndDate,
EndDate = GetDate(p.EndDate),
EpisodeNumber = p.Episode == null ? null : p.Episode.Episode,
EpisodeTitle = p.Episode == null ? null : p.Episode.Title,
Genres = p.Categories,
Id = String.Format("{0}_{1:O}", p.ChannelId, p.StartDate), // Construct an id from the channel and start date,
StartDate = p.StartDate,
StartDate = GetDate(p.StartDate),
Name = p.Title,
Overview = p.Description,
ShortOverview = p.Description,
@@ -135,6 +136,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
});
}
private DateTime GetDate(DateTime date)
{
if (date.Kind != DateTimeKind.Utc)
{
date = DateTime.SpecifyKind(date, DateTimeKind.Utc);
}
return date;
}
public async Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken)
{
// Add the channel image url

View File

@@ -656,7 +656,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
item.Audio = info.Audio;
item.ChannelId = channel.Id.ToString("N");
item.CommunityRating = item.CommunityRating ?? info.CommunityRating;
item.EndDate = info.EndDate;
item.EpisodeTitle = info.EpisodeTitle;
item.ExternalId = info.Id;
item.Genres = info.Genres;
@@ -673,7 +673,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv
item.OfficialRating = item.OfficialRating ?? info.OfficialRating;
item.Overview = item.Overview ?? info.Overview;
item.RunTimeTicks = (info.EndDate - info.StartDate).Ticks;
if (item.StartDate != info.StartDate)
{
forceUpdate = true;
}
item.StartDate = info.StartDate;
if (item.EndDate != info.EndDate)
{
forceUpdate = true;
}
item.EndDate = info.EndDate;
item.HomePageUrl = info.HomePageUrl;
item.ProductionYear = info.ProductionYear;