mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
updated fonts
This commit is contained in:
parent
7d9d57a36e
commit
7e8e899bc2
@ -69,7 +69,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="ImageMagick\fonts\MontserratLight.otf" />
|
<EmbeddedResource Include="ImageMagick\fonts\MontserratLight.otf" />
|
||||||
<EmbeddedResource Include="ImageMagick\fonts\robotoregular.ttf" />
|
<EmbeddedResource Include="ImageMagick\fonts\robotoregular.ttf" />
|
||||||
<EmbeddedResource Include="ImageMagick\fonts\webdings.ttf" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
|
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
using System.Linq;
|
using System.Threading.Tasks;
|
||||||
using ImageMagickSharp;
|
using ImageMagickSharp;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
using MediaBrowser.Model.Drawing;
|
using MediaBrowser.Model.Drawing;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Emby.Drawing.ImageMagick
|
namespace Emby.Drawing.ImageMagick
|
||||||
{
|
{
|
||||||
@ -13,11 +15,13 @@ namespace Emby.Drawing.ImageMagick
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IApplicationPaths _appPaths;
|
private readonly IApplicationPaths _appPaths;
|
||||||
|
private readonly IHttpClient _httpClient;
|
||||||
|
|
||||||
public ImageMagickEncoder(ILogger logger, IApplicationPaths appPaths)
|
public ImageMagickEncoder(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
|
_httpClient = httpClient;
|
||||||
|
|
||||||
LogImageMagickVersion();
|
LogImageMagickVersion();
|
||||||
}
|
}
|
||||||
@ -177,7 +181,8 @@ namespace Emby.Drawing.ImageMagick
|
|||||||
{
|
{
|
||||||
var currentImageSize = new ImageSize(imageWidth, imageHeight);
|
var currentImageSize = new ImageSize(imageWidth, imageHeight);
|
||||||
|
|
||||||
new PlayedIndicatorDrawer(_appPaths).DrawPlayedIndicator(wand, currentImageSize);
|
var task = new PlayedIndicatorDrawer(_appPaths, _httpClient).DrawPlayedIndicator(wand, currentImageSize);
|
||||||
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
else if (options.UnplayedCount.HasValue)
|
else if (options.UnplayedCount.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using ImageMagickSharp;
|
using ImageMagickSharp;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Model.Drawing;
|
using MediaBrowser.Model.Drawing;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Emby.Drawing.ImageMagick
|
namespace Emby.Drawing.ImageMagick
|
||||||
{
|
{
|
||||||
@ -12,13 +14,15 @@ namespace Emby.Drawing.ImageMagick
|
|||||||
private const int OffsetFromTopRightCorner = 38;
|
private const int OffsetFromTopRightCorner = 38;
|
||||||
|
|
||||||
private readonly IApplicationPaths _appPaths;
|
private readonly IApplicationPaths _appPaths;
|
||||||
|
private readonly IHttpClient _iHttpClient;
|
||||||
|
|
||||||
public PlayedIndicatorDrawer(IApplicationPaths appPaths)
|
public PlayedIndicatorDrawer(IApplicationPaths appPaths, IHttpClient iHttpClient)
|
||||||
{
|
{
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
|
_iHttpClient = iHttpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawPlayedIndicator(MagickWand wand, ImageSize imageSize)
|
public async Task DrawPlayedIndicator(MagickWand wand, ImageSize imageSize)
|
||||||
{
|
{
|
||||||
var x = imageSize.Width - OffsetFromTopRightCorner;
|
var x = imageSize.Width - OffsetFromTopRightCorner;
|
||||||
|
|
||||||
@ -34,7 +38,7 @@ namespace Emby.Drawing.ImageMagick
|
|||||||
pixel.Opacity = 0;
|
pixel.Opacity = 0;
|
||||||
pixel.Color = "white";
|
pixel.Color = "white";
|
||||||
draw.FillColor = pixel;
|
draw.FillColor = pixel;
|
||||||
draw.Font = ExtractFont("webdings.ttf", _appPaths);
|
draw.Font = await DownloadFont("webdings.ttf", "https://github.com/MediaBrowser/Emby.Resources/raw/master/fonts/webdings.ttf", _appPaths, _iHttpClient).ConfigureAwait(false);
|
||||||
draw.FontSize = FontSize;
|
draw.FontSize = FontSize;
|
||||||
draw.FontStyle = FontStyleType.NormalStyle;
|
draw.FontStyle = FontStyleType.NormalStyle;
|
||||||
draw.TextAlignment = TextAlignType.CenterAlign;
|
draw.TextAlignment = TextAlignType.CenterAlign;
|
||||||
@ -77,7 +81,37 @@ namespace Emby.Drawing.ImageMagick
|
|||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return tempPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static async Task<string> DownloadFont(string name, string url, IApplicationPaths paths, IHttpClient httpClient)
|
||||||
|
{
|
||||||
|
var filePath = Path.Combine(paths.ProgramDataPath, "fonts", name);
|
||||||
|
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tempPath = await httpClient.GetTempFile(new HttpRequestOptions
|
||||||
|
{
|
||||||
|
Url = url,
|
||||||
|
Progress = new Progress<double>()
|
||||||
|
|
||||||
|
}).ConfigureAwait(false);
|
||||||
|
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Copy(tempPath, filePath, false);
|
||||||
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempPath;
|
return tempPath;
|
||||||
|
@ -447,7 +447,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager);
|
TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager);
|
||||||
RegisterSingleInstance(TVSeriesManager);
|
RegisterSingleInstance(TVSeriesManager);
|
||||||
|
|
||||||
SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder, FileSystemManager, () => SubtitleEncoder, ServerConfigurationManager, UserDataManager, () => MediaSourceManager, JsonSerializer, TaskManager);
|
SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder, FileSystemManager, () => SubtitleEncoder, ServerConfigurationManager, UserDataManager, () => MediaSourceManager, JsonSerializer, TaskManager);
|
||||||
RegisterSingleInstance(SyncManager);
|
RegisterSingleInstance(SyncManager);
|
||||||
|
|
||||||
DtoService = new DtoService(LogManager.GetLogger("DtoService"), LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, SyncManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager);
|
DtoService = new DtoService(LogManager.GetLogger("DtoService"), LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, SyncManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager);
|
||||||
@ -554,8 +554,8 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
if (_startupOptions.ContainsOption("-imagethreads"))
|
if (_startupOptions.ContainsOption("-imagethreads"))
|
||||||
{
|
{
|
||||||
int.TryParse(_startupOptions.GetOption("-imagethreads"), NumberStyles.Any, CultureInfo.InvariantCulture, out maxConcurrentImageProcesses);
|
int.TryParse(_startupOptions.GetOption("-imagethreads"), NumberStyles.Any, CultureInfo.InvariantCulture, out maxConcurrentImageProcesses);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, GetImageEncoder(), maxConcurrentImageProcesses);
|
return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, GetImageEncoder(), maxConcurrentImageProcesses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,14 +565,14 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new ImageMagickEncoder(LogManager.GetLogger("ImageMagick"), ApplicationPaths);
|
return new ImageMagickEncoder(LogManager.GetLogger("ImageMagick"), ApplicationPaths, HttpClient);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error loading ImageMagick. Will revert to GDI.", ex);
|
Logger.ErrorException("Error loading ImageMagick. Will revert to GDI.", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new GDIImageEncoder(FileSystemManager, LogManager.GetLogger("GDI"));
|
return new GDIImageEncoder(FileSystemManager, LogManager.GetLogger("GDI"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user