commit
2b49a0ee0f
|
@ -35,7 +35,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
public static void LogResponse(ILogger logger, int statusCode, string url, string endPoint, TimeSpan duration)
|
public static void LogResponse(ILogger logger, int statusCode, string url, string endPoint, TimeSpan duration)
|
||||||
{
|
{
|
||||||
var durationMs = duration.TotalMilliseconds;
|
var durationMs = duration.TotalMilliseconds;
|
||||||
var logSuffix = durationMs >= 1000 ? "ms (slow)" : "ms";
|
var logSuffix = durationMs >= 1000 && durationMs < 60000 ? "ms (slow)" : "ms";
|
||||||
|
|
||||||
logger.Info("HTTP Response {0} to {1}. Time: {2}{3}. {4}", statusCode, endPoint, Convert.ToInt32(durationMs).ToString(CultureInfo.InvariantCulture), logSuffix, url);
|
logger.Info("HTTP Response {0} to {1}. Time: {2}{3}. {4}", statusCode, endPoint, Convert.ToInt32(durationMs).ToString(CultureInfo.InvariantCulture), logSuffix, url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
||||||
|
|
||||||
private async Task<string> GetXml(string path, CancellationToken cancellationToken)
|
private async Task<string> GetXml(string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
_logger.Info("xmltv path: {0}", path);
|
||||||
|
|
||||||
if (!path.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
if (!path.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return path;
|
return path;
|
||||||
|
@ -161,7 +163,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
||||||
{
|
{
|
||||||
Id = c.Id,
|
Id = c.Id,
|
||||||
Name = c.DisplayName,
|
Name = c.DisplayName,
|
||||||
ImageUrl = c.Icon != null && !String.IsNullOrEmpty(c.Icon.Source) ? c.Icon.Source : null
|
ImageUrl = c.Icon != null && !String.IsNullOrEmpty(c.Icon.Source) ? c.Icon.Source : null,
|
||||||
|
Number = c.Id
|
||||||
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
JournalMode = SQLiteJournalModeEnum.Wal,
|
JournalMode = SQLiteJournalModeEnum.Wal,
|
||||||
|
|
||||||
// This is causing crashing under linux
|
// This is causing crashing under linux
|
||||||
Pooling = Environment.OSVersion.Platform == PlatformID.Win32NT,
|
Pooling = enablePooling && Environment.OSVersion.Platform == PlatformID.Win32NT,
|
||||||
ReadOnly = isReadOnly
|
ReadOnly = isReadOnly
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -124,58 +124,77 @@ namespace MediaBrowser.Server.Implementations.TV
|
||||||
/// <returns>Task{Episode}.</returns>
|
/// <returns>Task{Episode}.</returns>
|
||||||
private Tuple<Episode, DateTime, bool> GetNextUp(Series series, User user)
|
private Tuple<Episode, DateTime, bool> GetNextUp(Series series, User user)
|
||||||
{
|
{
|
||||||
// Get them in display order, then reverse
|
var firstUnwatchedEpisode = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||||
var allEpisodes = series.GetEpisodes(user, false, false)
|
|
||||||
.Where(i => !i.ParentIndexNumber.HasValue || i.ParentIndexNumber.Value != 0)
|
|
||||||
.Reverse()
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
Episode lastWatched = null;
|
|
||||||
var lastWatchedDate = DateTime.MinValue;
|
|
||||||
Episode nextUp = null;
|
|
||||||
|
|
||||||
var unplayedEpisodes = new List<Episode>();
|
|
||||||
|
|
||||||
// Go back starting with the most recent episodes
|
|
||||||
foreach (var episode in allEpisodes)
|
|
||||||
{
|
{
|
||||||
var userData = _userDataManager.GetUserData(user, episode);
|
AncestorWithPresentationUniqueKey = series.PresentationUniqueKey,
|
||||||
|
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||||
|
SortBy = new[] { ItemSortBy.SortName },
|
||||||
|
SortOrder = SortOrder.Ascending,
|
||||||
|
Limit = 1,
|
||||||
|
IsPlayed = false,
|
||||||
|
IsVirtualItem = false
|
||||||
|
|
||||||
if (userData.Played)
|
}).Cast<Episode>().FirstOrDefault();
|
||||||
{
|
|
||||||
if (lastWatched != null || nextUp == null)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastWatched = episode;
|
if (firstUnwatchedEpisode == null)
|
||||||
lastWatchedDate = userData.LastPlayedDate ?? DateTime.MinValue;
|
{
|
||||||
}
|
return new Tuple<Episode, DateTime, bool>(null, DateTime.MinValue, true);
|
||||||
else
|
|
||||||
{
|
|
||||||
unplayedEpisodes.Add(episode);
|
|
||||||
|
|
||||||
nextUp = episode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastWatched != null)
|
var lastWatchedEpisode = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
return new Tuple<Episode, DateTime, bool>(nextUp, lastWatchedDate, false);
|
AncestorWithPresentationUniqueKey = series.PresentationUniqueKey,
|
||||||
}
|
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||||
|
SortBy = new[] { ItemSortBy.DatePlayed },
|
||||||
|
SortOrder = SortOrder.Descending,
|
||||||
|
Limit = 1,
|
||||||
|
IsVirtualItem = false
|
||||||
|
|
||||||
Episode firstEpisode = null;
|
}).FirstOrDefault();
|
||||||
// Find the first unplayed episode. Start from the back of the list since they're in reverse order
|
|
||||||
for (var i = unplayedEpisodes.Count - 1; i >= 0; i--)
|
//// Get them in display order, then reverse
|
||||||
|
//var allEpisodes = series.GetEpisodes(user, false, false)
|
||||||
|
// .Where(i => !i.ParentIndexNumber.HasValue || i.ParentIndexNumber.Value != 0)
|
||||||
|
// .Reverse()
|
||||||
|
// .ToList();
|
||||||
|
|
||||||
|
//Episode lastWatched = null;
|
||||||
|
//var lastWatchedDate = DateTime.MinValue;
|
||||||
|
//Episode nextUp = null;
|
||||||
|
|
||||||
|
//// Go back starting with the most recent episodes
|
||||||
|
//foreach (var episode in allEpisodes)
|
||||||
|
//{
|
||||||
|
// var userData = _userDataManager.GetUserData(user, episode);
|
||||||
|
|
||||||
|
// if (userData.Played)
|
||||||
|
// {
|
||||||
|
// if (lastWatched != null || nextUp == null)
|
||||||
|
// {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// lastWatched = episode;
|
||||||
|
// lastWatchedDate = userData.LastPlayedDate ?? DateTime.MinValue;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// nextUp = episode;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (lastWatchedEpisode != null)
|
||||||
{
|
{
|
||||||
var unplayedEpisode = unplayedEpisodes[i];
|
var userData = _userDataManager.GetUserData(user, lastWatchedEpisode);
|
||||||
|
|
||||||
firstEpisode = unplayedEpisode;
|
if (userData.LastPlayedDate.HasValue)
|
||||||
break;
|
{
|
||||||
|
return new Tuple<Episode, DateTime, bool>(firstUnwatchedEpisode, userData.LastPlayedDate.Value, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the first episode
|
// Return the first episode
|
||||||
return new Tuple<Episode, DateTime, bool>(firstEpisode, DateTime.MinValue, true);
|
return new Tuple<Episode, DateTime, bool>(firstUnwatchedEpisode, DateTime.MinValue, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetResult(IEnumerable<BaseItem> items, int? totalRecordLimit, NextUpQuery query)
|
private QueryResult<BaseItem> GetResult(IEnumerable<BaseItem> items, int? totalRecordLimit, NextUpQuery query)
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.3.6.0" newVersion="2.3.6.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-2.3.6.0" newVersion="2.3.6.0"/>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
|
<enforceFIPSPolicy enabled="false"/>
|
||||||
</runtime>
|
</runtime>
|
||||||
<system.web>
|
<system.web>
|
||||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user