コード例 #1
0
        public override IEnumerable <ExtraFile> CreateAfterSeriesScan(Series series, List <EpisodeFile> episodeFiles)
        {
            var metadataFiles = _metadataFileService.GetFilesBySeries(series.Id);

            _cleanMetadataService.Clean(series);

            if (!_diskProvider.FolderExists(series.Path))
            {
                _logger.Info("Series folder does not exist, skipping metadata creation");
                return(Enumerable.Empty <MetadataFile>());
            }

            var files = new List <MetadataFile>();

            foreach (var consumer in _metadataFactory.Enabled())
            {
                var consumerFiles = GetMetadataFilesForConsumer(consumer, metadataFiles);

                files.AddIfNotNull(ProcessSeriesMetadata(consumer, series, consumerFiles));
                files.AddRange(ProcessSeriesImages(consumer, series, consumerFiles));
                files.AddRange(ProcessSeasonImages(consumer, series, consumerFiles));

                foreach (var episodeFile in episodeFiles)
                {
                    files.AddIfNotNull(ProcessEpisodeMetadata(consumer, series, episodeFile, consumerFiles));
                    files.AddRange(ProcessEpisodeImages(consumer, series, episodeFile, consumerFiles));
                }
            }

            _metadataFileService.Upsert(files);

            return(files);
        }
コード例 #2
0
ファイル: MetadataService.cs プロジェクト: rmangaha/Radarr
        public override IEnumerable <ExtraFile> CreateAfterMovieScan(Movie movie, List <MovieFile> movieFiles)
        {
            var metadataFiles = _metadataFileService.GetFilesByMovie(movie.Id);

            _cleanMetadataService.Clean(movie);

            if (!_diskProvider.FolderExists(movie.Path))
            {
                _logger.Info("Movie folder does not exist, skipping metadata 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));

                foreach (var movieFile in movieFiles)
                {
                    files.AddIfNotNull(ProcessMovieMetadata(consumer, movie, movieFile, consumerFiles));
                }
            }

            _metadataFileService.Upsert(files);

            return(files);
        }
コード例 #3
0
        public void Handle(MediaCoversUpdatedEvent message)
        {
            _cleanMetadataService.Clean(message.Series);

            if (!_diskProvider.FolderExists(message.Series.Path))
            {
                _logger.Info("Series folder does not exist, skipping metadata creation");
                return;
            }

            var seriesMetadataFiles = _metadataFileService.GetFilesBySeries(message.Series.Id);
            var episodeFiles        = GetEpisodeFiles(message.Series.Id);

            foreach (var consumer in _metadataFactory.Enabled())
            {
                var consumerFiles = GetMetadataFilesForConsumer(consumer, seriesMetadataFiles);
                var files         = new List <MetadataFile>();

                files.AddIfNotNull(ProcessSeriesMetadata(consumer, message.Series, consumerFiles));
                files.AddRange(ProcessSeriesImages(consumer, message.Series, consumerFiles));
                files.AddRange(ProcessSeasonImages(consumer, message.Series, consumerFiles));

                foreach (var episodeFile in episodeFiles)
                {
                    files.AddIfNotNull(ProcessEpisodeMetadata(consumer, message.Series, episodeFile, consumerFiles));
                    files.AddRange(ProcessEpisodeImages(consumer, message.Series, episodeFile, consumerFiles));
                }

                _eventAggregator.PublishEvent(new MetadataFilesUpdated(files));
            }
        }
コード例 #4
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);
        }
コード例 #5
0
        public override IEnumerable <ExtraFile> CreateAfterAuthorScan(Author author, List <BookFile> bookFiles)
        {
            var metadataFiles = _metadataFileService.GetFilesByAuthor(author.Id);

            _cleanMetadataService.Clean(author);

            if (!_diskProvider.FolderExists(author.Path))
            {
                _logger.Info("Author folder does not exist, skipping metadata creation");
                return(Enumerable.Empty <MetadataFile>());
            }

            var files = new List <MetadataFile>();

            foreach (var consumer in _metadataFactory.Enabled())
            {
                var consumerFiles = GetMetadataFilesForConsumer(consumer, metadataFiles);

                files.AddIfNotNull(ProcessAuthorMetadata(consumer, author, consumerFiles));
                files.AddRange(ProcessAuthorImages(consumer, author, consumerFiles));

                foreach (var bookFile in bookFiles)
                {
                    files.AddIfNotNull(ProcessBookMetadata(consumer, author, bookFile, consumerFiles));
                }
            }

            _metadataFileService.Upsert(files);

            return(files);
        }
コード例 #6
0
        public override IEnumerable <ExtraFile> CreateAfterMediaCoverUpdate(Movie movie)
        {
            _logger.Debug("Creating Movie Metadata after Cover Update for: {0}", Path.Combine(movie.Path, movie.MovieFile?.RelativePath ?? string.Empty));

            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, movie.MovieFile, consumerFiles));
                files.AddIfNotNull(ProcessMovieMetadata(consumer, movie, movie.MovieFile, consumerFiles));
            }

            _metadataFileService.Upsert(files);

            return(files);
        }
コード例 #7
0
        public void Handle(MediaCoversUpdatedEvent message)
        {
            _cleanMetadataService.Clean(message.Series);
            var seriesMetadata = _metadataFileService.GetFilesBySeries(message.Series.Id);

            foreach (var consumer in _metadataFactory.Enabled())
            {
                consumer.OnSeriesUpdated(message.Series, GetMetadataFilesForConsumer(consumer, seriesMetadata), GetEpisodeFiles(message.Series.Id));
            }
        }
コード例 #8
0
ファイル: MetadataService.cs プロジェクト: zobe123/Lidarr
        public override IEnumerable <ExtraFile> CreateAfterArtistScan(Artist artist, List <TrackFile> trackFiles)
        {
            var metadataFiles = _metadataFileService.GetFilesByArtist(artist.Id);

            _cleanMetadataService.Clean(artist);

            if (!_diskProvider.FolderExists(artist.Path))
            {
                _logger.Info("Artist folder does not exist, skipping metadata creation");
                return(Enumerable.Empty <MetadataFile>());
            }

            var files = new List <MetadataFile>();

            foreach (var consumer in _metadataFactory.Enabled())
            {
                var consumerFiles = GetMetadataFilesForConsumer(consumer, metadataFiles);

                files.AddIfNotNull(ProcessArtistMetadata(consumer, artist, consumerFiles));
                files.AddRange(ProcessArtistImages(consumer, artist, consumerFiles));

                var albumGroups = trackFiles.GroupBy(s => Path.GetDirectoryName(s.Path)).ToList();

                foreach (var group in albumGroups)
                {
                    var album       = _albumService.GetAlbum(group.First().AlbumId);
                    var albumFolder = group.Key;
                    files.AddIfNotNull(ProcessAlbumMetadata(consumer, artist, album, albumFolder, consumerFiles));
                    files.AddRange(ProcessAlbumImages(consumer, artist, album, albumFolder, consumerFiles));

                    foreach (var trackFile in group)
                    {
                        files.AddIfNotNull(ProcessTrackMetadata(consumer, artist, trackFile, consumerFiles));
                    }
                }
            }

            _metadataFileService.Upsert(files);

            return(files);
        }