* add letter bar with no links * use lucene for search, add paged search results * add search index version * index library_name; rebuild index when folder is missing * maintain index as local movies change * fix tests * maintain index as local shows change * maintain index as plex movies change * maintain index as plex shows change * code cleanup * add duplicate filter to search * add links to letter bar * code cleanup
165 lines
7.0 KiB
Plaintext
165 lines
7.0 KiB
Plaintext
@page "/media/tv/shows/{ShowId:int}"
|
|
@using ErsatzTV.Application.Television
|
|
@using ErsatzTV.Application.Television.Queries
|
|
@using ErsatzTV.Application.MediaCards
|
|
@using ErsatzTV.Application.MediaCards.Queries
|
|
@using ErsatzTV.Application.MediaCollections
|
|
@using ErsatzTV.Application.MediaCollections.Commands
|
|
@using ErsatzTV.Application.ProgramSchedules
|
|
@using ErsatzTV.Application.ProgramSchedules.Commands
|
|
@using Unit = LanguageExt.Unit
|
|
@inject IMediator Mediator
|
|
@inject ILogger<TelevisionSeasonList> Logger
|
|
@inject ISnackbar Snackbar
|
|
@inject IDialogService Dialog
|
|
@inject NavigationManager NavigationManager
|
|
@inject ChannelWriter<IBackgroundServiceRequest> Channel
|
|
|
|
<MudContainer MaxWidth="MaxWidth.False" Style="padding: 0" Class="fanart-container">
|
|
<div class="fanart-tint"></div>
|
|
@if (!string.IsNullOrWhiteSpace(_show.FanArt))
|
|
{
|
|
<img src="@($"/artwork/fanart/{_show.FanArt}")" alt="fan art"/>
|
|
}
|
|
</MudContainer>
|
|
<MudContainer MaxWidth="MaxWidth.Large" Style="margin-top: 200px">
|
|
<div style="display: flex; flex-direction: row;" class="mb-6">
|
|
@if (!string.IsNullOrWhiteSpace(_show.Poster))
|
|
{
|
|
<img class="mud-elevation-2 mr-6"
|
|
style="border-radius: 4px; max-height: 440px"
|
|
src="@($"/artwork/posters/{_show.Poster}")" alt="show poster"/>
|
|
}
|
|
<div style="display: flex; flex-direction: column; height: 100%">
|
|
<MudText Typo="Typo.h2" Class="media-item-title">@_show.Title</MudText>
|
|
<MudText Typo="Typo.subtitle1" Class="media-item-subtitle mb-6 mud-text-secondary">@_show.Year</MudText>
|
|
@if (!string.IsNullOrWhiteSpace(_show.Plot))
|
|
{
|
|
<MudCard Elevation="2" Class="mb-6">
|
|
<MudCardContent Class="mx-3 my-3" Style="height: 100%">
|
|
<MudText Style="flex-grow: 1">@_show.Plot</MudText>
|
|
</MudCardContent>
|
|
</MudCard>
|
|
}
|
|
<div>
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Primary"
|
|
StartIcon="@Icons.Material.Filled.Add"
|
|
OnClick="@AddToCollection">
|
|
Add To Collection
|
|
</MudButton>
|
|
<MudButton Class="ml-3"
|
|
Variant="Variant.Filled"
|
|
Color="Color.Primary"
|
|
StartIcon="@Icons.Material.Filled.Schedule"
|
|
OnClick="@AddToSchedule">
|
|
Add To Schedule
|
|
</MudButton>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@if (_show.Genres.Any())
|
|
{
|
|
<MudText GutterBottom="true">Genres</MudText>
|
|
<div class="mb-2">
|
|
@foreach (string genre in _show.Genres.OrderBy(g => g))
|
|
{
|
|
<MudFab Color="Color.Info" Size="Size.Small" Label="@genre" Class="mr-2 mb-2" Link="@($"/search?query=genre%3a%22{genre.ToLowerInvariant()}%22")"/>
|
|
}
|
|
</div>
|
|
}
|
|
@if (_show.Tags.Any())
|
|
{
|
|
<MudText GutterBottom="true">Tags</MudText>
|
|
<div>
|
|
@foreach (string tag in _show.Tags.OrderBy(t => t))
|
|
{
|
|
<MudFab Color="Color.Info" Size="Size.Small" Label="@tag" Class="mr-2 mb-2" Link="@($"/search?query=tag%3a%22{tag.ToLowerInvariant()}%22")"/>
|
|
}
|
|
</div>
|
|
}
|
|
</MudContainer>
|
|
<MudContainer MaxWidth="MaxWidth.Large" Class="media-card-grid mt-8">
|
|
@foreach (TelevisionSeasonCardViewModel card in _data.Cards)
|
|
{
|
|
<MediaCard Data="@card" Placeholder="@card.Placeholder"
|
|
Link="@($"/media/tv/seasons/{card.TelevisionSeasonId}")"
|
|
AddToCollectionClicked="@AddSeasonToCollection"/>
|
|
}
|
|
</MudContainer>
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
public int ShowId { get; set; }
|
|
|
|
private TelevisionShowViewModel _show;
|
|
|
|
private int _pageSize => 100;
|
|
private readonly int _pageNumber = 1;
|
|
|
|
private TelevisionSeasonCardResultsViewModel _data;
|
|
|
|
protected override Task OnParametersSetAsync() => RefreshData();
|
|
|
|
private async Task RefreshData()
|
|
{
|
|
await Mediator.Send(new GetTelevisionShowById(ShowId))
|
|
.IfSomeAsync(vm => _show = vm);
|
|
|
|
_data = await Mediator.Send(new GetTelevisionSeasonCards(ShowId, _pageNumber, _pageSize));
|
|
}
|
|
|
|
private async Task AddToCollection()
|
|
{
|
|
var parameters = new DialogParameters { { "EntityType", "show" }, { "EntityName", _show.Title } };
|
|
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall };
|
|
|
|
IDialogReference dialog = Dialog.Show<AddToCollectionDialog>("Add To Collection", parameters, options);
|
|
DialogResult result = await dialog.Result;
|
|
if (!result.Cancelled && result.Data is MediaCollectionViewModel collection)
|
|
{
|
|
await Mediator.Send(new AddShowToCollection(collection.Id, ShowId));
|
|
NavigationManager.NavigateTo($"/media/collections/{collection.Id}");
|
|
}
|
|
}
|
|
|
|
private async Task AddToSchedule()
|
|
{
|
|
var parameters = new DialogParameters { { "EntityType", "show" }, { "EntityName", _show.Title } };
|
|
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall };
|
|
|
|
IDialogReference dialog = Dialog.Show<AddToScheduleDialog>("Add To Schedule", parameters, options);
|
|
DialogResult result = await dialog.Result;
|
|
if (!result.Cancelled && result.Data is ProgramScheduleViewModel schedule)
|
|
{
|
|
await Mediator.Send(new AddProgramScheduleItem(schedule.Id, StartType.Dynamic, null, PlayoutMode.One, ProgramScheduleItemCollectionType.TelevisionShow, null, ShowId, null, null, null));
|
|
NavigationManager.NavigateTo($"/schedules/{schedule.Id}/items");
|
|
}
|
|
}
|
|
|
|
private async Task AddSeasonToCollection(MediaCardViewModel card)
|
|
{
|
|
if (card is TelevisionSeasonCardViewModel season)
|
|
{
|
|
var parameters = new DialogParameters { { "EntityType", "season" }, { "EntityName", season.Title } };
|
|
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall };
|
|
|
|
IDialogReference dialog = Dialog.Show<AddToCollectionDialog>("Add To Collection", parameters, options);
|
|
DialogResult result = await dialog.Result;
|
|
if (!result.Cancelled && result.Data is MediaCollectionViewModel collection)
|
|
{
|
|
var request = new AddSeasonToCollection(collection.Id, season.TelevisionSeasonId);
|
|
Either<BaseError, Unit> addResult = await Mediator.Send(request);
|
|
addResult.Match(
|
|
Left: error =>
|
|
{
|
|
Snackbar.Add($"Unexpected error adding season to collection: {error.Value}");
|
|
Logger.LogError("Unexpected error adding season to collection: {Error}", error.Value);
|
|
},
|
|
Right: _ => Snackbar.Add($"Added {season.Title} to collection {collection.Name}", Severity.Success));
|
|
}
|
|
}
|
|
}
|
|
|
|
} |