mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-15 10:39:47 +02:00
Fixed: Generating Kodi episode metadata files when scanning series folder
This commit is contained in:
parent
b8e2f3d716
commit
23dc7794f1
@ -24,6 +24,7 @@ public interface IExtraService
|
|||||||
public class ExtraService : IExtraService,
|
public class ExtraService : IExtraService,
|
||||||
IHandle<MediaCoversUpdatedEvent>,
|
IHandle<MediaCoversUpdatedEvent>,
|
||||||
IHandle<EpisodeFolderCreatedEvent>,
|
IHandle<EpisodeFolderCreatedEvent>,
|
||||||
|
IHandle<SeriesScannedEvent>,
|
||||||
IHandle<SeriesRenamedEvent>
|
IHandle<SeriesRenamedEvent>
|
||||||
{
|
{
|
||||||
private readonly IMediaFileService _mediaFileService;
|
private readonly IMediaFileService _mediaFileService;
|
||||||
@ -52,7 +53,7 @@ public void ImportEpisode(LocalEpisode localEpisode, EpisodeFile episodeFile, bo
|
|||||||
{
|
{
|
||||||
ImportExtraFiles(localEpisode, episodeFile, isReadOnly);
|
ImportExtraFiles(localEpisode, episodeFile, isReadOnly);
|
||||||
|
|
||||||
CreateAfterImport(localEpisode.Series, episodeFile);
|
CreateAfterEpisodeImport(localEpisode.Series, episodeFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ImportExtraFiles(LocalEpisode localEpisode, EpisodeFile episodeFile, bool isReadOnly)
|
private void ImportExtraFiles(LocalEpisode localEpisode, EpisodeFile episodeFile, bool isReadOnly)
|
||||||
@ -121,7 +122,7 @@ private void ImportExtraFiles(LocalEpisode localEpisode, EpisodeFile episodeFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateAfterImport(Series series, EpisodeFile episodeFile)
|
private void CreateAfterEpisodeImport(Series series, EpisodeFile episodeFile)
|
||||||
{
|
{
|
||||||
foreach (var extraFileManager in _extraFileManagers)
|
foreach (var extraFileManager in _extraFileManagers)
|
||||||
{
|
{
|
||||||
@ -130,6 +131,19 @@ private void CreateAfterImport(Series series, EpisodeFile episodeFile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Handle(MediaCoversUpdatedEvent message)
|
public void Handle(MediaCoversUpdatedEvent message)
|
||||||
|
{
|
||||||
|
if (message.Updated)
|
||||||
|
{
|
||||||
|
var series = message.Series;
|
||||||
|
|
||||||
|
foreach (var extraFileManager in _extraFileManagers)
|
||||||
|
{
|
||||||
|
extraFileManager.CreateAfterMediaCoverUpdate(series);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Handle(SeriesScannedEvent message)
|
||||||
{
|
{
|
||||||
var series = message.Series;
|
var series = message.Series;
|
||||||
var episodeFiles = GetEpisodeFiles(series.Id);
|
var episodeFiles = GetEpisodeFiles(series.Id);
|
||||||
@ -146,7 +160,7 @@ public void Handle(EpisodeFolderCreatedEvent message)
|
|||||||
|
|
||||||
foreach (var extraFileManager in _extraFileManagers)
|
foreach (var extraFileManager in _extraFileManagers)
|
||||||
{
|
{
|
||||||
extraFileManager.CreateAfterEpisodeImport(series, message.SeriesFolder, message.SeasonFolder);
|
extraFileManager.CreateAfterEpisodeFolder(series, message.SeriesFolder, message.SeasonFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,9 +14,10 @@ namespace NzbDrone.Core.Extras.Files
|
|||||||
public interface IManageExtraFiles
|
public interface IManageExtraFiles
|
||||||
{
|
{
|
||||||
int Order { get; }
|
int Order { get; }
|
||||||
|
IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Series series);
|
||||||
IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles);
|
IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles);
|
||||||
IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, EpisodeFile episodeFile);
|
IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, EpisodeFile episodeFile);
|
||||||
IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, string seriesFolder, string seasonFolder);
|
IEnumerable<ExtraFile> CreateAfterEpisodeFolder(Series series, string seriesFolder, string seasonFolder);
|
||||||
IEnumerable<ExtraFile> MoveFilesAfterRename(Series series, List<EpisodeFile> episodeFiles);
|
IEnumerable<ExtraFile> MoveFilesAfterRename(Series series, List<EpisodeFile> episodeFiles);
|
||||||
ExtraFile Import(Series series, EpisodeFile episodeFile, string path, string extension, bool readOnly);
|
ExtraFile Import(Series series, EpisodeFile episodeFile, string path, string extension, bool readOnly);
|
||||||
}
|
}
|
||||||
@ -42,9 +43,10 @@ public ExtraFileManager(IConfigService configService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract int Order { get; }
|
public abstract int Order { get; }
|
||||||
|
public abstract IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Series series);
|
||||||
public abstract IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles);
|
public abstract IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles);
|
||||||
public abstract IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, EpisodeFile episodeFile);
|
public abstract IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, EpisodeFile episodeFile);
|
||||||
public abstract IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, string seriesFolder, string seasonFolder);
|
public abstract IEnumerable<ExtraFile> CreateAfterEpisodeFolder(Series series, string seriesFolder, string seasonFolder);
|
||||||
public abstract IEnumerable<ExtraFile> MoveFilesAfterRename(Series series, List<EpisodeFile> episodeFiles);
|
public abstract IEnumerable<ExtraFile> MoveFilesAfterRename(Series series, List<EpisodeFile> episodeFiles);
|
||||||
public abstract ExtraFile Import(Series series, EpisodeFile episodeFile, string path, string extension, bool readOnly);
|
public abstract ExtraFile Import(Series series, EpisodeFile episodeFile, string path, string extension, bool readOnly);
|
||||||
|
|
||||||
|
@ -56,6 +56,31 @@ public MetadataService(IConfigService configService,
|
|||||||
|
|
||||||
public override int Order => 0;
|
public override int Order => 0;
|
||||||
|
|
||||||
|
public override IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Series series)
|
||||||
|
{
|
||||||
|
var metadataFiles = _metadataFileService.GetFilesBySeries(series.Id);
|
||||||
|
_cleanMetadataService.Clean(series);
|
||||||
|
|
||||||
|
if (!_diskProvider.FolderExists(series.Path))
|
||||||
|
{
|
||||||
|
_logger.Info("Series 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(ProcessSeriesImages(consumer, series, consumerFiles));
|
||||||
|
}
|
||||||
|
|
||||||
|
_metadataFileService.Upsert(files);
|
||||||
|
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
public override IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles)
|
public override IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles)
|
||||||
{
|
{
|
||||||
var metadataFiles = _metadataFileService.GetFilesBySeries(series.Id);
|
var metadataFiles = _metadataFileService.GetFilesBySeries(series.Id);
|
||||||
@ -104,7 +129,7 @@ public override IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, E
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, string seriesFolder, string seasonFolder)
|
public override IEnumerable<ExtraFile> CreateAfterEpisodeFolder(Series series, string seriesFolder, string seasonFolder)
|
||||||
{
|
{
|
||||||
var metadataFiles = _metadataFileService.GetFilesBySeries(series.Id);
|
var metadataFiles = _metadataFileService.GetFilesBySeries(series.Id);
|
||||||
|
|
||||||
|
@ -31,6 +31,11 @@ public OtherExtraService(IConfigService configService,
|
|||||||
|
|
||||||
public override int Order => 2;
|
public override int Order => 2;
|
||||||
|
|
||||||
|
public override IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Series series)
|
||||||
|
{
|
||||||
|
return Enumerable.Empty<ExtraFile>();
|
||||||
|
}
|
||||||
|
|
||||||
public override IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles)
|
public override IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles)
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<ExtraFile>();
|
return Enumerable.Empty<ExtraFile>();
|
||||||
@ -41,7 +46,7 @@ public override IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, E
|
|||||||
return Enumerable.Empty<ExtraFile>();
|
return Enumerable.Empty<ExtraFile>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, string seriesFolder, string seasonFolder)
|
public override IEnumerable<ExtraFile> CreateAfterEpisodeFolder(Series series, string seriesFolder, string seasonFolder)
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<ExtraFile>();
|
return Enumerable.Empty<ExtraFile>();
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,11 @@ public SubtitleService(IConfigService configService,
|
|||||||
|
|
||||||
public override int Order => 1;
|
public override int Order => 1;
|
||||||
|
|
||||||
|
public override IEnumerable<ExtraFile> CreateAfterMediaCoverUpdate(Series series)
|
||||||
|
{
|
||||||
|
return Enumerable.Empty<SubtitleFile>();
|
||||||
|
}
|
||||||
|
|
||||||
public override IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles)
|
public override IEnumerable<ExtraFile> CreateAfterSeriesScan(Series series, List<EpisodeFile> episodeFiles)
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<SubtitleFile>();
|
return Enumerable.Empty<SubtitleFile>();
|
||||||
@ -45,7 +50,7 @@ public override IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, E
|
|||||||
return Enumerable.Empty<SubtitleFile>();
|
return Enumerable.Empty<SubtitleFile>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<ExtraFile> CreateAfterEpisodeImport(Series series, string seriesFolder, string seasonFolder)
|
public override IEnumerable<ExtraFile> CreateAfterEpisodeFolder(Series series, string seriesFolder, string seasonFolder)
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<SubtitleFile>();
|
return Enumerable.Empty<SubtitleFile>();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user