浏览代码

update latest channel content display

Luke Pulverenti 11 年之前
父节点
当前提交
43ab885530

+ 8 - 0
MediaBrowser.Api/ChannelService.cs

@@ -34,6 +34,9 @@ namespace MediaBrowser.Api
         /// <value>The limit.</value>
         /// <value>The limit.</value>
         [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
         [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
         public int? Limit { get; set; }
         public int? Limit { get; set; }
+
+        [ApiMember(Name = "SupportsLatestItems", Description = "Optional. Filter by channels that support getting latest items.", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
+        public bool? SupportsLatestItems { get; set; }
     }
     }
 
 
     [Route("/Channels/{Id}/Features", "GET", Summary = "Gets features for a channel")]
     [Route("/Channels/{Id}/Features", "GET", Summary = "Gets features for a channel")]
@@ -137,6 +140,9 @@ namespace MediaBrowser.Api
         [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
         [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
         public string Fields { get; set; }
         public string Fields { get; set; }
 
 
+        [ApiMember(Name = "ChannelIds", Description = "Optional. Specify one or more channel id's, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
+        public string ChannelIds { get; set; }
+        
         /// <summary>
         /// <summary>
         /// Gets the filters.
         /// Gets the filters.
         /// </summary>
         /// </summary>
@@ -196,6 +202,7 @@ namespace MediaBrowser.Api
                 Limit = request.Limit,
                 Limit = request.Limit,
                 StartIndex = request.StartIndex,
                 StartIndex = request.StartIndex,
                 UserId = request.UserId,
                 UserId = request.UserId,
+                SupportsLatestItems = request.SupportsLatestItems
 
 
             }, CancellationToken.None).Result;
             }, CancellationToken.None).Result;
 
 
@@ -227,6 +234,7 @@ namespace MediaBrowser.Api
             {
             {
                 Limit = request.Limit,
                 Limit = request.Limit,
                 StartIndex = request.StartIndex,
                 StartIndex = request.StartIndex,
+                ChannelIds = (request.ChannelIds ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),
                 UserId = request.UserId,
                 UserId = request.UserId,
                 Filters = request.GetFilters().ToArray(),
                 Filters = request.GetFilters().ToArray(),
                 Fields = request.GetItemFields().ToList()
                 Fields = request.GetItemFields().ToList()

+ 22 - 2
MediaBrowser.Controller/LiveTv/LiveTvChannel.cs

@@ -1,8 +1,11 @@
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Model.Configuration;
 using MediaBrowser.Model.Configuration;
+using MediaBrowser.Model.Dto;
+using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.LiveTv;
 using MediaBrowser.Model.LiveTv;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
+using MediaBrowser.Model.MediaInfo;
 
 
 namespace MediaBrowser.Controller.LiveTv
 namespace MediaBrowser.Controller.LiveTv
 {
 {
@@ -115,9 +118,26 @@ namespace MediaBrowser.Controller.LiveTv
             return new List<BaseItem>();
             return new List<BaseItem>();
         }
         }
 
 
-        public IEnumerable<Model.Dto.MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
+        public IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
         {
         {
-            throw new System.NotImplementedException();
+            var list = new List<MediaSourceInfo>();
+
+            var locationType = LocationType;
+
+            var info = new MediaSourceInfo
+            {
+                Id = Id.ToString("N"),
+                Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
+                MediaStreams = new List<MediaStream>(),
+                Name = Name,
+                Path = Path,
+                RunTimeTicks = RunTimeTicks,
+                Type = MediaSourceType.Default
+            };
+
+            list.Add(info);
+
+            return list;
         }
         }
     }
     }
 }
 }

+ 1 - 36
MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs

@@ -1,7 +1,4 @@
-using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.MediaInfo;
-using System;
+using MediaBrowser.Model.MediaInfo;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 
 
@@ -61,37 +58,5 @@ namespace MediaBrowser.MediaEncoding.Encoder
         {
         {
             return isDvd ? "-probesize 1G -analyzeduration 200M" : string.Empty;
             return isDvd ? "-probesize 1G -analyzeduration 200M" : string.Empty;
         }
         }
