Quellcode durchsuchen

Display specials within seasons

Luke Pulverenti vor 11 Jahren
Ursprung
Commit
a09e330d4e

+ 22 - 0
MediaBrowser.Api/UserLibrary/ItemsService.cs

@@ -202,6 +202,9 @@ namespace MediaBrowser.Api.UserLibrary
 
         [ApiMember(Name = "MinCriticRating", Description = "Optional filter by minimum critic rating.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
         public double? MinCriticRating { get; set; }
+
+        [ApiMember(Name = "AiredDuringSeason", Description = "Gets all episodes that aired during a season, including specials.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
+        public int? AiredDuringSeason { get; set; }
     }
 
     /// <summary>
@@ -1000,6 +1003,25 @@ namespace MediaBrowser.Api.UserLibrary
                 });
             }
 
+            if (request.AiredDuringSeason.HasValue)
+            {
+                var val = request.AiredDuringSeason.Value;
+
+                items = items.Where(i =>
+                {
+                    var episode = i as Episode;
+
+                    if (episode != null)
+                    {
+                        var seasonNumber = episode.SpecialSeasonNumber ?? episode.ParentIndexNumber;
+
+                        return seasonNumber.HasValue && seasonNumber.Value == val;
+                    }
+
+                    return false;
+                });
+            }
+
             return items;
         }
 

+ 3 - 2
MediaBrowser.Controller/Entities/Folder.cs

@@ -796,7 +796,7 @@ namespace MediaBrowser.Controller.Entities
 
             foreach (var tuple in list)
             {
-                if (tasks.Count > 7)
+                if (tasks.Count > 10)
                 {
                     await Task.WhenAll(tasks).ConfigureAwait(false);
                 }
@@ -873,7 +873,8 @@ namespace MediaBrowser.Controller.Entities
                             progress.Report((90 * percent) + 10);
                         }
                     }
-                }));
+
+                }, cancellationToken));
             }
 
             cancellationToken.ThrowIfCancellationRequested();

+ 6 - 0
MediaBrowser.Controller/Entities/TV/Episode.cs

@@ -32,6 +32,12 @@ namespace MediaBrowser.Controller.Entities.TV
             }
         }
 
+        /// <summary>
+        /// Gets the season in which it aired.
+        /// </summary>
+        /// <value>The aired season.</value>
+        public int? SpecialSeasonNumber { get; set; }
+
         /// <summary>
         /// We want to group into series not show individually in an index
         /// </summary>

+ 6 - 0
MediaBrowser.Model/Dto/BaseItemDto.cs

@@ -30,6 +30,12 @@ namespace MediaBrowser.Model.Dto
         /// <value>The date created.</value>
         public DateTime? DateCreated { get; set; }
 
+        /// <summary>
+        /// Gets or sets the special season number.
+        /// </summary>
+        /// <value>The special season number.</value>
+        public int? SpecialSeasonNumber { get; set; }
+        
         /// <summary>
         /// Gets or sets the name of the sort.
         /// </summary>

+ 23 - 0
MediaBrowser.Model/LiveTv/ChannelGuide.cs

@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+
+namespace MediaBrowser.Model.LiveTv
+{
+    public class ChannelGuide
+    {
+        /// <summary>
+        /// Gets or sets the name of the service.
+        /// </summary>
+        /// <value>The name of the service.</value>
+        public string ServiceName { get; set; }
+
+        /// <summary>
+        /// ChannelId for the EPG.
+        /// </summary>
+        public string ChannelId { get; set; }
+
+        /// <summary>
+        /// List of all the programs for a specific channel
+        /// </summary>
+        public List<ProgramInfo> Programs { get; set; } 
+    }
+}

+ 37 - 0
MediaBrowser.Model/LiveTv/ProgramInfo.cs

@@ -0,0 +1,37 @@
+using System;
+
+namespace MediaBrowser.Model.LiveTv
+{
+    public class ProgramInfo
+    {
+        /// <summary>
+        /// Id of the program.
+        /// </summary>
+        public string Id { get; set; }
+
+        /// <summary>
+        /// Name of the program
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// Description of the progam.
+        /// </summary>
+        public string Description { get; set; }
+
+        /// <summary>
+        /// The start date of the program, in UTC.
+        /// </summary>
+        public DateTime StartDate { get; set; }
+
+        /// <summary>
+        /// The end date of the program, in UTC.
+        /// </summary>
+        public DateTime EndDate { get; set; }
+
+        /// <summary>
+        /// Genre of the program.
+        /// </summary>
+        public string Genre { get; set; }
+    }
+}

