diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index b3765847..a1238895 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -1,7 +1,6 @@ name: Qodana on: workflow_dispatch: - pull_request: push: branches: - main diff --git a/CHANGELOG.md b/CHANGELOG.md index 170e5faf..9f808e9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Add basic cache busting to XMLTV image URLs - This should help with clients not showing correct channel logos or posters +- Fix artwork in other video libraries by @raknam ### Changed - Remove some unnecessary API calls related to media server scanning and paging diff --git a/ErsatzTV.Application/MediaCards/Mapper.cs b/ErsatzTV.Application/MediaCards/Mapper.cs index 7f00a354..f79c2e50 100644 --- a/ErsatzTV.Application/MediaCards/Mapper.cs +++ b/ErsatzTV.Application/MediaCards/Mapper.cs @@ -117,13 +117,22 @@ internal static class Mapper musicVideoMetadata.MusicVideo.GetHeadVersion().MediaFiles.Head().Path, localPath); - internal static OtherVideoCardViewModel ProjectToViewModel(OtherVideoMetadata otherVideoMetadata) => - new( + internal static OtherVideoCardViewModel ProjectToViewModel(OtherVideoMetadata otherVideoMetadata) + { + string poster = GetThumbnail(otherVideoMetadata, None, None); + if (string.IsNullOrWhiteSpace(poster)) + { + poster = GetPoster(otherVideoMetadata, None, None); + } + + return new OtherVideoCardViewModel( otherVideoMetadata.OtherVideoId, otherVideoMetadata.Title, otherVideoMetadata.OriginalTitle, otherVideoMetadata.SortTitle, + poster, otherVideoMetadata.OtherVideo.State); + } internal static SongCardViewModel ProjectToViewModel(SongMetadata songMetadata) { diff --git a/ErsatzTV.Application/MediaCards/OtherVideoCardViewModel.cs b/ErsatzTV.Application/MediaCards/OtherVideoCardViewModel.cs index 914fe118..eb2a34f6 100644 --- a/ErsatzTV.Application/MediaCards/OtherVideoCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/OtherVideoCardViewModel.cs @@ -7,12 +7,13 @@ public record OtherVideoCardViewModel( string Title, string Subtitle, string SortTitle, + string Poster, MediaItemState State) : MediaCardViewModel( OtherVideoId, Title, Subtitle, SortTitle, - null, + Poster, State) { public int CustomIndex { get; set; } diff --git a/ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs b/ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs index 21d9c2f1..8dbc9a6d 100644 --- a/ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs +++ b/ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs @@ -304,6 +304,11 @@ public class MetadataRepository : IMetadataRepository VALUES (@ArtworkKind, @Id, @DateAdded, @DateUpdated, @Path, @SourcePath, @BlurHash43, @BlurHash54, @BlurHash64)", parameters) .ToUnit(), + OtherVideoMetadata => await dbContext.Connection.ExecuteAsync( + @"INSERT INTO Artwork (ArtworkKind, OtherVideoMetadataId, DateAdded, DateUpdated, Path, SourcePath, BlurHash43, BlurHash54, BlurHash64) + VALUES (@ArtworkKind, @Id, @DateAdded, @DateUpdated, @Path, @SourcePath, @BlurHash43, @BlurHash54, @BlurHash64)", + parameters) + .ToUnit(), _ => Unit.Default }; } @@ -313,7 +318,7 @@ public class MetadataRepository : IMetadataRepository await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(); return await dbContext.Connection.ExecuteAsync( @"DELETE FROM Artwork WHERE ArtworkKind = @ArtworkKind AND (MovieMetadataId = @Id - OR ShowMetadataId = @Id OR SeasonMetadataId = @Id OR EpisodeMetadataId = @Id)", + OR ShowMetadataId = @Id OR SeasonMetadataId = @Id OR EpisodeMetadataId = @Id OR OtherVideoMetadataId = @Id)", new { ArtworkKind = artworkKind, metadata.Id }).ToUnit(); }