The Free Software Media System - Server Backend & API
update latest channel content display
Luke Pulverenti43ab885530a9
diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.csindex 3cd032015b..a6407349d8 100644--- a/MediaBrowser.Api/ChannelService.cs+++ b/MediaBrowser.Api/ChannelService.cs@@ -34,6 +34,9 @@ namespace MediaBrowser.Api/// <value>The limit.</value>[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; }++ [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")]@@ -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)]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>/// Gets the filters./// </summary>@@ -196,6 +202,7 @@ namespace MediaBrowser.ApiLimit = request.Limit,StartIndex = request.StartIndex,UserId = request.UserId,+ SupportsLatestItems = request.SupportsLatestItems}, CancellationToken.None).Result;@@ -227,6 +234,7 @@ namespace MediaBrowser.Api{Limit = request.Limit,StartIndex = request.StartIndex,+ ChannelIds = (request.ChannelIds ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),UserId = request.UserId,Filters = request.GetFilters().ToArray(),Fields = request.GetItemFields().ToList()diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.csindex 3c1c9f442a..01fed68c8a 100644--- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs+++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs@@ -1,8 +1,11 @@using MediaBrowser.Controller.Entities;using MediaBrowser.Model.Configuration;+using MediaBrowser.Model.Dto;+using MediaBrowser.Model.Entities;using MediaBrowser.Model.LiveTv;using System.Collections.Generic;using System.Linq;+using MediaBrowser.Model.MediaInfo;namespace MediaBrowser.Controller.LiveTv{@@ -115,9 +118,26 @@ namespace MediaBrowser.Controller.LiveTvreturn 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;}}}diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.csindex bf4daf7867..56ff427adf 100644--- a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs+++ b/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.Linq;@@ -61,37 +58,5 @@ namespace MediaBrowser.MediaEncoding.Encoder{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;- }}}diff --git a/MediaBrowser.Model/Channels/ChannelQuery.cs b/MediaBrowser.Model/Channels/ChannelQuery.csindex 9d4e26fa65..62bb543f67 100644--- a/MediaBrowser.Model/Channels/ChannelQuery.cs+++ b/MediaBrowser.Model/Channels/ChannelQuery.cs@@ -22,10 +22,20 @@ namespace MediaBrowser.Model.Channels/// </summary>/// <value>The limit.</value>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{+ /// <summary>+ /// Gets or sets the channel ids.+ /// </summary>+ /// <value>The channel ids.</value>public string[] ChannelIds { get; set; }/// <summary>diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.csindex 59e4e695dc..aaebd1c34c 100644--- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs+++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs@@ -107,6 +107,13 @@ namespace MediaBrowser.Server.Implementations.Channelsvar 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){channels = channels.Where(i => GetChannelProvider(i).IsEnabledFor(user.Id.ToString("N")) && i.IsVisible(user))diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.jsonindex 8e698095f7..230e5fddc7 100644--- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json+++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json@@ -38,6 +38,7 @@"LabelEpisode": "Episode","LabelSeries": "Series","LabelStopping": "Stopping",+ "ButtonStop": "Stop","LabelCancelled": "(cancelled)","LabelFailed": "(failed)","LabelAbortedByServerShutdown": "(Aborted by server shutdown)",@@ -170,5 +171,15 @@"MessageConfirmShutdown": "Are you sure you wish to shutdown Media Browser Server?","ButtonUpdateNow": "Update Now","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}"}\ No newline at end of file