fix plex actor artwork with newly added media items (#175)
This commit is contained in:
@@ -156,7 +156,7 @@ namespace ErsatzTV.Core.Plex
|
|||||||
PlexMovie existing = result.Item;
|
PlexMovie existing = result.Item;
|
||||||
MovieMetadata existingMetadata = existing.MovieMetadata.Head();
|
MovieMetadata existingMetadata = existing.MovieMetadata.Head();
|
||||||
|
|
||||||
if (incoming.MovieMetadata.Head().DateUpdated > existingMetadata.DateUpdated)
|
if (result.IsAdded || incoming.MovieMetadata.Head().DateUpdated > existingMetadata.DateUpdated)
|
||||||
{
|
{
|
||||||
_logger.LogDebug(
|
_logger.LogDebug(
|
||||||
"Refreshing {Attribute} from {Path}",
|
"Refreshing {Attribute} from {Path}",
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace ErsatzTV.Core.Plex
|
|||||||
PlexShow existing = result.Item;
|
PlexShow existing = result.Item;
|
||||||
ShowMetadata existingMetadata = existing.ShowMetadata.Head();
|
ShowMetadata existingMetadata = existing.ShowMetadata.Head();
|
||||||
|
|
||||||
if (incoming.ShowMetadata.Head().DateUpdated > existingMetadata.DateUpdated)
|
if (result.IsAdded || incoming.ShowMetadata.Head().DateUpdated > existingMetadata.DateUpdated)
|
||||||
{
|
{
|
||||||
Either<BaseError, ShowMetadata> maybeMetadata =
|
Either<BaseError, ShowMetadata> maybeMetadata =
|
||||||
await _plexServerApiClient.GetShowMetadata(
|
await _plexServerApiClient.GetShowMetadata(
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
.ThenInclude(mm => mm.Studios)
|
.ThenInclude(mm => mm.Studios)
|
||||||
.Include(i => i.MovieMetadata)
|
.Include(i => i.MovieMetadata)
|
||||||
.ThenInclude(mm => mm.Actors)
|
.ThenInclude(mm => mm.Actors)
|
||||||
|
.ThenInclude(a => a.Artwork)
|
||||||
.Include(i => i.LibraryPath)
|
.Include(i => i.LibraryPath)
|
||||||
.ThenInclude(lp => lp.Library)
|
.ThenInclude(lp => lp.Library)
|
||||||
.Include(i => i.MediaVersions)
|
.Include(i => i.MediaVersions)
|
||||||
@@ -98,6 +99,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
.ThenInclude(mm => mm.Studios)
|
.ThenInclude(mm => mm.Studios)
|
||||||
.Include(i => i.MovieMetadata)
|
.Include(i => i.MovieMetadata)
|
||||||
.ThenInclude(mm => mm.Actors)
|
.ThenInclude(mm => mm.Actors)
|
||||||
|
.ThenInclude(a => a.Artwork)
|
||||||
.Include(i => i.MovieMetadata)
|
.Include(i => i.MovieMetadata)
|
||||||
.ThenInclude(mm => mm.Artwork)
|
.ThenInclude(mm => mm.Artwork)
|
||||||
.Include(i => i.MediaVersions)
|
.Include(i => i.MediaVersions)
|
||||||
@@ -112,7 +114,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
return await maybeExisting.Match(
|
return await maybeExisting.Match(
|
||||||
plexMovie =>
|
plexMovie =>
|
||||||
Right<BaseError, MediaItemScanResult<PlexMovie>>(
|
Right<BaseError, MediaItemScanResult<PlexMovie>>(
|
||||||
new MediaItemScanResult<PlexMovie>(plexMovie) { IsAdded = true }).AsTask(),
|
new MediaItemScanResult<PlexMovie>(plexMovie) { IsAdded = false }).AsTask(),
|
||||||
async () => await AddPlexMovie(context, library, item));
|
async () => await AddPlexMovie(context, library, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
.ThenInclude(s => s.Show)
|
.ThenInclude(s => s.Show)
|
||||||
.ThenInclude(s => s.ShowMetadata)
|
.ThenInclude(s => s.ShowMetadata)
|
||||||
.ThenInclude(sm => sm.Actors)
|
.ThenInclude(sm => sm.Actors)
|
||||||
|
.ThenInclude(a => a.Artwork)
|
||||||
.OrderBy(em => em.Episode.EpisodeNumber)
|
.OrderBy(em => em.Episode.EpisodeNumber)
|
||||||
.Skip((pageNumber - 1) * pageSize)
|
.Skip((pageNumber - 1) * pageSize)
|
||||||
.Take(pageSize)
|
.Take(pageSize)
|
||||||
@@ -293,6 +294,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
.ThenInclude(em => em.Artwork)
|
.ThenInclude(em => em.Artwork)
|
||||||
.Include(i => i.EpisodeMetadata)
|
.Include(i => i.EpisodeMetadata)
|
||||||
.ThenInclude(em => em.Actors)
|
.ThenInclude(em => em.Actors)
|
||||||
|
.ThenInclude(a => a.Artwork)
|
||||||
.Include(i => i.MediaVersions)
|
.Include(i => i.MediaVersions)
|
||||||
.ThenInclude(mv => mv.MediaFiles)
|
.ThenInclude(mv => mv.MediaFiles)
|
||||||
.Include(i => i.MediaVersions)
|
.Include(i => i.MediaVersions)
|
||||||
@@ -393,6 +395,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
.ThenInclude(sm => sm.Studios)
|
.ThenInclude(sm => sm.Studios)
|
||||||
.Include(i => i.ShowMetadata)
|
.Include(i => i.ShowMetadata)
|
||||||
.ThenInclude(sm => sm.Actors)
|
.ThenInclude(sm => sm.Actors)
|
||||||
|
.ThenInclude(a => a.Artwork)
|
||||||
.Include(i => i.ShowMetadata)
|
.Include(i => i.ShowMetadata)
|
||||||
.ThenInclude(sm => sm.Artwork)
|
.ThenInclude(sm => sm.Artwork)
|
||||||
.Include(i => i.LibraryPath)
|
.Include(i => i.LibraryPath)
|
||||||
@@ -402,7 +405,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
|
|
||||||
return await maybeExisting.Match(
|
return await maybeExisting.Match(
|
||||||
plexShow => Right<BaseError, MediaItemScanResult<PlexShow>>(
|
plexShow => Right<BaseError, MediaItemScanResult<PlexShow>>(
|
||||||
new MediaItemScanResult<PlexShow>(plexShow) { IsAdded = true }).AsTask(),
|
new MediaItemScanResult<PlexShow>(plexShow) { IsAdded = false }).AsTask(),
|
||||||
async () => await AddPlexShow(dbContext, library, item));
|
async () => await AddPlexShow(dbContext, library, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,6 +437,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
.ThenInclude(mv => mv.Streams)
|
.ThenInclude(mv => mv.Streams)
|
||||||
.Include(e => e.EpisodeMetadata)
|
.Include(e => e.EpisodeMetadata)
|
||||||
.ThenInclude(em => em.Actors)
|
.ThenInclude(em => em.Actors)
|
||||||
|
.ThenInclude(a => a.Artwork)
|
||||||
.OrderBy(i => i.Key)
|
.OrderBy(i => i.Key)
|
||||||
.SingleOrDefaultAsync(i => i.Key == item.Key);
|
.SingleOrDefaultAsync(i => i.Key == item.Key);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user