reduce image indicator sizes

This commit is contained in:
Luke Pulverenti 2014-01-01 22:53:27 -05:00
parent b9d17c9bc7
commit e80cbe5b64
8 changed files with 74 additions and 30 deletions

View File

@ -68,7 +68,7 @@ namespace MediaBrowser.Api.LiveTv
[Route("/LiveTv/Recordings/Groups", "GET")]
[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")]
public string UserId { get; set; }
@ -208,6 +208,14 @@ namespace MediaBrowser.Api.LiveTv
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
{
private readonly ILiveTvManager _liveTvManager;
@ -427,5 +435,17 @@ namespace MediaBrowser.Api.LiveTv
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);
}
}
}

View File

@ -677,9 +677,12 @@ namespace MediaBrowser.Api.Playback
/// <returns>Task.</returns>
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))
{

View File

@ -1,5 +1,6 @@
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using System;
using System.Collections.Generic;
@ -18,7 +19,7 @@ namespace MediaBrowser.Controller.Entities.Movies
}
public List<Guid> LocalTrailerIds { get; set; }
/// <summary>
/// Gets or sets the remote trailers.
/// </summary>
@ -43,5 +44,12 @@ namespace MediaBrowser.Controller.Entities.Movies
{
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);
}
}
}

View File

@ -4,9 +4,9 @@ namespace MediaBrowser.Server.Implementations.Drawing
{
public class PlayedIndicatorDrawer
{
private const int IndicatorHeight = 50;
public const int IndicatorWidth = 50;
private const int FontSize = 50;
private const int IndicatorHeight = 40;
public const int IndicatorWidth = 40;
private const int FontSize = 40;
private const int OffsetFromTopRightCorner = 10;
public void DrawPlayedIndicator(Graphics graphics, Size imageSize)
@ -17,7 +17,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
{
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))
{

View File

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

View File

@ -863,8 +863,10 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
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";
// 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)
{
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) :
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);

View File

@ -395,10 +395,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
throw new Error("null id");
}
var options = {
var options = {
};
if (userId) {
options.userId = userId;
}
@ -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) {
if (!id) {
@ -559,7 +574,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
self.getNewLiveTvTimerDefaults = function (options) {
options = options || {};
var url = self.getUrl("LiveTv/Timers/Defaults", options);
return self.ajax({

View File

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