Browse Source

update plex plot during deep scan (#2105)

pull/2108/head
Jason Dove 1 month ago committed by GitHub
parent
commit
a42234a7c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 2
      ErsatzTV.Core/Interfaces/Repositories/IMetadataRepository.cs
  3. 15
      ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs
  4. 7
      ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs
  5. 7
      ErsatzTV.Scanner/Core/Plex/PlexOtherVideoLibraryScanner.cs

1
CHANGELOG.md

@ -86,6 +86,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -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

2
ErsatzTV.Core/Interfaces/Repositories/IMetadataRepository.cs

@ -36,6 +36,8 @@ public interface IMetadataRepository @@ -36,6 +36,8 @@ public interface IMetadataRepository
Task<Unit> MarkAsExternal(OtherVideoMetadata metadata);
Task<Unit> SetContentRating(MovieMetadata metadata, string contentRating);
Task<Unit> SetContentRating(OtherVideoMetadata metadata, string contentRating);
Task<Unit> SetPlot(MovieMetadata metadata, string plot);
Task<Unit> SetPlot(OtherVideoMetadata metadata, string plot);
[SuppressMessage("Naming", "CA1720:Identifier contains type name")]
Task<bool> RemoveGuid(MetadataGuid guid);

15
ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs

@ -456,6 +456,21 @@ public class MetadataRepository : IMetadataRepository @@ -456,6 +456,21 @@ public class MetadataRepository : IMetadataRepository
new { metadata.Id, ContentRating = contentRating }).ToUnit();
}
public async Task<Unit> 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<Unit> 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<bool> RemoveGuid(MetadataGuid guid)
{
await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync();

7
ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs

@ -174,6 +174,13 @@ public class PlexMovieLibraryScanner : @@ -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())

7
ErsatzTV.Scanner/Core/Plex/PlexOtherVideoLibraryScanner.cs

@ -177,6 +177,13 @@ public class PlexOtherVideoLibraryScanner : @@ -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())

Loading…
Cancel
Save