expose episode absolute numbers for editing
This commit is contained in:
parent
7c6581dd0f
commit
90184470fa
|
@ -279,6 +279,7 @@ namespace MediaBrowser.Api
|
||||||
episode.AirsAfterSeasonNumber = request.AirsAfterSeasonNumber;
|
episode.AirsAfterSeasonNumber = request.AirsAfterSeasonNumber;
|
||||||
episode.AirsBeforeEpisodeNumber = request.AirsBeforeEpisodeNumber;
|
episode.AirsBeforeEpisodeNumber = request.AirsBeforeEpisodeNumber;
|
||||||
episode.AirsBeforeSeasonNumber = request.AirsBeforeSeasonNumber;
|
episode.AirsBeforeSeasonNumber = request.AirsBeforeSeasonNumber;
|
||||||
|
episode.AbsoluteEpisodeNumber = request.AbsoluteEpisodeNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasTags = item as IHasTags;
|
var hasTags = item as IHasTags;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Api.UserLibrary;
|
using MediaBrowser.Api.UserLibrary;
|
||||||
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
@ -364,12 +365,11 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
var series = _libraryManager.GetItemById(request.Id) as Series;
|
var series = _libraryManager.GetItemById(request.Id) as Series;
|
||||||
|
|
||||||
var fields = request.GetItemFields().ToList();
|
if (series == null)
|
||||||
|
{
|
||||||
var seasons = series.GetChildren(user, true)
|
throw new ResourceNotFoundException("No series exists with Id " + request.Id);
|
||||||
.OfType<Season>();
|
}
|
||||||
|
var seasons = series.GetSeasons(user);
|
||||||
var sortOrder = ItemSortBy.SortName;
|
|
||||||
|
|
||||||
if (request.IsSpecialSeason.HasValue)
|
if (request.IsSpecialSeason.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -378,29 +378,8 @@ namespace MediaBrowser.Api
|
||||||
seasons = seasons.Where(i => i.IsSpecialSeason == val);
|
seasons = seasons.Where(i => i.IsSpecialSeason == val);
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = user.Configuration;
|
|
||||||
|
|
||||||
if (!config.DisplayMissingEpisodes && !config.DisplayUnairedEpisodes)
|
|
||||||
{
|
|
||||||
seasons = seasons.Where(i => !i.IsMissingOrVirtualUnaired);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!config.DisplayMissingEpisodes)
|
|
||||||
{
|
|
||||||
seasons = seasons.Where(i => !i.IsMissingSeason);
|
|
||||||
}
|
|
||||||
if (!config.DisplayUnairedEpisodes)
|
|
||||||
{
|
|
||||||
seasons = seasons.Where(i => !i.IsVirtualUnaired);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
seasons = FilterVirtualSeasons(request, seasons);
|
seasons = FilterVirtualSeasons(request, seasons);
|
||||||
|
|
||||||
seasons = _libraryManager.Sort(seasons, user, new[] { sortOrder }, SortOrder.Ascending)
|
|
||||||
.Cast<Season>();
|
|
||||||
|
|
||||||
// This must be the last filter
|
// This must be the last filter
|
||||||
if (!string.IsNullOrEmpty(request.AdjacentTo))
|
if (!string.IsNullOrEmpty(request.AdjacentTo))
|
||||||
{
|
{
|
||||||
|
@ -408,6 +387,8 @@ namespace MediaBrowser.Api
|
||||||
.Cast<Season>();
|
.Cast<Season>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fields = request.GetItemFields().ToList();
|
||||||
|
|
||||||
var returnItems = seasons.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
|
var returnItems = seasons.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
@ -450,66 +431,45 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
|
IEnumerable<Episode> episodes;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(request.SeasonId))
|
||||||
|
{
|
||||||
var series = _libraryManager.GetItemById(request.Id) as Series;
|
var series = _libraryManager.GetItemById(request.Id) as Series;
|
||||||
|
|
||||||
var fields = request.GetItemFields().ToList();
|
if (series == null)
|
||||||
|
|
||||||
var episodes = series.GetRecursiveChildren(user)
|
|
||||||
.OfType<Episode>();
|
|
||||||
|
|
||||||
var sortOrder = ItemSortBy.SortName;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(request.SeasonId))
|
|
||||||
{
|
{
|
||||||
var season = _libraryManager.GetItemById(new Guid(request.SeasonId)) as Season;
|
throw new ResourceNotFoundException("No series exists with Id " + request.Id);
|
||||||
|
}
|
||||||
|
|
||||||
if (season.IndexNumber.HasValue)
|
episodes = series.GetEpisodes(user, request.Season.Value);
|
||||||
{
|
|
||||||
episodes = FilterEpisodesBySeason(episodes, season.IndexNumber.Value, true);
|
|
||||||
|
|
||||||
sortOrder = ItemSortBy.AiredEpisodeOrder;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
episodes = season.RecursiveChildren.OfType<Episode>();
|
var season = _libraryManager.GetItemById(new Guid(request.SeasonId)) as Season;
|
||||||
|
|
||||||
sortOrder = ItemSortBy.SortName;
|
if (season == null)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (request.Season.HasValue)
|
|
||||||
{
|
{
|
||||||
episodes = FilterEpisodesBySeason(episodes, request.Season.Value, true);
|
throw new ResourceNotFoundException("No season exists with Id " + request.SeasonId);
|
||||||
|
|
||||||
sortOrder = ItemSortBy.AiredEpisodeOrder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = user.Configuration;
|
episodes = season.GetEpisodes(user);
|
||||||
|
|
||||||
if (!config.DisplayMissingEpisodes)
|
|
||||||
{
|
|
||||||
episodes = episodes.Where(i => !i.IsMissingEpisode);
|
|
||||||
}
|
|
||||||
if (!config.DisplayUnairedEpisodes)
|
|
||||||
{
|
|
||||||
episodes = episodes.Where(i => !i.IsVirtualUnaired);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter after the fact in case the ui doesn't want them
|
||||||
if (request.IsMissing.HasValue)
|
if (request.IsMissing.HasValue)
|
||||||
{
|
{
|
||||||
var val = request.IsMissing.Value;
|
var val = request.IsMissing.Value;
|
||||||
episodes = episodes.Where(i => i.IsMissingEpisode == val);
|
episodes = episodes.Where(i => i.IsMissingEpisode == val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter after the fact in case the ui doesn't want them
|
||||||
if (request.IsVirtualUnaired.HasValue)
|
if (request.IsVirtualUnaired.HasValue)
|
||||||
{
|
{
|
||||||
var val = request.IsVirtualUnaired.Value;
|
var val = request.IsVirtualUnaired.Value;
|
||||||
episodes = episodes.Where(i => i.IsVirtualUnaired == val);
|
episodes = episodes.Where(i => i.IsVirtualUnaired == val);
|
||||||
}
|
}
|
||||||
|
|
||||||
episodes = _libraryManager.Sort(episodes, user, new[] { sortOrder }, SortOrder.Ascending)
|
|
||||||
.Cast<Episode>();
|
|
||||||
|
|
||||||
// This must be the last filter
|
// This must be the last filter
|
||||||
if (!string.IsNullOrEmpty(request.AdjacentTo))
|
if (!string.IsNullOrEmpty(request.AdjacentTo))
|
||||||
{
|
{
|
||||||
|
@ -517,6 +477,8 @@ namespace MediaBrowser.Api
|
||||||
.Cast<Episode>();
|
.Cast<Episode>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fields = request.GetItemFields().ToList();
|
||||||
|
|
||||||
var returnItems = episodes.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
|
var returnItems = episodes.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
@ -526,27 +488,5 @@ namespace MediaBrowser.Api
|
||||||
Items = returnItems
|
Items = returnItems
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static IEnumerable<Episode> FilterEpisodesBySeason(IEnumerable<Episode> episodes, int seasonNumber, bool includeSpecials)
|
|
||||||
{
|
|
||||||
if (!includeSpecials || seasonNumber < 1)
|
|
||||||
{
|
|
||||||
return episodes.Where(i => (i.PhysicalSeasonNumber ?? -1) == seasonNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
return episodes.Where(i =>
|
|
||||||
{
|
|
||||||
var episode = i;
|
|
||||||
|
|
||||||
if (episode != null)
|
|
||||||
{
|
|
||||||
var currentSeasonNumber = episode.AiredSeasonNumber;
|
|
||||||
|
|
||||||
return currentSeasonNumber.HasValue && currentSeasonNumber.Value == seasonNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1041,7 +1041,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
if (request.AiredDuringSeason.HasValue)
|
if (request.AiredDuringSeason.HasValue)
|
||||||
{
|
{
|
||||||
items = TvShowsService.FilterEpisodesBySeason(items.OfType<Episode>(), request.AiredDuringSeason.Value, true);
|
items = Series.FilterEpisodesBySeason(items.OfType<Episode>(), request.AiredDuringSeason.Value, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(request.MinPremiereDate))
|
if (!string.IsNullOrEmpty(request.MinPremiereDate))
|
||||||
|
|
|
@ -51,6 +51,12 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
/// <value>The DVD episode number.</value>
|
/// <value>The DVD episode number.</value>
|
||||||
public float? DvdEpisodeNumber { get; set; }
|
public float? DvdEpisodeNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the absolute episode number.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The absolute episode number.</value>
|
||||||
|
public int? AbsoluteEpisodeNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// We want to group into series not show individually in an index
|
/// We want to group into series not show individually in an index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Localization;
|
using MediaBrowser.Controller.Localization;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Querying;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -186,7 +188,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public bool IsMissingSeason
|
public bool IsMissingSeason
|
||||||
{
|
{
|
||||||
get { return LocationType == Model.Entities.LocationType.Virtual && GetEpisodes().All(i => i.IsMissingEpisode); }
|
get { return LocationType == LocationType.Virtual && GetEpisodes().All(i => i.IsMissingEpisode); }
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
|
@ -198,13 +200,13 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public bool IsVirtualUnaired
|
public bool IsVirtualUnaired
|
||||||
{
|
{
|
||||||
get { return LocationType == Model.Entities.LocationType.Virtual && IsUnaired; }
|
get { return LocationType == LocationType.Virtual && IsUnaired; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public bool IsMissingOrVirtualUnaired
|
public bool IsMissingOrVirtualUnaired
|
||||||
{
|
{
|
||||||
get { return LocationType == Model.Entities.LocationType.Virtual && GetEpisodes().All(i => i.IsVirtualUnaired || i.IsMissingEpisode); }
|
get { return LocationType == LocationType.Virtual && GetEpisodes().All(i => i.IsVirtualUnaired || i.IsMissingEpisode); }
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
|
@ -212,5 +214,35 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
{
|
{
|
||||||
get { return (IndexNumber ?? -1) == 0; }
|
get { return (IndexNumber ?? -1) == 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the episodes.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user.</param>
|
||||||
|
/// <returns>IEnumerable{Episode}.</returns>
|
||||||
|
public IEnumerable<Episode> GetEpisodes(User user)
|
||||||
|
{
|
||||||
|
if (IndexNumber.HasValue)
|
||||||
|
{
|
||||||
|
var series = Series;
|
||||||
|
|
||||||
|
if (series != null)
|
||||||
|
{
|
||||||
|
return series.GetEpisodes(user, IndexNumber.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var episodes = GetRecursiveChildren(user)
|
||||||
|
.OfType<Episode>();
|
||||||
|
|
||||||
|
return LibraryManager
|
||||||
|
.Sort(episodes, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending)
|
||||||
|
.Cast<Episode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren, string indexBy = null)
|
||||||
|
{
|
||||||
|
return GetEpisodes(user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Localization;
|
using MediaBrowser.Controller.Localization;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Querying;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -117,5 +118,89 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
return Children.OfType<Video>().Any();
|
return Children.OfType<Video>().Any();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren, string indexBy = null)
|
||||||
|
{
|
||||||
|
return GetSeasons(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Season> GetSeasons(User user)
|
||||||
|
{
|
||||||
|
var seasons = base.GetChildren(user, true)
|
||||||
|
.OfType<Season>();
|
||||||
|
|
||||||
|
var config = user.Configuration;
|
||||||
|
|
||||||
|
if (!config.DisplayMissingEpisodes && !config.DisplayUnairedEpisodes)
|
||||||
|
{
|
||||||
|
seasons = seasons.Where(i => !i.IsMissingOrVirtualUnaired);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!config.DisplayMissingEpisodes)
|
||||||
|
{
|
||||||
|
seasons = seasons.Where(i => !i.IsMissingSeason);
|
||||||
|
}
|
||||||
|
if (!config.DisplayUnairedEpisodes)
|
||||||
|
{
|
||||||
|
seasons = seasons.Where(i => !i.IsVirtualUnaired);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return LibraryManager
|
||||||
|
.Sort(seasons, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending)
|
||||||
|
.Cast<Season>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Episode> GetEpisodes(User user, int seasonNumber)
|
||||||
|
{
|
||||||
|
var episodes = GetRecursiveChildren(user)
|
||||||
|
.OfType<Episode>();
|
||||||
|
|
||||||
|
episodes = FilterEpisodesBySeason(episodes, seasonNumber, true);
|
||||||
|
|
||||||
|
var config = user.Configuration;
|
||||||
|
|
||||||
|
if (!config.DisplayMissingEpisodes)
|
||||||
|
{
|
||||||
|
episodes = episodes.Where(i => !i.IsMissingEpisode);
|
||||||
|
}
|
||||||
|
if (!config.DisplayUnairedEpisodes)
|
||||||
|
{
|
||||||
|
episodes = episodes.Where(i => !i.IsVirtualUnaired);
|
||||||
|
}
|
||||||
|
|
||||||
|
return LibraryManager.Sort(episodes, user, new[] { ItemSortBy.AiredEpisodeOrder }, SortOrder.Ascending)
|
||||||
|
.Cast<Episode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Filters the episodes by season.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="episodes">The episodes.</param>
|
||||||
|
/// <param name="seasonNumber">The season number.</param>
|
||||||
|
/// <param name="includeSpecials">if set to <c>true</c> [include specials].</param>
|
||||||
|
/// <returns>IEnumerable{Episode}.</returns>
|
||||||
|
public static IEnumerable<Episode> FilterEpisodesBySeason(IEnumerable<Episode> episodes, int seasonNumber, bool includeSpecials)
|
||||||
|
{
|
||||||
|
if (!includeSpecials || seasonNumber < 1)
|
||||||
|
{
|
||||||
|
return episodes.Where(i => (i.PhysicalSeasonNumber ?? -1) == seasonNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
return episodes.Where(i =>
|
||||||
|
{
|
||||||
|
var episode = i;
|
||||||
|
|
||||||
|
if (episode != null)
|
||||||
|
{
|
||||||
|
var currentSeasonNumber = episode.AiredSeasonNumber;
|
||||||
|
|
||||||
|
return currentSeasonNumber.HasValue && currentSeasonNumber.Value == seasonNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace MediaBrowser.Model.Dto
|
||||||
public int? AirsBeforeSeasonNumber { get; set; }
|
public int? AirsBeforeSeasonNumber { get; set; }
|
||||||
public int? AirsAfterSeasonNumber { get; set; }
|
public int? AirsAfterSeasonNumber { get; set; }
|
||||||
public int? AirsBeforeEpisodeNumber { get; set; }
|
public int? AirsBeforeEpisodeNumber { get; set; }
|
||||||
|
public int? AbsoluteEpisodeNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DVD season number.
|
/// Gets or sets the DVD season number.
|
||||||
|
|
|
@ -92,6 +92,11 @@ namespace MediaBrowser.Providers.Savers
|
||||||
builder.Append("<SeasonNumber>" + SecurityElement.Escape(episode.ParentIndexNumber.Value.ToString(_usCulture)) + "</SeasonNumber>");
|
builder.Append("<SeasonNumber>" + SecurityElement.Escape(episode.ParentIndexNumber.Value.ToString(_usCulture)) + "</SeasonNumber>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (episode.AbsoluteEpisodeNumber.HasValue)
|
||||||
|
{
|
||||||
|
builder.Append("<absolute_number>" + SecurityElement.Escape(episode.AbsoluteEpisodeNumber.Value.ToString(_usCulture)) + "</absolute_number>");
|
||||||
|
}
|
||||||
|
|
||||||
if (episode.DvdEpisodeNumber.HasValue)
|
if (episode.DvdEpisodeNumber.HasValue)
|
||||||
{
|
{
|
||||||
builder.Append("<DVD_episodenumber>" + SecurityElement.Escape(episode.DvdEpisodeNumber.Value.ToString(_usCulture)) + "</DVD_episodenumber>");
|
builder.Append("<DVD_episodenumber>" + SecurityElement.Escape(episode.DvdEpisodeNumber.Value.ToString(_usCulture)) + "</DVD_episodenumber>");
|
||||||
|
@ -125,7 +130,8 @@ namespace MediaBrowser.Providers.Savers
|
||||||
"airsbefore_episode",
|
"airsbefore_episode",
|
||||||
"airsbefore_season",
|
"airsbefore_season",
|
||||||
"DVD_episodenumber",
|
"DVD_episodenumber",
|
||||||
"DVD_season"
|
"DVD_season",
|
||||||
|
"absolute_number"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -534,20 +534,12 @@ namespace MediaBrowser.Providers.Savers
|
||||||
{
|
{
|
||||||
var video = item as Video;
|
var video = item as Video;
|
||||||
|
|
||||||
|
if (video != null && video.Video3DFormat.HasValue)
|
||||||
|
{
|
||||||
builder.Append("<MediaInfo>");
|
builder.Append("<MediaInfo>");
|
||||||
|
|
||||||
builder.Append("<Video>");
|
builder.Append("<Video>");
|
||||||
|
|
||||||
if (item.RunTimeTicks.HasValue)
|
|
||||||
{
|
|
||||||
var timespan = TimeSpan.FromTicks(item.RunTimeTicks.Value);
|
|
||||||
|
|
||||||
builder.Append("<Duration>" + Convert.ToInt64(timespan.TotalMinutes).ToString(UsCulture) + "</Duration>");
|
|
||||||
builder.Append("<DurationSeconds>" + Convert.ToInt64(timespan.TotalSeconds).ToString(UsCulture) + "</DurationSeconds>");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (video != null && video.Video3DFormat.HasValue)
|
|
||||||
{
|
|
||||||
switch (video.Video3DFormat.Value)
|
switch (video.Video3DFormat.Value)
|
||||||
{
|
{
|
||||||
case Video3DFormat.FullSideBySide:
|
case Video3DFormat.FullSideBySide:
|
||||||
|
@ -563,11 +555,11 @@ namespace MediaBrowser.Providers.Savers
|
||||||
builder.Append("<Format3D>HTAB</Format3D>");
|
builder.Append("<Format3D>HTAB</Format3D>");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("</Video>");
|
builder.Append("</Video>");
|
||||||
|
|
||||||
builder.Append("</MediaInfo>");
|
builder.Append("</MediaInfo>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,23 @@ namespace MediaBrowser.Providers.TV
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "absolute_number":
|
||||||
|
{
|
||||||
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(val))
|
||||||
|
{
|
||||||
|
int rval;
|
||||||
|
|
||||||
|
// int.TryParse is local aware, so it can be probamatic, force us culture
|
||||||
|
if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval))
|
||||||
|
{
|
||||||
|
item.AbsoluteEpisodeNumber = rval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "DVD_episodenumber":
|
case "DVD_episodenumber":
|
||||||
{
|
{
|
||||||
var number = reader.ReadElementContentAsString();
|
var number = reader.ReadElementContentAsString();
|
||||||
|
|
|
@ -438,6 +438,24 @@ namespace MediaBrowser.Providers.TV
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "absolute_number":
|
||||||
|
{
|
||||||
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(val))
|
||||||
|
{
|
||||||
|
int rval;
|
||||||
|
|
||||||
|
// int.TryParse is local aware, so it can be probamatic, force us culture
|
||||||
|
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out rval))
|
||||||
|
{
|
||||||
|
item.AbsoluteEpisodeNumber = rval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case "airsbefore_episode":
|
case "airsbefore_episode":
|
||||||
{
|
{
|
||||||
var val = reader.ReadElementContentAsString();
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
|
@ -163,8 +163,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||||
{
|
{
|
||||||
var folder = (Folder)item;
|
var folder = (Folder)item;
|
||||||
|
|
||||||
dto.ChildCount = folder.GetChildren(user, true)
|
dto.ChildCount = GetChildCount(folder, user);
|
||||||
.Count();
|
|
||||||
|
|
||||||
if (!(folder is UserRootFolder))
|
if (!(folder is UserRootFolder))
|
||||||
{
|
{
|
||||||
|
@ -182,6 +181,12 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int GetChildCount(Folder folder, User user)
|
||||||
|
{
|
||||||
|
return folder.GetChildren(user, true)
|
||||||
|
.Count();
|
||||||
|
}
|
||||||
|
|
||||||
public UserDto GetUserDto(User user)
|
public UserDto GetUserDto(User user)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
|
@ -1067,6 +1072,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||||
dto.AirsAfterSeasonNumber = episode.AirsAfterSeasonNumber;
|
dto.AirsAfterSeasonNumber = episode.AirsAfterSeasonNumber;
|
||||||
dto.AirsBeforeEpisodeNumber = episode.AirsBeforeEpisodeNumber;
|
dto.AirsBeforeEpisodeNumber = episode.AirsBeforeEpisodeNumber;
|
||||||
dto.AirsBeforeSeasonNumber = episode.AirsBeforeSeasonNumber;
|
dto.AirsBeforeSeasonNumber = episode.AirsBeforeSeasonNumber;
|
||||||
|
dto.AbsoluteEpisodeNumber = episode.AbsoluteEpisodeNumber;
|
||||||
|
|
||||||
var seasonId = episode.SeasonId;
|
var seasonId = episode.SeasonId;
|
||||||
if (seasonId.HasValue)
|
if (seasonId.HasValue)
|
||||||
|
@ -1202,8 +1208,21 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||||
|
|
||||||
double totalPercentPlayed = 0;
|
double totalPercentPlayed = 0;
|
||||||
|
|
||||||
|
IEnumerable<BaseItem> children;
|
||||||
|
|
||||||
|
var season = folder as Season;
|
||||||
|
|
||||||
|
if (season != null)
|
||||||
|
{
|
||||||
|
children = season.GetEpisodes(user).Where(i => i.LocationType != LocationType.Virtual);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
children = folder.GetRecursiveChildren(user, i => !i.IsFolder && i.LocationType != LocationType.Virtual);
|
||||||
|
}
|
||||||
|
|
||||||
// Loop through each recursive child
|
// Loop through each recursive child
|
||||||
foreach (var child in folder.GetRecursiveChildren(user, i => !i.IsFolder && i.LocationType != LocationType.Virtual))
|
foreach (var child in children)
|
||||||
{
|
{
|
||||||
var userdata = _userDataRepository.GetUserData(user.Id, child.GetUserDataKey());
|
var userdata = _userDataRepository.GetUserData(user.Id, child.GetUserDataKey());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user