Record coordinated reception results and prepare scoped web H264 option
This commit is contained in:
@@ -29,6 +29,7 @@ namespace Jellyfin.Plugin.Enigma2.Configuration
|
||||
|
||||
public bool EnableDebugLogging { get; set; }
|
||||
public bool EnableVuRecordings { get; set; } = false;
|
||||
public bool PreferH264ForWebLiveTv { get; set; } = true;
|
||||
|
||||
|
||||
public PluginConfiguration()
|
||||
|
||||
@@ -148,6 +148,11 @@
|
||||
<span>Obsługuj nagrania z Vu+ (Enigma2 Recordings)</span>
|
||||
</label>
|
||||
<div class="fieldDescription">Włącza bibliotekę nagrań dekodera. Zmiana wymaga ponownego uruchomienia Jellyfina. Wyłączenie nie usuwa plików nagrań.</div>
|
||||
<label class="checkboxContainer">
|
||||
<input is="emby-checkbox" type="checkbox" id="chkPreferH264ForWebLiveTv" />
|
||||
<span>Preferuj H264 przy transkodowaniu telewizji w przeglądarce</span>
|
||||
</label>
|
||||
<div class="fieldDescription">Ogranicza transkodowanie kanałów Enigma2 w aplikacji webowej do H264. Ułatwia odtwarzanie na urządzeniach bez wydajnego dekodowania AV1. Zmiana dotyczy kolejnego uruchomienia kanału.</div>
|
||||
<label class="checkboxContainer">
|
||||
<input is="emby-checkbox" type="checkbox" id="chkDebugLogging" />
|
||||
<span>Enable Enigma2 debug logging</span>
|
||||
@@ -188,6 +193,7 @@
|
||||
document.getElementById('txtTranscodingPort').value = config.TranscodingPort || "";
|
||||
document.getElementById('chkDebugLogging').checked = config.EnableDebugLogging || false;
|
||||
document.getElementById('chkEnableVuRecordings').checked = config.EnableVuRecordings || false;
|
||||
document.getElementById('chkPreferH264ForWebLiveTv').checked = config.PreferH264ForWebLiveTv !== false;
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
@@ -215,6 +221,7 @@
|
||||
config.TranscodingPort = document.getElementById('txtTranscodingPort').value;
|
||||
config.EnableDebugLogging = document.getElementById('chkDebugLogging').checked;
|
||||
config.EnableVuRecordings = document.getElementById('chkEnableVuRecordings').checked;
|
||||
config.PreferH264ForWebLiveTv = document.getElementById('chkPreferH264ForWebLiveTv').checked;
|
||||
|
||||
ApiClient.updatePluginConfiguration(Enigma2ConfigurationPage.pluginUniqueId, config).then(Dashboard.processPluginConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net10.0</TargetFrameworks>
|
||||
<AssemblyVersion>7.0.6.0</AssemblyVersion>
|
||||
<FileVersion>7.0.6.0</FileVersion>
|
||||
<AssemblyVersion>7.0.7.0</AssemblyVersion>
|
||||
<FileVersion>7.0.7.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|AnyCPU'">
|
||||
|
||||
@@ -5,11 +5,26 @@ using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data;
|
||||
using Jellyfin.Database.Implementations.Enums;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Jellyfin.Plugin.Enigma2;
|
||||
public sealed class WebPlaybackPolicy
|
||||
{
|
||||
public bool IsEnigmaChannel { get; set; }
|
||||
public bool PreferH264 { get; set; }
|
||||
public static WebPlaybackPolicy For(BaseItem item, bool enabled)
|
||||
{
|
||||
var owned = item is LiveTvChannel && string.Equals(item.ServiceName, "Enigma2", StringComparison.OrdinalIgnoreCase);
|
||||
return new() { IsEnigmaChannel = owned, PreferH264 = owned && enabled };
|
||||
}
|
||||
}
|
||||
public sealed class ChannelPreferences
|
||||
{
|
||||
public string[] FavoriteIds { get; set; } = Array.Empty<string>();
|
||||
@@ -52,7 +67,9 @@ public sealed class PreferencesController : ControllerBase
|
||||
private readonly InternetEpg epg;
|
||||
private readonly LiveStreamRelay relay;
|
||||
private readonly LiveStreamProbe probe;
|
||||
public PreferencesController(PreferencesStore store,InternetEpg epg,LiveStreamRelay relay,LiveStreamProbe probe) { this.store=store; this.epg=epg; this.relay=relay; this.probe=probe; }
|
||||
private readonly ILibraryManager library;
|
||||
private readonly IUserManager users;
|
||||
public PreferencesController(PreferencesStore store,InternetEpg epg,LiveStreamRelay relay,LiveStreamProbe probe,ILibraryManager library,IUserManager users) { this.store=store; this.epg=epg; this.relay=relay; this.probe=probe; this.library=library; this.users=users; }
|
||||
private Guid UserId => Guid.TryParse(User.FindFirst("Jellyfin-UserId")?.Value,out var id) ? id : Guid.Empty;
|
||||
[HttpGet("Channels")]
|
||||
[AllowAnonymous]
|
||||
@@ -66,6 +83,19 @@ public sealed class PreferencesController : ControllerBase
|
||||
[HttpPut("Preferences")]
|
||||
public async Task<IActionResult> Put(ChannelPreferences value,CancellationToken token)
|
||||
{ if (UserId == Guid.Empty) return Unauthorized(); await store.Save(UserId,value,token); return NoContent(); }
|
||||
[HttpGet("WebPlaybackPolicy")]
|
||||
[ResponseCache(NoStore = true, Location = ResponseCacheLocation.None)]
|
||||
public ActionResult<WebPlaybackPolicy> GetWebPlaybackPolicy([FromQuery] Guid channelId)
|
||||
{
|
||||
// Resolve the authenticated user explicitly: the native library lookup with a
|
||||
// null user would skip visibility checks. Never accept a userId from the query.
|
||||
if (UserId == Guid.Empty) return Unauthorized();
|
||||
var user = users.GetUserById(UserId);
|
||||
if (user == null) return Unauthorized();
|
||||
if (!user.HasPermission(PermissionKind.EnableLiveTvAccess)) return Forbid();
|
||||
var item = channelId == Guid.Empty ? null : library.GetItemById<BaseItem>(channelId, user);
|
||||
return WebPlaybackPolicy.For(item, Plugin.Instance?.Configuration?.PreferH264ForWebLiveTv ?? false);
|
||||
}
|
||||
[HttpGet("Status")]
|
||||
[Authorize(Policy="RequiresElevation")]
|
||||
public IActionResult Status() => Ok(new { epg.LastSuccess,epg.MatchedImages,epg.LastError, Source="https://epg.polishteam.one/guide.xml", Streams=relay.Status(), ProbeError=probe.LastError });
|
||||
|
||||
Reference in New Issue
Block a user