diff --git a/src/NzbDrone.Api/Config/MediaManagementConfigResource.cs b/src/NzbDrone.Api/Config/MediaManagementConfigResource.cs index f5724489c..75a261aa2 100644 --- a/src/NzbDrone.Api/Config/MediaManagementConfigResource.cs +++ b/src/NzbDrone.Api/Config/MediaManagementConfigResource.cs @@ -20,5 +20,6 @@ namespace NzbDrone.Api.Config public Boolean SkipFreeSpaceCheckWhenImporting { get; set; } public Boolean CopyUsingHardlinks { get; set; } + public Boolean EnableMediaInfo { get; set; } } } diff --git a/src/NzbDrone.Core.Test/MediaFiles/MediaInfo/UpdateMediaInfoServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/MediaInfo/UpdateMediaInfoServiceFixture.cs index e96a91fb3..f31051e9b 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/MediaInfo/UpdateMediaInfoServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/MediaInfo/UpdateMediaInfoServiceFixture.cs @@ -10,6 +10,7 @@ using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Tv; using NzbDrone.Test.Common; using System; +using NzbDrone.Core.Configuration; namespace NzbDrone.Core.Test.MediaFiles.MediaInfo { @@ -26,6 +27,10 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo Id = 1, Path = @"C:\series".AsOsAgnostic() }; + + Mocker.GetMock() + .SetupGet(s => s.EnableMediaInfo) + .Returns(true); } private void GivenFileExists() diff --git a/src/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs index fbe8b3bf2..28baf7f80 100644 --- a/src/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -219,6 +219,13 @@ namespace NzbDrone.Core.Configuration set { SetValue("CopyUsingHardlinks", value); } } + public Boolean EnableMediaInfo + { + get { return GetValueBoolean("EnableMediaInfo", true); } + + set { SetValue("EnableMediaInfo", value); } + } + public Boolean SetPermissionsLinux { get { return GetValueBoolean("SetPermissionsLinux", false); } diff --git a/src/NzbDrone.Core/Configuration/IConfigService.cs b/src/NzbDrone.Core/Configuration/IConfigService.cs index 93d298cfd..2b6717600 100644 --- a/src/NzbDrone.Core/Configuration/IConfigService.cs +++ b/src/NzbDrone.Core/Configuration/IConfigService.cs @@ -37,6 +37,7 @@ namespace NzbDrone.Core.Configuration FileDateType FileDate { get; set; } Boolean SkipFreeSpaceCheckWhenImporting { get; set; } Boolean CopyUsingHardlinks { get; set; } + Boolean EnableMediaInfo { get; set; } //Permissions (Media Management) Boolean SetPermissionsLinux { get; set; } diff --git a/src/NzbDrone.Core/MediaFiles/MediaInfo/UpdateMediaInfoService.cs b/src/NzbDrone.Core/MediaFiles/MediaInfo/UpdateMediaInfoService.cs index 534010c22..dc6cadc8b 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaInfo/UpdateMediaInfoService.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaInfo/UpdateMediaInfoService.cs @@ -6,6 +6,7 @@ using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Tv; using System.Collections.Generic; using System.Linq; +using NzbDrone.Core.Configuration; namespace NzbDrone.Core.MediaFiles.MediaInfo { @@ -14,16 +15,19 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo private readonly IDiskProvider _diskProvider; private readonly IMediaFileService _mediaFileService; private readonly IVideoFileInfoReader _videoFileInfoReader; + private readonly IConfigService _configService; private readonly Logger _logger; public UpdateMediaInfoService(IDiskProvider diskProvider, IMediaFileService mediaFileService, IVideoFileInfoReader videoFileInfoReader, + IConfigService configService, Logger logger) { _diskProvider = diskProvider; _mediaFileService = mediaFileService; _videoFileInfoReader = videoFileInfoReader; + _configService = configService; _logger = logger; } @@ -51,6 +55,12 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo public void Handle(SeriesScannedEvent message) { + if (!_configService.EnableMediaInfo) + { + _logger.Debug("MediaInfo is disabled"); + return; + } + var mediaFiles = _mediaFileService.GetFilesBySeries(message.Series.Id) .Where(c => c.MediaInfo == null) .ToList(); diff --git a/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.hbs b/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.hbs index 174b6fd2a..06a3f34d0 100644 --- a/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.hbs +++ b/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.hbs @@ -45,6 +45,28 @@ +
+ + +
+
+
+
+