本文整理汇总了C#中MediaBrowser.Controller.Entities.TV.Series.GetSeasons方法的典型用法代码示例。如果您正苦于以下问题:C# Series.GetSeasons方法的具体用法?C# Series.GetSeasons怎么用?C# Series.GetSeasons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaBrowser.Controller.Entities.TV.Series
的用法示例。
在下文中一共展示了Series.GetSeasons方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNextUp
/// <summary>
/// Gets the next up.
/// </summary>
/// <param name="series">The series.</param>
/// <param name="user">The user.</param>
/// <returns>Task{Episode}.</returns>
private Tuple<Episode, DateTime, bool> GetNextUp(Series series, User user)
{
// Get them in display order, then reverse
var allEpisodes = series.GetSeasons(user, true, true)
.Where(i => !i.IndexNumber.HasValue || i.IndexNumber.Value != 0)
.SelectMany(i => i.GetEpisodes(user))
.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.Id, episode.GetUserDataKey());
if (userData.Played)
{
if (lastWatched != null || nextUp == null)
{
break;
}
lastWatched = episode;
lastWatchedDate = userData.LastPlayedDate ?? DateTime.MinValue;
}
else
{
if (episode.LocationType != LocationType.Virtual)
{
nextUp = episode;
}
}
}
if (lastWatched != null)
{
return new Tuple<Episode, DateTime, bool>(nextUp, lastWatchedDate, false);
}
var firstEpisode = allEpisodes.LastOrDefault(i => i.LocationType != LocationType.Virtual && !i.IsPlayed(user));
// Return the first episode
return new Tuple<Episode, DateTime, bool>(firstEpisode, DateTime.MinValue, true);
}
示例2: GetNextUp
/// <summary>
/// Gets the next up.
/// </summary>
/// <param name="series">The series.</param>
/// <param name="user">The user.</param>
/// <returns>Task{Episode}.</returns>
private Tuple<Episode, DateTime> GetNextUp(Series series, User user)
{
// Get them in display order, then reverse
var allEpisodes = series.GetSeasons(user, true, true)
.SelectMany(i => i.GetEpisodes(user, true, true))
.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.Id, episode.GetUserDataKey());
if (userData.Played)
{
if (lastWatched != null || nextUp == null)
{
break;
}
lastWatched = episode;
lastWatchedDate = userData.LastPlayedDate ?? DateTime.MinValue;
}
else
{
if (episode.LocationType != LocationType.Virtual)
{
nextUp = episode;
}
}
}
if (lastWatched != null)
{
return new Tuple<Episode, DateTime>(nextUp, lastWatchedDate);
}
return new Tuple<Episode, DateTime>(null, lastWatchedDate);
}