update recording layout

pull/702/head
Luke Pulverenti 9 years ago
parent 22ac006d4e
commit cc7b150b90

@ -155,6 +155,9 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableUserData { get; set; } public bool? EnableUserData { get; set; }
public bool? IsMovie { get; set; }
public bool? IsSeries { get; set; }
public GetRecordings() public GetRecordings()
{ {
EnableTotalRecordCount = true; EnableTotalRecordCount = true;
@ -863,7 +866,9 @@ namespace MediaBrowser.Api.LiveTv
Status = request.Status, Status = request.Status,
SeriesTimerId = request.SeriesTimerId, SeriesTimerId = request.SeriesTimerId,
IsInProgress = request.IsInProgress, IsInProgress = request.IsInProgress,
EnableTotalRecordCount = request.EnableTotalRecordCount EnableTotalRecordCount = request.EnableTotalRecordCount,
IsMovie = request.IsMovie,
IsSeries = request.IsSeries
}, options, CancellationToken.None).ConfigureAwait(false); }, options, CancellationToken.None).ConfigureAwait(false);

@ -1786,6 +1786,16 @@ namespace MediaBrowser.Api.Playback
// state.SegmentLength = 6; // state.SegmentLength = 6;
//} //}
if (state.VideoRequest != null)
{
if (!string.IsNullOrWhiteSpace(state.VideoRequest.VideoCodec))
{
state.SupportedVideoCodecs = state.VideoRequest.VideoCodec.Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
state.VideoRequest.VideoCodec = state.SupportedVideoCodecs.FirstOrDefault(i => MediaEncoder.CanEncodeToAudioCodec(i))
?? state.SupportedVideoCodecs.FirstOrDefault();
}
}
if (!string.IsNullOrWhiteSpace(request.AudioCodec)) if (!string.IsNullOrWhiteSpace(request.AudioCodec))
{ {
state.SupportedAudioCodecs = request.AudioCodec.Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); state.SupportedAudioCodecs = request.AudioCodec.Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
@ -2028,7 +2038,7 @@ namespace MediaBrowser.Api.Playback
} }
// Source and target codecs must match // Source and target codecs must match
if (!string.Equals(request.VideoCodec, videoStream.Codec, StringComparison.OrdinalIgnoreCase)) if (string.IsNullOrEmpty(videoStream.Codec) || !state.SupportedVideoCodecs.Contains(videoStream.Codec, StringComparer.OrdinalIgnoreCase))
{ {
return false; return false;
} }

@ -112,6 +112,7 @@ namespace MediaBrowser.Api.Playback
public string OutputVideoSync = "-1"; public string OutputVideoSync = "-1";
public List<string> SupportedAudioCodecs { get; set; } public List<string> SupportedAudioCodecs { get; set; }
public List<string> SupportedVideoCodecs { get; set; }
public string UserAgent { get; set; } public string UserAgent { get; set; }
public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger) public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger)
@ -119,6 +120,7 @@ namespace MediaBrowser.Api.Playback
_mediaSourceManager = mediaSourceManager; _mediaSourceManager = mediaSourceManager;
_logger = logger; _logger = logger;
SupportedAudioCodecs = new List<string>(); SupportedAudioCodecs = new List<string>();
SupportedVideoCodecs = new List<string>();
PlayableStreamFileNames = new List<string>(); PlayableStreamFileNames = new List<string>();
RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
} }

@ -68,6 +68,8 @@ namespace MediaBrowser.Model.LiveTv
/// <value>The fields.</value> /// <value>The fields.</value>
public ItemFields[] Fields { get; set; } public ItemFields[] Fields { get; set; }
public bool? EnableImages { get; set; } public bool? EnableImages { get; set; }
public bool? IsMovie { get; set; }
public bool? IsSeries { get; set; }
public int? ImageTypeLimit { get; set; } public int? ImageTypeLimit { get; set; }
public ImageType[] EnableImageTypes { get; set; } public ImageType[] EnableImageTypes { get; set; }

