Files
ersatztv/ErsatzTV/Pages/JellyfinMediaSources.razor
T
Jason DoveandGitHub a87ec2d75d cleanup (#1708)
* fix blazor naming

* code cleanup

* update dependencies
2024-05-06 17:00:52 -05:00

31 lines
1020 B
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);
}