History Improvements Round 1

This commit is contained in:
Qstick
2021-03-07 23:07:12 -05:00
parent 0fa526a1af
commit 9fab7d8328
54 changed files with 395 additions and 79 deletions

View File

@@ -70,6 +70,7 @@ import {
faLanguage as fasLanguage, faLanguage as fasLanguage,
faLaptop as fasLaptop, faLaptop as fasLaptop,
faLevelUpAlt as fasLevelUpAlt, faLevelUpAlt as fasLevelUpAlt,
faLock as fasLock,
faMedkit as fasMedkit, faMedkit as fasMedkit,
faMinus as fasMinus, faMinus as fasMinus,
faPause as fasPause, faPause as fasPause,
@@ -167,6 +168,7 @@ export const IN_CINEMAS = fasTicketAlt;
export const INFO = fasInfoCircle; export const INFO = fasInfoCircle;
export const INTERACTIVE = fasUser; export const INTERACTIVE = fasUser;
export const KEYBOARD = farKeyboard; export const KEYBOARD = farKeyboard;
export const LOCK = fasLock;
export const LOGOUT = fasSignOutAlt; export const LOGOUT = fasSignOutAlt;
export const MEDIA_INFO = farFileInvoice; export const MEDIA_INFO = farFileInvoice;
export const MISSING = fasExclamationTriangle; export const MISSING = fasExclamationTriangle;

View File

@@ -12,7 +12,7 @@ function HistoryDetails(props) {
data data
} = props; } = props;
if (eventType === 'indexerQuery') { if (eventType === 'indexerQuery' || eventType === 'indexerRss') {
const { const {
query, query,
queryResults, queryResults,
@@ -65,7 +65,8 @@ function HistoryDetails(props) {
if (eventType === 'releaseGrabbed') { if (eventType === 'releaseGrabbed') {
const { const {
source source,
title
} = data; } = data;
return ( return (
@@ -82,7 +83,32 @@ function HistoryDetails(props) {
!!data && !!data &&
<DescriptionListItem <DescriptionListItem
title={'Source'} title={'Source'}
data={source} data={source ? source : '-'}
/>
}
{
!!data &&
<DescriptionListItem
title={'Title'}
data={title ? title : '-'}
/>
}
</DescriptionList>
);
}
if (eventType === 'indexerAuth') {
return (
<DescriptionList
descriptionClassName={styles.description}
title={translate('Auth')}
>
{
!!indexer &&
<DescriptionListItem
title={translate('Indexer')}
data={indexer.name}
/> />
} }
</DescriptionList> </DescriptionList>

View File

@@ -16,6 +16,12 @@ function getHeaderTitle(eventType) {
switch (eventType) { switch (eventType) {
case 'indexerQuery': case 'indexerQuery':
return 'Indexer Query'; return 'Indexer Query';
case 'releaseGrabbed':
return 'Release Grabbed';
case 'indexerAuth':
return 'Indexer Auth Attempt';
case 'indexerRss':
return 'Indexer Rss Query';
default: default:
return 'Unknown'; return 'Unknown';
} }

View File

@@ -27,7 +27,7 @@ class History extends Component {
error, error,
isMoviesFetching, isMoviesFetching,
isMoviesPopulated, isMoviesPopulated,
moviesError, indexersError,
items, items,
columns, columns,
selectedFilterKey, selectedFilterKey,
@@ -40,7 +40,7 @@ class History extends Component {
const isFetchingAny = isFetching || isMoviesFetching; const isFetchingAny = isFetching || isMoviesFetching;
const isAllPopulated = isPopulated && (isMoviesPopulated || !items.length); const isAllPopulated = isPopulated && (isMoviesPopulated || !items.length);
const hasError = error || moviesError; const hasError = error || indexersError;
return ( return (
<PageContent title={translate('History')}> <PageContent title={translate('History')}>
@@ -140,7 +140,7 @@ History.propTypes = {
error: PropTypes.object, error: PropTypes.object,
isMoviesFetching: PropTypes.bool.isRequired, isMoviesFetching: PropTypes.bool.isRequired,
isMoviesPopulated: PropTypes.bool.isRequired, isMoviesPopulated: PropTypes.bool.isRequired,
moviesError: PropTypes.object, indexersError: PropTypes.object,
items: PropTypes.arrayOf(PropTypes.object).isRequired, items: PropTypes.arrayOf(PropTypes.object).isRequired,
columns: PropTypes.arrayOf(PropTypes.object).isRequired, columns: PropTypes.arrayOf(PropTypes.object).isRequired,
selectedFilterKey: PropTypes.string.isRequired, selectedFilterKey: PropTypes.string.isRequired,

View File

@@ -15,7 +15,7 @@ function createMapStateToProps() {
return { return {
isMoviesFetching: indexers.isFetching, isMoviesFetching: indexers.isFetching,
isMoviesPopulated: indexers.isPopulated, isMoviesPopulated: indexers.isPopulated,
moviesError: indexers.error, indexersError: indexers.error,
...history ...history
}; };
} }

View File

@@ -11,6 +11,10 @@ function getIconName(eventType) {
return icons.SEARCH; return icons.SEARCH;
case 'releaseGrabbed': case 'releaseGrabbed':
return icons.DOWNLOAD; return icons.DOWNLOAD;
case 'indexerAuth':
return icons.LOCK;
case 'indexerRss':
return icons.RSS;
default: default:
return icons.UNKNOWN; return icons.UNKNOWN;
} }
@@ -31,6 +35,10 @@ function getTooltip(eventType, data, indexer) {
return `Query "${data.query}" sent to ${indexer.name}`; return `Query "${data.query}" sent to ${indexer.name}`;
case 'releaseGrabbed': case 'releaseGrabbed':
return `Release grabbed from ${indexer.name}`; return `Release grabbed from ${indexer.name}`;
case 'indexerAuth':
return `Auth attempted for ${indexer.name}`;
case 'indexerRss':
return `RSS query for ${indexer.name}`;
default: default:
return 'Unknown event'; return 'Unknown event';
} }

View File

@@ -16,6 +16,18 @@
width: 110px; width: 110px;
} }
.categories {
composes: cell from '~Components/Table/Cells/TableRowCell.css';
width: 110px;
}
.source {
composes: cell from '~Components/Table/Cells/TableRowCell.css';
width: 110px;
}
.details { .details {
composes: cell from '~Components/Table/Cells/TableRowCell.css'; composes: cell from '~Components/Table/Cells/TableRowCell.css';

View File

@@ -117,6 +117,21 @@ class HistoryRow extends Component {
); );
} }
if (name === 'categories') {
return (
<TableRowCell
key={name}
className={styles.indexer}
>
{
data.categories ?
data.categories :
null
}
</TableRowCell>
);
}
if (name === 'successful') { if (name === 'successful') {
return ( return (
<TableRowCell <TableRowCell
@@ -128,6 +143,21 @@ class HistoryRow extends Component {
); );
} }
if (name === 'source') {
return (
<TableRowCell
key={name}
className={styles.indexer}
>
{
data.source ?
data.source :
null
}
</TableRowCell>
);
}
if (name === 'elapsedTime') { if (name === 'elapsedTime') {
return ( return (
<TableRowCell <TableRowCell

View File

@@ -61,6 +61,8 @@
.downloadLink { .downloadLink {
composes: link from '~Components/Link/Link.css'; composes: link from '~Components/Link/Link.css';
margin: 0 2px;
width: 22px;
color: $textColor; color: $textColor;
} }

View File

@@ -220,6 +220,13 @@ class SearchIndexRow extends Component {
title={'Grab'} title={'Grab'}
to={downloadUrl} to={downloadUrl}
/> />
<IconButton
className={styles.downloadLink}
name={icons.SAVE}
title={'Save'}
to={downloadUrl}
/>
</VirtualTableRowCell> </VirtualTableRowCell>
); );
} }

View File

@@ -46,6 +46,12 @@ export const defaultState = {
isSortable: false, isSortable: false,
isVisible: true isVisible: true
}, },
{
name: 'categories',
label: 'Categories',
isSortable: false,
isVisible: true
},
{ {
name: 'date', name: 'date',
label: translate('Date'), label: translate('Date'),
@@ -56,7 +62,13 @@ export const defaultState = {
name: 'successful', name: 'successful',
label: 'Successful', label: 'Successful',
isSortable: false, isSortable: false,
isVisible: true isVisible: false
},
{
name: 'source',
label: 'Source',
isSortable: false,
isVisible: false
}, },
{ {
name: 'elapsedTime', name: 'elapsedTime',

View File

@@ -2,6 +2,7 @@ using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Test.IndexerTests namespace NzbDrone.Core.Test.IndexerTests
{ {
@@ -17,8 +18,8 @@ namespace NzbDrone.Core.Test.IndexerTests
public int _supportedPageSize; public int _supportedPageSize;
public override int PageSize => _supportedPageSize; public override int PageSize => _supportedPageSize;
public TestIndexer(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public TestIndexer(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -23,6 +23,9 @@ namespace NzbDrone.Core.History
{ {
Unknown = 0, Unknown = 0,
ReleaseGrabbed = 1, ReleaseGrabbed = 1,
IndexerQuery = 2 IndexerQuery = 2,
IndexerRss = 3,
IndexerAuth = 4,
IndexerCapabilities = 5
} }
} }

View File

@@ -5,6 +5,8 @@ using NLog;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.Events; using NzbDrone.Core.Indexers.Events;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.ThingiProvider.Events; using NzbDrone.Core.ThingiProvider.Events;
@@ -26,7 +28,8 @@ namespace NzbDrone.Core.History
public class HistoryService : IHistoryService, public class HistoryService : IHistoryService,
IHandle<ProviderDeletedEvent<IIndexer>>, IHandle<ProviderDeletedEvent<IIndexer>>,
IHandle<IndexerQueryEvent>, IHandle<IndexerQueryEvent>,
IHandle<IndexerDownloadEvent> IHandle<IndexerDownloadEvent>,
IHandle<IndexerAuthEvent>
{ {
private readonly IHistoryRepository _historyRepository; private readonly IHistoryRepository _historyRepository;
private readonly Logger _logger; private readonly Logger _logger;
@@ -88,11 +91,42 @@ namespace NzbDrone.Core.History
{ {
Date = DateTime.UtcNow, Date = DateTime.UtcNow,
IndexerId = message.IndexerId, IndexerId = message.IndexerId,
EventType = HistoryEventType.IndexerQuery EventType = message.Query.RssSearch ? HistoryEventType.IndexerRss : HistoryEventType.IndexerQuery
}; };
if (message.Query is MovieSearchCriteria)
{
history.Data.Add("ImdbId", ((MovieSearchCriteria)message.Query).ImdbId ?? string.Empty);
history.Data.Add("TmdbId", ((MovieSearchCriteria)message.Query).TmdbId?.ToString() ?? string.Empty);
history.Data.Add("TraktId", ((MovieSearchCriteria)message.Query).TraktId?.ToString() ?? string.Empty);
}
if (message.Query is TvSearchCriteria)
{
history.Data.Add("ImdbId", ((TvSearchCriteria)message.Query).ImdbId ?? string.Empty);
history.Data.Add("TvdbId", ((TvSearchCriteria)message.Query).TvdbId?.ToString() ?? string.Empty);
history.Data.Add("TraktId", ((TvSearchCriteria)message.Query).TraktId?.ToString() ?? string.Empty);
history.Data.Add("RId", ((TvSearchCriteria)message.Query).RId?.ToString() ?? string.Empty);
history.Data.Add("TvMazeId", ((TvSearchCriteria)message.Query).TvMazeId?.ToString() ?? string.Empty);
history.Data.Add("Season", ((TvSearchCriteria)message.Query).Season?.ToString() ?? string.Empty);
history.Data.Add("Episode", ((TvSearchCriteria)message.Query).Episode ?? string.Empty);
}
if (message.Query is MusicSearchCriteria)
{
history.Data.Add("Artist", ((MusicSearchCriteria)message.Query).Artist ?? string.Empty);
history.Data.Add("Album", ((MusicSearchCriteria)message.Query).Album ?? string.Empty);
}
if (message.Query is BookSearchCriteria)
{
history.Data.Add("Author", ((BookSearchCriteria)message.Query).Author ?? string.Empty);
history.Data.Add("Title", ((BookSearchCriteria)message.Query).Title ?? string.Empty);
}
history.Data.Add("ElapsedTime", message.Time.ToString()); history.Data.Add("ElapsedTime", message.Time.ToString());
history.Data.Add("Query", message.Query.SearchTerm ?? string.Empty); history.Data.Add("Query", message.Query.SearchTerm ?? string.Empty);
history.Data.Add("QueryType", message.Query.SearchType ?? string.Empty);
history.Data.Add("Categories", string.Join(",", message.Query.Categories) ?? string.Empty); history.Data.Add("Categories", string.Join(",", message.Query.Categories) ?? string.Empty);
history.Data.Add("Source", message.Query.Source ?? string.Empty); history.Data.Add("Source", message.Query.Source ?? string.Empty);
history.Data.Add("Successful", message.Successful.ToString()); history.Data.Add("Successful", message.Successful.ToString());
@@ -112,12 +146,27 @@ namespace NzbDrone.Core.History
history.Data.Add("Successful", message.Successful.ToString()); history.Data.Add("Successful", message.Successful.ToString());
history.Data.Add("Source", message.Source ?? string.Empty); history.Data.Add("Source", message.Source ?? string.Empty);
history.Data.Add("GrabMethod", message.Redirect ? "Proxy" : "Redirect"); history.Data.Add("GrabMethod", message.Redirect ? "Redirect" : "Proxy");
history.Data.Add("Title", message.Title); history.Data.Add("Title", message.Title);
_historyRepository.Insert(history); _historyRepository.Insert(history);
} }
public void Handle(IndexerAuthEvent message)
{
var history = new History
{
Date = DateTime.UtcNow,
IndexerId = message.IndexerId,
EventType = HistoryEventType.IndexerAuth
};
history.Data.Add("Successful", message.Successful.ToString());
history.Data.Add("ElapsedTime", message.Time.ToString());
_historyRepository.Insert(history);
}
public void Handle(ProviderDeletedEvent<IIndexer> message) public void Handle(ProviderDeletedEvent<IIndexer> message)
{ {
_historyRepository.DeleteForIndexers(new List<int> { message.ProviderId }); _historyRepository.DeleteForIndexers(new List<int> { message.ProviderId });

View File

@@ -1,8 +1,23 @@
using NzbDrone.Common.Extensions;
namespace NzbDrone.Core.IndexerSearch.Definitions namespace NzbDrone.Core.IndexerSearch.Definitions
{ {
public class BookSearchCriteria : SearchCriteriaBase public class BookSearchCriteria : SearchCriteriaBase
{ {
public string Author { get; set; } public string Author { get; set; }
public string Title { get; set; } public string Title { get; set; }
public override bool RssSearch
{
get
{
if (SearchTerm.IsNullOrWhiteSpace() && Author.IsNullOrWhiteSpace() && Title.IsNullOrWhiteSpace())
{
return true;
}
return false;
}
}
} }
} }

View File

@@ -1,3 +1,5 @@
using NzbDrone.Common.Extensions;
namespace NzbDrone.Core.IndexerSearch.Definitions namespace NzbDrone.Core.IndexerSearch.Definitions
{ {
public class MovieSearchCriteria : SearchCriteriaBase public class MovieSearchCriteria : SearchCriteriaBase
@@ -5,5 +7,18 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
public string ImdbId { get; set; } public string ImdbId { get; set; }
public int? TmdbId { get; set; } public int? TmdbId { get; set; }
public int? TraktId { get; set; } public int? TraktId { get; set; }
public override bool RssSearch
{
get
{
if (SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TmdbId.HasValue && !TraktId.HasValue)
{
return true;
}
return false;
}
}
} }
} }

View File

@@ -1,3 +1,6 @@
using System.Collections.Generic;
using NzbDrone.Common.Extensions;
namespace NzbDrone.Core.IndexerSearch.Definitions namespace NzbDrone.Core.IndexerSearch.Definitions
{ {
public class MusicSearchCriteria : SearchCriteriaBase public class MusicSearchCriteria : SearchCriteriaBase
@@ -5,5 +8,18 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
public string Album { get; set; } public string Album { get; set; }
public string Artist { get; set; } public string Artist { get; set; }
public string Label { get; set; } public string Label { get; set; }
public override bool RssSearch
{
get
{
if (SearchTerm.IsNullOrWhiteSpace() && Album.IsNullOrWhiteSpace() && Artist.IsNullOrWhiteSpace() && Label.IsNullOrWhiteSpace())
{
return true;
}
return false;
}
}
} }
} }

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using NzbDrone.Common.Extensions;
namespace NzbDrone.Core.IndexerSearch.Definitions namespace NzbDrone.Core.IndexerSearch.Definitions
{ {
@@ -24,6 +25,19 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
return $"{{Term: {SearchTerm}, Offset: {Offset ?? 0}, Limit: {Limit ?? 0}, Categories: [{string.Join(", ", Categories)}]}}"; return $"{{Term: {SearchTerm}, Offset: {Offset ?? 0}, Limit: {Limit ?? 0}, Categories: [{string.Join(", ", Categories)}]}}";
} }
public virtual bool RssSearch
{
get
{
if (SearchTerm.IsNullOrWhiteSpace())
{
return true;
}
return false;
}
}
public string SanitizedSearchTerm public string SanitizedSearchTerm
{ {
get get

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
@@ -19,6 +20,19 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
public string SanitizedTvSearchString => (SanitizedSearchTerm + " " + EpisodeSearchString).Trim(); public string SanitizedTvSearchString => (SanitizedSearchTerm + " " + EpisodeSearchString).Trim();
public string EpisodeSearchString => GetEpisodeSearchString(); public string EpisodeSearchString => GetEpisodeSearchString();
public override bool RssSearch
{
get
{
if (SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TvdbId.HasValue && !RId.HasValue && !TraktId.HasValue && !TvMazeId.HasValue)
{
return true;
}
return false;
}
}
private string GetEpisodeSearchString() private string GetEpisodeSearchString()
{ {
if (Season == 0) if (Season == 0)

View File

@@ -156,7 +156,7 @@ namespace NzbDrone.Core.IndexerSearch
.ToList(); .ToList();
} }
_logger.ProgressInfo("Searching {0} indexers for {1}", indexers.Count, criteriaBase.SearchTerm); _logger.ProgressInfo("Searching {0} indexers for {1}", indexers.Count, criteriaBase.ToString());
var tasks = indexers.Select(x => DispatchIndexer(searchAction, x, criteriaBase)); var tasks = indexers.Select(x => DispatchIndexer(searchAction, x, criteriaBase));

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
@@ -11,8 +12,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override string BaseUrl => "https://alpharatio.cc/"; public override string BaseUrl => "https://alpharatio.cc/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public AlphaRatio(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public AlphaRatio(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -13,6 +13,7 @@ using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -30,8 +31,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public AnimeTorrents(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public AnimeTorrents(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }
@@ -68,7 +69,7 @@ namespace NzbDrone.Core.Indexers.Definitions
.SetHeader("Content-Type", "multipart/form-data") .SetHeader("Content-Type", "multipart/form-data")
.Build(); .Build();
var response = await _httpClient.ExecuteAsync(authLoginRequest); var response = await ExecuteAuth(authLoginRequest);
if (response.Content != null && response.Content.Contains("logout.php")) if (response.Content != null && response.Content.Contains("logout.php"))
{ {

View File

@@ -5,6 +5,7 @@ using FluentValidation.Results;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions.Avistaz namespace NzbDrone.Core.Indexers.Definitions.Avistaz
{ {
@@ -21,10 +22,11 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public Avistaz(IIndexerRepository indexerRepository, public Avistaz(IIndexerRepository indexerRepository,
IHttpClient httpClient, IHttpClient httpClient,
IEventAggregator eventAggregator,
IIndexerStatusService indexerStatusService, IIndexerStatusService indexerStatusService,
IConfigService configService, IConfigService configService,
Logger logger) Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
_indexerRepository = indexerRepository; _indexerRepository = indexerRepository;
} }

View File

@@ -15,6 +15,7 @@ using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
@@ -31,8 +32,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public BakaBT(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public BakaBT(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.BroadcastheNet namespace NzbDrone.Core.Indexers.BroadcastheNet
{ {
@@ -18,8 +19,8 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
public override string BaseUrl => "http://api.broadcasthe.net/"; public override string BaseUrl => "http://api.broadcasthe.net/";
public BroadcastheNet(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public BroadcastheNet(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -1,6 +1,7 @@
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
@@ -10,8 +11,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override string BaseUrl => "https://brokenstones.club/"; public override string BaseUrl => "https://brokenstones.club/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public BrokenStones(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public BrokenStones(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -1,6 +1,7 @@
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
@@ -10,8 +11,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override string BaseUrl => "https://cgpeers.to/"; public override string BaseUrl => "https://cgpeers.to/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public CGPeers(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public CGPeers(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -8,6 +8,7 @@ using NzbDrone.Common.Cache;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerVersions; using NzbDrone.Core.IndexerVersions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
@@ -60,11 +61,12 @@ namespace NzbDrone.Core.Indexers.Cardigann
public Cardigann(IIndexerDefinitionUpdateService definitionService, public Cardigann(IIndexerDefinitionUpdateService definitionService,
IHttpClient httpClient, IHttpClient httpClient,
IEventAggregator eventAggregator,
IIndexerStatusService indexerStatusService, IIndexerStatusService indexerStatusService,
IConfigService configService, IConfigService configService,
ICacheManager cacheManager, ICacheManager cacheManager,
Logger logger) Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
_definitionService = definitionService; _definitionService = definitionService;
_generatorCache = cacheManager.GetRollingCache<CardigannRequestGenerator>(GetType(), "CardigannGeneratorCache", TimeSpan.FromMinutes(5)); _generatorCache = cacheManager.GetRollingCache<CardigannRequestGenerator>(GetType(), "CardigannGeneratorCache", TimeSpan.FromMinutes(5));

View File

@@ -13,6 +13,7 @@ using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -28,8 +29,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public DigitalCore(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public DigitalCore(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.FileList namespace NzbDrone.Core.Indexers.FileList
{ {
@@ -16,8 +17,8 @@ namespace NzbDrone.Core.Indexers.FileList
public override bool SupportsRedirect => true; public override bool SupportsRedirect => true;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public FileList(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public FileList(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -3,6 +3,7 @@ using System.Threading.Tasks;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Gazelle namespace NzbDrone.Core.Indexers.Gazelle
{ {
@@ -17,10 +18,11 @@ namespace NzbDrone.Core.Indexers.Gazelle
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public Gazelle(IHttpClient httpClient, public Gazelle(IHttpClient httpClient,
IEventAggregator eventAggregator,
IIndexerStatusService indexerStatusService, IIndexerStatusService indexerStatusService,
IConfigService configService, IConfigService configService,
Logger logger) Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }
@@ -69,7 +71,7 @@ namespace NzbDrone.Core.Indexers.Gazelle
.Accept(HttpAccept.Json) .Accept(HttpAccept.Json)
.Build(); .Build();
var response = await _httpClient.ExecuteAsync(authLoginRequest); var response = await ExecuteAuth(authLoginRequest);
cookies = response.GetCookies(); cookies = response.GetCookies();

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.HDBits namespace NzbDrone.Core.Indexers.HDBits
{ {
@@ -16,8 +17,8 @@ namespace NzbDrone.Core.Indexers.HDBits
public override int PageSize => 30; public override int PageSize => 30;
public HDBits(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public HDBits(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -12,6 +12,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -29,8 +30,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public HDTorrents(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public HDTorrents(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }
@@ -63,7 +64,7 @@ namespace NzbDrone.Core.Indexers.Definitions
.SetHeader("Content-Type", "multipart/form-data") .SetHeader("Content-Type", "multipart/form-data")
.Build(); .Build();
var response = await _httpClient.ExecuteAsync(authLoginRequest); var response = await ExecuteAuth(authLoginRequest);
cookies = response.GetCookies(); cookies = response.GetCookies();
UpdateCookies(cookies, DateTime.Now + TimeSpan.FromDays(30)); UpdateCookies(cookies, DateTime.Now + TimeSpan.FromDays(30));

View File

@@ -6,6 +6,7 @@ using FluentValidation.Results;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Headphones namespace NzbDrone.Core.Indexers.Headphones
{ {
@@ -34,8 +35,8 @@ namespace NzbDrone.Core.Indexers.Headphones
return new HeadphonesRssParser(Capabilities.Categories); return new HeadphonesRssParser(Capabilities.Categories);
} }
public Headphones(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public Headphones(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -10,6 +10,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -26,8 +27,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public IPTorrents(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public IPTorrents(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -8,6 +8,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -24,8 +25,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public Milkie(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public Milkie(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -10,6 +10,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -26,8 +27,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public MyAnonamouse(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public MyAnonamouse(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -7,6 +7,7 @@ using NLog;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
@@ -97,8 +98,8 @@ namespace NzbDrone.Core.Indexers.Newznab
} }
} }
public Newznab(INewznabCapabilitiesProvider capabilitiesProvider, IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public Newznab(INewznabCapabilitiesProvider capabilitiesProvider, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
_capabilitiesProvider = capabilitiesProvider; _capabilitiesProvider = capabilitiesProvider;
} }

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
@@ -11,8 +12,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override string BaseUrl => "https://notwhat.cd/"; public override string BaseUrl => "https://notwhat.cd/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public NotWhatCD(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public NotWhatCD(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
@@ -11,8 +12,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override string BaseUrl => "https://orpheus.network/"; public override string BaseUrl => "https://orpheus.network/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public Orpheus(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public Orpheus(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -3,6 +3,7 @@ using NLog;
using NzbDrone.Common.Cache; using NzbDrone.Common.Cache;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.PassThePopcorn namespace NzbDrone.Core.Indexers.PassThePopcorn
{ {
@@ -20,11 +21,12 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
public override int PageSize => 50; public override int PageSize => 50;
public PassThePopcorn(IHttpClient httpClient, public PassThePopcorn(IHttpClient httpClient,
IEventAggregator eventAggregator,
ICacheManager cacheManager, ICacheManager cacheManager,
IIndexerStatusService indexerStatusService, IIndexerStatusService indexerStatusService,
IConfigService configService, IConfigService configService,
Logger logger) Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -3,6 +3,7 @@ using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Definitions.Avistaz; using NzbDrone.Core.Indexers.Definitions.Avistaz;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
@@ -12,8 +13,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override string BaseUrl => "https://privatehd.to/"; public override string BaseUrl => "https://privatehd.to/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public PrivateHD(IIndexerRepository indexerRepository, IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public PrivateHD(IIndexerRepository indexerRepository, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(indexerRepository, httpClient, indexerStatusService, configService, logger) : base(indexerRepository, httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -6,6 +6,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Exceptions; using NzbDrone.Core.Exceptions;
using NzbDrone.Core.Http.CloudFlare; using NzbDrone.Core.Http.CloudFlare;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Rarbg namespace NzbDrone.Core.Indexers.Rarbg
@@ -25,8 +26,8 @@ namespace NzbDrone.Core.Indexers.Rarbg
public override TimeSpan RateLimit => TimeSpan.FromSeconds(2); public override TimeSpan RateLimit => TimeSpan.FromSeconds(2);
public Rarbg(IRarbgTokenProvider tokenProvider, IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public Rarbg(IRarbgTokenProvider tokenProvider, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
_tokenProvider = tokenProvider; _tokenProvider = tokenProvider;
} }

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions namespace NzbDrone.Core.Indexers.Definitions
{ {
@@ -11,8 +12,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override string BaseUrl => "https://redacted.ch/"; public override string BaseUrl => "https://redacted.ch/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public Redacted(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public Redacted(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -14,6 +14,7 @@ using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -31,8 +32,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public RevolutionTT(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public RevolutionTT(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }
@@ -68,7 +69,7 @@ namespace NzbDrone.Core.Indexers.Definitions
.SetHeader("Content-Type", "multipart/form-data") .SetHeader("Content-Type", "multipart/form-data")
.Build(); .Build();
var response = await _httpClient.ExecuteAsync(authLoginRequest); var response = await ExecuteAuth(authLoginRequest);
if (response.Content != null && response.Content.Contains("/logout.php")) if (response.Content != null && response.Content.Contains("/logout.php"))
{ {

View File

@@ -11,6 +11,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -27,8 +28,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public SuperBits(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public SuperBits(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -9,6 +9,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -25,8 +26,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public TorrentDay(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public TorrentDay(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -13,6 +13,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -30,8 +31,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public TorrentLeech(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public TorrentLeech(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }
@@ -64,7 +65,7 @@ namespace NzbDrone.Core.Indexers.Definitions
.SetHeader("Content-Type", "multipart/form-data") .SetHeader("Content-Type", "multipart/form-data")
.Build(); .Build();
var response = await _httpClient.ExecuteAsync(authLoginRequest); var response = await ExecuteAuth(authLoginRequest);
cookies = response.GetCookies(); cookies = response.GetCookies();
UpdateCookies(cookies, DateTime.Now + TimeSpan.FromDays(30)); UpdateCookies(cookies, DateTime.Now + TimeSpan.FromDays(30));

View File

@@ -2,6 +2,7 @@ using System;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.TorrentPotato namespace NzbDrone.Core.Indexers.TorrentPotato
{ {
@@ -14,8 +15,8 @@ namespace NzbDrone.Core.Indexers.TorrentPotato
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override TimeSpan RateLimit => TimeSpan.FromSeconds(2); public override TimeSpan RateLimit => TimeSpan.FromSeconds(2);
public TorrentPotato(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public TorrentPotato(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -12,6 +12,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser; using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -30,8 +31,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities(); public override IndexerCapabilities Capabilities => SetCapabilities();
public TorrentSeeds(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public TorrentSeeds(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
} }

View File

@@ -8,6 +8,7 @@ using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Newznab; using NzbDrone.Core.Indexers.Newznab;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
@@ -48,8 +49,8 @@ namespace NzbDrone.Core.Indexers.Torznab
} }
} }
public Torznab(INewznabCapabilitiesProvider capabilitiesProvider, IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public Torznab(INewznabCapabilitiesProvider capabilitiesProvider, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(httpClient, indexerStatusService, configService, logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger)
{ {
_capabilitiesProvider = capabilitiesProvider; _capabilitiesProvider = capabilitiesProvider;
} }

View File

@@ -0,0 +1,18 @@
using NzbDrone.Common.Messaging;
namespace NzbDrone.Core.Indexers.Events
{
public class IndexerAuthEvent : IEvent
{
public int IndexerId { get; set; }
public bool Successful { get; set; }
public long Time { get; set; }
public IndexerAuthEvent(int indexerId, bool successful, long time)
{
IndexerId = indexerId;
Successful = successful;
Time = time;
}
}
}

View File

@@ -0,0 +1,16 @@
using NzbDrone.Common.Messaging;
namespace NzbDrone.Core.Indexers.Events
{
public class IndexerCapsEvent : IEvent
{
public int IndexerId { get; set; }
public bool Successful { get; set; }
public IndexerCapsEvent(int indexerId, bool successful)
{
IndexerId = indexerId;
Successful = successful;
}
}
}

View File

@@ -10,8 +10,10 @@ using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Http.CloudFlare; using NzbDrone.Core.Http.CloudFlare;
using NzbDrone.Core.Indexers.Events;
using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
@@ -23,6 +25,7 @@ namespace NzbDrone.Core.Indexers
protected const int MaxNumResultsPerQuery = 1000; protected const int MaxNumResultsPerQuery = 1000;
protected readonly IHttpClient _httpClient; protected readonly IHttpClient _httpClient;
protected readonly IEventAggregator _eventAggregator;
public IDictionary<string, string> Cookies { get; set; } public IDictionary<string, string> Cookies { get; set; }
public override bool SupportsRss => true; public override bool SupportsRss => true;
@@ -37,10 +40,11 @@ namespace NzbDrone.Core.Indexers
public abstract IIndexerRequestGenerator GetRequestGenerator(); public abstract IIndexerRequestGenerator GetRequestGenerator();
public abstract IParseIndexerResponse GetParser(); public abstract IParseIndexerResponse GetParser();
public HttpIndexerBase(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) public HttpIndexerBase(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(indexerStatusService, configService, logger) : base(indexerStatusService, configService, logger)
{ {
_httpClient = httpClient; _httpClient = httpClient;
_eventAggregator = eventAggregator;
} }
public override Task<IndexerPageableQueryResult> Fetch(MovieSearchCriteria searchCriteria) public override Task<IndexerPageableQueryResult> Fetch(MovieSearchCriteria searchCriteria)
@@ -477,6 +481,17 @@ namespace NzbDrone.Core.Indexers
return new IndexerResponse(request, response, stopWatch.ElapsedMilliseconds); return new IndexerResponse(request, response, stopWatch.ElapsedMilliseconds);
} }
protected HttpResponse ExecuteAuth(HttpRequest request)
{
var stopWatch = Stopwatch.StartNew();
var response = _httpClient.Execute(request);
stopWatch.Stop();
_eventAggregator.PublishEvent(new IndexerAuthEvent(Definition.Id, !response.HasHttpError, stopWatch.ElapsedMilliseconds));
return response;
}
protected override async Task Test(List<ValidationFailure> failures) protected override async Task Test(List<ValidationFailure> failures)
{ {
failures.AddIfNotNull(await TestConnection()); failures.AddIfNotNull(await TestConnection());