aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-05-24 12:59:56 -0400
committerLuke <luke.pulverenti@gmail.com>2016-05-24 12:59:56 -0400
commitca6293568515221b661d4e6f9ec755dfee9cf461 (patch)
treed9f9523c32615b8e3f356e6be0c2860b4785978e
parentcd920b4a0db8fa4f4f8d013e2a6aa9dcf7a2cb1b (diff)
parent58d4534a2690389c37a7ad5bb247e6dc28c01401 (diff)
Merge pull request #1773 from MediaBrowser/dev
Dev
-rw-r--r--MediaBrowser.Server.Implementations/Library/UserDataManager.cs22
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs56
-rw-r--r--MediaBrowser.ServerApplication/MainStartup.cs12
-rw-r--r--MediaBrowser.WebDashboard/Api/PackageCreator.cs2
4 files changed, 30 insertions, 62 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs
index 0e211937f..afbce87a9 100644
--- a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs
@@ -170,22 +170,18 @@ namespace MediaBrowser.Server.Implementations.Library
return value;
}
}
+ }
- if (keys.Count > 0)
+ if (keys.Count > 0)
+ {
+ return new UserItemData
{
- var key = keys[0];
- var cacheKey = GetCacheKey(userId, key);
- var userdata = new UserItemData
- {
- UserId = userId,
- Key = key
- };
- _userData[cacheKey] = userdata;
- return userdata;
- }
-
- return null;
+ UserId = userId,
+ Key = keys[0]
+ };
}
+
+ return null;
}
/// <summary>
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
index a35a7c940..bbdc4ab0d 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -939,9 +939,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
IsMovie = query.IsMovie,
IsSports = query.IsSports,
IsKids = query.IsKids,
- EnableTotalRecordCount = query.EnableTotalRecordCount
+ EnableTotalRecordCount = query.EnableTotalRecordCount,
+ SortBy = new[] { ItemSortBy.StartDate }
};
+ if (query.Limit.HasValue)
+ {
+ internalQuery.Limit = Math.Max(query.Limit.Value * 5, 300);
+ }
+
if (query.HasAired.HasValue)
{
if (query.HasAired.Value)
@@ -958,15 +964,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var programList = programs.ToList();
- var genres = programList.SelectMany(i => i.Genres)
- .Where(i => !string.IsNullOrWhiteSpace(i))
- .DistinctNames()
- .Select(i => _libraryManager.GetGenre(i))
- .DistinctBy(i => i.Id)
- .ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
+ var factorChannelWatchCount = (query.IsAiring ?? false) || (query.IsKids ?? false) || (query.IsSports ?? false) || (query.IsMovie ?? false);
programs = programList.OrderBy(i => i.HasImage(ImageType.Primary) ? 0 : 1)
- .ThenByDescending(i => GetRecommendationScore(i, user.Id, genres))
+ .ThenByDescending(i => GetRecommendationScore(i, user.Id, factorChannelWatchCount))
.ThenBy(i => i.StartDate);
if (query.Limit.HasValue)
@@ -1004,7 +1005,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return result;
}
- private int GetRecommendationScore(LiveTvProgram program, Guid userId, Dictionary<string, Genre> genres)
+ private int GetRecommendationScore(LiveTvProgram program, Guid userId, bool factorChannelWatchCount)
{
var score = 0;
@@ -1036,41 +1037,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv
score += 3;
}
- score += GetGenreScore(program.Genres, userId, genres);
-
- return score;
- }
-
- private int GetGenreScore(IEnumerable<string> programGenres, Guid userId, Dictionary<string, Genre> genres)
- {
- return programGenres.Select(i =>
+ if (factorChannelWatchCount)
{
- var score = 0;
-
- Genre genre;
-
- if (genres.TryGetValue(i, out genre))
- {
- var genreUserdata = _userDataManager.GetUserData(userId, genre);
-
- if (genreUserdata.Likes ?? false)
- {
- score++;
- }
- else if (!(genreUserdata.Likes ?? true))
- {
- score--;
- }
-
- if (genreUserdata.IsFavorite)
- {
- score += 2;
- }
- }
-
- return score;
+ score += channelUserdata.PlayCount;
+ }
- }).Sum();
+ return score;
}
private async Task AddRecordingInfo(IEnumerable<Tuple<BaseItemDto, string, string>> programs, CancellationToken cancellationToken)
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index dc61dcda8..706e9c8ed 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -254,7 +254,7 @@ namespace MediaBrowser.ServerApplication
{
Task.WaitAll(task);
- task = InstallVcredistIfNeeded(_appHost, _logger);
+ task = InstallVcredist2013IfNeeded(_appHost, _logger);
Task.WaitAll(task);
task = InstallFrameworkV46IfNeeded(_logger);
@@ -679,7 +679,7 @@ namespace MediaBrowser.ServerApplication
}
}
- private static async Task InstallVcredistIfNeeded(ApplicationHost appHost, ILogger logger)
+ private static async Task InstallVcredist2013IfNeeded(ApplicationHost appHost, ILogger logger)
{
try
{
@@ -693,7 +693,7 @@ namespace MediaBrowser.ServerApplication
try
{
- await InstallVcredist().ConfigureAwait(false);
+ await InstallVcredist2013().ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -701,13 +701,13 @@ namespace MediaBrowser.ServerApplication
}
}
- private async static Task InstallVcredist()
+ private async static Task InstallVcredist2013()
{
var httpClient = _appHost.HttpClient;
var tmp = await httpClient.GetTempFile(new HttpRequestOptions
{
- Url = GetVcredistUrl(),
+ Url = GetVcredist2013Url(),
Progress = new Progress<double>()
}).ConfigureAwait(false);
@@ -733,7 +733,7 @@ namespace MediaBrowser.ServerApplication
}
}
- private static string GetVcredistUrl()
+ private static string GetVcredist2013Url()
{
if (Environment.Is64BitProcess)
{
diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
index d8de98abe..883c02914 100644
--- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs
+++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
@@ -274,7 +274,7 @@ namespace MediaBrowser.WebDashboard.Api
}
var mainFile = File.ReadAllText(GetDashboardResourcePath("index.html"));
- html = ReplaceFirst(mainFile, "<div class=\"mainAnimatedPage hide\"></div>", "<div class=\"mainAnimatedPage hide\">" + html + "</div>");
+ html = ReplaceFirst(mainFile, "<div class=\"mainAnimatedPages skinBody\"></div>", "<div class=\"mainAnimatedPages skinBody hide\">" + html + "</div>");
}
if (!string.IsNullOrWhiteSpace(localizationCulture))