-
-        /// <summary>
-        /// Gets the number of audio channels to specify on the command line
-        /// </summary>
-        /// <param name="request">The request.</param>
-        /// <param name="audioStream">The audio stream.</param>
-        /// <returns>System.Nullable{System.Int32}.</returns>
-        public static int? GetNumAudioChannelsParam(EncodingOptions request, MediaStream audioStream)
-        {
-            if (audioStream != null)
-            {
-                var codec = request.AudioCodec ?? string.Empty;
-
-                if (audioStream.Channels > 2 && codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
-                {
-                    // wmav2 currently only supports two channel output
-                    return 2;
-                }
-            }
-
-            if (request.MaxAudioChannels.HasValue)
-            {
-                if (audioStream != null && audioStream.Channels.HasValue)
-                {
-                    return Math.Min(request.MaxAudioChannels.Value, audioStream.Channels.Value);
-                }
-
-                return request.MaxAudioChannels.Value;
-            }
-
-            return request.AudioChannels;
-        }
     }
     }
 }
 }

+ 10 - 0
MediaBrowser.Model/Channels/ChannelQuery.cs

@@ -22,10 +22,20 @@ namespace MediaBrowser.Model.Channels
         /// </summary>
         /// </summary>
         /// <value>The limit.</value>
         /// <value>The limit.</value>
         public int? Limit { get; set; }
         public int? Limit { get; set; }
+
+        /// <summary>
+        /// Gets or sets a value indicating whether [supports latest items].
+        /// </summary>
+        /// <value><c>true</c> if [supports latest items]; otherwise, <c>false</c>.</value>
+        public bool? SupportsLatestItems { get; set; }
     }
     }
 
 
     public class AllChannelMediaQuery
     public class AllChannelMediaQuery
     {
     {
+        /// <summary>
+        /// Gets or sets the channel ids.
+        /// </summary>
+        /// <value>The channel ids.</value>
         public string[] ChannelIds { get; set; }
         public string[] ChannelIds { get; set; }
 
 
         /// <summary>
         /// <summary>

+ 7 - 0
MediaBrowser.Server.Implementations/Channels/ChannelManager.cs

@@ -107,6 +107,13 @@ namespace MediaBrowser.Server.Implementations.Channels
 
 
             var channels = _channelEntities.OrderBy(i => i.SortName).ToList();
             var channels = _channelEntities.OrderBy(i => i.SortName).ToList();
 
 
+            if (query.SupportsLatestItems.HasValue)
+            {
+                var val = query.SupportsLatestItems.Value;
+                channels = channels.Where(i => (GetChannelProvider(i) is ISupportsLatestMedia) == val)
+                    .ToList();
+            }
+
             if (user != null)
             if (user != null)
             {
             {
                 channels = channels.Where(i => GetChannelProvider(i).IsEnabledFor(user.Id.ToString("N")) && i.IsVisible(user))
                 channels = channels.Where(i => GetChannelProvider(i).IsEnabledFor(user.Id.ToString("N")) && i.IsVisible(user))

+ 12 - 1
MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json

@@ -38,6 +38,7 @@
 	"LabelEpisode": "Episode",
 	"LabelEpisode": "Episode",
 	"LabelSeries": "Series",
 	"LabelSeries": "Series",
 	"LabelStopping": "Stopping",
 	"LabelStopping": "Stopping",
+	"ButtonStop": "Stop",
 	"LabelCancelled": "(cancelled)",
 	"LabelCancelled": "(cancelled)",
 	"LabelFailed": "(failed)",
 	"LabelFailed": "(failed)",
 	"LabelAbortedByServerShutdown": "(Aborted by server shutdown)",
 	"LabelAbortedByServerShutdown": "(Aborted by server shutdown)",
@@ -170,5 +171,15 @@
 	"MessageConfirmShutdown": "Are you sure you wish to shutdown Media Browser Server?",
 	"MessageConfirmShutdown": "Are you sure you wish to shutdown Media Browser Server?",
 	"ButtonUpdateNow": "Update Now",
 	"ButtonUpdateNow": "Update Now",
 	"NewVersionOfSomethingAvailable": "A new version of {0} is available!",
 	"NewVersionOfSomethingAvailable": "A new version of {0} is available!",
-	"VersionXIsAvailableForDownload": "Version {0} is now available for download."
+	"VersionXIsAvailableForDownload": "Version {0} is now available for download.",
+	"LabelVersionNumber": "Version {0}",
+	"LabelPlayMethodTranscoding": "Transcoding",
+	"LabelPlayMethodDirectStream": "Direct Streaming",
+	"LabelPlayMethodDirectPlay": "Direct Playing",
+	"LabelAudioCodec": "Audio: {0}",
+	"LabelVideoCodec": "Video: {0}",
+	"LabelRemoteAccessUrl": "Remote access: {0}",
+	"LabelRunningOnPort": "Running on port {0}.",
+	"LabelRunningOnPorts": "Running on ports {0} and {1}.",
+	"HeaderLatestFromChannel": "Latest from {0}"
 }
 }