31 lines
964 B
Plaintext
31 lines
964 B
Plaintext
@page "/media/sources/emby"
|
|
@using ErsatzTV.Application.Emby
|
|
@using ErsatzTV.Core.Emby
|
|
@using ErsatzTV.Core.Interfaces.Emby
|
|
@implements IDisposable
|
|
@inject IEmbySecretStore EmbySecretStore
|
|
@inject ChannelWriter<IScannerBackgroundServiceRequest> ScannerWorkerChannel
|
|
|
|
<RemoteMediaSources
|
|
TViewModel="EmbyMediaSourceViewModel"
|
|
TSecrets="EmbySecrets"
|
|
TMediaSource="EmbyMediaSource"
|
|
Name="Emby"
|
|
GetAllMediaSourcesCommand="@(new GetAllEmbyMediaSources())"
|
|
DisconnectCommand="@(new DisconnectEmby())"
|
|
RefreshLibrariesCommand="@(mediaSourceId => RefreshLibraries(mediaSourceId))"
|
|
SecretStore="@EmbySecretStore"/>
|
|
|
|
@code {
|
|
private readonly CancellationTokenSource _cts = new();
|
|
|
|
public void Dispose()
|
|
{
|
|
_cts.Cancel();
|
|
_cts.Dispose();
|
|
}
|
|
|
|
private async Task RefreshLibraries(int mediaSourceId) =>
|
|
await ScannerWorkerChannel.WriteAsync(new SynchronizeEmbyLibraries(mediaSourceId), _cts.Token);
|
|
|
|
} |