fix statistic updates (#399)
This commit is contained in:
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
### Fixed
|
||||
- Add downsampling to support transcoding 10-bit HEVC content with the h264_vaapi encoder
|
||||
- Fix updating statistics when media items are replaced
|
||||
|
||||
## [0.0.62-alpha] - 2021-10-05
|
||||
### Added
|
||||
|
||||
@@ -96,6 +96,8 @@ namespace ErsatzTV.Core.Emby
|
||||
|
||||
foreach (EmbyMovie incoming in validMovies)
|
||||
{
|
||||
EmbyMovie incomingMovie = incoming;
|
||||
|
||||
decimal percentCompletion = (decimal) validMovies.IndexOf(incoming) / validMovies.Count;
|
||||
await _mediator.Publish(new LibraryScanProgress(library.Id, percentCompletion));
|
||||
|
||||
@@ -122,12 +124,14 @@ namespace ErsatzTV.Core.Emby
|
||||
|
||||
updateStatistics = true;
|
||||
incoming.LibraryPathId = library.Paths.Head().Id;
|
||||
Option<EmbyMovie> updated = await _movieRepository.UpdateEmby(incoming);
|
||||
if (updated.IsSome)
|
||||
Option<EmbyMovie> maybeUpdated = await _movieRepository.UpdateEmby(incoming);
|
||||
foreach (EmbyMovie updated in maybeUpdated)
|
||||
{
|
||||
await _searchIndex.UpdateItems(
|
||||
_searchRepository,
|
||||
new List<MediaItem> { updated.ValueUnsafe() });
|
||||
new List<MediaItem> { updated });
|
||||
|
||||
incomingMovie = updated;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -174,12 +178,12 @@ namespace ErsatzTV.Core.Emby
|
||||
|
||||
_logger.LogDebug("Refreshing {Attribute} for {Path}", "Statistics", localPath);
|
||||
Either<BaseError, bool> refreshResult =
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incoming, localPath);
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incomingMovie, localPath);
|
||||
|
||||
await refreshResult.Match(
|
||||
async _ =>
|
||||
{
|
||||
Option<MediaItem> updated = await _searchRepository.GetItemToIndex(incoming.Id);
|
||||
Option<MediaItem> updated = await _searchRepository.GetItemToIndex(incomingMovie.Id);
|
||||
if (updated.IsSome)
|
||||
{
|
||||
await _searchIndex.UpdateItems(
|
||||
|
||||
@@ -326,6 +326,7 @@ namespace ErsatzTV.Core.Emby
|
||||
{
|
||||
foreach (EmbyEpisode incoming in episodes)
|
||||
{
|
||||
EmbyEpisode incomingEpisode = incoming;
|
||||
var updateStatistics = false;
|
||||
|
||||
Option<EmbyItemEtag> maybeExisting = existingEpisodes.Find(ie => ie.ItemId == incoming.ItemId);
|
||||
@@ -349,12 +350,14 @@ namespace ErsatzTV.Core.Emby
|
||||
incoming.SeasonId = season.Id;
|
||||
incoming.LibraryPathId = library.Paths.Head().Id;
|
||||
|
||||
Option<EmbyEpisode> updated = await _televisionRepository.Update(incoming);
|
||||
if (updated.IsSome)
|
||||
Option<EmbyEpisode> maybeUpdated = await _televisionRepository.Update(incoming);
|
||||
foreach (EmbyEpisode updated in maybeUpdated)
|
||||
{
|
||||
await _searchIndex.UpdateItems(
|
||||
_searchRepository,
|
||||
new List<MediaItem> { updated.ValueUnsafe() });
|
||||
new List<MediaItem> { updated });
|
||||
|
||||
incomingEpisode = updated;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -403,7 +406,7 @@ namespace ErsatzTV.Core.Emby
|
||||
|
||||
_logger.LogDebug("Refreshing {Attribute} for {Path}", "Statistics", localPath);
|
||||
Either<BaseError, bool> refreshResult =
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incoming, localPath);
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incomingEpisode, localPath);
|
||||
|
||||
refreshResult.Match(
|
||||
_ => { },
|
||||
|
||||
@@ -96,6 +96,8 @@ namespace ErsatzTV.Core.Jellyfin
|
||||
|
||||
foreach (JellyfinMovie incoming in validMovies)
|
||||
{
|
||||
JellyfinMovie incomingMovie = incoming;
|
||||
|
||||
decimal percentCompletion = (decimal) validMovies.IndexOf(incoming) / validMovies.Count;
|
||||
await _mediator.Publish(new LibraryScanProgress(library.Id, percentCompletion));
|
||||
|
||||
@@ -122,12 +124,14 @@ namespace ErsatzTV.Core.Jellyfin
|
||||
|
||||
updateStatistics = true;
|
||||
incoming.LibraryPathId = library.Paths.Head().Id;
|
||||
Option<JellyfinMovie> updated = await _movieRepository.UpdateJellyfin(incoming);
|
||||
if (updated.IsSome)
|
||||
Option<JellyfinMovie> maybeUpdated = await _movieRepository.UpdateJellyfin(incoming);
|
||||
foreach (JellyfinMovie updated in maybeUpdated)
|
||||
{
|
||||
await _searchIndex.UpdateItems(
|
||||
_searchRepository,
|
||||
new List<MediaItem> { updated.ValueUnsafe() });
|
||||
new List<MediaItem> { updated });
|
||||
|
||||
incomingMovie = updated;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -174,12 +178,12 @@ namespace ErsatzTV.Core.Jellyfin
|
||||
|
||||
_logger.LogDebug("Refreshing {Attribute} for {Path}", "Statistics", localPath);
|
||||
Either<BaseError, bool> refreshResult =
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incoming, localPath);
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incomingMovie, localPath);
|
||||
|
||||
await refreshResult.Match(
|
||||
async _ =>
|
||||
{
|
||||
Option<MediaItem> updated = await _searchRepository.GetItemToIndex(incoming.Id);
|
||||
Option<MediaItem> updated = await _searchRepository.GetItemToIndex(incomingMovie.Id);
|
||||
if (updated.IsSome)
|
||||
{
|
||||
await _searchIndex.UpdateItems(
|
||||
|
||||
@@ -327,6 +327,8 @@ namespace ErsatzTV.Core.Jellyfin
|
||||
{
|
||||
foreach (JellyfinEpisode incoming in episodes)
|
||||
{
|
||||
JellyfinEpisode incomingEpisode = incoming;
|
||||
|
||||
var updateStatistics = false;
|
||||
|
||||
Option<JellyfinItemEtag> maybeExisting = existingEpisodes.Find(ie => ie.ItemId == incoming.ItemId);
|
||||
@@ -350,12 +352,14 @@ namespace ErsatzTV.Core.Jellyfin
|
||||
incoming.SeasonId = season.Id;
|
||||
incoming.LibraryPathId = library.Paths.Head().Id;
|
||||
|
||||
Option<JellyfinEpisode> updated = await _televisionRepository.Update(incoming);
|
||||
if (updated.IsSome)
|
||||
Option<JellyfinEpisode> maybeUpdated = await _televisionRepository.Update(incoming);
|
||||
foreach (JellyfinEpisode updated in maybeUpdated)
|
||||
{
|
||||
await _searchIndex.UpdateItems(
|
||||
_searchRepository,
|
||||
new List<MediaItem> { updated.ValueUnsafe() });
|
||||
new List<MediaItem> { updated });
|
||||
|
||||
incomingEpisode = updated;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -404,7 +408,7 @@ namespace ErsatzTV.Core.Jellyfin
|
||||
|
||||
_logger.LogDebug("Refreshing {Attribute} for {Path}", "Statistics", localPath);
|
||||
Either<BaseError, bool> refreshResult =
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incoming, localPath);
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incomingEpisode, localPath);
|
||||
|
||||
refreshResult.Match(
|
||||
_ => { },
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace ErsatzTV.Core.Plex
|
||||
|
||||
_logger.LogDebug("Refreshing {Attribute} for {Path}", "Statistics", localPath);
|
||||
Either<BaseError, bool> refreshResult =
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incoming, localPath);
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, existing, localPath);
|
||||
|
||||
await refreshResult.Match(
|
||||
async _ =>
|
||||
|
||||
@@ -542,7 +542,7 @@ namespace ErsatzTV.Core.Plex
|
||||
|
||||
_logger.LogDebug("Refreshing {Attribute} for {Path}", "Statistics", localPath);
|
||||
Either<BaseError, bool> refreshResult =
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, incoming, localPath);
|
||||
await _localStatisticsProvider.RefreshStatistics(ffprobePath, existing, localPath);
|
||||
|
||||
await refreshResult.Match(
|
||||
async _ =>
|
||||
|
||||
Reference in New Issue
Block a user