mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02: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
@ -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,8 +144,11 @@ private Movie RefreshMovieInfo(int movieId)
|
||||
RootFolderPath = _folderService.GetBestRootFolderPath(movie.Path).TrimEnd('/', '\\', ' ')
|
||||
});
|
||||
|
||||
movieMetadata.CollectionTmdbId = newCollection.TmdbId;
|
||||
movieMetadata.CollectionTitle = newCollection.Title;
|
||||
if (newCollection != null)
|
||||
{
|
||||
movieMetadata.CollectionTmdbId = newCollection.TmdbId;
|
||||
movieMetadata.CollectionTitle = newCollection.Title;
|
||||
}
|
||||
}
|
||||
|
||||
movieMetadata.AlternativeTitles = _titleService.UpdateTitles(movieInfo.AlternativeTitles, movieMetadata);
|
||||
|
Loading…
Reference in New Issue
Block a user