diff --git a/CHANGELOG.md b/CHANGELOG.md index b9c8a07b..b6c90da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Classify HDHR endpoints as streaming endpoints - This allows these endpoints to be accessed through port `ETV_STREAMING_PORT` (default `8409`) - This only matters if you configured `ETV_UI_PORT` to be a different value, which makes UI endpoints inaccessible on the streaming port +- Update Plex movie/other video plot ("summary") during library deep scan ## [25.2.0] - 2025-06-24 ### Added diff --git a/ErsatzTV.Core/Interfaces/Repositories/IMetadataRepository.cs b/ErsatzTV.Core/Interfaces/Repositories/IMetadataRepository.cs index f7ec371f..fadfb849 100644 --- a/ErsatzTV.Core/Interfaces/Repositories/IMetadataRepository.cs +++ b/ErsatzTV.Core/Interfaces/Repositories/IMetadataRepository.cs @@ -36,6 +36,8 @@ public interface IMetadataRepository Task MarkAsExternal(OtherVideoMetadata metadata); Task SetContentRating(MovieMetadata metadata, string contentRating); Task SetContentRating(OtherVideoMetadata metadata, string contentRating); + Task SetPlot(MovieMetadata metadata, string plot); + Task SetPlot(OtherVideoMetadata metadata, string plot); [SuppressMessage("Naming", "CA1720:Identifier contains type name")] Task RemoveGuid(MetadataGuid guid); diff --git a/ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs b/ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs index 8dbc9a6d..268a88fb 100644 --- a/ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs +++ b/ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs @@ -456,6 +456,21 @@ public class MetadataRepository : IMetadataRepository new { metadata.Id, ContentRating = contentRating }).ToUnit(); } + public async Task SetPlot(MovieMetadata metadata, string plot) + { + await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(); + return await dbContext.Connection.ExecuteAsync( + @"UPDATE MovieMetadata SET Plot = @Plot WHERE Id = @Id", + new { metadata.Id, Plot = plot }).ToUnit(); } + + public async Task SetPlot(OtherVideoMetadata metadata, string plot) + { + await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(); + return await dbContext.Connection.ExecuteAsync( + @"UPDATE OtherVideoMetadata SET Plot = @Plot WHERE Id = @Id", + new { metadata.Id, Plot = plot }).ToUnit(); + } + public async Task RemoveGuid(MetadataGuid guid) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(); diff --git a/ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs b/ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs index a9dcc049..3585c6a9 100644 --- a/ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs @@ -174,6 +174,13 @@ public class PlexMovieLibraryScanner : result.IsUpdated = true; } + if (existingMetadata.Plot != fullMetadata.Plot) + { + existingMetadata.Plot = fullMetadata.Plot; + await _metadataRepository.SetPlot(existingMetadata, fullMetadata.Plot); + result.IsUpdated = true; + } + foreach (Genre genre in existingMetadata.Genres .Filter(g => fullMetadata.Genres.All(g2 => g2.Name != g.Name)) .ToList()) diff --git a/ErsatzTV.Scanner/Core/Plex/PlexOtherVideoLibraryScanner.cs b/ErsatzTV.Scanner/Core/Plex/PlexOtherVideoLibraryScanner.cs index 418d143f..07fc6c3f 100644 --- a/ErsatzTV.Scanner/Core/Plex/PlexOtherVideoLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Plex/PlexOtherVideoLibraryScanner.cs @@ -177,6 +177,13 @@ public class PlexOtherVideoLibraryScanner : result.IsUpdated = true; } + if (existingMetadata.Plot != fullMetadata.Plot) + { + existingMetadata.Plot = fullMetadata.Plot; + await _metadataRepository.SetPlot(existingMetadata, fullMetadata.Plot); + result.IsUpdated = true; + } + foreach (Genre genre in existingMetadata.Genres .Filter(g => fullMetadata.Genres.All(g2 => g2.Name != g.Name)) .ToList())