mirror of
https://github.com/Radarr/Radarr
synced 2025-02-24 07:10:57 +00:00
Fixed: Don't die on movie refresh when collection has been deleted from TMDB
Fixes #8664
This commit is contained in:
parent
d5cc84d8c8
commit
3542b263c7
3 changed files with 17 additions and 9 deletions
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
|
@ -42,6 +39,12 @@ public MovieCollection AddMovieCollection(MovieCollection newCollection)
|
|||
}
|
||||
|
||||
newCollection = AddSkyhookData(newCollection);
|
||||
|
||||
if (newCollection == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
newCollection = SetPropertiesAndValidate(newCollection);
|
||||
|
||||
_logger.Info("Adding Collection {0}[{1}]", newCollection.Title, newCollection.TmdbId);
|
||||
|
@ -63,10 +66,7 @@ private MovieCollection AddSkyhookData(MovieCollection newCollection)
|
|||
{
|
||||
_logger.Error("TmdbId {0} was not found, it may have been removed from TMDb.", newCollection.TmdbId);
|
||||
|
||||
throw new ValidationException(new List<ValidationFailure>
|
||||
{
|
||||
new ValidationFailure("TmdbId", $"A collection with this ID was not found.", newCollection.TmdbId)
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
collection.ApplyChanges(newCollection);
|
||||
|
|
|
@ -122,6 +122,11 @@ public void HandleAsync(MoviesDeletedEvent message)
|
|||
|
||||
var collection = FindByTmdbId(collectionTmdbId);
|
||||
|
||||
if (collection == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_repo.Delete(collection.Id);
|
||||
|
||||
_eventAggregator.PublishEvent(new CollectionDeletedEvent(collection));
|
||||
|
|
|
@ -144,9 +144,12 @@ private Movie RefreshMovieInfo(int movieId)
|
|||
RootFolderPath = _folderService.GetBestRootFolderPath(movie.Path).TrimEnd('/', '\\', ' ')
|
||||
});
|
||||
|
||||
if (newCollection != null)
|
||||
{
|
||||
movieMetadata.CollectionTmdbId = newCollection.TmdbId;
|
||||
movieMetadata.CollectionTitle = newCollection.Title;
|
||||
}
|
||||
}
|
||||
|
||||
movieMetadata.AlternativeTitles = _titleService.UpdateTitles(movieInfo.AlternativeTitles, movieMetadata);
|
||||
_movieTranslationService.UpdateTranslations(movieInfo.Translations, movieMetadata);
|
||||
|
|
Loading…
Reference in a new issue