Browse Source

edit jellyfin and emby connection info (#2556)

pull/2557/head
Jason Dove 9 months ago committed by GitHub
parent
commit
2d53063ce9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 5
      ErsatzTV.Application/Emby/Commands/SaveEmbySecretsHandler.cs
  3. 5
      ErsatzTV.Application/Jellyfin/Commands/SaveJellyfinSecretsHandler.cs
  4. 3
      ErsatzTV/Pages/EmbyMediaSources.razor
  5. 3
      ErsatzTV/Pages/JellyfinMediaSources.razor
  6. 29
      ErsatzTV/Shared/RemoteMediaSources.razor

1
CHANGELOG.md

@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -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

5
ErsatzTV.Application/Emby/Commands/SaveEmbySecretsHandler.cs

@ -3,6 +3,7 @@ using ErsatzTV.Core; @@ -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 @@ -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 @@ -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;

5
ErsatzTV.Application/Jellyfin/Commands/SaveJellyfinSecretsHandler.cs

@ -3,6 +3,7 @@ using ErsatzTV.Core; @@ -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 @@ -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 @@ -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;

3
ErsatzTV/Pages/EmbyMediaSources.razor

@ -13,7 +13,8 @@ @@ -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) =>

3
ErsatzTV/Pages/JellyfinMediaSources.razor

@ -13,7 +13,8 @@ @@ -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) =>

29
ErsatzTV/Shared/RemoteMediaSources.razor

@ -28,14 +28,26 @@ @@ -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 @@ @@ -102,6 +114,9 @@
[Parameter]
public IRemoteMediaSourceSecretStore<TSecrets> SecretStore { get; set; }
[Parameter]
public bool CanEdit { get; set; }
private List<TViewModel> _mediaSources = [];
private bool _isAuthorized;

Loading…
Cancel
Save