add sports to suggested tv
This commit is contained in:
parent
1654236978
commit
0481fef03b
|
@ -186,6 +186,9 @@ namespace MediaBrowser.Api.LiveTv
|
|||
[ApiMember(Name = "IsMovie", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
|
||||
public bool? IsMovie { get; set; }
|
||||
|
||||
[ApiMember(Name = "IsSports", Description = "Optional filter for sports.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
|
||||
public bool? IsSports { get; set; }
|
||||
|
||||
[ApiMember(Name = "StartIndex", Description = "Optional. The record index to start at. All items with a lower index will be dropped from the results.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
|
||||
public int? StartIndex { get; set; }
|
||||
|
||||
|
@ -218,6 +221,9 @@ namespace MediaBrowser.Api.LiveTv
|
|||
[ApiMember(Name = "HasAired", Description = "Optional. Filter by programs that have completed airing, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||
public bool? HasAired { get; set; }
|
||||
|
||||
[ApiMember(Name = "IsSports", Description = "Optional filter for sports.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET,POST")]
|
||||
public bool? IsSports { get; set; }
|
||||
|
||||
[ApiMember(Name = "IsMovie", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||
public bool? IsMovie { get; set; }
|
||||
}
|
||||
|
@ -422,6 +428,7 @@ namespace MediaBrowser.Api.LiveTv
|
|||
query.SortBy = (request.SortBy ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
query.SortOrder = request.SortOrder;
|
||||
query.IsMovie = request.IsMovie;
|
||||
query.IsSports = request.IsSports;
|
||||
query.Genres = (request.Genres ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
var result = await _liveTvManager.GetPrograms(query, CancellationToken.None).ConfigureAwait(false);
|
||||
|
@ -437,7 +444,8 @@ namespace MediaBrowser.Api.LiveTv
|
|||
IsAiring = request.IsAiring,
|
||||
Limit = request.Limit,
|
||||
HasAired = request.HasAired,
|
||||
IsMovie = request.IsMovie
|
||||
IsMovie = request.IsMovie,
|
||||
IsSports = request.IsSports
|
||||
};
|
||||
|
||||
var result = await _liveTvManager.GetRecommendedPrograms(query, CancellationToken.None).ConfigureAwait(false);
|
||||
|
|
|
@ -53,6 +53,12 @@ namespace MediaBrowser.Model.LiveTv
|
|||
/// <remarks>If set to null, all programs will be returned</remarks>
|
||||
public bool? IsMovie { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is sports.
|
||||
/// </summary>
|
||||
/// <value><c>null</c> if [is sports] contains no value, <c>true</c> if [is sports]; otherwise, <c>false</c>.</value>
|
||||
public bool? IsSports { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Skips over a given number of items within the results. Use for paging.
|
||||
/// </summary>
|
||||
|
|
|
@ -31,5 +31,10 @@
|
|||
/// </summary>
|
||||
/// <value><c>null</c> if [is movie] contains no value, <c>true</c> if [is movie]; otherwise, <c>false</c>.</value>
|
||||
public bool? IsMovie { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is sports.
|
||||
/// </summary>
|
||||
/// <value><c>null</c> if [is sports] contains no value, <c>true</c> if [is sports]; otherwise, <c>false</c>.</value>
|
||||
public bool? IsSports { get; set; }
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ namespace MediaBrowser.Model.Querying
|
|||
/// The premiere date
|
||||
/// </summary>
|
||||
public const string PremiereDate = "PremiereDate";
|
||||
public const string StartDate = "StartDate";
|
||||
/// <summary>
|
||||
/// The sort name
|
||||
/// </summary>
|
||||
|
|
|
@ -761,6 +761,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
programs = programs.Where(p => p.IsMovie == query.IsMovie);
|
||||
}
|
||||
|
||||
if (query.IsSports.HasValue)
|
||||
{
|
||||
programs = programs.Where(p => p.IsSports == query.IsSports);
|
||||
}
|
||||
|
||||
programs = _libraryManager.Sort(programs, user, query.SortBy, query.SortOrder ?? SortOrder.Ascending)
|
||||
.Cast<LiveTvProgram>();
|
||||
|
||||
|
@ -826,6 +831,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
programs = programs.Where(p => p.IsMovie == query.IsMovie.Value);
|
||||
}
|
||||
|
||||
if (query.IsSports.HasValue)
|
||||
{
|
||||
programs = programs.Where(p => p.IsSports == query.IsSports.Value);
|
||||
}
|
||||
|
||||
var programList = programs.ToList();
|
||||
|
||||
var genres = programList.SelectMany(i => i.Genres)
|
||||
|
@ -996,6 +1006,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
innerProgress = new ActionableProgress<double>();
|
||||
innerProgress.RegisterAction(p => progress.Report(90 + (p * .1)));
|
||||
await CleanDatabaseInternal(progress, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
foreach (var program in _programs.Values
|
||||
.Where(i => (i.StartDate - DateTime.UtcNow).TotalDays <= 1)
|
||||
.ToList())
|
||||
{
|
||||
RefreshIfNeeded(program);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -913,7 +913,7 @@
|
|||
"OptionDefaultSort": "Default",
|
||||
"OptionCommunityMostWatchedSort": "Most Watched",
|
||||
"TabNextUp": "Next Up",
|
||||
"PlaceholderUsername": "Username",
|
||||
"PlaceholderUsername": "Username",
|
||||
"HeaderBecomeProjectSupporter": "Become an Emby Supporter",
|
||||
"MessageNoMovieSuggestionsAvailable": "No movie suggestions are currently available. Start watching and rating your movies, and then come back to view your recommendations.",
|
||||
"MessageNoCollectionsAvailable": "Collections allow you to enjoy personalized groupings of Movies, Series, Albums, Books and Games. Click the + button to start creating Collections.",
|
||||
|
@ -1399,6 +1399,7 @@
|
|||
"LabelEnableInternetMetadataForTvPrograms": "Download internet metadata for:",
|
||||
"OptionTVMovies": "TV Movies",
|
||||
"HeaderUpcomingMovies": "Upcoming Movies",
|
||||
"HeaderUpcomingSports": "Upcoming Sports",
|
||||
"HeaderUpcomingPrograms": "Upcoming Programs",
|
||||
"ButtonMoreItems": "More...",
|
||||
"LabelShowLibraryTileNames": "Show library tile names",
|
||||
|
|
|
@ -233,6 +233,7 @@
|
|||
<Compile Include="Localization\LocalizationManager.cs" />
|
||||
<Compile Include="Logging\PatternsLogger.cs" />
|
||||
<Compile Include="MediaEncoder\EncodingManager.cs" />
|
||||
<Compile Include="Sorting\StartDateComparer.cs" />
|
||||
<Compile Include="Sync\SyncHelper.cs" />
|
||||
<Compile Include="Sync\SyncJobOptions.cs" />
|
||||
<Compile Include="UserViews\DynamicImageProvider.cs" />
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Sorting
|
||||
{
|
||||
public class StartDateComparer : IBaseItemComparer
|
||||
{
|
||||
/// <summary>
|
||||
/// Compares the specified x.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
{
|
||||
return GetDate(x).CompareTo(GetDate(y));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
private DateTime GetDate(BaseItem x)
|
||||
{
|
||||
var hasStartDate = x as LiveTvProgram;
|
||||
|
||||
if (hasStartDate != null)
|
||||
{
|
||||
return hasStartDate.StartDate;
|
||||
}
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name
|
||||
{
|
||||
get { return ItemSortBy.StartDate; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user