Don't read media info when disabled in settings

Fixed: Don't read media info for existing files if "Analyse video files" disabled
Fixes #2549
pull/2538/merge
Mark McDowall 7 years ago
parent c687f45ff6
commit 2b3d0235cf

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using NLog; using NLog;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators; using NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators;
using NzbDrone.Core.MediaFiles.MediaInfo; using NzbDrone.Core.MediaFiles.MediaInfo;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
@ -19,16 +20,19 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation
private readonly IEnumerable<IAggregateLocalEpisode> _augmenters; private readonly IEnumerable<IAggregateLocalEpisode> _augmenters;
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
private readonly IVideoFileInfoReader _videoFileInfoReader; private readonly IVideoFileInfoReader _videoFileInfoReader;
private readonly IConfigService _configService;
private readonly Logger _logger; private readonly Logger _logger;
public AugmentingService(IEnumerable<IAggregateLocalEpisode> augmenters, public AugmentingService(IEnumerable<IAggregateLocalEpisode> augmenters,
IDiskProvider diskProvider, IDiskProvider diskProvider,
IVideoFileInfoReader videoFileInfoReader, IVideoFileInfoReader videoFileInfoReader,
IConfigService configService,
Logger logger) Logger logger)
{ {
_augmenters = augmenters; _augmenters = augmenters;
_diskProvider = diskProvider; _diskProvider = diskProvider;
_videoFileInfoReader = videoFileInfoReader; _videoFileInfoReader = videoFileInfoReader;
_configService = configService;
_logger = logger; _logger = logger;
} }
@ -45,7 +49,11 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation
} }
localEpisode.Size = _diskProvider.GetFileSize(localEpisode.Path); localEpisode.Size = _diskProvider.GetFileSize(localEpisode.Path);
if (!localEpisode.ExistingFile || _configService.EnableMediaInfo)
{
localEpisode.MediaInfo = _videoFileInfoReader.GetMediaInfo(localEpisode.Path); localEpisode.MediaInfo = _videoFileInfoReader.GetMediaInfo(localEpisode.Path);
}
foreach (var augmenter in _augmenters) foreach (var augmenter in _augmenters)
{ {

Loading…
Cancel
Save