Display specials within seasons

pull/702/head
Luke Pulverenti 11 years ago
parent cc16fd3af8
commit a09e330d4e

@ -202,6 +202,9 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "MinCriticRating", Description = "Optional filter by minimum critic rating.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public double? MinCriticRating { get; set; }
[ApiMember(Name = "AiredDuringSeason", Description = "Gets all episodes that aired during a season, including specials.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? AiredDuringSeason { get; set; }
}
/// <summary>
@ -1000,6 +1003,25 @@ namespace MediaBrowser.Api.UserLibrary
});
}
if (request.AiredDuringSeason.HasValue)
{
var val = request.AiredDuringSeason.Value;
items = items.Where(i =>
{
var episode = i as Episode;
if (episode != null)
{
var seasonNumber = episode.SpecialSeasonNumber ?? episode.ParentIndexNumber;
return seasonNumber.HasValue && seasonNumber.Value == val;
}
return false;
});
}
return items;
}

@ -796,7 +796,7 @@ namespace MediaBrowser.Controller.Entities
foreach (var tuple in list)
{
if (tasks.Count > 7)
if (tasks.Count > 10)
{
await Task.WhenAll(tasks).ConfigureAwait(false);
}
@ -873,7 +873,8 @@ namespace MediaBrowser.Controller.Entities
progress.Report((90 * percent) + 10);
}
}
}));
}, cancellationToken));
}
cancellationToken.ThrowIfCancellationRequested();

@ -32,6 +32,12 @@ namespace MediaBrowser.Controller.Entities.TV
}
}
/// <summary>
/// Gets the season in which it aired.
/// </summary>
/// <value>The aired season.</value>
public int? SpecialSeasonNumber { get; set; }
/// <summary>
/// We want to group into series not show individually in an index
/// </summary>

@ -30,6 +30,12 @@ namespace MediaBrowser.Model.Dto
/// <value>The date created.</value>
public DateTime? DateCreated { get; set; }
/// <summary>
/// Gets or sets the special season number.
/// </summary>
/// <value>The special season number.</value>
public int? SpecialSeasonNumber { get; set; }
/// <summary>
/// Gets or sets the name of the sort.
/// </summary>

@ -0,0 +1,23 @@
using System.Collections.Generic;
namespace MediaBrowser.Model.LiveTv
{
public class ChannelGuide
{
/// <summary>
/// Gets or sets the name of the service.
/// </summary>
/// <value>The name of the service.</value>
public string ServiceName { get; set; }
/// <summary>
/// ChannelId for the EPG.
/// </summary>
public string ChannelId { get; set; }
/// <summary>
/// List of all the programs for a specific channel
/// </summary>
public List<ProgramInfo> Programs { get; set; }
}
}

@ -0,0 +1,37 @@
using System;
namespace MediaBrowser.Model.LiveTv
{
public class ProgramInfo
{
/// <summary>
/// Id of the program.
/// </summary>
public string Id { get; set; }
/// <summary>
/// Name of the program
/// </summary>
public string Name { get; set; }
/// <summary>
/// Description of the progam.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The start date of the program, in UTC.
/// </summary>
public DateTime StartDate { get; set; }
/// <summary>
/// The end date of the program, in UTC.
/// </summary>
public DateTime EndDate { get; set; }
/// <summary>
/// Genre of the program.
/// </summary>
public string Genre { get; set; }
}
}

@ -0,0 +1,14 @@
namespace MediaBrowser.Model.LiveTv
{
/// <summary>
/// Class RecordingQuery.
/// </summary>
public class RecordingQuery
{
/// <summary>
/// Gets or sets a value indicating whether this instance has recorded.
/// </summary>
/// <value><c>null</c> if [has recorded] contains no value, <c>true</c> if [has recorded]; otherwise, <c>false</c>.</value>
public bool? HasRecorded { get; set; }
}
}

@ -265,6 +265,8 @@ namespace MediaBrowser.Model.Querying
public double? MinCommunityRating { get; set; }
public double? MinCriticRating { get; set; }
public int? AiredDuringSeason { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ItemQuery" /> class.
/// </summary>

@ -76,6 +76,11 @@ namespace MediaBrowser.Providers.Savers
builder.Append("<EpisodeNumberEnd>" + SecurityElement.Escape(episode.IndexNumberEnd.Value.ToString(_usCulture)) + "</EpisodeNumberEnd>");
}
if (episode.SpecialSeasonNumber.HasValue)
{
builder.Append("<SpecialSeasonNumber>" + SecurityElement.Escape(episode.SpecialSeasonNumber.Value.ToString(_usCulture)) + "</SpecialSeasonNumber>");
}
if (episode.ParentIndexNumber.HasValue)
{
builder.Append("<SeasonNumber>" + SecurityElement.Escape(episode.ParentIndexNumber.Value.ToString(_usCulture)) + "</SeasonNumber>");
@ -99,7 +104,8 @@ namespace MediaBrowser.Providers.Savers
"SeasonNumber",
"EpisodeNumber",
"EpisodeName",
"EpisodeNumberEnd"
"EpisodeNumberEnd",
"SpecialSeasonNumber"
});
// Set last refreshed so that the provider doesn't trigger after the file save

@ -139,6 +139,22 @@ namespace MediaBrowser.Providers.TV
break;
}
case "SpecialSeasonNumber":
{
var number = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(number))
{
int num;
if (int.TryParse(number, out num))
{
item.SpecialSeasonNumber = num;
}
}
break;
}
case "EpisodeName":
{
var name = reader.ReadElementContentAsString();

@ -113,7 +113,7 @@ namespace MediaBrowser.Providers.TV
{
get
{
return "1";
return "3";
}
}
@ -404,6 +404,40 @@ namespace MediaBrowser.Providers.TV
break;
}
case "airsafter_season":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val))
{
int rval;
// int.TryParse is local aware, so it can be probamatic, force us culture
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval))
{
item.SpecialSeasonNumber = rval;
}
}
break;
}
case "airsbefore_season":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val))
{
int rval;
// int.TryParse is local aware, so it can be probamatic, force us culture
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval))
{
item.SpecialSeasonNumber = rval;
}
}
break;
}
case "EpisodeName":
{
if (!item.LockedFields.Contains(MetadataFields.Name))

@ -1029,6 +1029,7 @@ namespace MediaBrowser.Server.Implementations.Dto
if (episode != null)
{
dto.IndexNumberEnd = episode.IndexNumberEnd;
dto.SpecialSeasonNumber = episode.SpecialSeasonNumber;
}
// Add SeriesInfo

Loading…
Cancel
Save