fix television metadata (#161)
This commit is contained in:
@@ -82,7 +82,7 @@ namespace ErsatzTV.Application.MediaCards
|
|||||||
collection.MediaItems.OfType<Season>().Map(ProjectToViewModel).ToList(),
|
collection.MediaItems.OfType<Season>().Map(ProjectToViewModel).ToList(),
|
||||||
collection.MediaItems.OfType<Episode>().Map(e => ProjectToViewModel(e.EpisodeMetadata.Head()))
|
collection.MediaItems.OfType<Episode>().Map(e => ProjectToViewModel(e.EpisodeMetadata.Head()))
|
||||||
.ToList(),
|
.ToList(),
|
||||||
collection.MediaItems.OfType<Artist>().Map(a => ProjectToViewModel(a.ArtistMetadata.Head())).ToList(),
|
collection.MediaItems.OfType<Artist>().Map(a => ProjectToViewModel(a.ArtistMetadata.Head())).ToList(),
|
||||||
collection.MediaItems.OfType<MusicVideo>().Map(mv => ProjectToViewModel(mv.MusicVideoMetadata.Head()))
|
collection.MediaItems.OfType<MusicVideo>().Map(mv => ProjectToViewModel(mv.MusicVideoMetadata.Head()))
|
||||||
.ToList()) { UseCustomPlaybackOrder = collection.UseCustomPlaybackOrder };
|
.ToList()) { UseCustomPlaybackOrder = collection.UseCustomPlaybackOrder };
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
namespace ErsatzTV.Application.MediaCards
|
namespace ErsatzTV.Application.MediaCards
|
||||||
{
|
{
|
||||||
public record MusicVideoCardViewModel
|
public record MusicVideoCardViewModel
|
||||||
(int MusicVideoId, string Title, string Subtitle, string SortTitle, string Plot, string Poster) : MediaCardViewModel(
|
(
|
||||||
MusicVideoId,
|
int MusicVideoId,
|
||||||
Title,
|
string Title,
|
||||||
Subtitle,
|
string Subtitle,
|
||||||
SortTitle,
|
string SortTitle,
|
||||||
Poster)
|
string Plot,
|
||||||
|
string Poster) : MediaCardViewModel(
|
||||||
|
MusicVideoId,
|
||||||
|
Title,
|
||||||
|
Subtitle,
|
||||||
|
SortTitle,
|
||||||
|
Poster)
|
||||||
{
|
{
|
||||||
public int CustomIndex { get; set; }
|
public int CustomIndex { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ namespace ErsatzTV.Application.MediaCollections.Commands
|
|||||||
public class
|
public class
|
||||||
AddArtistToCollectionHandler : MediatR.IRequestHandler<AddArtistToCollection, Either<BaseError, Unit>>
|
AddArtistToCollectionHandler : MediatR.IRequestHandler<AddArtistToCollection, Either<BaseError, Unit>>
|
||||||
{
|
{
|
||||||
|
private readonly IArtistRepository _artistRepository;
|
||||||
private readonly ChannelWriter<IBackgroundServiceRequest> _channel;
|
private readonly ChannelWriter<IBackgroundServiceRequest> _channel;
|
||||||
private readonly IMediaCollectionRepository _mediaCollectionRepository;
|
private readonly IMediaCollectionRepository _mediaCollectionRepository;
|
||||||
private readonly IArtistRepository _artistRepository;
|
|
||||||
|
|
||||||
public AddArtistToCollectionHandler(
|
public AddArtistToCollectionHandler(
|
||||||
IMediaCollectionRepository mediaCollectionRepository,
|
IMediaCollectionRepository mediaCollectionRepository,
|
||||||
|
|||||||
@@ -2,5 +2,9 @@
|
|||||||
|
|
||||||
namespace ErsatzTV.Application.Search
|
namespace ErsatzTV.Application.Search
|
||||||
{
|
{
|
||||||
public record SearchResultAllItemsViewModel(List<int> MovieIds, List<int> ShowIds, List<int> ArtistIds, List<int> MusicVideoIds);
|
public record SearchResultAllItemsViewModel(
|
||||||
|
List<int> MovieIds,
|
||||||
|
List<int> ShowIds,
|
||||||
|
List<int> ArtistIds,
|
||||||
|
List<int> MusicVideoIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
await dbContext.SaveChangesAsync();
|
await dbContext.SaveChangesAsync();
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Option<Artist>> GetArtist(int artistId)
|
public async Task<Option<Artist>> GetArtist(int artistId)
|
||||||
{
|
{
|
||||||
await using TvContext dbContext = _dbContextFactory.CreateDbContext();
|
await using TvContext dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
|||||||
@@ -9,25 +9,25 @@ namespace ErsatzTV.Infrastructure.Migrations
|
|||||||
migrationBuilder.Sql(
|
migrationBuilder.Sql(
|
||||||
@"DELETE FROM Genre
|
@"DELETE FROM Genre
|
||||||
WHERE MovieMetadataId NOT IN (SELECT Id FROM MovieMetadata)
|
WHERE MovieMetadataId NOT IN (SELECT Id FROM MovieMetadata)
|
||||||
OR ShowMetadataId NOT IN (SELECT Id FROM Show)
|
OR ShowMetadataId NOT IN (SELECT Id FROM ShowMetadata)
|
||||||
OR SeasonMetadataId NOT IN (SELECT Id FROM Season)
|
OR SeasonMetadataId NOT IN (SELECT Id FROM SeasonMetadata)
|
||||||
OR EpisodeMetadataId NOT IN (SELECT Id FROM Episode)
|
OR EpisodeMetadataId NOT IN (SELECT Id FROM EpisodeMetadata)
|
||||||
OR MusicVideoMetadataId NOT IN (SELECT Id FROM MusicVideoMetadata)");
|
OR MusicVideoMetadataId NOT IN (SELECT Id FROM MusicVideoMetadata)");
|
||||||
|
|
||||||
migrationBuilder.Sql(
|
migrationBuilder.Sql(
|
||||||
@"DELETE FROM Tag
|
@"DELETE FROM Tag
|
||||||
WHERE MovieMetadataId NOT IN (SELECT Id FROM MovieMetadata)
|
WHERE MovieMetadataId NOT IN (SELECT Id FROM MovieMetadata)
|
||||||
OR ShowMetadataId NOT IN (SELECT Id FROM Show)
|
OR ShowMetadataId NOT IN (SELECT Id FROM ShowMetadata)
|
||||||
OR SeasonMetadataId NOT IN (SELECT Id FROM Season)
|
OR SeasonMetadataId NOT IN (SELECT Id FROM SeasonMetadata)
|
||||||
OR EpisodeMetadataId NOT IN (SELECT Id FROM Episode)
|
OR EpisodeMetadataId NOT IN (SELECT Id FROM EpisodeMetadata)
|
||||||
OR MusicVideoMetadataId NOT IN (SELECT Id FROM MusicVideoMetadata)");
|
OR MusicVideoMetadataId NOT IN (SELECT Id FROM MusicVideoMetadata)");
|
||||||
|
|
||||||
migrationBuilder.Sql(
|
migrationBuilder.Sql(
|
||||||
@"DELETE FROM Studio
|
@"DELETE FROM Studio
|
||||||
WHERE MovieMetadataId NOT IN (SELECT Id FROM MovieMetadata)
|
WHERE MovieMetadataId NOT IN (SELECT Id FROM MovieMetadata)
|
||||||
OR ShowMetadataId NOT IN (SELECT Id FROM Show)
|
OR ShowMetadataId NOT IN (SELECT Id FROM ShowMetadata)
|
||||||
OR SeasonMetadataId NOT IN (SELECT Id FROM Season)
|
OR SeasonMetadataId NOT IN (SELECT Id FROM SeasonMetadata)
|
||||||
OR EpisodeMetadataId NOT IN (SELECT Id FROM Episode)
|
OR EpisodeMetadataId NOT IN (SELECT Id FROM EpisodeMetadata)
|
||||||
OR MusicVideoMetadataId NOT IN (SELECT Id FROM MusicVideoMetadata)");
|
OR MusicVideoMetadataId NOT IN (SELECT Id FROM MusicVideoMetadata)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
+2164
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ErsatzTV.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
public partial class Update_LibraryLastScan_Metadata : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.Sql(
|
||||||
|
@"UPDATE LibraryPath SET LastScan = '0001-01-01 00:00:00' WHERE Id IN
|
||||||
|
(SELECT LP.Id FROM LibraryPath LP INNER JOIN Library L on L.Id = LP.LibraryId WHERE MediaKind = 2)");
|
||||||
|
|
||||||
|
migrationBuilder.Sql(
|
||||||
|
@"UPDATE Library SET LastScan = '0001-01-01 00:00:00' WHERE MediaKind = 2");
|
||||||
|
|
||||||
|
migrationBuilder.Sql(
|
||||||
|
@"UPDATE ShowMetadata SET DateUpdated = '0001-01-01 00:00:00' WHERE MetadataKind = 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<MudSkeleton SkeletonType="SkeletonType.Rectangle" Animation="Animation.False" Height="220px" Width="293px" />
|
<MudSkeleton SkeletonType="SkeletonType.Rectangle" Animation="Animation.False" Height="220px" Width="293px"/>
|
||||||
}
|
}
|
||||||
<MudCardContent Class="ml-3">
|
<MudCardContent Class="ml-3">
|
||||||
<div style="display: flex; flex-direction: column; height: 100%">
|
<div style="display: flex; flex-direction: column; height: 100%">
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
NavigationManager.NavigateTo($"/media/collections/{collection.Id}");
|
NavigationManager.NavigateTo($"/media/collections/{collection.Id}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddMusicVideoToCollection(MusicVideoCardViewModel musicVideo)
|
private async Task AddMusicVideoToCollection(MusicVideoCardViewModel musicVideo)
|
||||||
{
|
{
|
||||||
var parameters = new DialogParameters { { "EntityType", "music video" }, { "EntityName", musicVideo.Title } };
|
var parameters = new DialogParameters { { "EntityType", "music video" }, { "EntityName", musicVideo.Title } };
|
||||||
|
|||||||
@@ -131,7 +131,10 @@
|
|||||||
|
|
||||||
private void SelectClicked(MediaCardViewModel card, MouseEventArgs e)
|
private void SelectClicked(MediaCardViewModel card, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
List<MediaCardViewModel> GetSortedItems() => _data.Cards.OrderBy(m => m.SortTitle).ToList<MediaCardViewModel>();
|
List<MediaCardViewModel> GetSortedItems()
|
||||||
|
{
|
||||||
|
return _data.Cards.OrderBy(m => m.SortTitle).ToList<MediaCardViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
SelectClicked(GetSortedItems, card, e);
|
SelectClicked(GetSortedItems, card, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,13 +271,16 @@
|
|||||||
|
|
||||||
private void SelectClicked(MediaCardViewModel card, MouseEventArgs e)
|
private void SelectClicked(MediaCardViewModel card, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
List<MediaCardViewModel> GetSortedItems() => _data.MovieCards.OrderBy(m => m.SortTitle)
|
List<MediaCardViewModel> GetSortedItems()
|
||||||
.Append<MediaCardViewModel>(_data.ShowCards.OrderBy(s => s.SortTitle))
|
{
|
||||||
.Append(_data.SeasonCards.OrderBy(s => s.SortTitle))
|
return _data.MovieCards.OrderBy(m => m.SortTitle)
|
||||||
.Append(_data.EpisodeCards.OrderBy(ep => ep.Aired))
|
.Append<MediaCardViewModel>(_data.ShowCards.OrderBy(s => s.SortTitle))
|
||||||
.Append(_data.ArtistCards.OrderBy(a => a.SortTitle))
|
.Append(_data.SeasonCards.OrderBy(s => s.SortTitle))
|
||||||
.Append(_data.MusicVideoCards.OrderBy(mv => mv.SortTitle))
|
.Append(_data.EpisodeCards.OrderBy(ep => ep.Aired))
|
||||||
.ToList();
|
.Append(_data.ArtistCards.OrderBy(a => a.SortTitle))
|
||||||
|
.Append(_data.MusicVideoCards.OrderBy(mv => mv.SortTitle))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
SelectClicked(GetSortedItems, card, e);
|
SelectClicked(GetSortedItems, card, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
{
|
{
|
||||||
<MudLink Class="ml-4" Href="@(NavigationManager.Uri.Split("#").Head() + "#shows")" Style="margin-bottom: auto; margin-top: auto">@_shows.Count Shows</MudLink>
|
<MudLink Class="ml-4" Href="@(NavigationManager.Uri.Split("#").Head() + "#shows")" Style="margin-bottom: auto; margin-top: auto">@_shows.Count Shows</MudLink>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_artists.Count > 0)
|
if (_artists.Count > 0)
|
||||||
{
|
{
|
||||||
<MudLink Class="ml-4" Href="@(NavigationManager.Uri.Split("#").Head() + "#artists")" Style="margin-bottom: auto; margin-top: auto">@_artists.Count Artists</MudLink>
|
<MudLink Class="ml-4" Href="@(NavigationManager.Uri.Split("#").Head() + "#artists")" Style="margin-bottom: auto; margin-top: auto">@_artists.Count Artists</MudLink>
|
||||||
@@ -256,7 +256,7 @@
|
|||||||
Right: _ => Snackbar.Add($"Added {show.Title} to collection {collection.Name}", Severity.Success));
|
Right: _ => Snackbar.Add($"Added {show.Title} to collection {collection.Name}", Severity.Success));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card is ArtistCardViewModel artist)
|
if (card is ArtistCardViewModel artist)
|
||||||
{
|
{
|
||||||
var parameters = new DialogParameters { { "EntityType", "artist" }, { "EntityName", artist.Title } };
|
var parameters = new DialogParameters { { "EntityType", "artist" }, { "EntityName", artist.Title } };
|
||||||
@@ -319,7 +319,7 @@
|
|||||||
}
|
}
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetArtistsLink()
|
private string GetArtistsLink()
|
||||||
{
|
{
|
||||||
var uri = "/media/music/artists/page/1";
|
var uri = "/media/music/artists/page/1";
|
||||||
|
|||||||
Reference in New Issue
Block a user