fixes #632 - Show yesterday's episodes in upcoming view

This commit is contained in:
Luke Pulverenti 2013-11-19 12:17:14 -05:00
parent 2b68dcd3c6
commit de339b8265
3 changed files with 32 additions and 8 deletions

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Dto;
using System.Globalization;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
@ -205,6 +206,12 @@ namespace MediaBrowser.Api.UserLibrary
[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; }
[ApiMember(Name = "MinPremiereDate", Description = "Optional. The minimum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MinPremiereDate { get; set; }
[ApiMember(Name = "MaxPremiereDate", Description = "Optional. The maximum premiere date. Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string MaxPremiereDate { get; set; }
}
/// <summary>
@ -1022,6 +1029,20 @@ namespace MediaBrowser.Api.UserLibrary
});
}
if (!string.IsNullOrEmpty(request.MinPremiereDate))
{
var date = DateTime.ParseExact(request.MinPremiereDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
items = items.Where(i => i.PremiereDate.HasValue && i.PremiereDate.Value >= date);
}
if (!string.IsNullOrEmpty(request.MaxPremiereDate))
{
var date = DateTime.ParseExact(request.MaxPremiereDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
items = items.Where(i => i.PremiereDate.HasValue && i.PremiereDate.Value <= date);
}
return items;
}

View File

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

View File

@ -481,11 +481,6 @@ namespace MediaBrowser.Server.Implementations.Providers
if (type == ImageType.Primary)
{
if (item is MusicAlbum || item is Artist || item is MusicArtist)
{
return new[] { Path.Combine(item.Path, "folder" + extension) };
}
if (item is Season && item.IndexNumber.HasValue)
{
var seriesFolder = Path.GetDirectoryName(item.Path);
@ -513,8 +508,12 @@ namespace MediaBrowser.Server.Implementations.Providers
return new[] { GetSavePathForItemInMixedFolder(item, type, string.Empty, extension) };
}
var filename = "poster" + extension;
return new[] { Path.Combine(item.MetaLocation, filename) };
if (item is MusicAlbum || item is Artist || item is MusicArtist)
{
return new[] { Path.Combine(item.MetaLocation, "folder" + extension) };
}
return new[] { Path.Combine(item.MetaLocation, "poster" + extension) };
}
if (type == ImageType.Banner)