mirror of https://github.com/Radarr/Radarr
Fixed: Generating Kodi movie file metadata files when scanning folder
Co-Authored-By: Taloth <Taloth@users.noreply.github.com>
This commit is contained in:
parent
17b93bcc57
commit
95a30b50fa
|
@ -23,6 +23,7 @@ namespace NzbDrone.Core.Extras
|
|||
public class ExtraService : IExtraService,
|
||||
IHandle<MediaCoversUpdatedEvent>,
|
||||
IHandle<MovieFolderCreatedEvent>,
|
||||
IHandle<MovieScannedEvent>,
|
||||
IHandle<MovieRenamedEvent>
|
||||
{
|
||||
private readonly IMediaFileService _mediaFileService;
|
||||
|
@ -51,7 +52,7 @@ namespace NzbDrone.Core.Extras
|
|||
{
|
||||
ImportExtraFiles(localMovie, movieFile, isReadOnly);
|
||||
|
||||
CreateAfterImport(localMovie.Movie, movieFile);
|
||||
CreateAfterMovieImport(localMovie.Movie, movieFile);
|
||||
}
|
||||
|
||||
public void ImportExtraFiles(LocalMovie localMovie, MovieFile movieFile, bool isReadOnly)
|
||||
|
@ -119,7 +120,7 @@ namespace NzbDrone.Core.Extras
|
|||
}
|
||||
}
|
||||
|
||||
private void CreateAfterImport(Movie movie, MovieFile movieFile)
|
||||
private void CreateAfterMovieImport(Movie movie, MovieFile movieFile)
|
||||
{
|
||||
foreach (var extraFileManager in _extraFileManagers)
|
||||
{
|
||||
|
@ -128,6 +129,19 @@ namespace NzbDrone.Core.Extras
|
|||
}
|
||||
|
||||
public void Handle(MediaCoversUpdatedEvent message)
|
||||
{
|
||||
if (message.Updated)
|
||||
{
|
||||
var movie = message.Movie;
|
||||
|
||||
foreach (var extraFileManager in _extraFileManagers)
|
||||
{
|
||||
extraFileManager.CreateAfterMediaCoverUpdate(movie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(MovieScannedEvent message)
|
||||
{
|
||||
var movie = message.Movie;
|
||||
var movieFiles = GetMovieFiles(movie.Id);
|
||||
|
@ -144,7 +158,7 @@ namespace NzbDrone.Core.Extras
|
|||
|
||||
foreach (var extraFileManager in _extraFileManagers)
|
||||
{
|
||||
extraFileManager.CreateAfterMovieImport(movie, message.MovieFolder);
|
||||
extraFileManager.CreateAfterMovieFolder(movie, message.MovieFolder);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,10 @@ namespace NzbDrone.Core.Extras.Files
|
|||
public interface IManageExtraFiles
|
||||
{
|
||||
int Order { get; }
|
||||
IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Movie movie);
|
||||
IEnumerable<ExtraFile> CreateAfterMovieScan(Movie movie, List<MovieFile> movieFiles);
|
||||
IEnumerable<ExtraFile> CreateAfterMovieImport(Movie movie, MovieFile movieFile);
|
||||
IEnumerable<ExtraFile> CreateAfterMovieImport(Movie movie, string movieFolder);
|
||||
IEnumerable<ExtraFile> CreateAfterMovieFolder(Movie movie, string movieFolder);
|
||||
IEnumerable<ExtraFile> MoveFilesAfterRename(Movie movie, List<MovieFile> movieFiles);
|
||||
ExtraFile Import(Movie movie, MovieFile movieFile, string path, string extension, bool readOnly);
|
||||
}
|
||||
|
@ -41,9 +42,10 @@ namespace NzbDrone.Core.Extras.Files
|
|||
}
|
||||
|
||||
public abstract int Order { get; }
|
||||
public abstract IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Movie movie);
|
||||
public abstract IEnumerable<ExtraFile> CreateAfterMovieScan(Movie movie, List<MovieFile> movieFiles);
|
||||
public abstract IEnumerable<ExtraFile> CreateAfterMovieImport(Movie movie, MovieFile movieFile);
|
||||
public abstract IEnumerable<ExtraFile> CreateAfterMovieImport(Movie movie, string movieFolder);
|
||||
public abstract IEnumerable<ExtraFile> CreateAfterMovieFolder(Movie movie, string movieFolder);
|
||||
public abstract IEnumerable<ExtraFile> MoveFilesAfterRename(Movie movie, List<MovieFile> movieFiles);
|
||||
public abstract ExtraFile Import(Movie movie, MovieFile movieFile, string path, string extension, bool readOnly);
|
||||
|
||||
|
|
|
@ -56,6 +56,31 @@ namespace NzbDrone.Core.Extras.Metadata
|
|||
|
||||
public override int Order => 0;
|
||||
|
||||
public override IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Movie movie)
|
||||
{
|
||||
var metadataFiles = _metadataFileService.GetFilesByMovie(movie.Id);
|
||||
_cleanMetadataService.Clean(movie);
|
||||
|
||||
if (!_diskProvider.FolderExists(movie.Path))
|
||||
{
|
||||
_logger.Info("Movie folder does not exist, skipping metadata image creation");
|
||||
return Enumerable.Empty<MetadataFile>();
|
||||
}
|
||||
|
||||
var files = new List<MetadataFile>();
|
||||
|
||||
foreach (var consumer in _metadataFactory.Enabled())
|
||||
{
|
||||
var consumerFiles = GetMetadataFilesForConsumer(consumer, metadataFiles);
|
||||
|
||||
files.AddRange(ProcessMovieImages(consumer, movie, consumerFiles));
|
||||
}
|
||||
|
||||
_metadataFileService.Upsert(files);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
public override IEnumerable<ExtraFile> CreateAfterMovieScan(Movie movie, List<MovieFile> movieFiles)
|
||||
{
|
||||
var metadataFiles = _metadataFileService.GetFilesByMovie(movie.Id);
|
||||
|
@ -100,7 +125,7 @@ namespace NzbDrone.Core.Extras.Metadata
|
|||
return files;
|
||||
}
|
||||
|
||||
public override IEnumerable<ExtraFile> CreateAfterMovieImport(Movie movie, string movieFolder)
|
||||
public override IEnumerable<ExtraFile> CreateAfterMovieFolder(Movie movie, string movieFolder)
|
||||
{
|
||||
var metadataFiles = _metadataFileService.GetFilesByMovie(movie.Id);
|
||||
|
||||
|
|
|
@ -29,6 +29,11 @@ namespace NzbDrone.Core.Extras.Others
|
|||
|
||||
public override int Order => 2;
|
||||
|
||||
public override IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Movie movie)
|
||||
{
|
||||
return Enumerable.Empty<ExtraFile>();
|
||||
}
|
||||
|
||||
public override IEnumerable<ExtraFile> CreateAfterMovieScan(Movie movie, List<MovieFile> movieFiles)
|
||||
{
|
||||
return Enumerable.Empty<ExtraFile>();
|
||||
|
@ -39,7 +44,7 @@ namespace NzbDrone.Core.Extras.Others
|
|||
return Enumerable.Empty<ExtraFile>();
|
||||
}
|
||||
|
||||
public override IEnumerable<ExtraFile> CreateAfterMovieImport(Movie movie, string movieFolder)
|
||||
public override IEnumerable<ExtraFile> CreateAfterMovieFolder(Movie movie, string movieFolder)
|
||||
{
|
||||
return Enumerable.Empty<ExtraFile>();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,11 @@ namespace NzbDrone.Core.Extras.Subtitles
|
|||
|
||||
public override int Order => 1;
|
||||
|
||||
public override IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Movie movie)
|
||||
{
|
||||
return Enumerable.Empty<SubtitleFile>();
|
||||
}
|
||||
|
||||
public override IEnumerable<ExtraFile> CreateAfterMovieScan(Movie movie, List<MovieFile> movieFiles)
|
||||
{
|
||||
return Enumerable.Empty<SubtitleFile>();
|
||||
|
@ -45,7 +50,7 @@ namespace NzbDrone.Core.Extras.Subtitles
|
|||
return Enumerable.Empty<SubtitleFile>();
|
||||
}
|
||||
|
||||
public override IEnumerable<ExtraFile> CreateAfterMovieImport(Movie movie, string movieFolder)
|
||||
public override IEnumerable<ExtraFile> CreateAfterMovieFolder(Movie movie, string movieFolder)
|
||||
{
|
||||
return Enumerable.Empty<SubtitleFile>();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue