reduce image indicator sizes

pull/702/head
Luke Pulverenti 11 years ago
parent b9d17c9bc7
commit e80cbe5b64

@ -68,7 +68,7 @@ namespace MediaBrowser.Api.LiveTv
[Route("/LiveTv/Recordings/Groups", "GET")] [Route("/LiveTv/Recordings/Groups", "GET")]
[Api(Description = "Gets live tv recording groups")] [Api(Description = "Gets live tv recording groups")]
public class GetRecordingGroups : IReturn<QueryResult<RecordingInfoDto>> public class GetRecordingGroups : IReturn<QueryResult<RecordingGroupDto>>
{ {
[ApiMember(Name = "UserId", Description = "Optional filter by user and attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "UserId", Description = "Optional filter by user and attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string UserId { get; set; } public string UserId { get; set; }
@ -208,6 +208,14 @@ namespace MediaBrowser.Api.LiveTv
public string Id { get; set; } public string Id { get; set; }
} }
[Route("/LiveTv/Recordings/Groups/{Id}", "GET")]
[Api(Description = "Gets a recording group")]
public class GetRecordingGroup : IReturn<RecordingGroupDto>
{
[ApiMember(Name = "Id", Description = "Recording group Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
}
public class LiveTvService : BaseApiService public class LiveTvService : BaseApiService
{ {
private readonly ILiveTvManager _liveTvManager; private readonly ILiveTvManager _liveTvManager;
@ -427,5 +435,17 @@ namespace MediaBrowser.Api.LiveTv
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
public object Get(GetRecordingGroup request)
{
var result = _liveTvManager.GetRecordingGroups(new RecordingGroupQuery
{
}, CancellationToken.None).Result;
var group = result.Items.FirstOrDefault(i => string.Equals(i.Id, request.Id, StringComparison.OrdinalIgnoreCase));
return ToOptimizedResult(group);
}
} }
} }

@ -677,9 +677,12 @@ namespace MediaBrowser.Api.Playback
/// <returns>Task.</returns> /// <returns>Task.</returns>
protected async Task StartFfMpeg(StreamState state, string outputPath) protected async Task StartFfMpeg(StreamState state, string outputPath)
{ {
var parentPath = Path.GetDirectoryName(outputPath); if (!File.Exists(MediaEncoder.EncoderPath))
{
throw new InvalidOperationException("ffmpeg was not found at " + MediaEncoder.EncoderPath);
}
Directory.CreateDirectory(parentPath); Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
if (state.IsInputVideo && state.VideoType == VideoType.Iso && state.IsoType.HasValue && IsoManager.CanMount(state.MediaPath)) if (state.IsInputVideo && state.VideoType == VideoType.Iso && state.IsoType.HasValue && IsoManager.CanMount(state.MediaPath))
{ {

@ -1,5 +1,6 @@
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -43,5 +44,12 @@ namespace MediaBrowser.Controller.Entities.Movies
{ {
return config.BlockUnratedMovies; return config.BlockUnratedMovies;
} }
public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
var children = base.GetChildren(user, includeLinkedChildren);
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
}
} }
} }

@ -4,9 +4,9 @@ namespace MediaBrowser.Server.Implementations.Drawing
{ {
public class PlayedIndicatorDrawer public class PlayedIndicatorDrawer
{ {
private const int IndicatorHeight = 50; private const int IndicatorHeight = 40;
public const int IndicatorWidth = 50; public const int IndicatorWidth = 40;
private const int FontSize = 50; private const int FontSize = 40;
private const int OffsetFromTopRightCorner = 10; private const int OffsetFromTopRightCorner = 10;
public void DrawPlayedIndicator(Graphics graphics, Size imageSize) public void DrawPlayedIndicator(Graphics graphics, Size imageSize)
@ -17,7 +17,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
{ {
graphics.FillEllipse(backdroundBrush, x, OffsetFromTopRightCorner, IndicatorWidth, IndicatorHeight); graphics.FillEllipse(backdroundBrush, x, OffsetFromTopRightCorner, IndicatorWidth, IndicatorHeight);
x = imageSize.Width - 55 - OffsetFromTopRightCorner; x = imageSize.Width - 45 - OffsetFromTopRightCorner;
using (var font = new Font("Webdings", FontSize, FontStyle.Regular, GraphicsUnit.Pixel)) using (var font = new Font("Webdings", FontSize, FontStyle.Regular, GraphicsUnit.Pixel))
{ {

@ -1,16 +1,11 @@
using System; using System.Drawing;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.Drawing namespace MediaBrowser.Server.Implementations.Drawing
{ {
public class UnplayedCountIndicator public class UnplayedCountIndicator
{ {
private const int IndicatorHeight = 50; private const int IndicatorHeight = 41;
public const int IndicatorWidth = 50; public const int IndicatorWidth = 41;
private const int OffsetFromTopRightCorner = 10; private const int OffsetFromTopRightCorner = 10;
public void DrawUnplayedCountIndicator(Graphics graphics, Size imageSize, int count) public void DrawUnplayedCountIndicator(Graphics graphics, Size imageSize, int count)
@ -23,13 +18,13 @@ namespace MediaBrowser.Server.Implementations.Drawing
var text = count.ToString(); var text = count.ToString();
x = imageSize.Width - 50 - OffsetFromTopRightCorner; x = imageSize.Width - IndicatorWidth - OffsetFromTopRightCorner;
var y = OffsetFromTopRightCorner + 7; var y = OffsetFromTopRightCorner + 6;
var fontSize = 30; var fontSize = 24;
if (text.Length == 1) if (text.Length == 1)
{ {
x += 11; x += 10;
} }
else if (text.Length == 2) else if (text.Length == 2)
{ {
@ -37,9 +32,9 @@ namespace MediaBrowser.Server.Implementations.Drawing
} }
else if (text.Length == 3) else if (text.Length == 3)
{ {
//x += 1; x += 1;
y += 3; y += 1;
fontSize = 24; fontSize = 20;
} }
using (var font = new Font("Sans-Serif", fontSize, FontStyle.Regular, GraphicsUnit.Pixel)) using (var font = new Font("Sans-Serif", fontSize, FontStyle.Regular, GraphicsUnit.Pixel))

@ -863,8 +863,10 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
throw new ArgumentNullException("outputPath"); throw new ArgumentNullException("outputPath");
} }
// apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
// This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar
var vf = "crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,scale=600:600/dar"; var vf = "crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,scale=600:600/dar";
// apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600. This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar
if (threedFormat.HasValue) if (threedFormat.HasValue)
{ {
switch (threedFormat.Value) switch (threedFormat.Value)
@ -888,8 +890,9 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
} }
} }
// Use ffmpeg to sample 100 (we can drop this if required using thumbnail=50 for 50 frames) frames and pick the best thumbnail. Have a fall back just in case.
var args = useIFrame ? string.Format("-i {0} -threads 0 -v quiet -vframes 1 -vf \"thumbnail,{2}\" -f image2 \"{1}\"", inputPath, outputPath, vf) : var args = useIFrame ? string.Format("-i {0} -threads 0 -v quiet -vframes 1 -vf \"thumbnail,{2}\" -f image2 \"{1}\"", inputPath, outputPath, vf) :
string.Format("-i {0} -threads 0 -v quiet -vframes 1 -vf \"{2}\" -f image2 \"{1}\"", inputPath, outputPath, vf); //use ffmpeg to sample 100 (we can drop this if required using thumbnail=50 for 50 frames) frames and pick the best thumbnail. Have a fall back jic string.Format("-i {0} -threads 0 -v quiet -vframes 1 -vf \"{2}\" -f image2 \"{1}\"", inputPath, outputPath, vf);
var probeSize = GetProbeSizeArgument(type); var probeSize = GetProbeSizeArgument(type);

@ -456,6 +456,21 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
}); });
}; };
self.getLiveTvRecordingGroup = function (id) {
if (!id) {
throw new Error("null id");
}
var url = self.getUrl("LiveTv/Recordings/Groups/" + id);
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getLiveTvRecording = function (id, userId) { self.getLiveTvRecording = function (id, userId) {
if (!id) { if (!id) {

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.216" targetFramework="net45" /> <package id="MediaBrowser.ApiClient.Javascript" version="3.0.217" targetFramework="net45" />
</packages> </packages>
Loading…
Cancel
Save