diff --git a/frontend/src/History/HistoryConnector.js b/frontend/src/History/HistoryConnector.js
index 4cda67a5f..259123fe6 100644
--- a/frontend/src/History/HistoryConnector.js
+++ b/frontend/src/History/HistoryConnector.js
@@ -10,12 +10,12 @@ import History from './History';
function createMapStateToProps() {
return createSelector(
(state) => state.history,
- (state) => state.movies,
- (history, movies) => {
+ (state) => state.indexers,
+ (history, indexers) => {
return {
- isMoviesFetching: movies.isFetching,
- isMoviesPopulated: movies.isPopulated,
- moviesError: movies.error,
+ isMoviesFetching: indexers.isFetching,
+ isMoviesPopulated: indexers.isPopulated,
+ moviesError: indexers.error,
...history
};
}
diff --git a/frontend/src/History/HistoryRow.js b/frontend/src/History/HistoryRow.js
index 0bf96cb9e..bff4533d3 100644
--- a/frontend/src/History/HistoryRow.js
+++ b/frontend/src/History/HistoryRow.js
@@ -5,8 +5,6 @@ import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellCo
import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableRow from 'Components/Table/TableRow';
import { icons } from 'Helpers/Props';
-import MovieLanguage from 'Indexer/MovieLanguage';
-import MovieQuality from 'Indexer/MovieQuality';
import MovieTitleLink from 'Indexer/MovieTitleLink';
import HistoryDetailsModal from './Details/HistoryDetailsModal';
import HistoryEventTypeCell from './HistoryEventTypeCell';
@@ -52,9 +50,6 @@ class HistoryRow extends Component {
render() {
const {
movie,
- quality,
- languages,
- qualityCutoffNotMet,
eventType,
sourceTitle,
date,
@@ -93,34 +88,13 @@ class HistoryRow extends Component {
);
}
- if (name === 'movies.sortTitle') {
+ if (name === 'indexer') {
return (
-
-
-
- );
- }
-
- if (name === 'languages') {
- return (
-
-
-
- );
- }
-
- if (name === 'quality') {
- return (
-
-
+
+ {movie.name}
);
}
@@ -134,39 +108,6 @@ class HistoryRow extends Component {
);
}
- if (name === 'downloadClient') {
- return (
-
- {data.downloadClient}
-
- );
- }
-
- if (name === 'indexer') {
- return (
-
- {data.indexer}
-
- );
- }
-
- if (name === 'releaseGroup') {
- return (
-
- {data.releaseGroup}
-
- );
- }
-
if (name === 'details') {
return (
Since(DateTime date, HistoryEventType? eventType);
}
- public class HistoryService : IHistoryService
+ public class HistoryService : IHistoryService,
+ IHandle>,
+ IHandle
{
private readonly IHistoryRepository _historyRepository;
private readonly Logger _logger;
@@ -74,5 +79,23 @@ namespace NzbDrone.Core.History
{
return _historyRepository.Since(date, eventType);
}
+
+ public void Handle(IndexerQueryEvent message)
+ {
+ var history = new History
+ {
+ Date = DateTime.UtcNow,
+ IndexerId = message.IndexerId,
+ EventType = HistoryEventType.IndexerQuery,
+ SourceTitle = message.Query
+ };
+
+ _historyRepository.Insert(history);
+ }
+
+ public void Handle(ProviderDeletedEvent message)
+ {
+ _historyRepository.DeleteForIndexers(new List { message.ProviderId });
+ }
}
}
diff --git a/src/NzbDrone.Core/IndexerSearch/NzbSearchService.cs b/src/NzbDrone.Core/IndexerSearch/NzbSearchService.cs
index df0e64102..d9cca36d7 100644
--- a/src/NzbDrone.Core/IndexerSearch/NzbSearchService.cs
+++ b/src/NzbDrone.Core/IndexerSearch/NzbSearchService.cs
@@ -8,6 +8,7 @@ using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Common.TPL;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.IndexerSearch.Definitions;
+using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.IndexerSearch
@@ -20,12 +21,15 @@ namespace NzbDrone.Core.IndexerSearch
public class NzbSearchService : ISearchForNzb
{
+ private readonly IEventAggregator _eventAggregator;
private readonly IIndexerFactory _indexerFactory;
private readonly Logger _logger;
- public NzbSearchService(IIndexerFactory indexerFactory,
+ public NzbSearchService(IEventAggregator eventAggregator,
+ IIndexerFactory indexerFactory,
Logger logger)
{
+ _eventAggregator = eventAggregator;
_indexerFactory = indexerFactory;
_logger = logger;
}
@@ -87,6 +91,8 @@ namespace NzbDrone.Core.IndexerSearch
{
var indexerReports = searchAction(indexerLocal);
+ _eventAggregator.PublishEvent(new IndexerQueryEvent(indexer.Definition.Id, criteriaBase.QueryTitles.Join(", ")));
+
lock (reports)
{
reports.AddRange(indexerReports);
diff --git a/src/NzbDrone.Core/Indexers/IndexerFactory.cs b/src/NzbDrone.Core/Indexers/IndexerFactory.cs
index 2f767f2fb..b8f4187f4 100644
--- a/src/NzbDrone.Core/Indexers/IndexerFactory.cs
+++ b/src/NzbDrone.Core/Indexers/IndexerFactory.cs
@@ -45,6 +45,7 @@ namespace NzbDrone.Core.Indexers
definition.Protocol = provider.Protocol;
definition.Privacy = provider.Privacy;
definition.SupportsRss = provider.SupportsRss;
+ definition.SupportsSearch = provider.SupportsSearch;
definition.Capabilities = provider.Capabilities;
}
diff --git a/src/NzbDrone.Core/Indexers/IndexerQueryEvent.cs b/src/NzbDrone.Core/Indexers/IndexerQueryEvent.cs
new file mode 100644
index 000000000..dada6bb30
--- /dev/null
+++ b/src/NzbDrone.Core/Indexers/IndexerQueryEvent.cs
@@ -0,0 +1,16 @@
+using NzbDrone.Common.Messaging;
+
+namespace NzbDrone.Core.Indexers
+{
+ public class IndexerQueryEvent : IEvent
+ {
+ public int IndexerId { get; set; }
+ public string Query { get; set; }
+
+ public IndexerQueryEvent(int indexerId, string query)
+ {
+ IndexerId = indexerId;
+ Query = query;
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/Indexers/IndexerRepository.cs b/src/NzbDrone.Core/Indexers/IndexerRepository.cs
index c4858f415..ace52631d 100644
--- a/src/NzbDrone.Core/Indexers/IndexerRepository.cs
+++ b/src/NzbDrone.Core/Indexers/IndexerRepository.cs
@@ -1,4 +1,4 @@
-using NzbDrone.Core.Datastore;
+using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.ThingiProvider;
diff --git a/src/Prowlarr.Api.V1/Search/SearchModule.cs b/src/Prowlarr.Api.V1/Search/SearchModule.cs
index 95321035d..5288bd104 100644
--- a/src/Prowlarr.Api.V1/Search/SearchModule.cs
+++ b/src/Prowlarr.Api.V1/Search/SearchModule.cs
@@ -1,7 +1,10 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Net;
+using Nancy.ModelBinding;
using NLog;
+using NzbDrone.Common.Extensions;
using NzbDrone.Core.Exceptions;
using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Parser.Model;
@@ -24,17 +27,19 @@ namespace Prowlarr.Api.V1.Search
private List GetAll()
{
- if (Request.Query.query.HasValue)
+ var request = this.Bind();
+
+ if (request.Query.IsNotNullOrWhiteSpace())
{
- var indexerIds = Request.Query.indexerIds.HasValue ? (List)Request.Query.indexerIds.split(',') : new List();
+ var indexerIds = request.IndexerIds ?? new List();
if (indexerIds.Count > 0)
{
- return GetSearchReleases(Request.Query.query, indexerIds);
+ return GetSearchReleases(request.Query, indexerIds);
}
else
{
- return GetSearchReleases(Request.Query.query, null);
+ return GetSearchReleases(request.Query, null);
}
}
diff --git a/src/Prowlarr.Api.V1/Search/SearchRequest.cs b/src/Prowlarr.Api.V1/Search/SearchRequest.cs
new file mode 100644
index 000000000..d8acfdfca
--- /dev/null
+++ b/src/Prowlarr.Api.V1/Search/SearchRequest.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace Prowlarr.Api.V1.Search
+{
+ public class SearchRequest
+ {
+ public List IndexerIds { get; set; }
+ public string Query { get; set; }
+ }
+}