+ 14 - 0
MediaBrowser.Model/LiveTv/RecordingQuery.cs

@@ -0,0 +1,14 @@
+namespace MediaBrowser.Model.LiveTv
+{
+    /// <summary>
+    /// Class RecordingQuery.
+    /// </summary>
+    public class RecordingQuery
+    {
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance has recorded.
+        /// </summary>
+        /// <value><c>null</c> if [has recorded] contains no value, <c>true</c> if [has recorded]; otherwise, <c>false</c>.</value>
+        public bool? HasRecorded { get; set; }
+    }
+}

+ 2 - 0
MediaBrowser.Model/Querying/ItemQuery.cs

@@ -265,6 +265,8 @@ namespace MediaBrowser.Model.Querying
         public double? MinCommunityRating { get; set; }
         public double? MinCriticRating { get; set; }
 
+        public int? AiredDuringSeason { get; set; }
+        
         /// <summary>
         /// Initializes a new instance of the <see cref="ItemQuery" /> class.
         /// </summary>

+ 7 - 1
MediaBrowser.Providers/Savers/EpisodeXmlSaver.cs

@@ -75,6 +75,11 @@ namespace MediaBrowser.Providers.Savers
             {
                 builder.Append("<EpisodeNumberEnd>" + SecurityElement.Escape(episode.IndexNumberEnd.Value.ToString(_usCulture)) + "</EpisodeNumberEnd>");
             }
+
+            if (episode.SpecialSeasonNumber.HasValue)
+            {
+                builder.Append("<SpecialSeasonNumber>" + SecurityElement.Escape(episode.SpecialSeasonNumber.Value.ToString(_usCulture)) + "</SpecialSeasonNumber>");
+            }
             
             if (episode.ParentIndexNumber.HasValue)
             {
@@ -99,7 +104,8 @@ namespace MediaBrowser.Providers.Savers
                     "SeasonNumber",
                     "EpisodeNumber",
                     "EpisodeName",
-                    "EpisodeNumberEnd"
+                    "EpisodeNumberEnd",
+                    "SpecialSeasonNumber"
                 });
 
             // Set last refreshed so that the provider doesn't trigger after the file save

+ 16 - 0
MediaBrowser.Providers/TV/EpisodeXmlParser.cs

@@ -139,6 +139,22 @@ namespace MediaBrowser.Providers.TV
                         break;
                     }
 
+                case "SpecialSeasonNumber":
+                    {
+                        var number = reader.ReadElementContentAsString();
+
+                        if (!string.IsNullOrWhiteSpace(number))
+                        {
+                            int num;
+
+                            if (int.TryParse(number, out num))
+                            {
+                                item.SpecialSeasonNumber = num;
+                            }
+                        }
+                        break;
+                    }
+
                 case "EpisodeName":
                     {
                         var name = reader.ReadElementContentAsString();

+ 35 - 1
MediaBrowser.Providers/TV/TvdbEpisodeProvider.cs

@@ -113,7 +113,7 @@ namespace MediaBrowser.Providers.TV
         {
             get
             {
-                return "1";
+                return "3";
             }
         }
 
@@ -404,6 +404,40 @@ namespace MediaBrowser.Providers.TV
                                         break;
                                     }
 
+                                case "airsafter_season":
+                                    {
+                                        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.SpecialSeasonNumber = rval;
+                                            }
+                                        }
+                                        break;
+                                    }
+
+                                case "airsbefore_season":
+                                    {
+                                        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.SpecialSeasonNumber = rval;
+                                            }
+                                        }
+                                        break;
+                                    }
+
                                 case "EpisodeName":
                                     {
                                         if (!item.LockedFields.Contains(MetadataFields.Name))

+ 1 - 0
MediaBrowser.Server.Implementations/Dto/DtoService.cs

@@ -1029,6 +1029,7 @@ namespace MediaBrowser.Server.Implementations.Dto
             if (episode != null)
             {
                 dto.IndexNumberEnd = episode.IndexNumberEnd;
+                dto.SpecialSeasonNumber = episode.SpecialSeasonNumber;
             }
 
             // Add SeriesInfo