Advanced option to disable media info for add series/rescan

pull/4/head
Mark McDowall 10 years ago
parent 5f927722df
commit e637d68157

@ -20,5 +20,6 @@ namespace NzbDrone.Api.Config
public Boolean SkipFreeSpaceCheckWhenImporting { get; set; } public Boolean SkipFreeSpaceCheckWhenImporting { get; set; }
public Boolean CopyUsingHardlinks { get; set; } public Boolean CopyUsingHardlinks { get; set; }
public Boolean EnableMediaInfo { get; set; }
} }
} }

@ -10,6 +10,7 @@ using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using System; using System;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Core.Test.MediaFiles.MediaInfo namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
{ {
@ -26,6 +27,10 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
Id = 1, Id = 1,
Path = @"C:\series".AsOsAgnostic() Path = @"C:\series".AsOsAgnostic()
}; };
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.EnableMediaInfo)
.Returns(true);
} }
private void GivenFileExists() private void GivenFileExists()

@ -219,6 +219,13 @@ namespace NzbDrone.Core.Configuration
set { SetValue("CopyUsingHardlinks", value); } set { SetValue("CopyUsingHardlinks", value); }
} }
public Boolean EnableMediaInfo
{
get { return GetValueBoolean("EnableMediaInfo", true); }
set { SetValue("EnableMediaInfo", value); }
}
public Boolean SetPermissionsLinux public Boolean SetPermissionsLinux
{ {
get { return GetValueBoolean("SetPermissionsLinux", false); } get { return GetValueBoolean("SetPermissionsLinux", false); }

@ -37,6 +37,7 @@ namespace NzbDrone.Core.Configuration
FileDateType FileDate { get; set; } FileDateType FileDate { get; set; }
Boolean SkipFreeSpaceCheckWhenImporting { get; set; } Boolean SkipFreeSpaceCheckWhenImporting { get; set; }
Boolean CopyUsingHardlinks { get; set; } Boolean CopyUsingHardlinks { get; set; }
Boolean EnableMediaInfo { get; set; }
//Permissions (Media Management) //Permissions (Media Management)
Boolean SetPermissionsLinux { get; set; } Boolean SetPermissionsLinux { get; set; }

@ -6,6 +6,7 @@ using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Core.MediaFiles.MediaInfo namespace NzbDrone.Core.MediaFiles.MediaInfo
{ {
@ -14,16 +15,19 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
private readonly IMediaFileService _mediaFileService; private readonly IMediaFileService _mediaFileService;
private readonly IVideoFileInfoReader _videoFileInfoReader; private readonly IVideoFileInfoReader _videoFileInfoReader;
private readonly IConfigService _configService;
private readonly Logger _logger; private readonly Logger _logger;
public UpdateMediaInfoService(IDiskProvider diskProvider, public UpdateMediaInfoService(IDiskProvider diskProvider,
IMediaFileService mediaFileService, IMediaFileService mediaFileService,
IVideoFileInfoReader videoFileInfoReader, IVideoFileInfoReader videoFileInfoReader,
IConfigService configService,
Logger logger) Logger logger)
{ {
_diskProvider = diskProvider; _diskProvider = diskProvider;
_mediaFileService = mediaFileService; _mediaFileService = mediaFileService;
_videoFileInfoReader = videoFileInfoReader; _videoFileInfoReader = videoFileInfoReader;
_configService = configService;
_logger = logger; _logger = logger;
} }
@ -51,6 +55,12 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
public void Handle(SeriesScannedEvent message) public void Handle(SeriesScannedEvent message)
{ {
if (!_configService.EnableMediaInfo)
{
_logger.Debug("MediaInfo is disabled");
return;
}
var mediaFiles = _mediaFileService.GetFilesBySeries(message.Series.Id) var mediaFiles = _mediaFileService.GetFilesBySeries(message.Series.Id)
.Where(c => c.MediaInfo == null) .Where(c => c.MediaInfo == null)
.ToList(); .ToList();

@ -45,6 +45,28 @@
</div> </div>
</div> </div>
<div class="form-group advanced-setting">
<label class="col-sm-3 control-label">Use Media Info</label>
<div class="col-sm-9">
<div class="input-group">
<label class="checkbox toggle well">
<input type="checkbox" name="enableMediaInfo"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-nd-form-info" title="Use Media Info to scan files on refresh and when adding series?"/>
</span>
</div>
</div>
</div>
<div class="form-group advanced-setting"> <div class="form-group advanced-setting">
<label class="col-sm-3 control-label">Change File Date</label> <label class="col-sm-3 control-label">Change File Date</label>

Loading…
Cancel
Save