edit jellyfin and emby connection info (#2556)

This commit is contained in:
Jason Dove
2025-10-21 19:10:48 -05:00
committed by GitHub
parent 626048f9c3
commit 2d53063ce9
6 changed files with 37 additions and 9 deletions
+1
View File
@@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add episode thumbnail artwork URL to XMLTV template
- By default, poster will be added as image with type "poster" and thumbnail will be added as image with type "still"
- Poster will continue to be added as icon by default
- Add buttons to edit Jellyfin and Emby connection information in **Media Sources** > **Jellyfin** and **Media Sources** > **Emby**
### Fixed
- Fix NVIDIA startup errors on arm64
@@ -3,6 +3,7 @@ using ErsatzTV.Core;
using ErsatzTV.Core.Emby;
using ErsatzTV.Core.Interfaces.Emby;
using ErsatzTV.Core.Interfaces.Repositories;
using Microsoft.Extensions.Caching.Memory;
namespace ErsatzTV.Application.Emby;
@@ -12,16 +13,19 @@ public class SaveEmbySecretsHandler : IRequestHandler<SaveEmbySecrets, Either<Ba
private readonly IEmbyApiClient _embyApiClient;
private readonly IEmbySecretStore _embySecretStore;
private readonly IMediaSourceRepository _mediaSourceRepository;
private readonly IMemoryCache _memoryCache;
public SaveEmbySecretsHandler(
IEmbySecretStore embySecretStore,
IEmbyApiClient embyApiClient,
IMediaSourceRepository mediaSourceRepository,
IMemoryCache memoryCache,
ChannelWriter<IEmbyBackgroundServiceRequest> channel)
{
_embySecretStore = embySecretStore;
_embyApiClient = embyApiClient;
_mediaSourceRepository = mediaSourceRepository;
_memoryCache = memoryCache;
_channel = channel;
}
@@ -47,6 +51,7 @@ public class SaveEmbySecretsHandler : IRequestHandler<SaveEmbySecrets, Either<Ba
parameters.Secrets.Address,
parameters.ServerInformation.ServerName,
parameters.ServerInformation.OperatingSystem);
_memoryCache.Remove(new GetEmbyConnectionParameters());
await _channel.WriteAsync(new SynchronizeEmbyMediaSources());
return Unit.Default;
@@ -3,6 +3,7 @@ using ErsatzTV.Core;
using ErsatzTV.Core.Interfaces.Jellyfin;
using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.Core.Jellyfin;
using Microsoft.Extensions.Caching.Memory;
namespace ErsatzTV.Application.Jellyfin;
@@ -12,16 +13,19 @@ public class SaveJellyfinSecretsHandler : IRequestHandler<SaveJellyfinSecrets, E
private readonly IJellyfinApiClient _jellyfinApiClient;
private readonly IJellyfinSecretStore _jellyfinSecretStore;
private readonly IMediaSourceRepository _mediaSourceRepository;
private readonly IMemoryCache _memoryCache;
public SaveJellyfinSecretsHandler(
IJellyfinSecretStore jellyfinSecretStore,
IJellyfinApiClient jellyfinApiClient,
IMediaSourceRepository mediaSourceRepository,
IMemoryCache memoryCache,
ChannelWriter<IJellyfinBackgroundServiceRequest> channel)
{
_jellyfinSecretStore = jellyfinSecretStore;
_jellyfinApiClient = jellyfinApiClient;
_mediaSourceRepository = mediaSourceRepository;
_memoryCache = memoryCache;
_channel = channel;
}
@@ -47,6 +51,7 @@ public class SaveJellyfinSecretsHandler : IRequestHandler<SaveJellyfinSecrets, E
parameters.Secrets.Address,
parameters.ServerInformation.ServerName,
parameters.ServerInformation.OperatingSystem);
_memoryCache.Remove(new GetJellyfinConnectionParameters());
await _channel.WriteAsync(new SynchronizeJellyfinMediaSources());
return Unit.Default;
+2 -1
View File
@@ -13,7 +13,8 @@
GetAllMediaSourcesCommand="@(new GetAllEmbyMediaSources())"
DisconnectCommand="@(new DisconnectEmby())"
RefreshLibrariesCommand="@RefreshLibraries"
SecretStore="@EmbySecretStore"/>
SecretStore="@EmbySecretStore"
CanEdit="true"/>
@code {
private async Task RefreshLibraries(int mediaSourceId, CancellationToken cancellationToken) =>
+2 -1
View File
@@ -13,7 +13,8 @@
GetAllMediaSourcesCommand="@(new GetAllJellyfinMediaSources())"
DisconnectCommand="@(new DisconnectJellyfin())"
RefreshLibrariesCommand="@RefreshLibraries"
SecretStore="@JellyfinSecretStore"/>
SecretStore="@JellyfinSecretStore"
CanEdit="true"/>
@code {
private async Task RefreshLibraries(int mediaSourceId, CancellationToken cancellationToken) =>
+22 -7
View File
@@ -28,14 +28,26 @@
</MudButton>
}
@if (_mediaSources.Any() && !_isAuthorized)
@if (_mediaSources.Any())
{
<MudButton Variant="Variant.Filled"
Color="Color.Secondary"
Href="@($"media/sources/{Name.ToLowerInvariant()}/edit")"
Class="ml-4">
Fix @Name Connection
</MudButton>
@if (CanEdit)
{
<MudButton Variant="Variant.Filled"
Color="Color.Secondary"
Href="@($"media/sources/{Name.ToLowerInvariant()}/edit")"
Class="ml-4">
Edit @Name Connection
</MudButton>
}
else if (!_isAuthorized)
{
<MudButton Variant="Variant.Filled"
Color="Color.Secondary"
Href="@($"media/sources/{Name.ToLowerInvariant()}/edit")"
Class="ml-4">
Fix @Name Connection
</MudButton>
}
}
</MudPaper>
<div class="d-flex flex-column" style="height: 100vh; overflow-x: auto">
@@ -102,6 +114,9 @@
[Parameter]
public IRemoteMediaSourceSecretStore<TSecrets> SecretStore { get; set; }
[Parameter]
public bool CanEdit { get; set; }
private List<TViewModel> _mediaSources = [];
private bool _isAuthorized;