update detail page

pull/702/head
Luke Pulverenti 9 years ago
parent d2b4dd9a98
commit 615d1e2a53

@ -33,6 +33,11 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The overview.</value>
public string Overview { get; set; }
/// <summary>
/// Gets or sets the short overview.
/// </summary>
/// <value>The short overview.</value>
public string ShortOverview { get; set; }
/// <summary>
/// The start date of the program, in UTC.
@ -165,7 +170,17 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The show identifier.</value>
public string ShowId { get; set; }
/// <summary>
/// Gets or sets the season number.
/// </summary>
/// <value>The season number.</value>
public int? SeasonNumber { get; set; }
/// <summary>
/// Gets or sets the episode number.
/// </summary>
/// <value>The episode number.</value>
public int? EpisodeNumber { get; set; }
public ProgramInfo()
{
Genres = new List<string>();

@ -193,6 +193,9 @@ namespace MediaBrowser.Dlna.Didl
if (string.Equals(subtitleMode, "CaptionInfoEx", StringComparison.OrdinalIgnoreCase))
{
// <sec:CaptionInfoEx sec:type="srt">http://192.168.1.3:9999/video.srt</sec:CaptionInfoEx>
// <sec:CaptionInfo sec:type="srt">http://192.168.1.3:9999/video.srt</sec:CaptionInfo>
//var res = container.OwnerDocument.CreateElement("SEC", "CaptionInfoEx");
//res.InnerText = info.Url;
@ -201,6 +204,16 @@ namespace MediaBrowser.Dlna.Didl
//res.SetAttribute("type", info.Format.ToLower());
//container.AppendChild(res);
}
else if (string.Equals(subtitleMode, "smi", StringComparison.OrdinalIgnoreCase))
{
var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
res.InnerText = info.Url;
res.SetAttribute("protocolInfo", "http-get:*:smi/caption:*");
container.AppendChild(res);
}
else
{
var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);

@ -132,6 +132,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
StreamReader innerReader = new StreamReader(innerResponse.Content);
responseString = innerReader.ReadToEnd();
var programDetails =
_jsonSerializer.DeserializeFromString<List<ScheduleDirect.ProgramDetails>>(
responseString);
@ -142,10 +143,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
var schedules = dailySchedules.SelectMany(d => d.programs);
foreach (ScheduleDirect.Program schedule in schedules)
{
_logger.Debug("Proccesing Schedule for statio ID " + stationID +
" which corresponds to channel " + channelNumber + " and program id " +
schedule.programID + " which says it has images? " +
programDict[schedule.programID].hasImageArtwork);
//_logger.Debug("Proccesing Schedule for statio ID " + stationID +
// " which corresponds to channel " + channelNumber + " and program id " +
// 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)
@ -244,7 +245,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
CultureInfo.InvariantCulture);
DateTime endAt = startAt.AddSeconds(programInfo.duration);
ProgramAudio audioType = ProgramAudio.Stereo;
bool hdtv = false;
bool repeat = (programInfo.@new == null);
string newID = programInfo.programID + "T" + startAt.Ticks + "C" + channel;
@ -268,43 +269,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
}
}
if ((programInfo.videoProperties != null))
{
hdtv = programInfo.videoProperties.Exists(item => item == "hdtv");
}
string desc = "";
if (details.descriptions != null)
{
if (details.descriptions.description1000 != null)
{
desc = details.descriptions.description1000[0].description;
}
else if (details.descriptions.description100 != null)
{
desc = details.descriptions.description100[0].description;
}
}
ScheduleDirect.Gracenote gracenote;
string episodeTitle = null;
if (details.metadata != null)
{
gracenote = details.metadata.Find(x => x.Gracenote != null).Gracenote;
if ((details.showType ?? "No ShowType") == "Series")
{
episodeTitle = "Season: " + gracenote.season + " Episode: " + gracenote.episode;
}
}
if (details.episodeTitle150 != null)
{
episodeTitle = ((episodeTitle ?? string.Empty) + " " + details.episodeTitle150).Trim();
episodeTitle = details.episodeTitle150;
}
var imageLink = "";
string imageUrl = null;
if (details.hasImageArtwork)
{
imageLink = details.images;
imageUrl = details.images;
}
var showType = details.showType ?? string.Empty;
@ -313,7 +288,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
ChannelId = channel,
Id = newID,
Overview = desc,
StartDate = startAt,
EndDate = endAt,
Name = details.titles[0].title120 ?? "Unkown",
@ -321,23 +295,48 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
CommunityRating = null,
EpisodeTitle = episodeTitle,
Audio = audioType,
IsHD = hdtv,
IsRepeat = repeat,
IsSeries = showType.IndexOf("series", StringComparison.OrdinalIgnoreCase) != -1,
ImageUrl = imageLink,
ImageUrl = imageUrl,
HasImage = details.hasImageArtwork,
IsNews = false,
IsKids = false,
IsKids = string.Equals(details.audience, "children", StringComparison.OrdinalIgnoreCase),
IsSports = showType.IndexOf("sports", StringComparison.OrdinalIgnoreCase) != -1,
IsLive = false,
IsMovie = showType.IndexOf("movie", StringComparison.OrdinalIgnoreCase) != -1 || showType.IndexOf("film", StringComparison.OrdinalIgnoreCase) != -1,
IsPremiere = false,
ShowId = programInfo.programID
};
if (programInfo.videoProperties != null)
{
info.IsHD = programInfo.videoProperties.Contains("hdtv", StringComparer.OrdinalIgnoreCase);
}
if (details.contentRating != null && details.contentRating.Count > 0)
{
info.OfficialRating = details.contentRating[0].code.Replace("TV", "TV-").Replace("--", "-");
}
if (details.descriptions != null)
{
if (details.descriptions.description1000 != null)
{
info.Overview = details.descriptions.description1000[0].description;
}
else if (details.descriptions.description100 != null)
{
info.ShortOverview = details.descriptions.description100[0].description;
}
}
if (info.IsSeries)
{
info.SeriesId = programInfo.programID.Substring(0, 10);
if (details.metadata != null)
{
var gracenote = details.metadata.Find(x => x.Gracenote != null).Gracenote;
info.SeasonNumber = gracenote.season;
info.EpisodeNumber = gracenote.episode;
}
}
if (!string.IsNullOrWhiteSpace(details.originalAirDate))
@ -349,8 +348,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{
info.Genres = details.genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList();
info.IsNews = details.genres.Contains("news", StringComparer.OrdinalIgnoreCase);
info.IsKids = false;
}
return info;
}
@ -888,6 +887,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
public class ProgramDetails
{
public string audience { get; set; }
public string programID { get; set; }
public List<Title> titles { get; set; }
public EventDetails eventDetails { get; set; }

@ -632,6 +632,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
item.ProductionYear = info.ProductionYear;
item.PremiereDate = item.PremiereDate ?? info.OriginalAirDate;
item.IndexNumber = info.EpisodeNumber;
item.ParentIndexNumber = info.SeasonNumber;
if (isNew)
{
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
@ -641,24 +644,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
}
var maxStartDate = DateTime.UtcNow.AddDays(3);
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions
{
ImageRefreshMode = info.StartDate <= maxStartDate ? ImageRefreshMode.Default : ImageRefreshMode.ValidationOnly
});
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions());
return item;
}
private void RefreshIfNeeded(LiveTvProgram program)
{
if (_refreshedPrograms.TryAdd(program.Id, program.Id))
{
_providerManager.QueueRefresh(program.Id, new MetadataRefreshOptions());
}
}
private async Task<Guid> CreateRecordingRecord(RecordingInfo info, string serviceName, CancellationToken cancellationToken)
{
var isNew = false;
@ -763,8 +753,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{
var program = GetInternalProgram(id);
RefreshIfNeeded(program);
var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user);
await AddRecordingInfo(new[] { dto }, cancellationToken).ConfigureAwait(false);
@ -832,7 +820,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var returnArray = returnPrograms
.Select(i =>
{
RefreshIfNeeded(i);
return _dtoService.GetBaseItemDto(i, options, user);
})
.ToArray();
@ -907,11 +894,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var returnArray = programList.ToArray();
foreach (var program in returnArray)
{
RefreshIfNeeded(program);
}
var result = new QueryResult<LiveTvProgram>
{
Items = returnArray,

Loading…
Cancel
Save