|
|
@ -11,15 +11,51 @@ |
|
|
|
@inject IPlexSecretStore PlexSecretStore |
|
|
|
@inject IPlexSecretStore PlexSecretStore |
|
|
|
@inject ChannelWriter<IScannerBackgroundServiceRequest> ScannerWorkerChannel |
|
|
|
@inject ChannelWriter<IScannerBackgroundServiceRequest> ScannerWorkerChannel |
|
|
|
|
|
|
|
|
|
|
|
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8"> |
|
|
|
<MudForm Style="max-height: 100%"> |
|
|
|
|
|
|
|
<MudPaper Square="true" Style="display: flex; height: 64px; min-height: 64px; width: 100%; z-index: 100; align-items: center"> |
|
|
|
|
|
|
|
@if (_mediaSources.Any()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
<MudButton Variant="Variant.Filled" |
|
|
|
|
|
|
|
Color="Color.Error" |
|
|
|
|
|
|
|
OnClick="@(_ => SignOutOfPlex())" |
|
|
|
|
|
|
|
Disabled="@Locker.IsPlexLocked()" |
|
|
|
|
|
|
|
Class="ml-8"> |
|
|
|
|
|
|
|
Sign out of plex |
|
|
|
|
|
|
|
</MudButton> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
<MudButton Variant="Variant.Filled" |
|
|
|
|
|
|
|
Color="Color.Primary" |
|
|
|
|
|
|
|
OnClick="@(_ => AddPlexMediaSource())" |
|
|
|
|
|
|
|
Disabled="@Locker.IsPlexLocked()" |
|
|
|
|
|
|
|
Class="ml-8"> |
|
|
|
|
|
|
|
Sign in to plex |
|
|
|
|
|
|
|
</MudButton> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@if (_mediaSources.Any() && !_isAuthorized) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
<MudButton Variant="Variant.Filled" |
|
|
|
|
|
|
|
Color="Color.Secondary" |
|
|
|
|
|
|
|
OnClick="@(_ => AddPlexMediaSource())" |
|
|
|
|
|
|
|
Disabled="@Locker.IsPlexLocked()" |
|
|
|
|
|
|
|
Class="ml-4"> |
|
|
|
|
|
|
|
Fix Plex Credentials |
|
|
|
|
|
|
|
</MudButton> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</MudPaper> |
|
|
|
|
|
|
|
<div class="d-flex flex-column" style="height: 100vh; overflow-x: auto"> |
|
|
|
|
|
|
|
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8"> |
|
|
|
|
|
|
|
<MudText Typo="Typo.h5" Class="mb-2">Plex Media Sources</MudText> |
|
|
|
|
|
|
|
<MudDivider Class="mb-6"/> |
|
|
|
<MudTable T="PlexMediaSourceViewModel" Hover="true" Dense="true" Items="_mediaSources"> |
|
|
|
<MudTable T="PlexMediaSourceViewModel" Hover="true" Dense="true" Items="_mediaSources"> |
|
|
|
<ToolBarContent> |
|
|
|
|
|
|
|
<MudText Typo="Typo.h6">Plex Media Sources</MudText> |
|
|
|
|
|
|
|
</ToolBarContent> |
|
|
|
|
|
|
|
<ColGroup> |
|
|
|
<ColGroup> |
|
|
|
|
|
|
|
<MudHidden Breakpoint="Breakpoint.Xs"> |
|
|
|
<col/> |
|
|
|
<col/> |
|
|
|
<col/> |
|
|
|
<col/> |
|
|
|
<col style="width: 120px;"/> |
|
|
|
<col style="width: 120px;"/> |
|
|
|
|
|
|
|
</MudHidden> |
|
|
|
</ColGroup> |
|
|
|
</ColGroup> |
|
|
|
<HeaderContent> |
|
|
|
<HeaderContent> |
|
|
|
<MudTh>Name</MudTh> |
|
|
|
<MudTh>Name</MudTh> |
|
|
@ -27,8 +63,8 @@ |
|
|
|
<MudTh/> |
|
|
|
<MudTh/> |
|
|
|
</HeaderContent> |
|
|
|
</HeaderContent> |
|
|
|
<RowTemplate> |
|
|
|
<RowTemplate> |
|
|
|
<MudTd DataLabel="Name">@context.Name</MudTd> |
|
|
|
<MudTd>@context.Name</MudTd> |
|
|
|
<MudTd DataLabel="Address">@context.Address</MudTd> |
|
|
|
<MudTd Style="overflow-wrap: anywhere;">@context.Address</MudTd> |
|
|
|
<MudTd> |
|
|
|
<MudTd> |
|
|
|
<div style="align-items: center; display: flex;"> |
|
|
|
<div style="align-items: center; display: flex;"> |
|
|
|
<MudTooltip Text="Refresh Libraries"> |
|
|
|
<MudTooltip Text="Refresh Libraries"> |
|
|
@ -51,39 +87,9 @@ |
|
|
|
</MudTd> |
|
|
|
</MudTd> |
|
|
|
</RowTemplate> |
|
|
|
</RowTemplate> |
|
|
|
</MudTable> |
|
|
|
</MudTable> |
|
|
|
@if (_mediaSources.Any()) |
|
|
|
</MudContainer> |
|
|
|
{ |
|
|
|
</div> |
|
|
|
<MudButton Variant="Variant.Filled" |
|
|
|
</MudForm> |
|
|
|
Color="Color.Error" |
|
|
|
|
|
|
|
OnClick="@(_ => SignOutOfPlex())" |
|
|
|
|
|
|
|
Disabled="@Locker.IsPlexLocked()" |
|
|
|
|
|
|
|
Class="mt-4"> |
|
|
|
|
|
|
|
Sign out of plex |
|
|
|
|
|
|
|
</MudButton> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
<MudButton Variant="Variant.Filled" |
|
|
|
|
|
|
|
Color="Color.Primary" |
|
|
|
|
|
|
|
OnClick="@(_ => AddPlexMediaSource())" |
|
|
|
|
|
|
|
Disabled="@Locker.IsPlexLocked()" |
|
|
|
|
|
|
|
Class="mt-4"> |
|
|
|
|
|
|
|
Sign in to plex |
|
|
|
|
|
|
|
</MudButton> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@if (_mediaSources.Any() && !_isAuthorized) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
<MudButton Variant="Variant.Filled" |
|
|
|
|
|
|
|
Color="Color.Secondary" |
|
|
|
|
|
|
|
OnClick="@(_ => AddPlexMediaSource())" |
|
|
|
|
|
|
|
Disabled="@Locker.IsPlexLocked()" |
|
|
|
|
|
|
|
Class="ml-4 mt-4"> |
|
|
|
|
|
|
|
Fix Plex Credentials |
|
|
|
|
|
|
|
</MudButton> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</MudContainer> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@code { |
|
|
|
@code { |
|
|
|
private List<PlexMediaSourceViewModel> _mediaSources = new(); |
|
|
|
private List<PlexMediaSourceViewModel> _mediaSources = new(); |
|
|
@ -106,7 +112,7 @@ |
|
|
|
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Small }; |
|
|
|
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Small }; |
|
|
|
IDialogReference dialog = await Dialog.ShowAsync<SignOutOfPlexDialog>("Sign out of Plex", options); |
|
|
|
IDialogReference dialog = await Dialog.ShowAsync<SignOutOfPlexDialog>("Sign out of Plex", options); |
|
|
|
DialogResult result = await dialog.Result; |
|
|
|
DialogResult result = await dialog.Result; |
|
|
|
if (!result.Canceled) |
|
|
|
if (result is { Canceled: false }) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (Locker.LockPlex()) |
|
|
|
if (Locker.LockPlex()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -126,7 +132,7 @@ |
|
|
|
{ |
|
|
|
{ |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
await JsRuntime.InvokeAsync<object>("open", new object[] { url, "_blank" }); |
|
|
|
await JsRuntime.InvokeAsync<object>("open", [url, "_blank"]); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -144,10 +150,17 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async void PlexChanged(object sender, EventArgs e) |
|
|
|
private async void PlexChanged(object sender, EventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
await InvokeAsync(LoadMediaSources); |
|
|
|
await InvokeAsync(LoadMediaSources); |
|
|
|
await InvokeAsync(StateHasChanged); |
|
|
|
await InvokeAsync(StateHasChanged); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// do nothing |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async Task RefreshLibraries(int mediaSourceId) => |
|
|
|
private async Task RefreshLibraries(int mediaSourceId) => |
|
|
|
await ScannerWorkerChannel.WriteAsync(new SynchronizePlexLibraries(mediaSourceId)); |
|
|
|
await ScannerWorkerChannel.WriteAsync(new SynchronizePlexLibraries(mediaSourceId)); |
|
|
|