Fixed: Don't die on movie refresh when collection has been deleted from TMDB

Fixes #8664
pull/8666/head
Qstick 1 year ago
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 @@ namespace NzbDrone.Core.Movies.Collections
}
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 @@ namespace NzbDrone.Core.Movies.Collections
{
_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 @@ namespace NzbDrone.Core.Movies.Collections
var collection = FindByTmdbId(collectionTmdbId);
if (collection == null)
{
continue;
}
_repo.Delete(collection.Id);
_eventAggregator.PublishEvent(new CollectionDeletedEvent(collection));

@ -144,8 +144,11 @@ namespace NzbDrone.Core.Movies
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…
Cancel
Save