@ -8,6 +8,8 @@ namespace MediaBrowser.Model.System
/// </summary> /// </summary>
public class SystemInfo : PublicSystemInfo public class SystemInfo : PublicSystemInfo
{ {
public PackageVersionClass SystemUpdateLevel { get; set; }
/// <summary> /// <summary>
/// Gets or sets the display name of the operating system. /// Gets or sets the display name of the operating system.
/// </summary> /// </summary>

@ -31,6 +31,8 @@ using CommonIO;
using IniParser; using IniParser;
using IniParser.Model; using IniParser.Model;
using MediaBrowser.Common.Events; using MediaBrowser.Common.Events;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Events; using MediaBrowser.Model.Events;
namespace MediaBrowser.Server.Implementations.LiveTv namespace MediaBrowser.Server.Implementations.LiveTv
@ -1423,6 +1425,32 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return new QueryResult<BaseItem>(); return new QueryResult<BaseItem>();
} }
var includeItemTypes = new List<string>();
var excludeItemTypes = new List<string>();
if (query.IsMovie.HasValue)
{
if (query.IsMovie.Value)
{
includeItemTypes.Add(typeof (Movie).Name);
}
else
{
excludeItemTypes.Add(typeof(Movie).Name);
}
}
if (query.IsSeries.HasValue)
{
if (query.IsSeries.Value)
{
includeItemTypes.Add(typeof(Episode).Name);
}
else
{
excludeItemTypes.Add(typeof(Episode).Name);
}
}
return _libraryManager.GetItemsResult(new InternalItemsQuery(user) return _libraryManager.GetItemsResult(new InternalItemsQuery(user)
{ {
MediaTypes = new[] { MediaType.Video }, MediaTypes = new[] { MediaType.Video },
@ -1433,7 +1461,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
Limit = Math.Min(200, query.Limit ?? int.MaxValue), Limit = Math.Min(200, query.Limit ?? int.MaxValue),
SortBy = new[] { ItemSortBy.DateCreated }, SortBy = new[] { ItemSortBy.DateCreated },
SortOrder = SortOrder.Descending, SortOrder = SortOrder.Descending,
EnableTotalRecordCount = query.EnableTotalRecordCount EnableTotalRecordCount = query.EnableTotalRecordCount,
IncludeItemTypes = includeItemTypes.ToArray(),
ExcludeItemTypes = excludeItemTypes.ToArray()
}); });
} }
@ -1492,6 +1522,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
recordings = recordings.Where(i => i.Status == val); recordings = recordings.Where(i => i.Status == val);
} }
if (query.IsMovie.HasValue)
{
var val = query.IsMovie.Value;
recordings = recordings.Where(i => i.IsMovie == val);
}
if (query.IsSeries.HasValue)
{
var val = query.IsSeries.Value;
recordings = recordings.Where(i => i.IsSeries == val);
}
if (!string.IsNullOrEmpty(query.SeriesTimerId)) if (!string.IsNullOrEmpty(query.SeriesTimerId))
{ {
var guid = new Guid(query.SeriesTimerId); var guid = new Guid(query.SeriesTimerId);
@ -1950,16 +1992,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv
dto.Number = channel.Number; dto.Number = channel.Number;
dto.ChannelNumber = channel.Number; dto.ChannelNumber = channel.Number;
dto.ChannelType = channel.ChannelType; dto.ChannelType = channel.ChannelType;
dto.ServiceName = GetService(channel).Name; dto.ServiceName = channel.ServiceName;
if (options.Fields.Contains(ItemFields.MediaSources)) if (options.Fields.Contains(ItemFields.MediaSources))
{ {
dto.MediaSources = channel.GetMediaSources(true).ToList(); dto.MediaSources = channel.GetMediaSources(true).ToList();
} }
var channelIdString = channel.Id.ToString("N");
if (options.AddCurrentProgram) if (options.AddCurrentProgram)
{ {
var channelIdString = channel.Id.ToString("N");
var currentProgram = programs.FirstOrDefault(i => string.Equals(i.ChannelId, channelIdString)); var currentProgram = programs.FirstOrDefault(i => string.Equals(i.ChannelId, channelIdString));
if (currentProgram != null) if (currentProgram != null)

@ -1096,7 +1096,8 @@ namespace MediaBrowser.Server.Startup.Common
LocalAddress = localAddress, LocalAddress = localAddress,
SupportsLibraryMonitor = SupportsLibraryMonitor, SupportsLibraryMonitor = SupportsLibraryMonitor,
EncoderLocationType = MediaEncoder.EncoderLocationType, EncoderLocationType = MediaEncoder.EncoderLocationType,
SystemArchitecture = NativeApp.Environment.SystemArchitecture SystemArchitecture = NativeApp.Environment.SystemArchitecture,
SystemUpdateLevel = ConfigurationManager.CommonConfiguration.SystemUpdateLevel
}; };
} }

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Implementations.Updates; using MediaBrowser.Common.Implementations.Updates;
@ -55,21 +56,39 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
} }
} }
private async Task CheckVersion(Version currentVersion, PackageVersionClass updateLevel, CancellationToken cancellationToken) private async Task CheckVersion(Version currentVersion, PackageVersionClass currentUpdateLevel, CancellationToken cancellationToken)
{ {
var releases = await new GithubUpdater(_httpClient, _jsonSerializer, TimeSpan.FromMinutes(3)) var releases = await new GithubUpdater(_httpClient, _jsonSerializer, TimeSpan.FromMinutes(3))
.GetLatestReleases("MediaBrowser", "Emby", _releaseAssetFilename, cancellationToken).ConfigureAwait(false); .GetLatestReleases("MediaBrowser", "Emby", _releaseAssetFilename, cancellationToken).ConfigureAwait(false);
var newUpdateLevel = updateLevel; var newUpdateLevel = GetNewUpdateLevel(currentVersion, currentUpdateLevel, releases);
if (newUpdateLevel != currentUpdateLevel)
{
_config.Configuration.SystemUpdateLevel = newUpdateLevel;
_config.SaveConfiguration();
}
}
private PackageVersionClass GetNewUpdateLevel(Version currentVersion, PackageVersionClass currentUpdateLevel, List<GithubUpdater.RootObject> releases)
{
var newUpdateLevel = currentUpdateLevel;
// If the current version is later than current stable, set the update level to beta // If the current version is later than current stable, set the update level to beta
if (releases.Count >= 1) if (releases.Count >= 1)
{ {
var release = releases[0]; var release = releases[0];
var version = ParseVersion(release.tag_name); var version = ParseVersion(release.tag_name);
if (version != null && currentVersion > version) if (version != null)
{ {
newUpdateLevel = PackageVersionClass.Beta; if (currentVersion > version)
{
newUpdateLevel = PackageVersionClass.Beta;
}
else
{
return PackageVersionClass.Release;
}
} }
} }
@ -78,17 +97,20 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
{ {
var release = releases[1]; var release = releases[1];
var version = ParseVersion(release.tag_name); var version = ParseVersion(release.tag_name);
if (version != null && currentVersion > version) if (version != null)
{ {
newUpdateLevel = PackageVersionClass.Dev; if (currentVersion > version)
{
newUpdateLevel = PackageVersionClass.Dev;
}
else
{
return PackageVersionClass.Beta;
}
} }
} }
if (newUpdateLevel != updateLevel) return newUpdateLevel;
{
_config.Configuration.SystemUpdateLevel = newUpdateLevel;
_config.SaveConfiguration();
}
} }
private Version ParseVersion(string versionString) private Version ParseVersion(string versionString)

Loading…
Cancel
Save