fix odd resolution padding; fix updating plex episode artwork (#173)

* fix padding odd resolutions

* fix updating plex episode artwork only as needed
This commit is contained in:
Jason Dove
2021-04-17 10:08:20 -05:00
committed by GitHub
parent d8d21996b4
commit 7c07c5f522
5 changed files with 7 additions and 4 deletions
@@ -4,9 +4,6 @@ namespace ErsatzTV.Core.FFmpeg
{ {
public static class DisplaySizeExtensions public static class DisplaySizeExtensions
{ {
internal static IDisplaySize PadToEven(this IDisplaySize size) =>
new DisplaySize(size.Width + size.Width % 2, size.Height + size.Height % 2);
internal static bool IsSameSizeAs(this IDisplaySize @this, IDisplaySize that) => internal static bool IsSameSizeAs(this IDisplaySize @this, IDisplaySize that) =>
@this.Width == that.Width && @this.Height == that.Height; @this.Width == that.Width && @this.Height == that.Height;
} }
@@ -60,7 +60,6 @@ namespace ErsatzTV.Core.FFmpeg
builder = builder.WithDeinterlace(playbackSettings.Deinterlace) builder = builder.WithDeinterlace(playbackSettings.Deinterlace)
.WithScaling(scaledSize); .WithScaling(scaledSize);
scaledSize = scaledSize.PadToEven();
if (NeedToPad(channel.FFmpegProfile.Resolution, scaledSize)) if (NeedToPad(channel.FFmpegProfile.Resolution, scaledSize))
{ {
builder = builder.WithBlackBars(channel.FFmpegProfile.Resolution); builder = builder.WithBlackBars(channel.FFmpegProfile.Resolution);
@@ -23,5 +23,6 @@ namespace ErsatzTV.Core.Interfaces.Repositories
Task<Unit> MarkAsUpdated(ShowMetadata metadata, DateTime dateUpdated); Task<Unit> MarkAsUpdated(ShowMetadata metadata, DateTime dateUpdated);
Task<Unit> MarkAsUpdated(SeasonMetadata metadata, DateTime dateUpdated); Task<Unit> MarkAsUpdated(SeasonMetadata metadata, DateTime dateUpdated);
Task<Unit> MarkAsUpdated(MovieMetadata metadata, DateTime dateUpdated); Task<Unit> MarkAsUpdated(MovieMetadata metadata, DateTime dateUpdated);
Task<Unit> MarkAsUpdated(EpisodeMetadata metadata, DateTime dateUpdated);
} }
} }
@@ -382,6 +382,7 @@ namespace ErsatzTV.Core.Plex
if (incomingMetadata.DateUpdated > existingMetadata.DateUpdated) if (incomingMetadata.DateUpdated > existingMetadata.DateUpdated)
{ {
await UpdateArtworkIfNeeded(existingMetadata, incomingMetadata, ArtworkKind.Thumbnail); await UpdateArtworkIfNeeded(existingMetadata, incomingMetadata, ArtworkKind.Thumbnail);
await _metadataRepository.MarkAsUpdated(existingMetadata, incomingMetadata.DateUpdated);
} }
return existing; return existing;
@@ -222,6 +222,11 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
_dbConnection.ExecuteAsync( _dbConnection.ExecuteAsync(
@"UPDATE MovieMetadata SET DateUpdated = @DateUpdated WHERE Id = @Id", @"UPDATE MovieMetadata SET DateUpdated = @DateUpdated WHERE Id = @Id",
new { DateUpdated = dateUpdated, metadata.Id }).ToUnit(); new { DateUpdated = dateUpdated, metadata.Id }).ToUnit();
public Task<Unit> MarkAsUpdated(EpisodeMetadata metadata, DateTime dateUpdated) =>
_dbConnection.ExecuteAsync(
@"UPDATE EpisodeMetadata SET DateUpdated = @DateUpdated WHERE Id = @Id",
new { DateUpdated = dateUpdated, metadata.Id }).ToUnit();
public Task<bool> RemoveGenre(Genre genre) => public Task<bool> RemoveGenre(Genre genre) =>
_dbConnection.ExecuteAsync("DELETE FROM Genre WHERE Id = @GenreId", new { GenreId = genre.Id }) _dbConnection.ExecuteAsync("DELETE FROM Genre WHERE Id = @GenreId", new { GenreId = genre.Id })