From bce86c502206b016cc448afc1934101b852a1994 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 19 Nov 2013 22:15:48 -0500 Subject: pull person sort order from tvdb/tmdb data --- MediaBrowser.Controller/Entities/BaseItem.cs | 21 ++++++++++++++++----- MediaBrowser.Controller/Entities/IHasAspectRatio.cs | 14 ++++++++++++++ MediaBrowser.Controller/Entities/Person.cs | 6 ++++++ MediaBrowser.Controller/Entities/Video.cs | 8 +++++++- MediaBrowser.Controller/LiveTv/ILiveTvService.cs | 11 ++++++++++- .../MediaBrowser.Controller.csproj | 1 + .../Providers/BaseItemXmlParser.cs | 5 +++-- 7 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 MediaBrowser.Controller/Entities/IHasAspectRatio.cs (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index a6178536c..6b6719f01 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -483,6 +483,22 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public Folder Parent { get; set; } + [IgnoreDataMember] + public IEnumerable Parents + { + get + { + var parent = Parent; + + while (parent != null) + { + yield return parent; + + parent = parent.Parent; + } + } + } + /// /// When the item first debuted. For movies this could be premiere date, episodes would be first aired /// @@ -630,11 +646,6 @@ namespace MediaBrowser.Controller.Entities /// The original run time ticks. public long? OriginalRunTimeTicks { get; set; } /// - /// Gets or sets the aspect ratio. - /// - /// The aspect ratio. - public string AspectRatio { get; set; } - /// /// Gets or sets the production year. /// /// The production year. diff --git a/MediaBrowser.Controller/Entities/IHasAspectRatio.cs b/MediaBrowser.Controller/Entities/IHasAspectRatio.cs new file mode 100644 index 000000000..5aecf4eac --- /dev/null +++ b/MediaBrowser.Controller/Entities/IHasAspectRatio.cs @@ -0,0 +1,14 @@ +namespace MediaBrowser.Controller.Entities +{ + /// + /// Interface IHasAspectRatio + /// + public interface IHasAspectRatio + { + /// + /// Gets or sets the aspect ratio. + /// + /// The aspect ratio. + string AspectRatio { get; set; } + } +} diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs index e5cf48ad0..17b9d7741 100644 --- a/MediaBrowser.Controller/Entities/Person.cs +++ b/MediaBrowser.Controller/Entities/Person.cs @@ -49,6 +49,12 @@ namespace MediaBrowser.Controller.Entities /// The type. public string Type { get; set; } + /// + /// Gets or sets the sort order - ascending + /// + /// The sort order. + public int? SortOrder { get; set; } + /// /// Returns a that represents this instance. /// diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index e900dd77e..6a27ed690 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities /// /// Class Video /// - public class Video : BaseItem, IHasMediaStreams + public class Video : BaseItem, IHasMediaStreams, IHasAspectRatio { public bool IsMultiPart { get; set; } @@ -65,6 +65,12 @@ namespace MediaBrowser.Controller.Entities return GetPlayableStreamFiles(Path); } + /// + /// Gets or sets the aspect ratio. + /// + /// The aspect ratio. + public string AspectRatio { get; set; } + /// /// Should be overridden to return the proper folder where metadata lives /// diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index 5c019ae8c..d39d98fa3 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Model.LiveTv; +using System.IO; +using MediaBrowser.Model.LiveTv; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -23,6 +24,14 @@ namespace MediaBrowser.Controller.LiveTv /// Task{IEnumerable{ChannelInfo}}. Task> GetChannelsAsync(CancellationToken cancellationToken); + /// + /// Gets the channel image asynchronous. + /// + /// The channel identifier. + /// The cancellation token. + /// Task{Stream}. + Task GetChannelImageAsync(string channelId, CancellationToken cancellationToken); + /// /// Gets the recordings asynchronous. /// diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index f2837a1f1..8837d04f5 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -89,6 +89,7 @@ + diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index 9fdbbf3b7..d3fa7b09b 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -375,9 +375,10 @@ namespace MediaBrowser.Controller.Providers { var val = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(val)) + var hasAspectRatio = item as IHasAspectRatio; + if (!string.IsNullOrWhiteSpace(val) && hasAspectRatio != null) { - item.AspectRatio = val; + hasAspectRatio.AspectRatio = val; } break; } -- cgit v1.2.3