allow uploading large watermarks (#2151)
This commit is contained in:
@@ -81,6 +81,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- `num`: the mid-roll point number, starting with 1
|
||||
- Add `Disable Watermarks` checkbox to block items
|
||||
- Block items that have this checked will never display a watermark, even with Deco set to override watermark
|
||||
- Add `ETV_MAXIMUM_UPLOAD_MB` environment variable to allow uploading large watermarks
|
||||
- Default value is 10
|
||||
|
||||
### Changed
|
||||
- Allow `Other Video` libraries and `Image` libraries to use the same folders
|
||||
|
||||
@@ -75,7 +75,7 @@ public static class FileSystemLayout
|
||||
Environment.SpecialFolderOption.DoNotVerify),
|
||||
"ersatztv");
|
||||
|
||||
string customConfigFolder = Environment.GetEnvironmentVariable("ETV_CONFIG_FOLDER");
|
||||
string customConfigFolder = SystemEnvironment.ConfigFolder;
|
||||
bool useCustomConfigFolder = !string.IsNullOrWhiteSpace(customConfigFolder);
|
||||
|
||||
if (useCustomConfigFolder && isDocker)
|
||||
@@ -101,7 +101,7 @@ public static class FileSystemLayout
|
||||
Environment.SpecialFolderOption.DoNotVerify),
|
||||
"etv-transcode");
|
||||
|
||||
string customTranscodeFolder = Environment.GetEnvironmentVariable("ETV_TRANSCODE_FOLDER");
|
||||
string customTranscodeFolder = SystemEnvironment.TranscodeFolder;
|
||||
bool useCustomTranscodeFolder = !string.IsNullOrWhiteSpace(customTranscodeFolder);
|
||||
|
||||
if (useCustomTranscodeFolder && isDocker)
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace ErsatzTV.Core;
|
||||
|
||||
public class SystemEnvironment
|
||||
{
|
||||
static SystemEnvironment()
|
||||
{
|
||||
BaseUrl = Environment.GetEnvironmentVariable("ETV_BASE_URL");
|
||||
|
||||
ConfigFolder = Environment.GetEnvironmentVariable("ETV_CONFIG_FOLDER");
|
||||
|
||||
TranscodeFolder = Environment.GetEnvironmentVariable("ETV_TRANSCODE_FOLDER");
|
||||
|
||||
string uiPortVariable = Environment.GetEnvironmentVariable("ETV_UI_PORT");
|
||||
if (!int.TryParse(uiPortVariable, out int uiPort))
|
||||
{
|
||||
uiPort = 8409;
|
||||
}
|
||||
|
||||
UiPort = uiPort;
|
||||
|
||||
string streamingPortVariable = Environment.GetEnvironmentVariable("ETV_STREAMING_PORT");
|
||||
if (!int.TryParse(streamingPortVariable, out int streamingPort))
|
||||
{
|
||||
streamingPort = 8409;
|
||||
}
|
||||
|
||||
StreamingPort = streamingPort;
|
||||
|
||||
AllowSharedPlexServers =
|
||||
!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("ETV_ALLOW_SHARED_PLEX_SERVERS"));
|
||||
|
||||
string maximumUploadMbVariable = Environment.GetEnvironmentVariable("ETV_MAXIMUM_UPLOAD_MB");
|
||||
if (!int.TryParse(maximumUploadMbVariable, out int maximumUploadMb))
|
||||
{
|
||||
maximumUploadMb = 10;
|
||||
}
|
||||
|
||||
MaximumUploadMb = maximumUploadMb;
|
||||
}
|
||||
|
||||
public static string BaseUrl { get; }
|
||||
public static string ConfigFolder { get; }
|
||||
public static string TranscodeFolder { get; }
|
||||
public static int UiPort { get; }
|
||||
public static int StreamingPort { get; }
|
||||
public static bool AllowSharedPlexServers { get; }
|
||||
public static int MaximumUploadMb { get; }
|
||||
}
|
||||
@@ -48,8 +48,7 @@ public class PlexTvApiClient : IPlexTvApiClient
|
||||
|
||||
IEnumerable<PlexResource> ownedServers = allServers;
|
||||
|
||||
string allowSharedServers = Environment.GetEnvironmentVariable("ETV_ALLOW_SHARED_PLEX_SERVERS");
|
||||
if (string.IsNullOrWhiteSpace(allowSharedServers))
|
||||
if (!SystemEnvironment.AllowSharedPlexServers)
|
||||
{
|
||||
ownedServers = ownedServers.Filter(r => r.Owned);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,9 @@
|
||||
</div>
|
||||
@if (!string.IsNullOrWhiteSpace(_model.Image?.Path) && _model.ImageSource == ChannelWatermarkImageSource.Custom)
|
||||
{
|
||||
<MudElement HtmlTag="img" src="@($"artwork/watermarks/{_model.Image.UrlWithContentType}")" Style="max-height: 50px"/>
|
||||
<div class="d-flex" style="max-height: 50px">
|
||||
<MudElement HtmlTag="img" src="@($"artwork/watermarks/{_model.Image.UrlWithContentType}")" />
|
||||
</div>
|
||||
}
|
||||
</MudStack>
|
||||
<MudStack Row="true" Breakpoint="Breakpoint.SmAndDown" Class="form-field-stack gap-md-8 mb-5">
|
||||
@@ -250,7 +252,7 @@
|
||||
try
|
||||
{
|
||||
Either<BaseError, string> maybeCacheFileName = await Mediator.Send(
|
||||
new SaveArtworkToDisk(e.File.OpenReadStream(10 * 1024 * 1024), ArtworkKind.Watermark, e.File.ContentType),
|
||||
new SaveArtworkToDisk(e.File.OpenReadStream(SystemEnvironment.MaximumUploadMb * 1024 * 1024), ArtworkKind.Watermark, e.File.ContentType),
|
||||
_cts.Token);
|
||||
maybeCacheFileName.Match(
|
||||
relativeFileName =>
|
||||
@@ -266,8 +268,8 @@
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
Snackbar.Add("Watermark exceeds maximum allowed file size of 10 MB", Severity.Error);
|
||||
Logger.LogError("Watermark exceeds maximum allowed file size of 10 MB");
|
||||
Snackbar.Add($"Watermark exceeds maximum allowed file size of {SystemEnvironment.MaximumUploadMb} MB", Severity.Error);
|
||||
Logger.LogError("Watermark exceeds maximum allowed file size of {MaximumUploadMb} MB", SystemEnvironment.MaximumUploadMb);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
+2
-15
@@ -134,21 +134,8 @@ public class Program
|
||||
|
||||
private static IHostBuilder CreateHostBuilder(string[] args)
|
||||
{
|
||||
string uiPortVariable = Environment.GetEnvironmentVariable("ETV_UI_PORT");
|
||||
if (!int.TryParse(uiPortVariable, out int uiPort))
|
||||
{
|
||||
uiPort = 8409;
|
||||
}
|
||||
|
||||
Settings.UiPort = uiPort;
|
||||
|
||||
string streamingPortVariable = Environment.GetEnvironmentVariable("ETV_STREAMING_PORT");
|
||||
if (!int.TryParse(streamingPortVariable, out int streamingPort))
|
||||
{
|
||||
streamingPort = 8409;
|
||||
}
|
||||
|
||||
Settings.StreamingPort = streamingPort;
|
||||
Settings.UiPort = SystemEnvironment.UiPort;
|
||||
Settings.StreamingPort = SystemEnvironment.StreamingPort;
|
||||
|
||||
return Host.CreateDefaultBuilder(args)
|
||||
.ConfigureServices(services => services.AddSingleton(LoggingLevelSwitches))
|
||||
|
||||
@@ -17,12 +17,10 @@ public class EndpointValidatorService : BackgroundService
|
||||
{
|
||||
await Task.Yield();
|
||||
|
||||
string baseUrl = Environment.GetEnvironmentVariable("ETV_BASE_URL");
|
||||
|
||||
_logger.LogInformation(
|
||||
"Server will listen on streaming port {StreamingPort}, UI port {UiPort} - try UI at {UI}",
|
||||
Settings.StreamingPort,
|
||||
Settings.UiPort,
|
||||
$"http://localhost:{Settings.UiPort}{baseUrl}");
|
||||
$"http://localhost:{Settings.UiPort}{SystemEnvironment.BaseUrl}");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -451,7 +451,7 @@ public class Startup
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
string baseUrl = Environment.GetEnvironmentVariable("ETV_BASE_URL");
|
||||
string baseUrl = SystemEnvironment.BaseUrl;
|
||||
if (!string.IsNullOrWhiteSpace(baseUrl))
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user