mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 09:34:44 +01:00
add sports to suggested tv
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user