diff --git a/ErsatzTV.Application/IMediaCard.cs b/ErsatzTV.Application/IMediaCard.cs new file mode 100644 index 000000000..a50da9758 --- /dev/null +++ b/ErsatzTV.Application/IMediaCard.cs @@ -0,0 +1,9 @@ +namespace ErsatzTV.Application +{ + public interface IMediaCard + { + string Title { get; } + string SortTitle { get; } + string Subtitle { get; } + } +} diff --git a/ErsatzTV.Application/MediaItems/AggregateMediaItemViewModel.cs b/ErsatzTV.Application/MediaItems/AggregateMediaItemViewModel.cs index 7d51ffa50..a768b3fcf 100644 --- a/ErsatzTV.Application/MediaItems/AggregateMediaItemViewModel.cs +++ b/ErsatzTV.Application/MediaItems/AggregateMediaItemViewModel.cs @@ -1,4 +1,13 @@ namespace ErsatzTV.Application.MediaItems { - public record AggregateMediaItemViewModel(string Source, string Title, int Count, string Duration); + public record AggregateMediaItemViewModel( + string Source, + string Title, + string Subtitle, + int Count, + string Duration) : IMediaCard + { + public string SortTitle => + Title.ToLowerInvariant().StartsWith("the ") ? Title.Substring(4) : Title; + } } diff --git a/ErsatzTV.Application/MediaItems/Queries/GetAggregateMediaItemsHandler.cs b/ErsatzTV.Application/MediaItems/Queries/GetAggregateMediaItemsHandler.cs index 189916267..643f7ca9f 100644 --- a/ErsatzTV.Application/MediaItems/Queries/GetAggregateMediaItemsHandler.cs +++ b/ErsatzTV.Application/MediaItems/Queries/GetAggregateMediaItemsHandler.cs @@ -34,6 +34,9 @@ namespace ErsatzTV.Application.MediaItems.Queries group => new AggregateMediaItemViewModel( group.Key.Name, group.Key.Title, + request.MediaType == MediaType.TvShow + ? $"{group.Count()} Episodes" + : group.Min(i => i.Metadata?.Aired?.Year).ToString(), group.Count(), group.Count() == 1 ? DisplayDuration(group.Head()) : string.Empty)) .ToList(); diff --git a/ErsatzTV/Pages/LocalMediaSourceEditor.razor b/ErsatzTV/Pages/LocalMediaSourceEditor.razor index 71680811f..848a06c25 100644 --- a/ErsatzTV/Pages/LocalMediaSourceEditor.razor +++ b/ErsatzTV/Pages/LocalMediaSourceEditor.razor @@ -1,7 +1,6 @@ @page "/media/sources/local/add" -@using ErsatzTV.Application -@using ErsatzTV.Application.MediaSources @using ErsatzTV.Application.MediaSources.Commands +@using ErsatzTV.Application.MediaSources @inject NavigationManager NavigationManager @inject ILogger Logger @inject ISnackbar Snackbar diff --git a/ErsatzTV/Pages/MediaItems.razor b/ErsatzTV/Pages/MediaItems.razor deleted file mode 100644 index 63bf3e387..000000000 --- a/ErsatzTV/Pages/MediaItems.razor +++ /dev/null @@ -1,17 +0,0 @@ -@page "/media/items" - - - - - - - - - - - - - -@code { - -} \ No newline at end of file diff --git a/ErsatzTV/Pages/MediaMovieItems.razor b/ErsatzTV/Pages/MediaMovieItems.razor new file mode 100644 index 000000000..185814ec3 --- /dev/null +++ b/ErsatzTV/Pages/MediaMovieItems.razor @@ -0,0 +1,8 @@ +@page "/media/movies/items" +@inject IMediator Mediator + + + +@code { + +} \ No newline at end of file diff --git a/ErsatzTV/Pages/MediaOtherItems.razor b/ErsatzTV/Pages/MediaOtherItems.razor new file mode 100644 index 000000000..d944a4f27 --- /dev/null +++ b/ErsatzTV/Pages/MediaOtherItems.razor @@ -0,0 +1,8 @@ +@page "/media/other/items" +@inject IMediator Mediator + + + +@code { + +} \ No newline at end of file diff --git a/ErsatzTV/Pages/MediaTVItems.razor b/ErsatzTV/Pages/MediaTVItems.razor new file mode 100644 index 000000000..69703faf8 --- /dev/null +++ b/ErsatzTV/Pages/MediaTVItems.razor @@ -0,0 +1,8 @@ +@page "/media/tv/items" +@inject IMediator Mediator + + + +@code { + +} \ No newline at end of file diff --git a/ErsatzTV/Shared/MainLayout.razor b/ErsatzTV/Shared/MainLayout.razor index c2c521569..c5536e260 100644 --- a/ErsatzTV/Shared/MainLayout.razor +++ b/ErsatzTV/Shared/MainLayout.razor @@ -28,7 +28,9 @@ FFmpeg Media Sources - Media Items + TV Shows + Movies + Other Items Media Collections Schedules @@ -42,7 +44,7 @@ - + @Body diff --git a/ErsatzTV/Shared/MediaCard.razor b/ErsatzTV/Shared/MediaCard.razor new file mode 100644 index 000000000..1cc736e26 --- /dev/null +++ b/ErsatzTV/Shared/MediaCard.razor @@ -0,0 +1,28 @@ +
+ + + @Data.SortTitle.Substring(0, 1) + + + + @Data.Title + + + @Data.Subtitle + +
+ +@code { + + [Parameter] + public IMediaCard Data { get; set; } + +} \ No newline at end of file diff --git a/ErsatzTV/Shared/MediaItemTable.razor b/ErsatzTV/Shared/MediaItemTable.razor deleted file mode 100644 index c1cf83b72..000000000 --- a/ErsatzTV/Shared/MediaItemTable.razor +++ /dev/null @@ -1,66 +0,0 @@ -@using ErsatzTV.Application.MediaItems -@using ErsatzTV.Application.MediaItems.Queries -@inject IMediator Mediator - - - - Media Items - - - - - - Source - Title - Count - Duration - - - @context.Source - @context.Title - @context.Count - @context.Duration - - - - - - -@code { - - [Parameter] - public MediaType MediaType { get; set; } - - private IEnumerable _pagedData; - private MudTable _table; - - private int _totalItems; - private string _searchString; - - private async Task> ServerReload(TableState state) - { - List aggregateData = - await Mediator.Send(new GetAggregateMediaItems(MediaType, _searchString)); - - _totalItems = aggregateData.Count; - - _pagedData = aggregateData.Skip(state.Page * state.PageSize).Take(state.PageSize); - return new TableData { TotalItems = _totalItems, Items = _pagedData }; - } - - private async Task OnSearch(string text) - { - _searchString = text; - await _table.ReloadServerData(); - } - - private class MediaItemAggregate - { - public string Source { get; set; } - public string Title { get; set; } - public int Count { get; set; } - public string Duration { get; set; } - } - -} \ No newline at end of file diff --git a/ErsatzTV/Shared/MediaItemsGrid.razor b/ErsatzTV/Shared/MediaItemsGrid.razor new file mode 100644 index 000000000..c8f3d90a9 --- /dev/null +++ b/ErsatzTV/Shared/MediaItemsGrid.razor @@ -0,0 +1,22 @@ +@using ErsatzTV.Application.MediaItems +@using ErsatzTV.Application.MediaItems.Queries +@inject IMediator Mediator + + + @foreach (AggregateMediaItemViewModel item in _data.OrderBy(i => i.SortTitle)) + { + + } + + +@code { + + [Parameter] + public MediaType MediaType { get; set; } + + private List _data; + + protected override async Task OnInitializedAsync() => + _data = await Mediator.Send(new GetAggregateMediaItems(MediaType, string.Empty)); + +} \ No newline at end of file diff --git a/ErsatzTV/_Imports.razor b/ErsatzTV/_Imports.razor index 17af02e6d..fad2bdf07 100644 --- a/ErsatzTV/_Imports.razor +++ b/ErsatzTV/_Imports.razor @@ -17,6 +17,7 @@ @using MudBlazor @using MudBlazor.Dialog @using ErsatzTV +@using ErsatzTV.Application @using ErsatzTV.Core @using ErsatzTV.Core.Domain @using ErsatzTV.Infrastructure.Data