Files
ersatztv/ErsatzTV/Pages/JellyfinMediaSources.razor
T

31 lines
1.0 KiB
Plaintext

@page "/media/sources/jellyfin"
@using ErsatzTV.Application.Jellyfin
@using ErsatzTV.Core.Interfaces.Jellyfin
@using ErsatzTV.Core.Jellyfin
@implements IDisposable
@inject IJellyfinSecretStore _jellyfinSecretStore
@inject ChannelWriter<IScannerBackgroundServiceRequest> _scannerWorkerChannel
<RemoteMediaSources
TViewModel="JellyfinMediaSourceViewModel"
TSecrets="JellyfinSecrets"
TMediaSource="JellyfinMediaSource"
Name="Jellyfin"
GetAllMediaSourcesCommand="@(new GetAllJellyfinMediaSources())"
DisconnectCommand="@(new DisconnectJellyfin())"
RefreshLibrariesCommand="@(mediaSourceId => RefreshLibraries(mediaSourceId))"
SecretStore="@_jellyfinSecretStore"/>
@code {
private readonly CancellationTokenSource _cts = new();
public void Dispose()
{
_cts.Cancel();
_cts.Dispose();
}
private async Task RefreshLibraries(int mediaSourceId) =>
await _scannerWorkerChannel.WriteAsync(new SynchronizeJellyfinLibraries(mediaSourceId), _cts.Token);
}