mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
UI Updates, Separate Auto and Manual Searches per Indexer
This commit is contained in:
parent
e181876dfc
commit
27d65937c0
28 changed files with 202 additions and 117 deletions
|
@ -153,33 +153,27 @@ class AddNewArtistModalContent extends Component {
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
{
|
<FormGroup className={showLanguageProfile ? undefined : styles.hideLanguageProfile}>
|
||||||
showLanguageProfile &&
|
<FormLabel>Language Profile</FormLabel>
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>Language Profile</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.LANGUAGE_PROFILE_SELECT}
|
type={inputTypes.LANGUAGE_PROFILE_SELECT}
|
||||||
name="languageProfileId"
|
name="languageProfileId"
|
||||||
onChange={this.onLanguageProfileIdChange}
|
onChange={this.onLanguageProfileIdChange}
|
||||||
{...languageProfileId}
|
{...languageProfileId}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
}
|
|
||||||
|
|
||||||
{
|
<FormGroup className={showMetadataProfile ? undefined : styles.hideMetadataProfile}>
|
||||||
showMetadataProfile &&
|
<FormLabel>Metadata Profile</FormLabel>
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>Metadata Profile</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.METADATA_PROFILE_SELECT}
|
type={inputTypes.METADATA_PROFILE_SELECT}
|
||||||
name="metadataProfileId"
|
name="metadataProfileId"
|
||||||
onChange={this.onMetadataProfileIdChange}
|
onChange={this.onMetadataProfileIdChange}
|
||||||
{...metadataProfileId}
|
{...metadataProfileId}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
}
|
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>Album Folder</FormLabel>
|
<FormLabel>Album Folder</FormLabel>
|
||||||
|
|
|
@ -162,7 +162,6 @@ class ImportArtistFooter extends Component {
|
||||||
|
|
||||||
{
|
{
|
||||||
showLanguageProfile &&
|
showLanguageProfile &&
|
||||||
|
|
||||||
<div className={styles.inputContainer}>
|
<div className={styles.inputContainer}>
|
||||||
<div className={styles.label}>
|
<div className={styles.label}>
|
||||||
Language Profile
|
Language Profile
|
||||||
|
@ -181,7 +180,6 @@ class ImportArtistFooter extends Component {
|
||||||
|
|
||||||
{
|
{
|
||||||
showMetadataProfile &&
|
showMetadataProfile &&
|
||||||
|
|
||||||
<div className={styles.inputContainer}>
|
<div className={styles.inputContainer}>
|
||||||
<div className={styles.label}>
|
<div className={styles.label}>
|
||||||
Metadata Profile
|
Metadata Profile
|
||||||
|
|
|
@ -4,11 +4,11 @@ import SelectInput from './SelectInput';
|
||||||
|
|
||||||
const monitorOptions = [
|
const monitorOptions = [
|
||||||
{ key: 'all', value: 'All Albums' },
|
{ key: 'all', value: 'All Albums' },
|
||||||
{ key: 'future', value: 'Future Albums' },
|
// { key: 'future', value: 'Future Albums' },
|
||||||
{ key: 'missing', value: 'Missing Albums' },
|
// { key: 'missing', value: 'Missing Albums' },
|
||||||
{ key: 'existing', value: 'Existing Albums' },
|
// { key: 'existing', value: 'Existing Albums' },
|
||||||
{ key: 'first', value: 'Only First Album' },
|
// { key: 'first', value: 'Only First Album' },
|
||||||
{ key: 'latest', value: 'Only Latest Album' },
|
// { key: 'latest', value: 'Only Latest Album' },
|
||||||
{ key: 'none', value: 'None' }
|
{ key: 'none', value: 'None' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ export const COMPUTER = 'fa fa-desktop';
|
||||||
export const DANGER = 'fa fa-exclamation-circle';
|
export const DANGER = 'fa fa-exclamation-circle';
|
||||||
export const DELETE = 'fa fa-trash';
|
export const DELETE = 'fa fa-trash';
|
||||||
export const DOWNLOAD = 'fa fa-download';
|
export const DOWNLOAD = 'fa fa-download';
|
||||||
export const DOWNLOADED = 'fa fa-inbox';
|
export const DOWNLOADED = 'fa fa-download';
|
||||||
export const DOWNLOADING = 'fa fa-cloud-download';
|
export const DOWNLOADING = 'fa fa-cloud-download';
|
||||||
export const DRIVE = 'fa fa-hdd-o';
|
export const DRIVE = 'fa fa-hdd-o';
|
||||||
export const EDIT = 'fa fa-wrench';
|
export const EDIT = 'fa fa-wrench';
|
||||||
|
|
|
@ -37,7 +37,8 @@ function EditIndexerModalContent(props) {
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
enableRss,
|
enableRss,
|
||||||
enableSearch,
|
enableAutomaticSearch,
|
||||||
|
enableInteractiveSearch,
|
||||||
supportsRss,
|
supportsRss,
|
||||||
supportsSearch,
|
supportsSearch,
|
||||||
fields
|
fields
|
||||||
|
@ -90,14 +91,29 @@ function EditIndexerModalContent(props) {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>Enable Search</FormLabel>
|
<FormLabel>Enable Automatic Search</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="enableSearch"
|
name="enableAutomaticSearch"
|
||||||
|
helpText={supportsSearch.value && 'Will be used when automatic searches are performed via the UI or by Lidarr'}
|
||||||
helpTextWarning={supportsSearch.value ? undefined : 'Search is not supported with this indexer'}
|
helpTextWarning={supportsSearch.value ? undefined : 'Search is not supported with this indexer'}
|
||||||
isDisabled={!supportsSearch.value}
|
isDisabled={!supportsSearch.value}
|
||||||
{...enableSearch}
|
{...enableAutomaticSearch}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>Enable Interactive Search</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="enableInteractiveSearch"
|
||||||
|
helpText={supportsSearch.value && 'Will be used when interactive search is used'}
|
||||||
|
helpTextWarning={supportsSearch.value ? undefined : 'Search is not supported with this indexer'}
|
||||||
|
isDisabled={!supportsSearch.value}
|
||||||
|
{...enableInteractiveSearch}
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
|
@ -67,7 +67,8 @@ class Indexer extends Component {
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
enableRss,
|
enableRss,
|
||||||
enableSearch,
|
enableAutomaticSearch,
|
||||||
|
enableInteractiveSearch,
|
||||||
supportsRss,
|
supportsRss,
|
||||||
supportsSearch
|
supportsSearch
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
@ -90,10 +91,17 @@ class Indexer extends Component {
|
||||||
</Label>
|
</Label>
|
||||||
|
|
||||||
<Label
|
<Label
|
||||||
kind={getLabelKind(supportsSearch, enableSearch)}
|
kind={getLabelKind(supportsSearch, enableAutomaticSearch)}
|
||||||
outline={supportsSearch && !enableSearch}
|
outline={supportsSearch && !enableAutomaticSearch}
|
||||||
>
|
>
|
||||||
Search
|
Automatic Search
|
||||||
|
</Label>
|
||||||
|
|
||||||
|
<Label
|
||||||
|
kind={getLabelKind(supportsSearch, enableInteractiveSearch)}
|
||||||
|
outline={supportsSearch && !enableInteractiveSearch}
|
||||||
|
>
|
||||||
|
Interactive Search
|
||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -122,7 +130,8 @@ Indexer.propTypes = {
|
||||||
id: PropTypes.number.isRequired,
|
id: PropTypes.number.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
enableRss: PropTypes.bool.isRequired,
|
enableRss: PropTypes.bool.isRequired,
|
||||||
enableSearch: PropTypes.bool.isRequired,
|
enableAutomaticSearch: PropTypes.bool.isRequired,
|
||||||
|
enableInteractiveSearch: PropTypes.bool.isRequired,
|
||||||
supportsRss: PropTypes.bool.isRequired,
|
supportsRss: PropTypes.bool.isRequired,
|
||||||
supportsSearch: PropTypes.bool.isRequired,
|
supportsSearch: PropTypes.bool.isRequired,
|
||||||
onConfirmDeleteIndexer: PropTypes.func.isRequired
|
onConfirmDeleteIndexer: PropTypes.func.isRequired
|
||||||
|
|
|
@ -107,12 +107,12 @@ function EditNotificationModalContent(props) {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>On Download</FormLabel>
|
<FormLabel>On Import</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="onDownload"
|
name="onDownload"
|
||||||
helpText="Be notified when episodes are successfully downloaded"
|
helpText="Be notified when tracks are successfully imported"
|
||||||
isDisabled={!supportsOnDownload.value}
|
isDisabled={!supportsOnDownload.value}
|
||||||
{...onDownload}
|
{...onDownload}
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
|
|
|
@ -80,7 +80,7 @@ export const actionHandlers = handleThunks({
|
||||||
const {
|
const {
|
||||||
albums,
|
albums,
|
||||||
options: artistMonitoringOptions
|
options: artistMonitoringOptions
|
||||||
} = getMonitoringOptions(_.cloneDeep(s.albums), monitor);
|
} = getMonitoringOptions(monitor);
|
||||||
|
|
||||||
if (!monitoringOptions) {
|
if (!monitoringOptions) {
|
||||||
monitoringOptions = artistMonitoringOptions;
|
monitoringOptions = artistMonitoringOptions;
|
||||||
|
|
|
@ -8,13 +8,13 @@ namespace Lidarr.Api.V1.AlbumStudio
|
||||||
public class AlbumStudioModule : LidarrV1Module
|
public class AlbumStudioModule : LidarrV1Module
|
||||||
{
|
{
|
||||||
private readonly IArtistService _artistService;
|
private readonly IArtistService _artistService;
|
||||||
private readonly IAlbumMonitoredService _episodeMonitoredService;
|
private readonly IAlbumMonitoredService _albumMonitoredService;
|
||||||
|
|
||||||
public AlbumStudioModule(IArtistService artistService, IAlbumMonitoredService episodeMonitoredService)
|
public AlbumStudioModule(IArtistService artistService, IAlbumMonitoredService albumMonitoredService)
|
||||||
: base("/albumstudio")
|
: base("/albumstudio")
|
||||||
{
|
{
|
||||||
_artistService = artistService;
|
_artistService = artistService;
|
||||||
_episodeMonitoredService = episodeMonitoredService;
|
_albumMonitoredService = albumMonitoredService;
|
||||||
Post["/"] = artist => UpdateAll();
|
Post["/"] = artist => UpdateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,20 +33,7 @@ namespace Lidarr.Api.V1.AlbumStudio
|
||||||
artist.Monitored = s.Monitored.Value;
|
artist.Monitored = s.Monitored.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.Albums != null && s.Albums.Any())
|
_albumMonitoredService.SetAlbumMonitoredStatus(artist, request.MonitoringOptions);
|
||||||
{
|
|
||||||
foreach (var artistAlbum in artist.Albums)
|
|
||||||
{
|
|
||||||
var album = s.Albums.FirstOrDefault(c => c.Id == artistAlbum.Id);
|
|
||||||
|
|
||||||
if (album != null)
|
|
||||||
{
|
|
||||||
artistAlbum.Monitored = album.Monitored;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_episodeMonitoredService.SetAlbumMonitoredStatus(artist, request.MonitoringOptions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "ok".AsResponse(HttpStatusCode.Accepted);
|
return "ok".AsResponse(HttpStatusCode.Accepted);
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
|
|
||||||
namespace Lidarr.Api.V1.Indexers
|
namespace Lidarr.Api.V1.Indexers
|
||||||
{
|
{
|
||||||
public class IndexerResource : ProviderResource
|
public class IndexerResource : ProviderResource
|
||||||
{
|
{
|
||||||
public bool EnableRss { get; set; }
|
public bool EnableRss { get; set; }
|
||||||
public bool EnableSearch { get; set; }
|
public bool EnableAutomaticSearch { get; set; }
|
||||||
|
public bool EnableInteractiveSearch { get; set; }
|
||||||
public bool SupportsRss { get; set; }
|
public bool SupportsRss { get; set; }
|
||||||
public bool SupportsSearch { get; set; }
|
public bool SupportsSearch { get; set; }
|
||||||
public DownloadProtocol Protocol { get; set; }
|
public DownloadProtocol Protocol { get; set; }
|
||||||
|
@ -20,7 +21,8 @@ namespace Lidarr.Api.V1.Indexers
|
||||||
var resource = base.ToResource(definition);
|
var resource = base.ToResource(definition);
|
||||||
|
|
||||||
resource.EnableRss = definition.EnableRss;
|
resource.EnableRss = definition.EnableRss;
|
||||||
resource.EnableSearch = definition.EnableSearch;
|
resource.EnableAutomaticSearch = definition.EnableAutomaticSearch;
|
||||||
|
resource.EnableInteractiveSearch = definition.EnableInteractiveSearch;
|
||||||
resource.SupportsRss = definition.SupportsRss;
|
resource.SupportsRss = definition.SupportsRss;
|
||||||
resource.SupportsSearch = definition.SupportsSearch;
|
resource.SupportsSearch = definition.SupportsSearch;
|
||||||
resource.Protocol = definition.Protocol;
|
resource.Protocol = definition.Protocol;
|
||||||
|
@ -35,9 +37,10 @@ namespace Lidarr.Api.V1.Indexers
|
||||||
var definition = base.ToModel(resource);
|
var definition = base.ToModel(resource);
|
||||||
|
|
||||||
definition.EnableRss = resource.EnableRss;
|
definition.EnableRss = resource.EnableRss;
|
||||||
definition.EnableSearch = resource.EnableSearch;
|
definition.EnableAutomaticSearch = resource.EnableAutomaticSearch;
|
||||||
|
definition.EnableInteractiveSearch = resource.EnableInteractiveSearch;
|
||||||
|
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace Lidarr.Api.V1.Indexers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var decisions = _nzbSearchService.AlbumSearch(albumId, true, true);
|
var decisions = _nzbSearchService.AlbumSearch(albumId, true, true, true);
|
||||||
var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions);
|
var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions);
|
||||||
|
|
||||||
return MapDecisions(prioritizedDecisions);
|
return MapDecisions(prioritizedDecisions);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.HealthCheck.Checks;
|
using NzbDrone.Core.HealthCheck.Checks;
|
||||||
|
@ -20,7 +20,11 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(new List<IIndexer>());
|
.Returns(new List<IIndexer>());
|
||||||
|
|
||||||
Mocker.GetMock<IIndexerFactory>()
|
Mocker.GetMock<IIndexerFactory>()
|
||||||
.Setup(s => s.SearchEnabled(It.IsAny<bool>()))
|
.Setup(s => s.AutomaticSearchEnabled(It.IsAny<bool>()))
|
||||||
|
.Returns(new List<IIndexer>());
|
||||||
|
|
||||||
|
Mocker.GetMock<IIndexerFactory>()
|
||||||
|
.Setup(s => s.InteractiveSearchEnabled(It.IsAny<bool>()))
|
||||||
.Returns(new List<IIndexer>());
|
.Returns(new List<IIndexer>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,17 +39,28 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(new List<IIndexer> { _indexerMock.Object });
|
.Returns(new List<IIndexer> { _indexerMock.Object });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenSearchEnabled()
|
private void GivenAutomaticSearchEnabled()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IIndexerFactory>()
|
Mocker.GetMock<IIndexerFactory>()
|
||||||
.Setup(s => s.SearchEnabled(It.IsAny<bool>()))
|
.Setup(s => s.AutomaticSearchEnabled(It.IsAny<bool>()))
|
||||||
|
.Returns(new List<IIndexer> { _indexerMock.Object });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GivenInteractiveSearchEnabled()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<IIndexerFactory>()
|
||||||
|
.Setup(s => s.InteractiveSearchEnabled(It.IsAny<bool>()))
|
||||||
.Returns(new List<IIndexer> { _indexerMock.Object });
|
.Returns(new List<IIndexer> { _indexerMock.Object });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenSearchFiltered()
|
private void GivenSearchFiltered()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IIndexerFactory>()
|
Mocker.GetMock<IIndexerFactory>()
|
||||||
.Setup(s => s.SearchEnabled(false))
|
.Setup(s => s.AutomaticSearchEnabled(false))
|
||||||
|
.Returns(new List<IIndexer> { _indexerMock.Object });
|
||||||
|
|
||||||
|
Mocker.GetMock<IIndexerFactory>()
|
||||||
|
.Setup(s => s.InteractiveSearchEnabled(false))
|
||||||
.Returns(new List<IIndexer> { _indexerMock.Object });
|
.Returns(new List<IIndexer> { _indexerMock.Object });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,14 +79,33 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_ok_when_search_is_enabled()
|
public void should_return_ok_when_automatic_and__search_is_enabled()
|
||||||
{
|
{
|
||||||
GivenIndexer(false, true);
|
GivenIndexer(false, true);
|
||||||
GivenSearchEnabled();
|
GivenAutomaticSearchEnabled();
|
||||||
|
GivenInteractiveSearchEnabled();
|
||||||
|
|
||||||
Subject.Check().ShouldBeOk();
|
Subject.Check().ShouldBeOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_return_warning_when_only_automatic_search_is_enabled()
|
||||||
|
{
|
||||||
|
GivenIndexer(false, true);
|
||||||
|
GivenAutomaticSearchEnabled();
|
||||||
|
|
||||||
|
Subject.Check().ShouldBeWarning();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_return_warning_when_only_interactive_search_is_enabled()
|
||||||
|
{
|
||||||
|
GivenIndexer(false, true);
|
||||||
|
GivenInteractiveSearchEnabled();
|
||||||
|
|
||||||
|
Subject.Check().ShouldBeWarning();
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_warning_if_search_is_supported_but_disabled()
|
public void should_return_warning_if_search_is_supported_but_disabled()
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
.Returns(_artist);
|
.Returns(_artist);
|
||||||
|
|
||||||
Mocker.GetMock<ISearchForNzb>()
|
Mocker.GetMock<ISearchForNzb>()
|
||||||
.Setup(s => s.ArtistSearch(_artist.Id, false, true))
|
.Setup(s => s.ArtistSearch(_artist.Id, false, true, false))
|
||||||
.Returns(new List<DownloadDecision>());
|
.Returns(new List<DownloadDecision>());
|
||||||
|
|
||||||
Mocker.GetMock<IProcessDownloadDecisions>()
|
Mocker.GetMock<IProcessDownloadDecisions>()
|
||||||
|
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
Subject.Execute(new ArtistSearchCommand {ArtistId = _artist.Id, Trigger = CommandTrigger.Manual});
|
Subject.Execute(new ArtistSearchCommand {ArtistId = _artist.Id, Trigger = CommandTrigger.Manual});
|
||||||
|
|
||||||
Mocker.GetMock<ISearchForNzb>()
|
Mocker.GetMock<ISearchForNzb>()
|
||||||
.Verify(v => v.ArtistSearch(_artist.Id, false, true),
|
.Verify(v => v.ArtistSearch(_artist.Id, false, true, false),
|
||||||
Times.Exactly(_artist.Albums.Count(s => s.Monitored)));
|
Times.Exactly(_artist.Albums.Count(s => s.Monitored)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(6)]
|
||||||
|
public class separate_automatic_and_interactive_search : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Rename.Column("EnableSearch").OnTable("Indexers").To("EnableAutomaticSearch");
|
||||||
|
Alter.Table("Indexers").AddColumn("EnableInteractiveSearch").AsBoolean().Nullable();
|
||||||
|
|
||||||
|
Execute.Sql("UPDATE Indexers SET EnableInteractiveSearch = EnableAutomaticSearch");
|
||||||
|
|
||||||
|
Alter.Table("Indexers").AlterColumn("EnableInteractiveSearch").AsBoolean().NotNullable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,14 +19,21 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
|
|
||||||
public override HealthCheck Check()
|
public override HealthCheck Check()
|
||||||
{
|
{
|
||||||
var enabled = _indexerFactory.SearchEnabled(false);
|
var automaticSearchEnabled = _indexerFactory.AutomaticSearchEnabled(false);
|
||||||
|
|
||||||
if (enabled.Empty())
|
if (automaticSearchEnabled.Empty())
|
||||||
{
|
{
|
||||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Search enabled, Lidarr will not provide any search results");
|
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Automatic Search enabled, Lidarr will not provide any automatic search results");
|
||||||
}
|
}
|
||||||
|
|
||||||
var active = _indexerFactory.SearchEnabled(true);
|
var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false);
|
||||||
|
|
||||||
|
if (interactiveSearchEnabled.Empty())
|
||||||
|
{
|
||||||
|
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Interactive Search enabled, Lidarr will not provide any interactive search results");
|
||||||
|
}
|
||||||
|
|
||||||
|
var active = _indexerFactory.AutomaticSearchEnabled(true);
|
||||||
|
|
||||||
if (active.Empty())
|
if (active.Empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
foreach (var album in albums)
|
foreach (var album in albums)
|
||||||
{
|
{
|
||||||
List<DownloadDecision> decisions;
|
List<DownloadDecision> decisions;
|
||||||
decisions = _nzbSearchService.AlbumSearch(album.Id, false, userInvokedSearch);
|
decisions = _nzbSearchService.AlbumSearch(album.Id, false, userInvokedSearch, false);
|
||||||
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
||||||
|
|
||||||
downloadedCount += processed.Grabbed.Count;
|
downloadedCount += processed.Grabbed.Count;
|
||||||
|
@ -59,7 +59,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
foreach (var albumId in message.AlbumIds)
|
foreach (var albumId in message.AlbumIds)
|
||||||
{
|
{
|
||||||
var decisions =
|
var decisions =
|
||||||
_nzbSearchService.AlbumSearch(albumId, false, message.Trigger == CommandTrigger.Manual);
|
_nzbSearchService.AlbumSearch(albumId, false, message.Trigger == CommandTrigger.Manual, false);
|
||||||
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
||||||
|
|
||||||
_logger.ProgressInfo("Album search completed. {0} reports downloaded.", processed.Grabbed.Count);
|
_logger.ProgressInfo("Album search completed. {0} reports downloaded.", processed.Grabbed.Count);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Instrumentation.Extensions;
|
using NzbDrone.Common.Instrumentation.Extensions;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Messaging.Commands;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
|
@ -22,7 +22,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
|
|
||||||
public void Execute(ArtistSearchCommand message)
|
public void Execute(ArtistSearchCommand message)
|
||||||
{
|
{
|
||||||
var decisions = _nzbSearchService.ArtistSearch(message.ArtistId, false, message.Trigger == CommandTrigger.Manual);
|
var decisions = _nzbSearchService.ArtistSearch(message.ArtistId, false, message.Trigger == CommandTrigger.Manual, false);
|
||||||
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
||||||
|
|
||||||
_logger.ProgressInfo("Artist search completed. {0} reports downloaded.", processed.Grabbed.Count);
|
_logger.ProgressInfo("Artist search completed. {0} reports downloaded.", processed.Grabbed.Count);
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
||||||
|
|
||||||
public virtual bool MonitoredEpisodesOnly { get; set; }
|
public virtual bool MonitoredEpisodesOnly { get; set; }
|
||||||
public virtual bool UserInvokedSearch { get; set; }
|
public virtual bool UserInvokedSearch { get; set; }
|
||||||
|
public virtual bool InteractiveSearch { get; set; }
|
||||||
|
|
||||||
public Artist Artist { get; set; }
|
public Artist Artist { get; set; }
|
||||||
public List<Album> Albums { get; set; }
|
public List<Album> Albums { get; set; }
|
||||||
|
|
|
@ -16,8 +16,8 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
public interface ISearchForNzb
|
public interface ISearchForNzb
|
||||||
{
|
{
|
||||||
List<DownloadDecision> AlbumSearch(int albumId, bool missingOnly, bool userInvokedSearch);
|
List<DownloadDecision> AlbumSearch(int albumId, bool missingOnly, bool userInvokedSearch, bool interactiveSearch);
|
||||||
List<DownloadDecision> ArtistSearch(int artistId, bool missingOnly, bool userInvokedSearch);
|
List<DownloadDecision> ArtistSearch(int artistId, bool missingOnly, bool userInvokedSearch, bool interactiveSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NzbSearchService : ISearchForNzb
|
public class NzbSearchService : ISearchForNzb
|
||||||
|
@ -41,21 +41,21 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DownloadDecision> AlbumSearch(int albumId, bool missingOnly, bool userInvokedSearch)
|
public List<DownloadDecision> AlbumSearch(int albumId, bool missingOnly, bool userInvokedSearch, bool interactiveSearch)
|
||||||
{
|
{
|
||||||
var album = _albumService.GetAlbum(albumId);
|
var album = _albumService.GetAlbum(albumId);
|
||||||
return AlbumSearch(album, missingOnly, userInvokedSearch);
|
return AlbumSearch(album, missingOnly, userInvokedSearch, interactiveSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DownloadDecision> ArtistSearch(int artistId, bool missingOnly, bool userInvokedSearch)
|
public List<DownloadDecision> ArtistSearch(int artistId, bool missingOnly, bool userInvokedSearch, bool interactiveSearch)
|
||||||
{
|
{
|
||||||
var artist = _artistService.GetArtist(artistId);
|
var artist = _artistService.GetArtist(artistId);
|
||||||
return ArtistSearch(artist, missingOnly, userInvokedSearch);
|
return ArtistSearch(artist, missingOnly, userInvokedSearch, interactiveSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DownloadDecision> ArtistSearch(Artist artist, bool missingOnly, bool userInvokedSearch)
|
public List<DownloadDecision> ArtistSearch(Artist artist, bool missingOnly, bool userInvokedSearch, bool interactiveSearch)
|
||||||
{
|
{
|
||||||
var searchSpec = Get<ArtistSearchCriteria>(artist, userInvokedSearch);
|
var searchSpec = Get<ArtistSearchCriteria>(artist, userInvokedSearch, interactiveSearch);
|
||||||
var albums = _albumService.GetAlbumsByArtist(artist.Id);
|
var albums = _albumService.GetAlbumsByArtist(artist.Id);
|
||||||
|
|
||||||
searchSpec.Albums = albums;
|
searchSpec.Albums = albums;
|
||||||
|
@ -63,11 +63,11 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
return Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
return Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DownloadDecision> AlbumSearch(Album album, bool missingOnly, bool userInvokedSearch)
|
public List<DownloadDecision> AlbumSearch(Album album, bool missingOnly, bool userInvokedSearch, bool interactiveSearch)
|
||||||
{
|
{
|
||||||
var artist = _artistService.GetArtist(album.ArtistId);
|
var artist = _artistService.GetArtist(album.ArtistId);
|
||||||
|
|
||||||
var searchSpec = Get<AlbumSearchCriteria>(artist, new List<Album> { album }, userInvokedSearch);
|
var searchSpec = Get<AlbumSearchCriteria>(artist, new List<Album> { album }, userInvokedSearch, interactiveSearch);
|
||||||
|
|
||||||
searchSpec.AlbumTitle = album.Title;
|
searchSpec.AlbumTitle = album.Title;
|
||||||
if (album.ReleaseDate.HasValue)
|
if (album.ReleaseDate.HasValue)
|
||||||
|
@ -78,29 +78,34 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
return Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
return Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TSpec Get<TSpec>(Artist artist, List<Album> albums, bool userInvokedSearch) where TSpec : SearchCriteriaBase, new()
|
private TSpec Get<TSpec>(Artist artist, List<Album> albums, bool userInvokedSearch, bool interactiveSearch) where TSpec : SearchCriteriaBase, new()
|
||||||
{
|
{
|
||||||
var spec = new TSpec();
|
var spec = new TSpec();
|
||||||
|
|
||||||
spec.Albums = albums;
|
spec.Albums = albums;
|
||||||
spec.Artist = artist;
|
spec.Artist = artist;
|
||||||
spec.UserInvokedSearch = userInvokedSearch;
|
spec.UserInvokedSearch = userInvokedSearch;
|
||||||
|
spec.InteractiveSearch = interactiveSearch;
|
||||||
|
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TSpec Get<TSpec>(Artist artist, bool userInvokedSearch) where TSpec : SearchCriteriaBase, new()
|
private static TSpec Get<TSpec>(Artist artist, bool userInvokedSearch, bool interactiveSearch) where TSpec : SearchCriteriaBase, new()
|
||||||
{
|
{
|
||||||
var spec = new TSpec();
|
var spec = new TSpec();
|
||||||
spec.Artist = artist;
|
spec.Artist = artist;
|
||||||
spec.UserInvokedSearch = userInvokedSearch;
|
spec.UserInvokedSearch = userInvokedSearch;
|
||||||
|
spec.InteractiveSearch = interactiveSearch;
|
||||||
|
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DownloadDecision> Dispatch(Func<IIndexer, IEnumerable<ReleaseInfo>> searchAction, SearchCriteriaBase criteriaBase)
|
private List<DownloadDecision> Dispatch(Func<IIndexer, IEnumerable<ReleaseInfo>> searchAction, SearchCriteriaBase criteriaBase)
|
||||||
{
|
{
|
||||||
var indexers = _indexerFactory.SearchEnabled();
|
var indexers = criteriaBase.InteractiveSearch ?
|
||||||
|
_indexerFactory.InteractiveSearchEnabled() :
|
||||||
|
_indexerFactory.AutomaticSearchEnabled();
|
||||||
|
|
||||||
var reports = new List<ReleaseInfo>();
|
var reports = new List<ReleaseInfo>();
|
||||||
|
|
||||||
_logger.ProgressInfo("Searching {0} indexers for {1}", indexers.Count, criteriaBase);
|
_logger.ProgressInfo("Searching {0} indexers for {1}", indexers.Count, criteriaBase);
|
||||||
|
|
|
@ -61,7 +61,8 @@ namespace NzbDrone.Core.Indexers.Gazelle
|
||||||
return new IndexerDefinition
|
return new IndexerDefinition
|
||||||
{
|
{
|
||||||
EnableRss = false,
|
EnableRss = false,
|
||||||
EnableSearch = false,
|
EnableAutomaticSearch = false,
|
||||||
|
EnableInteractiveSearch = false,
|
||||||
Name = name,
|
Name = name,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = settings,
|
Settings = settings,
|
||||||
|
|
|
@ -48,7 +48,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
Name = GetType().Name,
|
Name = GetType().Name,
|
||||||
EnableRss = config.Validate().IsValid && SupportsRss,
|
EnableRss = config.Validate().IsValid && SupportsRss,
|
||||||
EnableSearch = config.Validate().IsValid && SupportsSearch,
|
EnableAutomaticSearch = config.Validate().IsValid && SupportsSearch,
|
||||||
|
EnableInteractiveSearch = config.Validate().IsValid && SupportsSearch,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = config
|
Settings = config
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers
|
namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
public class IndexerDefinition : ProviderDefinition
|
public class IndexerDefinition : ProviderDefinition
|
||||||
{
|
{
|
||||||
public bool EnableRss { get; set; }
|
public bool EnableRss { get; set; }
|
||||||
public bool EnableSearch { get; set; }
|
public bool EnableAutomaticSearch { get; set; }
|
||||||
|
public bool EnableInteractiveSearch { get; set; }
|
||||||
public DownloadProtocol Protocol { get; set; }
|
public DownloadProtocol Protocol { get; set; }
|
||||||
public bool SupportsRss { get; set; }
|
public bool SupportsRss { get; set; }
|
||||||
public bool SupportsSearch { get; set; }
|
public bool SupportsSearch { get; set; }
|
||||||
|
|
||||||
public override bool Enable => EnableRss || EnableSearch;
|
public override bool Enable => EnableRss || EnableAutomaticSearch || EnableInteractiveSearch;
|
||||||
|
|
||||||
public IndexerStatus Status { get; set; }
|
public IndexerStatus Status { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ namespace NzbDrone.Core.Indexers
|
||||||
public interface IIndexerFactory : IProviderFactory<IIndexer, IndexerDefinition>
|
public interface IIndexerFactory : IProviderFactory<IIndexer, IndexerDefinition>
|
||||||
{
|
{
|
||||||
List<IIndexer> RssEnabled(bool filterBlockedIndexers = true);
|
List<IIndexer> RssEnabled(bool filterBlockedIndexers = true);
|
||||||
List<IIndexer> SearchEnabled(bool filterBlockedIndexers = true);
|
List<IIndexer> AutomaticSearchEnabled(bool filterBlockedIndexers = true);
|
||||||
|
List<IIndexer> InteractiveSearchEnabled(bool filterBlockedIndexers = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IndexerFactory : ProviderFactory<IIndexer, IndexerDefinition>, IIndexerFactory
|
public class IndexerFactory : ProviderFactory<IIndexer, IndexerDefinition>, IIndexerFactory
|
||||||
|
@ -57,9 +58,21 @@ namespace NzbDrone.Core.Indexers
|
||||||
return enabledIndexers.ToList();
|
return enabledIndexers.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IIndexer> SearchEnabled(bool filterBlockedIndexers = true)
|
public List<IIndexer> AutomaticSearchEnabled(bool filterBlockedIndexers = true)
|
||||||
{
|
{
|
||||||
var enabledIndexers = GetAvailableProviders().Where(n => ((IndexerDefinition)n.Definition).EnableSearch);
|
var enabledIndexers = GetAvailableProviders().Where(n => ((IndexerDefinition)n.Definition).EnableAutomaticSearch);
|
||||||
|
|
||||||
|
if (filterBlockedIndexers)
|
||||||
|
{
|
||||||
|
return FilterBlockedIndexers(enabledIndexers).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return enabledIndexers.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IIndexer> InteractiveSearchEnabled(bool filterBlockedIndexers = true)
|
||||||
|
{
|
||||||
|
var enabledIndexers = GetAvailableProviders().Where(n => ((IndexerDefinition)n.Definition).EnableInteractiveSearch);
|
||||||
|
|
||||||
if (filterBlockedIndexers)
|
if (filterBlockedIndexers)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,7 +66,8 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
return new IndexerDefinition
|
return new IndexerDefinition
|
||||||
{
|
{
|
||||||
EnableRss = false,
|
EnableRss = false,
|
||||||
EnableSearch = false,
|
EnableAutomaticSearch = false,
|
||||||
|
EnableInteractiveSearch = false,
|
||||||
Name = name,
|
Name = name,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = settings,
|
Settings = settings,
|
||||||
|
|
|
@ -54,7 +54,8 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||||
return new IndexerDefinition
|
return new IndexerDefinition
|
||||||
{
|
{
|
||||||
EnableRss = false,
|
EnableRss = false,
|
||||||
EnableSearch = false,
|
EnableAutomaticSearch = false,
|
||||||
|
EnableInteractiveSearch = false,
|
||||||
Name = name,
|
Name = name,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = settings,
|
Settings = settings,
|
||||||
|
|
|
@ -34,15 +34,7 @@ namespace NzbDrone.Core.Music
|
||||||
|
|
||||||
var albums = _albumService.GetAlbumsByArtist(artist.Id);
|
var albums = _albumService.GetAlbumsByArtist(artist.Id);
|
||||||
|
|
||||||
if (monitoringOptions.Monitored)
|
ToggleAlbumsMonitoredState(albums, monitoringOptions.Monitored);
|
||||||
{
|
|
||||||
ToggleAlbumsMonitoredState(albums, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ToggleAlbumsMonitoredState(albums, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO Add Other Options for Future/Exisitng/Missing Once we have a good way to check for Album Related Files.
|
//TODO Add Other Options for Future/Exisitng/Missing Once we have a good way to check for Album Related Files.
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,7 @@
|
||||||
<Compile Include="Datastore\Migration\005_metadata_profiles.cs" />
|
<Compile Include="Datastore\Migration\005_metadata_profiles.cs" />
|
||||||
<Compile Include="Datastore\Migration\004_add_various_qualities_in_profile.cs" />
|
<Compile Include="Datastore\Migration\004_add_various_qualities_in_profile.cs" />
|
||||||
<Compile Include="Datastore\Migration\003_add_medium_support.cs" />
|
<Compile Include="Datastore\Migration\003_add_medium_support.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\006_separate_automatic_and_interactive_search.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationDbFactory.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationDbFactory.cs" />
|
||||||
|
|
|
@ -28,7 +28,8 @@ namespace NzbDrone.Integration.Test
|
||||||
Indexers.Post(new Lidarr.Api.V1.Indexers.IndexerResource
|
Indexers.Post(new Lidarr.Api.V1.Indexers.IndexerResource
|
||||||
{
|
{
|
||||||
EnableRss = false,
|
EnableRss = false,
|
||||||
EnableSearch = false,
|
EnableInteractiveSearch = false,
|
||||||
|
EnableAutomaticSearch = false,
|
||||||
ConfigContract = nameof(NewznabSettings),
|
ConfigContract = nameof(NewznabSettings),
|
||||||
Implementation = nameof(Newznab),
|
Implementation = nameof(Newznab),
|
||||||
Name = "NewznabTest",
|
Name = "NewznabTest",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue