mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Indexer Cleanup
This commit is contained in:
@@ -30,8 +30,6 @@ function createMapStateToProps() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(values);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
value,
|
value,
|
||||||
values
|
values
|
||||||
|
@@ -3,7 +3,7 @@ import React, { Component } from 'react';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import withScrollPosition from 'Components/withScrollPosition';
|
import withScrollPosition from 'Components/withScrollPosition';
|
||||||
import { fetchReleases, setReleasesFilter, setReleasesSort, setReleasesTableOption } from 'Store/Actions/releaseActions';
|
import { cancelFetchReleases, clearReleases, fetchReleases, setReleasesFilter, setReleasesSort, setReleasesTableOption } from 'Store/Actions/releaseActions';
|
||||||
import scrollPositions from 'Store/scrollPositions';
|
import scrollPositions from 'Store/scrollPositions';
|
||||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
import createReleaseClientSideCollectionItemsSelector from 'Store/Selectors/createReleaseClientSideCollectionItemsSelector';
|
import createReleaseClientSideCollectionItemsSelector from 'Store/Selectors/createReleaseClientSideCollectionItemsSelector';
|
||||||
@@ -44,12 +44,25 @@ function createMapDispatchToProps(dispatch, props) {
|
|||||||
|
|
||||||
onSearchPress(payload) {
|
onSearchPress(payload) {
|
||||||
dispatch(fetchReleases(payload));
|
dispatch(fetchReleases(payload));
|
||||||
|
},
|
||||||
|
|
||||||
|
dispatchCancelFetchReleases() {
|
||||||
|
dispatch(cancelFetchReleases());
|
||||||
|
},
|
||||||
|
|
||||||
|
dispatchClearReleases() {
|
||||||
|
dispatch(clearReleases());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class SearchIndexConnector extends Component {
|
class SearchIndexConnector extends Component {
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.props.dispatchCancelFetchReleases();
|
||||||
|
this.props.dispatchClearReleases();
|
||||||
|
}
|
||||||
|
|
||||||
onScroll = ({ scrollTop }) => {
|
onScroll = ({ scrollTop }) => {
|
||||||
scrollPositions.movieIndex = scrollTop;
|
scrollPositions.movieIndex = scrollTop;
|
||||||
}
|
}
|
||||||
@@ -70,6 +83,8 @@ class SearchIndexConnector extends Component {
|
|||||||
SearchIndexConnector.propTypes = {
|
SearchIndexConnector.propTypes = {
|
||||||
isSmallScreen: PropTypes.bool.isRequired,
|
isSmallScreen: PropTypes.bool.isRequired,
|
||||||
onSearchPress: PropTypes.func.isRequired,
|
onSearchPress: PropTypes.func.isRequired,
|
||||||
|
dispatchCancelFetchReleases: PropTypes.func.isRequired,
|
||||||
|
dispatchClearReleases: PropTypes.func.isRequired,
|
||||||
items: PropTypes.arrayOf(PropTypes.object)
|
items: PropTypes.arrayOf(PropTypes.object)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -18,7 +18,6 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
|
|||||||
Subject.Settings = new FileListSettings()
|
Subject.Settings = new FileListSettings()
|
||||||
{
|
{
|
||||||
BaseUrl = "http://127.0.0.1:1234/",
|
BaseUrl = "http://127.0.0.1:1234/",
|
||||||
Categories = new[] { 1, 2 },
|
|
||||||
Passkey = "abcd",
|
Passkey = "abcd",
|
||||||
Username = "somename"
|
Username = "somename"
|
||||||
};
|
};
|
||||||
|
@@ -19,7 +19,6 @@ namespace NzbDrone.Core.Test.IndexerTests.HDBitsTests
|
|||||||
Subject.Settings = new HDBitsSettings()
|
Subject.Settings = new HDBitsSettings()
|
||||||
{
|
{
|
||||||
BaseUrl = "http://127.0.0.1:1234/",
|
BaseUrl = "http://127.0.0.1:1234/",
|
||||||
Categories = new[] { 1, 2 },
|
|
||||||
ApiKey = "abcd",
|
ApiKey = "abcd",
|
||||||
Username = "somename"
|
Username = "somename"
|
||||||
};
|
};
|
||||||
|
@@ -16,16 +16,14 @@ namespace NzbDrone.Core.Indexers.AwesomeHD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AwesomeHDSettings : ITorrentIndexerSettings
|
public class AwesomeHDSettings : IIndexerSettings
|
||||||
{
|
{
|
||||||
private static readonly AwesomeHDSettingsValidator Validator = new AwesomeHDSettingsValidator();
|
private static readonly AwesomeHDSettingsValidator Validator = new AwesomeHDSettingsValidator();
|
||||||
|
|
||||||
public AwesomeHDSettings()
|
public AwesomeHDSettings()
|
||||||
{
|
{
|
||||||
BaseUrl = "https://awesome-hd.me";
|
BaseUrl = "https://awesome-hd.me";
|
||||||
MinimumSeeders = 0;
|
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since you Passkey will be sent to that host.")]
|
[FieldDefinition(0, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since you Passkey will be sent to that host.")]
|
||||||
@@ -37,12 +35,6 @@ namespace NzbDrone.Core.Indexers.AwesomeHD
|
|||||||
[FieldDefinition(2, Label = "Passkey", Privacy = PrivacyLevel.ApiKey)]
|
[FieldDefinition(2, Label = "Passkey", Privacy = PrivacyLevel.ApiKey)]
|
||||||
public string Passkey { get; set; }
|
public string Passkey { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(3, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(4, Type = FieldType.TagSelect, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Prowlarr/Prowlarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
|
||||||
public IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@@ -19,16 +19,16 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
|
|
||||||
if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace())
|
if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
pageableRequests.Add(GetRequest("search-torrents", string.Format("&type=imdb&query={0}", searchCriteria.ImdbId)));
|
pageableRequests.Add(GetRequest("search-torrents", searchCriteria.Categories, string.Format("&type=imdb&query={0}", searchCriteria.ImdbId)));
|
||||||
}
|
}
|
||||||
else if (searchCriteria.SearchTerm.IsNotNullOrWhiteSpace())
|
else if (searchCriteria.SearchTerm.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
var titleYearSearchQuery = string.Format("{0}", searchCriteria.SearchTerm);
|
var titleYearSearchQuery = string.Format("{0}", searchCriteria.SearchTerm);
|
||||||
pageableRequests.Add(GetRequest("search-torrents", string.Format("&type=name&query={0}", titleYearSearchQuery.Trim())));
|
pageableRequests.Add(GetRequest("search-torrents", searchCriteria.Categories, string.Format("&type=name&query={0}", titleYearSearchQuery.Trim())));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pageableRequests.Add(GetRequest("latest-torrents", ""));
|
pageableRequests.Add(GetRequest("latest-torrents", searchCriteria.Categories, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
@@ -54,9 +54,9 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
return new IndexerPageableRequestChain();
|
return new IndexerPageableRequestChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetRequest(string searchType, string parameters)
|
private IEnumerable<IndexerRequest> GetRequest(string searchType, int[] categories, string parameters)
|
||||||
{
|
{
|
||||||
var categoriesQuery = string.Join(",", Settings.Categories.Distinct());
|
var categoriesQuery = string.Join(",", categories.Distinct());
|
||||||
|
|
||||||
var baseUrl = string.Format("{0}/api.php?action={1}&category={2}&username={3}&passkey={4}{5}", Settings.BaseUrl.TrimEnd('/'), searchType, categoriesQuery, Settings.Username.Trim(), Settings.Passkey.Trim(), parameters);
|
var baseUrl = string.Format("{0}/api.php?action={1}&category={2}&username={3}&passkey={4}{5}", Settings.BaseUrl.TrimEnd('/'), searchType, categoriesQuery, Settings.Username.Trim(), Settings.Passkey.Trim(), parameters);
|
||||||
|
|
||||||
|
@@ -17,24 +17,15 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FileListSettings : ITorrentIndexerSettings
|
public class FileListSettings : IIndexerSettings
|
||||||
{
|
{
|
||||||
private static readonly FileListSettingsValidator Validator = new FileListSettingsValidator();
|
private static readonly FileListSettingsValidator Validator = new FileListSettingsValidator();
|
||||||
|
|
||||||
public FileListSettings()
|
public FileListSettings()
|
||||||
{
|
{
|
||||||
BaseUrl = "https://filelist.io";
|
BaseUrl = "https://filelist.io";
|
||||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
||||||
|
|
||||||
Categories = new int[]
|
|
||||||
{
|
|
||||||
(int)FileListCategories.Movie_HD,
|
|
||||||
(int)FileListCategories.Movie_SD,
|
|
||||||
(int)FileListCategories.Movie_4K
|
|
||||||
};
|
|
||||||
|
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Username", Privacy = PrivacyLevel.UserName)]
|
[FieldDefinition(0, Label = "Username", Privacy = PrivacyLevel.UserName)]
|
||||||
@@ -49,15 +40,6 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
[FieldDefinition(3, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your API key will be sent to that host.")]
|
[FieldDefinition(3, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your API key will be sent to that host.")]
|
||||||
public string BaseUrl { get; set; }
|
public string BaseUrl { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(4, Label = "Categories", Type = FieldType.Select, SelectOptions = typeof(FileListCategories), Advanced = true, HelpText = "Categories for use in search and feeds. If unspecified, all options are used.")]
|
|
||||||
public IEnumerable<int> Categories { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(5, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(6, Type = FieldType.TagSelect, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Prowlarr/Prowlarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
|
||||||
public IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@@ -61,7 +61,8 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||||||
query.Username = Settings.Username;
|
query.Username = Settings.Username;
|
||||||
query.Passkey = Settings.ApiKey;
|
query.Passkey = Settings.ApiKey;
|
||||||
|
|
||||||
query.Category = Settings.Categories.ToArray();
|
//TODO Add from searchCriteria
|
||||||
|
// query.Category = Settings.Categories.ToArray();
|
||||||
query.Codec = Settings.Codecs.ToArray();
|
query.Codec = Settings.Codecs.ToArray();
|
||||||
query.Medium = Settings.Mediums.ToArray();
|
query.Medium = Settings.Mediums.ToArray();
|
||||||
|
|
||||||
|
@@ -16,20 +16,16 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HDBitsSettings : ITorrentIndexerSettings
|
public class HDBitsSettings : IIndexerSettings
|
||||||
{
|
{
|
||||||
private static readonly HDBitsSettingsValidator Validator = new HDBitsSettingsValidator();
|
private static readonly HDBitsSettingsValidator Validator = new HDBitsSettingsValidator();
|
||||||
|
|
||||||
public HDBitsSettings()
|
public HDBitsSettings()
|
||||||
{
|
{
|
||||||
BaseUrl = "https://hdbits.org";
|
BaseUrl = "https://hdbits.org";
|
||||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
||||||
|
|
||||||
Categories = new int[] { (int)HdBitsCategory.Movie };
|
|
||||||
Codecs = System.Array.Empty<int>();
|
Codecs = System.Array.Empty<int>();
|
||||||
Mediums = System.Array.Empty<int>();
|
Mediums = System.Array.Empty<int>();
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Username", Privacy = PrivacyLevel.UserName)]
|
[FieldDefinition(0, Label = "Username", Privacy = PrivacyLevel.UserName)]
|
||||||
@@ -44,21 +40,12 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||||||
[FieldDefinition(3, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your API key will be sent to that host.")]
|
[FieldDefinition(3, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your API key will be sent to that host.")]
|
||||||
public string BaseUrl { get; set; }
|
public string BaseUrl { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(4, Label = "Categories", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsCategory), Advanced = true, HelpText = "Options: Movie, TV, Documentary, Music, Sport, Audio, XXX, MiscDemo. If unspecified, all options are used.")]
|
|
||||||
public IEnumerable<int> Categories { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(5, Label = "Codecs", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsCodec), Advanced = true, HelpText = "Options: h264, Mpeg2, VC1, Xvid. If unspecified, all options are used.")]
|
[FieldDefinition(5, Label = "Codecs", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsCodec), Advanced = true, HelpText = "Options: h264, Mpeg2, VC1, Xvid. If unspecified, all options are used.")]
|
||||||
public IEnumerable<int> Codecs { get; set; }
|
public IEnumerable<int> Codecs { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(6, Label = "Mediums", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsMedium), Advanced = true, HelpText = "Options: BluRay, Encode, Capture, Remux, WebDL. If unspecified, all options are used.")]
|
[FieldDefinition(6, Label = "Mediums", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsMedium), Advanced = true, HelpText = "Options: BluRay, Encode, Capture, Remux, WebDL. If unspecified, all options are used.")]
|
||||||
public IEnumerable<int> Mediums { get; set; }
|
public IEnumerable<int> Mediums { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(7, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(8, Type = FieldType.TagSelect, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Prowlarr/Prowlarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
|
||||||
public IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@@ -23,16 +23,14 @@ namespace NzbDrone.Core.Indexers.IPTorrents
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IPTorrentsSettings : ITorrentIndexerSettings
|
public class IPTorrentsSettings : IIndexerSettings
|
||||||
{
|
{
|
||||||
private static readonly IPTorrentsSettingsValidator Validator = new IPTorrentsSettingsValidator();
|
private static readonly IPTorrentsSettingsValidator Validator = new IPTorrentsSettingsValidator();
|
||||||
|
|
||||||
public IPTorrentsSettings()
|
public IPTorrentsSettings()
|
||||||
{
|
{
|
||||||
BaseUrl = string.Empty;
|
BaseUrl = string.Empty;
|
||||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Feed URL", HelpText = "The full RSS feed url generated by IPTorrents, using only the categories you selected (HD, SD, x264, etc ...)")]
|
[FieldDefinition(0, Label = "Feed URL", HelpText = "The full RSS feed url generated by IPTorrents, using only the categories you selected (HD, SD, x264, etc ...)")]
|
||||||
@@ -41,12 +39,6 @@ namespace NzbDrone.Core.Indexers.IPTorrents
|
|||||||
[FieldDefinition(1, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
[FieldDefinition(1, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
||||||
public IEnumerable<int> MultiLanguages { get; set; }
|
public IEnumerable<int> MultiLanguages { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(2, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(3, Type = FieldType.TagSelect, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Prowlarr/Prowlarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
|
||||||
public IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@@ -17,7 +17,7 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NyaaSettings : ITorrentIndexerSettings
|
public class NyaaSettings : IIndexerSettings
|
||||||
{
|
{
|
||||||
private static readonly NyaaSettingsValidator Validator = new NyaaSettingsValidator();
|
private static readonly NyaaSettingsValidator Validator = new NyaaSettingsValidator();
|
||||||
|
|
||||||
@@ -25,9 +25,7 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
|||||||
{
|
{
|
||||||
BaseUrl = "";
|
BaseUrl = "";
|
||||||
AdditionalParameters = "";
|
AdditionalParameters = "";
|
||||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Website URL")]
|
[FieldDefinition(0, Label = "Website URL")]
|
||||||
@@ -39,12 +37,6 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
|||||||
[FieldDefinition(2, Label = "Additional Parameters", Advanced = true, HelpText = "Please note if you change the category you will have to add required/restricted rules about the subgroups to avoid foreign language releases.")]
|
[FieldDefinition(2, Label = "Additional Parameters", Advanced = true, HelpText = "Please note if you change the category you will have to add required/restricted rules about the subgroups to avoid foreign language releases.")]
|
||||||
public string AdditionalParameters { get; set; }
|
public string AdditionalParameters { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(3, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(4, Type = FieldType.TagSelect, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Prowlarr/Prowlarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
|
||||||
public IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@@ -17,16 +17,14 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PassThePopcornSettings : ITorrentIndexerSettings
|
public class PassThePopcornSettings : IIndexerSettings
|
||||||
{
|
{
|
||||||
private static readonly PassThePopcornSettingsValidator Validator = new PassThePopcornSettingsValidator();
|
private static readonly PassThePopcornSettingsValidator Validator = new PassThePopcornSettingsValidator();
|
||||||
|
|
||||||
public PassThePopcornSettings()
|
public PassThePopcornSettings()
|
||||||
{
|
{
|
||||||
BaseUrl = "https://passthepopcorn.me";
|
BaseUrl = "https://passthepopcorn.me";
|
||||||
MinimumSeeders = 0;
|
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your cookie will be sent to that host.")]
|
[FieldDefinition(0, Label = "URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your cookie will be sent to that host.")]
|
||||||
@@ -41,12 +39,6 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
||||||
public IEnumerable<int> MultiLanguages { get; set; }
|
public IEnumerable<int> MultiLanguages { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(4, Type = FieldType.Textbox, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(6, Type = FieldType.TagSelect, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Prowlarr/Prowlarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
|
||||||
public IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@@ -19,13 +19,6 @@ namespace NzbDrone.Core.Indexers.Rarbg
|
|||||||
_tokenProvider = tokenProvider;
|
_tokenProvider = tokenProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
|
||||||
{
|
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
|
||||||
pageableRequests.Add(GetPagedRequests("list", null, null));
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
@@ -33,46 +26,6 @@ namespace NzbDrone.Core.Indexers.Rarbg
|
|||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetPagedRequests(string mode, int? imdbId, string query, params object[] args)
|
|
||||||
{
|
|
||||||
var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl)
|
|
||||||
.Resource("/pubapi_v2.php")
|
|
||||||
.Accept(HttpAccept.Json);
|
|
||||||
|
|
||||||
if (Settings.CaptchaToken.IsNotNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
requestBuilder.UseSimplifiedUserAgent = true;
|
|
||||||
requestBuilder.SetCookie("cf_clearance", Settings.CaptchaToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
requestBuilder.AddQueryParam("mode", mode);
|
|
||||||
|
|
||||||
if (imdbId.HasValue)
|
|
||||||
{
|
|
||||||
requestBuilder.AddQueryParam("search_imdb", imdbId.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.IsNotNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
requestBuilder.AddQueryParam("search_string", string.Format(query, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Settings.RankedOnly)
|
|
||||||
{
|
|
||||||
requestBuilder.AddQueryParam("ranked", "0");
|
|
||||||
}
|
|
||||||
|
|
||||||
var categoryParam = string.Join(";", Settings.Categories.Distinct());
|
|
||||||
|
|
||||||
requestBuilder.AddQueryParam("category", categoryParam);
|
|
||||||
requestBuilder.AddQueryParam("limit", "100");
|
|
||||||
requestBuilder.AddQueryParam("token", _tokenProvider.GetToken(Settings));
|
|
||||||
requestBuilder.AddQueryParam("format", "json_extended");
|
|
||||||
requestBuilder.AddQueryParam("app_id", "Prowlarr");
|
|
||||||
|
|
||||||
yield return new IndexerRequest(requestBuilder.Build());
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetMovieRequest(MovieSearchCriteria searchCriteria)
|
private IEnumerable<IndexerRequest> GetMovieRequest(MovieSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl)
|
var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl)
|
||||||
@@ -105,7 +58,7 @@ namespace NzbDrone.Core.Indexers.Rarbg
|
|||||||
requestBuilder.AddQueryParam("ranked", "0");
|
requestBuilder.AddQueryParam("ranked", "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
var categoryParam = string.Join(";", Settings.Categories.Distinct());
|
var categoryParam = string.Join(";", searchCriteria.Categories.Distinct());
|
||||||
|
|
||||||
requestBuilder.AddQueryParam("category", categoryParam);
|
requestBuilder.AddQueryParam("category", categoryParam);
|
||||||
requestBuilder.AddQueryParam("limit", "100");
|
requestBuilder.AddQueryParam("limit", "100");
|
||||||
|
@@ -12,12 +12,10 @@ namespace NzbDrone.Core.Indexers.Rarbg
|
|||||||
public RarbgSettingsValidator()
|
public RarbgSettingsValidator()
|
||||||
{
|
{
|
||||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||||
|
|
||||||
RuleFor(c => c.Categories).NotEmpty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RarbgSettings : ITorrentIndexerSettings
|
public class RarbgSettings : IIndexerSettings
|
||||||
{
|
{
|
||||||
private static readonly RarbgSettingsValidator Validator = new RarbgSettingsValidator();
|
private static readonly RarbgSettingsValidator Validator = new RarbgSettingsValidator();
|
||||||
|
|
||||||
@@ -25,10 +23,7 @@ namespace NzbDrone.Core.Indexers.Rarbg
|
|||||||
{
|
{
|
||||||
BaseUrl = "https://torrentapi.org";
|
BaseUrl = "https://torrentapi.org";
|
||||||
RankedOnly = false;
|
RankedOnly = false;
|
||||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
||||||
Categories = new[] { 14, 48, 17, 44, 45, 47, 50, 51, 52, 42, 46 };
|
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "API URL", HelpText = "URL to Rarbg api, not the website.")]
|
[FieldDefinition(0, Label = "API URL", HelpText = "URL to Rarbg api, not the website.")]
|
||||||
@@ -43,15 +38,6 @@ namespace NzbDrone.Core.Indexers.Rarbg
|
|||||||
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
||||||
public IEnumerable<int> MultiLanguages { get; set; }
|
public IEnumerable<int> MultiLanguages { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(4, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(5, Type = FieldType.TagSelect, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Prowlarr/Prowlarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
|
||||||
public IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(6, Type = FieldType.Textbox, Label = "Categories", HelpText = "Comma Separated list, you can retrieve the ID by checking the URL behind the category on the website (i.e. Movie/x264/1080 = 44)", HelpLink = "https://rarbgmirror.org/torrents.php?category=movies", Advanced = true)]
|
|
||||||
public IEnumerable<int> Categories { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@@ -15,16 +15,14 @@ namespace NzbDrone.Core.Indexers.TorrentPotato
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TorrentPotatoSettings : ITorrentIndexerSettings
|
public class TorrentPotatoSettings : IIndexerSettings
|
||||||
{
|
{
|
||||||
private static readonly TorrentPotatoSettingsValidator Validator = new TorrentPotatoSettingsValidator();
|
private static readonly TorrentPotatoSettingsValidator Validator = new TorrentPotatoSettingsValidator();
|
||||||
|
|
||||||
public TorrentPotatoSettings()
|
public TorrentPotatoSettings()
|
||||||
{
|
{
|
||||||
BaseUrl = "http://127.0.0.1";
|
BaseUrl = "http://127.0.0.1";
|
||||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "API URL", HelpText = "URL to TorrentPotato api.")]
|
[FieldDefinition(0, Label = "API URL", HelpText = "URL to TorrentPotato api.")]
|
||||||
@@ -39,12 +37,6 @@ namespace NzbDrone.Core.Indexers.TorrentPotato
|
|||||||
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
||||||
public IEnumerable<int> MultiLanguages { get; set; }
|
public IEnumerable<int> MultiLanguages { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(4, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(6, Type = FieldType.TagSelect, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", Advanced = true)]
|
|
||||||
public IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Indexers.TorrentRss
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TorrentRssIndexerSettings : ITorrentIndexerSettings
|
public class TorrentRssIndexerSettings : IIndexerSettings
|
||||||
{
|
{
|
||||||
private static readonly TorrentRssIndexerSettingsValidator Validator = new TorrentRssIndexerSettingsValidator();
|
private static readonly TorrentRssIndexerSettingsValidator Validator = new TorrentRssIndexerSettingsValidator();
|
||||||
|
|
||||||
@@ -23,9 +23,7 @@ namespace NzbDrone.Core.Indexers.TorrentRss
|
|||||||
{
|
{
|
||||||
BaseUrl = string.Empty;
|
BaseUrl = string.Empty;
|
||||||
AllowZeroSize = false;
|
AllowZeroSize = false;
|
||||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
||||||
MultiLanguages = new List<int>();
|
MultiLanguages = new List<int>();
|
||||||
RequiredFlags = new List<int>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Full RSS Feed URL")]
|
[FieldDefinition(0, Label = "Full RSS Feed URL")]
|
||||||
@@ -40,12 +38,6 @@ namespace NzbDrone.Core.Indexers.TorrentRss
|
|||||||
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
||||||
public IEnumerable<int> MultiLanguages { get; set; }
|
public IEnumerable<int> MultiLanguages { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(4, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(6, Type = FieldType.TagSelect, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Prowlarr/Prowlarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
|
||||||
public IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers
|
|
||||||
{
|
|
||||||
public interface ITorrentIndexerSettings : IIndexerSettings
|
|
||||||
{
|
|
||||||
int MinimumSeeders { get; set; }
|
|
||||||
IEnumerable<int> RequiredFlags { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -32,21 +32,22 @@ namespace Prowlarr.Api.V1.Search
|
|||||||
if (request.Query.IsNotNullOrWhiteSpace())
|
if (request.Query.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
var indexerIds = request.IndexerIds ?? new List<int>();
|
var indexerIds = request.IndexerIds ?? new List<int>();
|
||||||
|
var categories = request.Categories ?? new List<int>();
|
||||||
|
|
||||||
if (indexerIds.Count > 0)
|
if (indexerIds.Count > 0)
|
||||||
{
|
{
|
||||||
return GetSearchReleases(request.Query, indexerIds, request.Categories);
|
return GetSearchReleases(request.Query, indexerIds, categories);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return GetSearchReleases(request.Query, null, request.Categories);
|
return GetSearchReleases(request.Query, null, categories);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<SearchResource>();
|
return new List<SearchResource>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SearchResource> GetSearchReleases(string query, List<int> indexerIds, int[] categories)
|
private List<SearchResource> GetSearchReleases(string query, List<int> indexerIds, List<int> categories)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -6,6 +6,6 @@ namespace Prowlarr.Api.V1.Search
|
|||||||
{
|
{
|
||||||
public List<int> IndexerIds { get; set; }
|
public List<int> IndexerIds { get; set; }
|
||||||
public string Query { get; set; }
|
public string Query { get; set; }
|
||||||
public int[] Categories { get; set; }
|
public List<int> Categories { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user