add null checks to ScheduleDirect

pull/1154/head
Luke Pulverenti 8 years ago
parent 636943be4b
commit f694ae7e95

@ -247,7 +247,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings
ProgramAudio audioType = ProgramAudio.Stereo; ProgramAudio audioType = ProgramAudio.Stereo;
bool repeat = programInfo.@new == null; bool repeat = programInfo.@new == null;
string newID = programInfo.programID + "T" + startAt.Ticks + "C" + channelId;
var programId = programInfo.programID ?? string.Empty;
string newID = programId + "T" + startAt.Ticks + "C" + channelId;
if (programInfo.audioProperties != null) if (programInfo.audioProperties != null)
{ {
@ -300,7 +303,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
Etag = programInfo.md5 Etag = programInfo.md5
}; };
var showId = programInfo.programID ?? string.Empty; var showId = programId;
if (!info.IsSeries) if (!info.IsSeries)
{ {
@ -339,11 +342,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings
if (details.descriptions != null) if (details.descriptions != null)
{ {
if (details.descriptions.description1000 != null) if (details.descriptions.description1000 != null && details.descriptions.description1000.Count > 0)
{ {
info.Overview = details.descriptions.description1000[0].description; info.Overview = details.descriptions.description1000[0].description;
} }
else if (details.descriptions.description100 != null) else if (details.descriptions.description100 != null && details.descriptions.description100.Count > 0)
{ {
info.Overview = details.descriptions.description100[0].description; info.Overview = details.descriptions.description100[0].description;
} }
@ -351,16 +354,19 @@ namespace Emby.Server.Implementations.LiveTv.Listings
if (info.IsSeries) if (info.IsSeries)
{ {
info.SeriesId = programInfo.programID.Substring(0, 10); info.SeriesId = programId.Substring(0, 10);
if (details.metadata != null) if (details.metadata != null)
{ {
var gracenote = details.metadata.Find(x => x.Gracenote != null).Gracenote; var gracenote = details.metadata.Find(x => x.Gracenote != null).Gracenote;
info.SeasonNumber = gracenote.season; if (gracenote != null)
if (gracenote.episode > 0)
{ {
info.EpisodeNumber = gracenote.episode; info.SeasonNumber = gracenote.season;
if (gracenote.episode > 0)
{
info.EpisodeNumber = gracenote.episode;
}
} }
} }
} }

Loading…
Cancel
Save