mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update detail page
This commit is contained in:
parent
d2b4dd9a98
commit
615d1e2a53
@ -33,6 +33,11 @@ namespace MediaBrowser.Controller.LiveTv
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The overview.</value>
|
/// <value>The overview.</value>
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the short overview.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The short overview.</value>
|
||||||
|
public string ShortOverview { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The start date of the program, in UTC.
|
/// The start date of the program, in UTC.
|
||||||
@ -165,6 +170,16 @@ namespace MediaBrowser.Controller.LiveTv
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The show identifier.</value>
|
/// <value>The show identifier.</value>
|
||||||
public string ShowId { get; set; }
|
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()
|
public ProgramInfo()
|
||||||
{
|
{
|
||||||
|
@ -193,6 +193,9 @@ namespace MediaBrowser.Dlna.Didl
|
|||||||
|
|
||||||
if (string.Equals(subtitleMode, "CaptionInfoEx", StringComparison.OrdinalIgnoreCase))
|
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");
|
//var res = container.OwnerDocument.CreateElement("SEC", "CaptionInfoEx");
|
||||||
|
|
||||||
//res.InnerText = info.Url;
|
//res.InnerText = info.Url;
|
||||||
@ -201,6 +204,16 @@ namespace MediaBrowser.Dlna.Didl
|
|||||||
//res.SetAttribute("type", info.Format.ToLower());
|
//res.SetAttribute("type", info.Format.ToLower());
|
||||||
//container.AppendChild(res);
|
//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
|
else
|
||||||
{
|
{
|
||||||
var res = container.OwnerDocument.CreateElement(string.Empty, "res", NS_DIDL);
|
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);
|
StreamReader innerReader = new StreamReader(innerResponse.Content);
|
||||||
responseString = innerReader.ReadToEnd();
|
responseString = innerReader.ReadToEnd();
|
||||||
|
|
||||||
var programDetails =
|
var programDetails =
|
||||||
_jsonSerializer.DeserializeFromString<List<ScheduleDirect.ProgramDetails>>(
|
_jsonSerializer.DeserializeFromString<List<ScheduleDirect.ProgramDetails>>(
|
||||||
responseString);
|
responseString);
|
||||||
@ -142,10 +143,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
var schedules = dailySchedules.SelectMany(d => d.programs);
|
var schedules = dailySchedules.SelectMany(d => d.programs);
|
||||||
foreach (ScheduleDirect.Program schedule in schedules)
|
foreach (ScheduleDirect.Program schedule in schedules)
|
||||||
{
|
{
|
||||||
_logger.Debug("Proccesing Schedule for statio ID " + stationID +
|
//_logger.Debug("Proccesing Schedule for statio ID " + stationID +
|
||||||
" which corresponds to channel " + channelNumber + " and program id " +
|
// " which corresponds to channel " + channelNumber + " and program id " +
|
||||||
schedule.programID + " which says it has images? " +
|
// schedule.programID + " which says it has images? " +
|
||||||
programDict[schedule.programID].hasImageArtwork);
|
// programDict[schedule.programID].hasImageArtwork);
|
||||||
|
|
||||||
var imageIndex = images.FindIndex(i => i.programID == schedule.programID.Substring(0, 10));
|
var imageIndex = images.FindIndex(i => i.programID == schedule.programID.Substring(0, 10));
|
||||||
if (imageIndex > -1)
|
if (imageIndex > -1)
|
||||||
@ -244,7 +245,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
CultureInfo.InvariantCulture);
|
CultureInfo.InvariantCulture);
|
||||||
DateTime endAt = startAt.AddSeconds(programInfo.duration);
|
DateTime endAt = startAt.AddSeconds(programInfo.duration);
|
||||||
ProgramAudio audioType = ProgramAudio.Stereo;
|
ProgramAudio audioType = ProgramAudio.Stereo;
|
||||||
bool hdtv = false;
|
|
||||||
bool repeat = (programInfo.@new == null);
|
bool repeat = (programInfo.@new == null);
|
||||||
string newID = programInfo.programID + "T" + startAt.Ticks + "C" + channel;
|
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;
|
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)
|
if (details.episodeTitle150 != null)
|
||||||
{
|
{
|
||||||
episodeTitle = ((episodeTitle ?? string.Empty) + " " + details.episodeTitle150).Trim();
|
episodeTitle = details.episodeTitle150;
|
||||||
}
|
}
|
||||||
|
|
||||||
var imageLink = "";
|
string imageUrl = null;
|
||||||
|
|
||||||
if (details.hasImageArtwork)
|
if (details.hasImageArtwork)
|
||||||
{
|
{
|
||||||
imageLink = details.images;
|
imageUrl = details.images;
|
||||||
}
|
}
|
||||||
|
|
||||||
var showType = details.showType ?? string.Empty;
|
var showType = details.showType ?? string.Empty;
|
||||||
@ -313,7 +288,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
{
|
{
|
||||||
ChannelId = channel,
|
ChannelId = channel,
|
||||||
Id = newID,
|
Id = newID,
|
||||||
Overview = desc,
|
|
||||||
StartDate = startAt,
|
StartDate = startAt,
|
||||||
EndDate = endAt,
|
EndDate = endAt,
|
||||||
Name = details.titles[0].title120 ?? "Unkown",
|
Name = details.titles[0].title120 ?? "Unkown",
|
||||||
@ -321,23 +295,48 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
CommunityRating = null,
|
CommunityRating = null,
|
||||||
EpisodeTitle = episodeTitle,
|
EpisodeTitle = episodeTitle,
|
||||||
Audio = audioType,
|
Audio = audioType,
|
||||||
IsHD = hdtv,
|
|
||||||
IsRepeat = repeat,
|
IsRepeat = repeat,
|
||||||
IsSeries = showType.IndexOf("series", StringComparison.OrdinalIgnoreCase) != -1,
|
IsSeries = showType.IndexOf("series", StringComparison.OrdinalIgnoreCase) != -1,
|
||||||
ImageUrl = imageLink,
|
ImageUrl = imageUrl,
|
||||||
HasImage = details.hasImageArtwork,
|
HasImage = details.hasImageArtwork,
|
||||||
IsNews = false,
|
IsKids = string.Equals(details.audience, "children", StringComparison.OrdinalIgnoreCase),
|
||||||
IsKids = false,
|
|
||||||
IsSports = showType.IndexOf("sports", StringComparison.OrdinalIgnoreCase) != -1,
|
IsSports = showType.IndexOf("sports", StringComparison.OrdinalIgnoreCase) != -1,
|
||||||
IsLive = false,
|
|
||||||
IsMovie = showType.IndexOf("movie", StringComparison.OrdinalIgnoreCase) != -1 || showType.IndexOf("film", StringComparison.OrdinalIgnoreCase) != -1,
|
IsMovie = showType.IndexOf("movie", StringComparison.OrdinalIgnoreCase) != -1 || showType.IndexOf("film", StringComparison.OrdinalIgnoreCase) != -1,
|
||||||
IsPremiere = false,
|
|
||||||
ShowId = programInfo.programID
|
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)
|
if (info.IsSeries)
|
||||||
{
|
{
|
||||||
info.SeriesId = programInfo.programID.Substring(0, 10);
|
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))
|
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.Genres = details.genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList();
|
||||||
info.IsNews = details.genres.Contains("news", StringComparer.OrdinalIgnoreCase);
|
info.IsNews = details.genres.Contains("news", StringComparer.OrdinalIgnoreCase);
|
||||||
info.IsKids = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,6 +887,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||||||
|
|
||||||
public class ProgramDetails
|
public class ProgramDetails
|
||||||
{
|
{
|
||||||
|
public string audience { get; set; }
|
||||||
public string programID { get; set; }
|
public string programID { get; set; }
|
||||||
public List<Title> titles { get; set; }
|
public List<Title> titles { get; set; }
|
||||||
public EventDetails eventDetails { get; set; }
|
public EventDetails eventDetails { get; set; }
|
||||||
|
@ -632,6 +632,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
item.ProductionYear = info.ProductionYear;
|
item.ProductionYear = info.ProductionYear;
|
||||||
item.PremiereDate = item.PremiereDate ?? info.OriginalAirDate;
|
item.PremiereDate = item.PremiereDate ?? info.OriginalAirDate;
|
||||||
|
|
||||||
|
item.IndexNumber = info.EpisodeNumber;
|
||||||
|
item.ParentIndexNumber = info.SeasonNumber;
|
||||||
|
|
||||||
if (isNew)
|
if (isNew)
|
||||||
{
|
{
|
||||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
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);
|
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var maxStartDate = DateTime.UtcNow.AddDays(3);
|
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions());
|
||||||
|
|
||||||
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions
|
|
||||||
{
|
|
||||||
ImageRefreshMode = info.StartDate <= maxStartDate ? ImageRefreshMode.Default : ImageRefreshMode.ValidationOnly
|
|
||||||
});
|
|
||||||
|
|
||||||
return item;
|
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)
|
private async Task<Guid> CreateRecordingRecord(RecordingInfo info, string serviceName, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var isNew = false;
|
var isNew = false;
|
||||||
@ -763,8 +753,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
{
|
{
|
||||||
var program = GetInternalProgram(id);
|
var program = GetInternalProgram(id);
|
||||||
|
|
||||||
RefreshIfNeeded(program);
|
|
||||||
|
|
||||||
var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user);
|
var dto = _dtoService.GetBaseItemDto(program, new DtoOptions(), user);
|
||||||
|
|
||||||
await AddRecordingInfo(new[] { dto }, cancellationToken).ConfigureAwait(false);
|
await AddRecordingInfo(new[] { dto }, cancellationToken).ConfigureAwait(false);
|
||||||
@ -832,7 +820,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
var returnArray = returnPrograms
|
var returnArray = returnPrograms
|
||||||
.Select(i =>
|
.Select(i =>
|
||||||
{
|
{
|
||||||
RefreshIfNeeded(i);
|
|
||||||
return _dtoService.GetBaseItemDto(i, options, user);
|
return _dtoService.GetBaseItemDto(i, options, user);
|
||||||
})
|
})
|
||||||
.ToArray();
|
.ToArray();
|
||||||
@ -907,11 +894,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
|
|
||||||
var returnArray = programList.ToArray();
|
var returnArray = programList.ToArray();
|
||||||
|
|
||||||
foreach (var program in returnArray)
|
|
||||||
{
|
|
||||||
RefreshIfNeeded(program);
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = new QueryResult<LiveTvProgram>
|
var result = new QueryResult<LiveTvProgram>
|
||||||
{
|
{
|
||||||
Items = returnArray,
|
Items = returnArray,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user