mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-18 21:55:12 -04:00
Compare commits
172 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ca6f83a4d | |||
| fb5b325271 | |||
| ec8025c3dc | |||
| b42bf2cf20 | |||
| 712d95e6ce | |||
| 24f6c937da | |||
| e94aa7c499 | |||
| 201bc1944b | |||
| 09e40e0060 | |||
| 348d90a37e | |||
| 726dc34424 | |||
| 2e9f6cd94b | |||
| 495f61f412 | |||
| 0f11f414b6 | |||
| d397cdf5fb | |||
| 888b514dd8 | |||
| caab337379 | |||
| 26bea14137 | |||
| 5f26287234 | |||
| 6ec761c217 | |||
| b85679de56 | |||
| 71775b97a3 | |||
| 5bb3dbfbf5 | |||
| b608a7a904 | |||
| 4ad992f76a | |||
| 95497480a2 | |||
| cc57866ab0 | |||
| dbc4989a95 | |||
| af4961e3e6 | |||
| 0ec54906c6 | |||
| 35f85fc986 | |||
| 0aedafb278 | |||
| 54dce448a8 | |||
| 3c915002c6 | |||
| e32f8f4330 | |||
| 5abb5ada49 | |||
| 6579385110 | |||
| 1c6e5543df | |||
| 85737aacbe | |||
| 30c3aedeb1 | |||
| 1640980e2b | |||
| 99bc56efb6 | |||
| 04276eb587 | |||
| 34c560fd3a | |||
| caa8bb05a7 | |||
| 773e8ff1f4 | |||
| 0984976378 | |||
| fcb3c96455 | |||
| acf7a425b5 | |||
| da898fe958 | |||
| 5bb3ea0806 | |||
| b41cb80e33 | |||
| a39341be4b | |||
| 27b3d8618a | |||
| 550b9b58df | |||
| 035ad33b72 | |||
| 85f8e0c451 | |||
| ea2061a7d3 | |||
| ea6d01a49b | |||
| 252cd97e35 | |||
| a8ea05af07 | |||
| 24d6a0cb06 | |||
| 8e1771b5a9 | |||
| d767a82e84 | |||
| 76bfd29f23 | |||
| c923982711 | |||
| f03a64f9ac | |||
| e713e58e83 | |||
| 4fb5d3432b | |||
| a31b107a90 | |||
| f91ffb8328 | |||
| a3ba070296 | |||
| bccb0bd5c8 | |||
| 4517f271c4 | |||
| 2ae2a0b184 | |||
| b5e43e7a1a | |||
| 3a52048dc2 | |||
| 8b898733ab | |||
| f99a2e1164 | |||
| 306209fcc2 | |||
| 5d09c2b5fa | |||
| 41a9d2d732 | |||
| 49b120ba55 | |||
| a88fc34a78 | |||
| c46b7c5e4b | |||
| 94c45541ae | |||
| f8082047a5 | |||
| 011fd57f7d | |||
| 6c35c3fc6f | |||
| 5da02c49eb | |||
| 1a339b9ab2 | |||
| 94edd7538e | |||
| 9b2274805e | |||
| dbf86efb0a | |||
| 529fbfd9bd | |||
| 0ed5bfe0d0 | |||
| 6a43eb0031 | |||
| a12001a5ef | |||
| b57014762d | |||
| a51a8bf921 | |||
| e8dc5b3206 | |||
| d4f22f3596 | |||
| b6018a4cd7 | |||
| ec389987df | |||
| 6b62504916 | |||
| 626d777d3c | |||
| 234707b291 | |||
| 15734ca0da | |||
| 19913e5b01 | |||
| 156f6505be | |||
| e383287972 | |||
| 0c0cbdac2f | |||
| 0685c2eb04 | |||
| e8c132e908 | |||
| bea9bd39ff | |||
| 077e4727f2 | |||
| 5f7bc82eb5 | |||
| 0dd5c56175 | |||
| 409a218379 | |||
| 07cc1e03c8 | |||
| 560cda8ba0 | |||
| 934f566359 | |||
| 89ae5ceaa6 | |||
| c7d5889e59 | |||
| bea3c051b9 | |||
| c0b1675627 | |||
| 906d09e162 | |||
| 8cd9ad01c2 | |||
| ce2f322478 | |||
| 0487309ee8 | |||
| 9862584611 | |||
| 6a00e0db90 | |||
| c93831dd8b | |||
| 6546ba773c | |||
| 4c3484a898 | |||
| 8561b862f9 | |||
| e1032fb0f5 | |||
| 4063219430 | |||
| e008be8581 | |||
| d6b379df64 | |||
| 27094ccf62 | |||
| edf9473e9a | |||
| a0d11e7e33 | |||
| 7729eb398a | |||
| 989564dbce | |||
| c1f917f1ac | |||
| 4b7e47c397 | |||
| 1529527af9 | |||
| a11bd1c3c7 | |||
| 915b320a4a | |||
| 155f72cc45 | |||
| 3f73fec5c3 | |||
| 8515623ceb | |||
| 963cddb582 | |||
| ede323b8ed | |||
| 07d7fc98b0 | |||
| 1b78fd38db | |||
| 5a9d4d6280 | |||
| 70685de5d2 | |||
| 9860183433 | |||
| 50331c61ae | |||
| bd3408f170 | |||
| c043bf8da9 | |||
| ea3fa6f28d | |||
| 8917347c0b | |||
| 2cebdf4a06 | |||
| 985110cfb9 | |||
| de876247a3 | |||
| bad6c301f8 | |||
| fc3b23394a | |||
| 92c3656bad | |||
| 1acbee2a57 |
+7
-7
@@ -117,7 +117,6 @@ dotnet_diagnostic.CA1003.severity = suggestion
|
|||||||
dotnet_diagnostic.CA1008.severity = suggestion
|
dotnet_diagnostic.CA1008.severity = suggestion
|
||||||
dotnet_diagnostic.CA1010.severity = suggestion
|
dotnet_diagnostic.CA1010.severity = suggestion
|
||||||
dotnet_diagnostic.CA1012.severity = suggestion
|
dotnet_diagnostic.CA1012.severity = suggestion
|
||||||
dotnet_diagnostic.CA1014.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA1016.severity = suggestion
|
dotnet_diagnostic.CA1016.severity = suggestion
|
||||||
dotnet_diagnostic.CA1017.severity = suggestion
|
dotnet_diagnostic.CA1017.severity = suggestion
|
||||||
dotnet_diagnostic.CA1018.severity = suggestion
|
dotnet_diagnostic.CA1018.severity = suggestion
|
||||||
@@ -163,6 +162,7 @@ dotnet_diagnostic.CA1309.severity = suggestion
|
|||||||
dotnet_diagnostic.CA1310.severity = suggestion
|
dotnet_diagnostic.CA1310.severity = suggestion
|
||||||
dotnet_diagnostic.CA1401.severity = suggestion
|
dotnet_diagnostic.CA1401.severity = suggestion
|
||||||
dotnet_diagnostic.CA1416.severity = suggestion
|
dotnet_diagnostic.CA1416.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1419.severity = suggestion
|
||||||
dotnet_diagnostic.CA1507.severity = suggestion
|
dotnet_diagnostic.CA1507.severity = suggestion
|
||||||
dotnet_diagnostic.CA1508.severity = suggestion
|
dotnet_diagnostic.CA1508.severity = suggestion
|
||||||
dotnet_diagnostic.CA1707.severity = suggestion
|
dotnet_diagnostic.CA1707.severity = suggestion
|
||||||
@@ -178,9 +178,6 @@ dotnet_diagnostic.CA1720.severity = suggestion
|
|||||||
dotnet_diagnostic.CA1721.severity = suggestion
|
dotnet_diagnostic.CA1721.severity = suggestion
|
||||||
dotnet_diagnostic.CA1724.severity = suggestion
|
dotnet_diagnostic.CA1724.severity = suggestion
|
||||||
dotnet_diagnostic.CA1725.severity = suggestion
|
dotnet_diagnostic.CA1725.severity = suggestion
|
||||||
dotnet_diagnostic.CA1801.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA1802.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA1805.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA1806.severity = suggestion
|
dotnet_diagnostic.CA1806.severity = suggestion
|
||||||
dotnet_diagnostic.CA1810.severity = suggestion
|
dotnet_diagnostic.CA1810.severity = suggestion
|
||||||
dotnet_diagnostic.CA1812.severity = suggestion
|
dotnet_diagnostic.CA1812.severity = suggestion
|
||||||
@@ -192,13 +189,14 @@ dotnet_diagnostic.CA1819.severity = suggestion
|
|||||||
dotnet_diagnostic.CA1822.severity = suggestion
|
dotnet_diagnostic.CA1822.severity = suggestion
|
||||||
dotnet_diagnostic.CA1823.severity = suggestion
|
dotnet_diagnostic.CA1823.severity = suggestion
|
||||||
dotnet_diagnostic.CA1824.severity = suggestion
|
dotnet_diagnostic.CA1824.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1835.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1845.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1848.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1849.severity = suggestion
|
||||||
dotnet_diagnostic.CA2000.severity = suggestion
|
dotnet_diagnostic.CA2000.severity = suggestion
|
||||||
dotnet_diagnostic.CA2002.severity = suggestion
|
dotnet_diagnostic.CA2002.severity = suggestion
|
||||||
dotnet_diagnostic.CA2007.severity = suggestion
|
dotnet_diagnostic.CA2007.severity = suggestion
|
||||||
dotnet_diagnostic.CA2008.severity = suggestion
|
dotnet_diagnostic.CA2008.severity = suggestion
|
||||||
dotnet_diagnostic.CA2009.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA2010.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA2011.severity = suggestion
|
|
||||||
dotnet_diagnostic.CA2012.severity = suggestion
|
dotnet_diagnostic.CA2012.severity = suggestion
|
||||||
dotnet_diagnostic.CA2013.severity = suggestion
|
dotnet_diagnostic.CA2013.severity = suggestion
|
||||||
dotnet_diagnostic.CA2100.severity = suggestion
|
dotnet_diagnostic.CA2100.severity = suggestion
|
||||||
@@ -229,6 +227,7 @@ dotnet_diagnostic.CA2243.severity = suggestion
|
|||||||
dotnet_diagnostic.CA2244.severity = suggestion
|
dotnet_diagnostic.CA2244.severity = suggestion
|
||||||
dotnet_diagnostic.CA2245.severity = suggestion
|
dotnet_diagnostic.CA2245.severity = suggestion
|
||||||
dotnet_diagnostic.CA2246.severity = suggestion
|
dotnet_diagnostic.CA2246.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA2254.severity = suggestion
|
||||||
dotnet_diagnostic.CA3061.severity = suggestion
|
dotnet_diagnostic.CA3061.severity = suggestion
|
||||||
dotnet_diagnostic.CA3075.severity = suggestion
|
dotnet_diagnostic.CA3075.severity = suggestion
|
||||||
dotnet_diagnostic.CA3076.severity = suggestion
|
dotnet_diagnostic.CA3076.severity = suggestion
|
||||||
@@ -255,6 +254,7 @@ dotnet_diagnostic.CA5385.severity = suggestion
|
|||||||
dotnet_diagnostic.CA5392.severity = suggestion
|
dotnet_diagnostic.CA5392.severity = suggestion
|
||||||
dotnet_diagnostic.CA5394.severity = suggestion
|
dotnet_diagnostic.CA5394.severity = suggestion
|
||||||
dotnet_diagnostic.CA5397.severity = suggestion
|
dotnet_diagnostic.CA5397.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA5401.severity = suggestion
|
||||||
|
|
||||||
dotnet_diagnostic.SYSLIB0014.severity = none
|
dotnet_diagnostic.SYSLIB0014.severity = none
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
name: Sync issue to Azure DevOps work item
|
|
||||||
|
|
||||||
on:
|
|
||||||
issues:
|
|
||||||
types:
|
|
||||||
[opened, edited, deleted, closed, reopened, labeled, unlabeled, assigned]
|
|
||||||
|
|
||||||
concurrency: azuresync-${{ github.event.issue.number }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
alert:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: danhellem/github-actions-issue-to-work-item@master
|
|
||||||
if: "${{ contains(github.event.issue.labels.*.name, 'Type: Bug') == true }}"
|
|
||||||
env:
|
|
||||||
ado_token: "${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}"
|
|
||||||
github_token: "${{ github.token }}"
|
|
||||||
ado_organization: "Servarr"
|
|
||||||
ado_project: "Servarr"
|
|
||||||
ado_area_path: "Servarr\\Prowlarr"
|
|
||||||
ado_wit: "Bug"
|
|
||||||
ado_new_state: "New"
|
|
||||||
ado_active_state: "Active"
|
|
||||||
ado_close_state: "Closed"
|
|
||||||
ado_bypassrules: true
|
|
||||||
log_level: 100
|
|
||||||
- uses: danhellem/github-actions-issue-to-work-item@master
|
|
||||||
if: "${{ contains(github.event.issue.labels.*.name, 'Type: Bug') == false }}"
|
|
||||||
env:
|
|
||||||
ado_token: "${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}"
|
|
||||||
github_token: "${{ github.token }}"
|
|
||||||
ado_organization: "Servarr"
|
|
||||||
ado_project: "Servarr"
|
|
||||||
ado_area_path: "Servarr\\Prowlarr"
|
|
||||||
ado_wit: "User Story"
|
|
||||||
ado_new_state: "New"
|
|
||||||
ado_active_state: "Active"
|
|
||||||
ado_close_state: "Closed"
|
|
||||||
ado_bypassrules: true
|
|
||||||
log_level: 100
|
|
||||||
+2
-2
@@ -9,13 +9,13 @@ variables:
|
|||||||
testsFolder: './_tests'
|
testsFolder: './_tests'
|
||||||
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
|
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
|
||||||
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
|
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
|
||||||
majorVersion: '1.1.0'
|
majorVersion: '1.3.1'
|
||||||
minorVersion: $[counter('minorVersion', 1)]
|
minorVersion: $[counter('minorVersion', 1)]
|
||||||
prowlarrVersion: '$(majorVersion).$(minorVersion)'
|
prowlarrVersion: '$(majorVersion).$(minorVersion)'
|
||||||
buildName: '$(Build.SourceBranchName).$(prowlarrVersion)'
|
buildName: '$(Build.SourceBranchName).$(prowlarrVersion)'
|
||||||
sentryOrg: 'servarr'
|
sentryOrg: 'servarr'
|
||||||
sentryUrl: 'https://sentry.servarr.com'
|
sentryUrl: 'https://sentry.servarr.com'
|
||||||
dotnetVersion: '6.0.404'
|
dotnetVersion: '6.0.405'
|
||||||
innoVersion: '6.2.0'
|
innoVersion: '6.2.0'
|
||||||
nodeVersion: '16.x'
|
nodeVersion: '16.x'
|
||||||
windowsImage: 'windows-2022'
|
windowsImage: 'windows-2022'
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ module.exports = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
'filenames',
|
'filenames',
|
||||||
'react',
|
'react',
|
||||||
|
'react-hooks',
|
||||||
'simple-import-sort',
|
'simple-import-sort',
|
||||||
'import'
|
'import'
|
||||||
],
|
],
|
||||||
@@ -308,7 +309,9 @@ module.exports = {
|
|||||||
'react/react-in-jsx-scope': 2,
|
'react/react-in-jsx-scope': 2,
|
||||||
'react/self-closing-comp': 2,
|
'react/self-closing-comp': 2,
|
||||||
'react/sort-comp': 2,
|
'react/sort-comp': 2,
|
||||||
'react/jsx-wrap-multilines': 2
|
'react/jsx-wrap-multilines': 2,
|
||||||
|
'react-hooks/rules-of-hooks': 'error',
|
||||||
|
'react-hooks/exhaustive-deps': 'error'
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ module.exports = (env) => {
|
|||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.js?$/,
|
test: /\.jsx?$/,
|
||||||
exclude: /(node_modules|JsLibraries)/,
|
exclude: /[\\/]node_modules[\\/](?!(@sentry\/browser|@sentry\/integrations|chart.js|filesize|normalize.css)[\\/])/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Fragment, useEffect } from 'react';
|
import React, { Fragment, useCallback, useEffect } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import themes from 'Styles/Themes';
|
import themes from 'Styles/Themes';
|
||||||
@@ -19,7 +19,8 @@ function createMapStateToProps() {
|
|||||||
|
|
||||||
function ApplyTheme({ theme, children }) {
|
function ApplyTheme({ theme, children }) {
|
||||||
// Update the CSS Variables
|
// Update the CSS Variables
|
||||||
function updateCSSVariables() {
|
|
||||||
|
const updateCSSVariables = useCallback(() => {
|
||||||
const arrayOfVariableKeys = Object.keys(themes[theme]);
|
const arrayOfVariableKeys = Object.keys(themes[theme]);
|
||||||
const arrayOfVariableValues = Object.values(themes[theme]);
|
const arrayOfVariableValues = Object.values(themes[theme]);
|
||||||
|
|
||||||
@@ -31,12 +32,12 @@ function ApplyTheme({ theme, children }) {
|
|||||||
arrayOfVariableValues[index]
|
arrayOfVariableValues[index]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}, [theme]);
|
||||||
|
|
||||||
// On Component Mount and Component Update
|
// On Component Mount and Component Update
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
updateCSSVariables(theme);
|
updateCSSVariables(theme);
|
||||||
}, [theme]);
|
}, [updateCSSVariables, theme]);
|
||||||
|
|
||||||
return <Fragment>{children}</Fragment>;
|
return <Fragment>{children}</Fragment>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function CustomFiltersModalContent(props) {
|
|||||||
|
|
||||||
<div className={styles.addButtonContainer}>
|
<div className={styles.addButtonContainer}>
|
||||||
<Button onPress={onAddCustomFilter}>
|
<Button onPress={onAddCustomFilter}>
|
||||||
Add Custom Filter
|
{translate('AddCustomFilter')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ function ConfirmModal(props) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
bindShortcut('enter', onConfirm);
|
bindShortcut('enter', onConfirm);
|
||||||
} else {
|
|
||||||
unbindShortcut('enter', onConfirm);
|
return () => unbindShortcut('enter', onConfirm);
|
||||||
}
|
}
|
||||||
}, [onConfirm]);
|
}, [bindShortcut, unbindShortcut, isOpen, onConfirm]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
|||||||
@@ -61,15 +61,15 @@ class TagsModalContent extends Component {
|
|||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
const applyTagsOptions = [
|
const applyTagsOptions = [
|
||||||
{ key: 'add', value: 'Add' },
|
{ key: 'add', value: translate('Add') },
|
||||||
{ key: 'remove', value: 'Remove' },
|
{ key: 'remove', value: translate('Remove') },
|
||||||
{ key: 'replace', value: 'Replace' }
|
{ key: 'replace', value: translate('Replace') }
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalContent onModalClose={onModalClose}>
|
<ModalContent onModalClose={onModalClose}>
|
||||||
<ModalHeader>
|
<ModalHeader>
|
||||||
Tags
|
{translate('Tags')}
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
|
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function IndexerIndexSortMenu(props) {
|
|||||||
sortDirection={sortDirection}
|
sortDirection={sortDirection}
|
||||||
onPress={onSortSelect}
|
onPress={onSortSelect}
|
||||||
>
|
>
|
||||||
Status
|
{translate('Status')}
|
||||||
</SortMenuItem>
|
</SortMenuItem>
|
||||||
|
|
||||||
<SortMenuItem
|
<SortMenuItem
|
||||||
@@ -62,7 +62,7 @@ function IndexerIndexSortMenu(props) {
|
|||||||
sortDirection={sortDirection}
|
sortDirection={sortDirection}
|
||||||
onPress={onSortSelect}
|
onPress={onSortSelect}
|
||||||
>
|
>
|
||||||
{'Priority'}
|
{translate('Priority')}
|
||||||
</SortMenuItem>
|
</SortMenuItem>
|
||||||
|
|
||||||
<SortMenuItem
|
<SortMenuItem
|
||||||
@@ -71,7 +71,7 @@ function IndexerIndexSortMenu(props) {
|
|||||||
sortDirection={sortDirection}
|
sortDirection={sortDirection}
|
||||||
onPress={onSortSelect}
|
onPress={onSortSelect}
|
||||||
>
|
>
|
||||||
{'Protocol'}
|
{translate('Protocol')}
|
||||||
</SortMenuItem>
|
</SortMenuItem>
|
||||||
|
|
||||||
<SortMenuItem
|
<SortMenuItem
|
||||||
@@ -80,7 +80,7 @@ function IndexerIndexSortMenu(props) {
|
|||||||
sortDirection={sortDirection}
|
sortDirection={sortDirection}
|
||||||
onPress={onSortSelect}
|
onPress={onSortSelect}
|
||||||
>
|
>
|
||||||
{'Privacy'}
|
{translate('Privacy')}
|
||||||
</SortMenuItem>
|
</SortMenuItem>
|
||||||
</MenuContent>
|
</MenuContent>
|
||||||
</SortMenu>
|
</SortMenu>
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class IndexerIndexRow extends Component {
|
|||||||
privacy,
|
privacy,
|
||||||
priority,
|
priority,
|
||||||
status,
|
status,
|
||||||
|
fields,
|
||||||
appProfile,
|
appProfile,
|
||||||
added,
|
added,
|
||||||
capabilities,
|
capabilities,
|
||||||
@@ -96,6 +97,8 @@ class IndexerIndexRow extends Component {
|
|||||||
isIndexerInfoModalOpen
|
isIndexerInfoModalOpen
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
|
const baseUrl = fields.find((field) => field.name === 'baseUrl')?.value ?? (Array.isArray(indexerUrls) ? indexerUrls[0] : undefined);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{
|
{
|
||||||
@@ -245,12 +248,12 @@ class IndexerIndexRow extends Component {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{
|
{
|
||||||
indexerUrls ?
|
baseUrl ?
|
||||||
<IconButton
|
<IconButton
|
||||||
className={styles.externalLink}
|
className={styles.externalLink}
|
||||||
name={icons.EXTERNAL_LINK}
|
name={icons.EXTERNAL_LINK}
|
||||||
title={translate('Website')}
|
title={translate('Website')}
|
||||||
to={indexerUrls[0].replace('api.', '')}
|
to={baseUrl.replace(/(:\/\/)api\./, '$1')}
|
||||||
/> : null
|
/> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +302,7 @@ IndexerIndexRow.propTypes = {
|
|||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
enable: PropTypes.bool.isRequired,
|
enable: PropTypes.bool.isRequired,
|
||||||
redirect: PropTypes.bool.isRequired,
|
redirect: PropTypes.bool.isRequired,
|
||||||
|
fields: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
appProfile: PropTypes.object.isRequired,
|
appProfile: PropTypes.object.isRequired,
|
||||||
status: PropTypes.object,
|
status: PropTypes.object,
|
||||||
capabilities: PropTypes.object,
|
capabilities: PropTypes.object,
|
||||||
|
|||||||
@@ -20,11 +20,14 @@ function IndexerInfoModalContent(props) {
|
|||||||
encoding,
|
encoding,
|
||||||
language,
|
language,
|
||||||
indexerUrls,
|
indexerUrls,
|
||||||
|
fields,
|
||||||
protocol,
|
protocol,
|
||||||
capabilities,
|
capabilities,
|
||||||
onModalClose
|
onModalClose
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
const baseUrl = fields.find((field) => field.name === 'baseUrl')?.value ?? indexerUrls[0];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalContent onModalClose={onModalClose}>
|
<ModalContent onModalClose={onModalClose}>
|
||||||
<ModalHeader>
|
<ModalHeader>
|
||||||
@@ -57,7 +60,7 @@ function IndexerInfoModalContent(props) {
|
|||||||
/>
|
/>
|
||||||
<DescriptionListItemTitle>{translate('IndexerSite')}</DescriptionListItemTitle>
|
<DescriptionListItemTitle>{translate('IndexerSite')}</DescriptionListItemTitle>
|
||||||
<DescriptionListItemDescription>
|
<DescriptionListItemDescription>
|
||||||
<Link to={indexerUrls[0]}>{indexerUrls[0]}</Link>
|
<Link to={baseUrl}>{baseUrl}</Link>
|
||||||
</DescriptionListItemDescription>
|
</DescriptionListItemDescription>
|
||||||
<DescriptionListItemTitle>{`${protocol === 'usenet' ? 'Newznab' : 'Torznab'} Url`}</DescriptionListItemTitle>
|
<DescriptionListItemTitle>{`${protocol === 'usenet' ? 'Newznab' : 'Torznab'} Url`}</DescriptionListItemTitle>
|
||||||
<DescriptionListItemDescription>
|
<DescriptionListItemDescription>
|
||||||
@@ -114,6 +117,7 @@ IndexerInfoModalContent.propTypes = {
|
|||||||
encoding: PropTypes.string.isRequired,
|
encoding: PropTypes.string.isRequired,
|
||||||
language: PropTypes.string.isRequired,
|
language: PropTypes.string.isRequired,
|
||||||
indexerUrls: PropTypes.arrayOf(PropTypes.string).isRequired,
|
indexerUrls: PropTypes.arrayOf(PropTypes.string).isRequired,
|
||||||
|
fields: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
protocol: PropTypes.string.isRequired,
|
protocol: PropTypes.string.isRequired,
|
||||||
capabilities: PropTypes.object.isRequired,
|
capabilities: PropTypes.object.isRequired,
|
||||||
onModalClose: PropTypes.func.isRequired
|
onModalClose: PropTypes.func.isRequired
|
||||||
|
|||||||
@@ -71,6 +71,19 @@ class SearchIndexRow extends Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onSavePress = () => {
|
||||||
|
const {
|
||||||
|
downloadUrl,
|
||||||
|
fileName,
|
||||||
|
onSavePress
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
onSavePress({
|
||||||
|
downloadUrl,
|
||||||
|
fileName
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render
|
// Render
|
||||||
|
|
||||||
@@ -85,7 +98,6 @@ class SearchIndexRow extends Component {
|
|||||||
publishDate,
|
publishDate,
|
||||||
title,
|
title,
|
||||||
infoUrl,
|
infoUrl,
|
||||||
downloadUrl,
|
|
||||||
indexer,
|
indexer,
|
||||||
size,
|
size,
|
||||||
files,
|
files,
|
||||||
@@ -300,7 +312,7 @@ class SearchIndexRow extends Component {
|
|||||||
className={styles.downloadLink}
|
className={styles.downloadLink}
|
||||||
name={icons.SAVE}
|
name={icons.SAVE}
|
||||||
title={translate('Save')}
|
title={translate('Save')}
|
||||||
to={downloadUrl}
|
onPress={this.onSavePress}
|
||||||
/>
|
/>
|
||||||
</VirtualTableRowCell>
|
</VirtualTableRowCell>
|
||||||
);
|
);
|
||||||
@@ -323,6 +335,7 @@ SearchIndexRow.propTypes = {
|
|||||||
ageMinutes: PropTypes.number.isRequired,
|
ageMinutes: PropTypes.number.isRequired,
|
||||||
publishDate: PropTypes.string.isRequired,
|
publishDate: PropTypes.string.isRequired,
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
|
fileName: PropTypes.string.isRequired,
|
||||||
infoUrl: PropTypes.string.isRequired,
|
infoUrl: PropTypes.string.isRequired,
|
||||||
downloadUrl: PropTypes.string.isRequired,
|
downloadUrl: PropTypes.string.isRequired,
|
||||||
indexerId: PropTypes.number.isRequired,
|
indexerId: PropTypes.number.isRequired,
|
||||||
@@ -335,6 +348,7 @@ SearchIndexRow.propTypes = {
|
|||||||
indexerFlags: PropTypes.arrayOf(PropTypes.string).isRequired,
|
indexerFlags: PropTypes.arrayOf(PropTypes.string).isRequired,
|
||||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
onGrabPress: PropTypes.func.isRequired,
|
onGrabPress: PropTypes.func.isRequired,
|
||||||
|
onSavePress: PropTypes.func.isRequired,
|
||||||
isGrabbing: PropTypes.bool.isRequired,
|
isGrabbing: PropTypes.bool.isRequired,
|
||||||
isGrabbed: PropTypes.bool.isRequired,
|
isGrabbed: PropTypes.bool.isRequired,
|
||||||
grabError: PropTypes.string,
|
grabError: PropTypes.string,
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ class SearchIndexTable extends Component {
|
|||||||
timeFormat,
|
timeFormat,
|
||||||
selectedState,
|
selectedState,
|
||||||
onSelectedChange,
|
onSelectedChange,
|
||||||
onGrabPress
|
onGrabPress,
|
||||||
|
onSavePress
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const release = items[rowIndex];
|
const release = items[rowIndex];
|
||||||
@@ -71,6 +72,7 @@ class SearchIndexTable extends Component {
|
|||||||
longDateFormat={longDateFormat}
|
longDateFormat={longDateFormat}
|
||||||
timeFormat={timeFormat}
|
timeFormat={timeFormat}
|
||||||
onGrabPress={onGrabPress}
|
onGrabPress={onGrabPress}
|
||||||
|
onSavePress={onSavePress}
|
||||||
/>
|
/>
|
||||||
</VirtualTableRow>
|
</VirtualTableRow>
|
||||||
);
|
);
|
||||||
@@ -134,6 +136,7 @@ SearchIndexTable.propTypes = {
|
|||||||
timeFormat: PropTypes.string.isRequired,
|
timeFormat: PropTypes.string.isRequired,
|
||||||
onSortPress: PropTypes.func.isRequired,
|
onSortPress: PropTypes.func.isRequired,
|
||||||
onGrabPress: PropTypes.func.isRequired,
|
onGrabPress: PropTypes.func.isRequired,
|
||||||
|
onSavePress: PropTypes.func.isRequired,
|
||||||
allSelected: PropTypes.bool.isRequired,
|
allSelected: PropTypes.bool.isRequired,
|
||||||
allUnselected: PropTypes.bool.isRequired,
|
allUnselected: PropTypes.bool.isRequired,
|
||||||
selectedState: PropTypes.object.isRequired,
|
selectedState: PropTypes.object.isRequired,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { grabRelease, setReleasesSort } from 'Store/Actions/releaseActions';
|
import { grabRelease, saveRelease, setReleasesSort } from 'Store/Actions/releaseActions';
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
import SearchIndexTable from './SearchIndexTable';
|
import SearchIndexTable from './SearchIndexTable';
|
||||||
|
|
||||||
@@ -25,6 +25,9 @@ function createMapDispatchToProps(dispatch, props) {
|
|||||||
},
|
},
|
||||||
onGrabPress(payload) {
|
onGrabPress(payload) {
|
||||||
dispatch(grabRelease(payload));
|
dispatch(grabRelease(payload));
|
||||||
|
},
|
||||||
|
onSavePress(payload) {
|
||||||
|
dispatch(saveRelease(payload));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class AddApplicationModalContent extends Component {
|
|||||||
return (
|
return (
|
||||||
<ModalContent onModalClose={onModalClose}>
|
<ModalContent onModalClose={onModalClose}>
|
||||||
<ModalHeader>
|
<ModalHeader>
|
||||||
Add Application
|
{translate('AddApplication')}
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
|
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
|
|||||||
@@ -71,14 +71,14 @@ class Application extends Component {
|
|||||||
{
|
{
|
||||||
syncLevel === 'addOnly' &&
|
syncLevel === 'addOnly' &&
|
||||||
<Label kind={kinds.WARNING}>
|
<Label kind={kinds.WARNING}>
|
||||||
Add and Remove Only
|
{translate('AddRemoveOnly')}
|
||||||
</Label>
|
</Label>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
syncLevel === 'fullSync' &&
|
syncLevel === 'fullSync' &&
|
||||||
<Label kind={kinds.SUCCESS}>
|
<Label kind={kinds.SUCCESS}>
|
||||||
Full Sync
|
{translate('FullSync')}
|
||||||
</Label>
|
</Label>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ class Application extends Component {
|
|||||||
kind={kinds.DISABLED}
|
kind={kinds.DISABLED}
|
||||||
outline={true}
|
outline={true}
|
||||||
>
|
>
|
||||||
Disabled
|
{translate('Disabled')}
|
||||||
</Label>
|
</Label>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class IndexerProxy extends Component {
|
|||||||
kind={kinds.DISABLED}
|
kind={kinds.DISABLED}
|
||||||
outline={true}
|
outline={true}
|
||||||
>
|
>
|
||||||
Disabled
|
{translate('Disabled')}
|
||||||
</Label> :
|
</Label> :
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,17 +56,9 @@ class Notification extends Component {
|
|||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
onGrab,
|
onGrab,
|
||||||
onDownload,
|
|
||||||
onUpgrade,
|
|
||||||
onRename,
|
|
||||||
onDelete,
|
|
||||||
onHealthIssue,
|
onHealthIssue,
|
||||||
onApplicationUpdate,
|
onApplicationUpdate,
|
||||||
supportsOnGrab,
|
supportsOnGrab,
|
||||||
supportsOnDownload,
|
|
||||||
supportsOnUpgrade,
|
|
||||||
supportsOnRename,
|
|
||||||
supportsOnDelete,
|
|
||||||
supportsOnHealthIssue,
|
supportsOnHealthIssue,
|
||||||
supportsOnApplicationUpdate
|
supportsOnApplicationUpdate
|
||||||
} = this.props;
|
} = this.props;
|
||||||
@@ -88,34 +80,6 @@ class Notification extends Component {
|
|||||||
</Label>
|
</Label>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
supportsOnDelete && onDelete &&
|
|
||||||
<Label kind={kinds.SUCCESS}>
|
|
||||||
{translate('OnDelete')}
|
|
||||||
</Label>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
supportsOnDownload && onDownload &&
|
|
||||||
<Label kind={kinds.SUCCESS}>
|
|
||||||
{translate('OnImport')}
|
|
||||||
</Label>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
supportsOnUpgrade && onDownload && onUpgrade &&
|
|
||||||
<Label kind={kinds.SUCCESS}>
|
|
||||||
{translate('OnUpgrade')}
|
|
||||||
</Label>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
supportsOnRename && onRename &&
|
|
||||||
<Label kind={kinds.SUCCESS}>
|
|
||||||
{translate('OnRename')}
|
|
||||||
</Label>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
supportsOnHealthIssue && onHealthIssue &&
|
supportsOnHealthIssue && onHealthIssue &&
|
||||||
<Label kind={kinds.SUCCESS}>
|
<Label kind={kinds.SUCCESS}>
|
||||||
@@ -132,7 +96,7 @@ class Notification extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
!onGrab && !onDownload && !onRename && !onHealthIssue && !onDelete && !onApplicationUpdate ?
|
!onGrab && !onHealthIssue && !onApplicationUpdate ?
|
||||||
<Label
|
<Label
|
||||||
kind={kinds.DISABLED}
|
kind={kinds.DISABLED}
|
||||||
outline={true}
|
outline={true}
|
||||||
@@ -167,17 +131,9 @@ Notification.propTypes = {
|
|||||||
id: PropTypes.number.isRequired,
|
id: PropTypes.number.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
onGrab: PropTypes.bool.isRequired,
|
onGrab: PropTypes.bool.isRequired,
|
||||||
onDownload: PropTypes.bool.isRequired,
|
|
||||||
onUpgrade: PropTypes.bool.isRequired,
|
|
||||||
onRename: PropTypes.bool.isRequired,
|
|
||||||
onDelete: PropTypes.bool.isRequired,
|
|
||||||
onHealthIssue: PropTypes.bool.isRequired,
|
onHealthIssue: PropTypes.bool.isRequired,
|
||||||
onApplicationUpdate: PropTypes.bool.isRequired,
|
onApplicationUpdate: PropTypes.bool.isRequired,
|
||||||
supportsOnGrab: PropTypes.bool.isRequired,
|
supportsOnGrab: PropTypes.bool.isRequired,
|
||||||
supportsOnDownload: PropTypes.bool.isRequired,
|
|
||||||
supportsOnDelete: PropTypes.bool.isRequired,
|
|
||||||
supportsOnUpgrade: PropTypes.bool.isRequired,
|
|
||||||
supportsOnRename: PropTypes.bool.isRequired,
|
|
||||||
supportsOnHealthIssue: PropTypes.bool.isRequired,
|
supportsOnHealthIssue: PropTypes.bool.isRequired,
|
||||||
supportsOnApplicationUpdate: PropTypes.bool.isRequired,
|
supportsOnApplicationUpdate: PropTypes.bool.isRequired,
|
||||||
onConfirmDeleteNotification: PropTypes.func.isRequired
|
onConfirmDeleteNotification: PropTypes.func.isRequired
|
||||||
|
|||||||
@@ -15,8 +15,11 @@ function NotificationEventItems(props) {
|
|||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
onGrab,
|
||||||
onHealthIssue,
|
onHealthIssue,
|
||||||
onApplicationUpdate,
|
onApplicationUpdate,
|
||||||
|
supportsOnGrab,
|
||||||
|
includeManualGrabs,
|
||||||
supportsOnHealthIssue,
|
supportsOnHealthIssue,
|
||||||
includeHealthWarnings,
|
includeHealthWarnings,
|
||||||
supportsOnApplicationUpdate
|
supportsOnApplicationUpdate
|
||||||
@@ -31,6 +34,31 @@ function NotificationEventItems(props) {
|
|||||||
link="https://wiki.servarr.com/prowlarr/settings#connections"
|
link="https://wiki.servarr.com/prowlarr/settings#connections"
|
||||||
/>
|
/>
|
||||||
<div className={styles.events}>
|
<div className={styles.events}>
|
||||||
|
<div>
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="onGrab"
|
||||||
|
helpText={translate('OnGrabHelpText')}
|
||||||
|
isDisabled={!supportsOnGrab.value}
|
||||||
|
{...onGrab}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{
|
||||||
|
onGrab.value &&
|
||||||
|
<div>
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="includeManualGrabs"
|
||||||
|
helpText={translate('IncludeManualGrabsHelpText')}
|
||||||
|
isDisabled={!supportsOnGrab.value}
|
||||||
|
{...includeManualGrabs}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function PendingChangesModal(props) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
bindShortcut('enter', onConfirm);
|
bindShortcut('enter', onConfirm);
|
||||||
}, [onConfirm]);
|
}, [bindShortcut, onConfirm]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
|||||||
@@ -103,9 +103,6 @@ export default {
|
|||||||
[SELECT_NOTIFICATION_SCHEMA]: (state, { payload }) => {
|
[SELECT_NOTIFICATION_SCHEMA]: (state, { payload }) => {
|
||||||
return selectProviderSchema(state, section, payload, (selectedSchema) => {
|
return selectProviderSchema(state, section, payload, (selectedSchema) => {
|
||||||
selectedSchema.onGrab = selectedSchema.supportsOnGrab;
|
selectedSchema.onGrab = selectedSchema.supportsOnGrab;
|
||||||
selectedSchema.onDownload = selectedSchema.supportsOnDownload;
|
|
||||||
selectedSchema.onUpgrade = selectedSchema.supportsOnUpgrade;
|
|
||||||
selectedSchema.onRename = selectedSchema.supportsOnRename;
|
|
||||||
selectedSchema.onApplicationUpdate = selectedSchema.supportsOnApplicationUpdate;
|
selectedSchema.onApplicationUpdate = selectedSchema.supportsOnApplicationUpdate;
|
||||||
|
|
||||||
return selectedSchema;
|
return selectedSchema;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export const defaultState = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'grabTitle',
|
name: 'grabTitle',
|
||||||
label: translate('Grab Title'),
|
label: translate('GrabTitle'),
|
||||||
isSortable: false,
|
isSortable: false,
|
||||||
isVisible: false
|
isVisible: false
|
||||||
},
|
},
|
||||||
@@ -78,7 +78,7 @@ export const defaultState = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'elapsedTime',
|
name: 'elapsedTime',
|
||||||
label: translate('Elapsed Time'),
|
label: translate('ElapsedTime'),
|
||||||
isSortable: false,
|
isSortable: false,
|
||||||
isVisible: true
|
isVisible: true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import $ from 'jquery';
|
||||||
import { createAction } from 'redux-actions';
|
import { createAction } from 'redux-actions';
|
||||||
import { batchActions } from 'redux-batched-actions';
|
import { batchActions } from 'redux-batched-actions';
|
||||||
import { filterBuilderTypes, filterBuilderValueTypes, sortDirections } from 'Helpers/Props';
|
import { filterBuilderTypes, filterBuilderValueTypes, sortDirections } from 'Helpers/Props';
|
||||||
@@ -229,6 +230,7 @@ export const CANCEL_FETCH_RELEASES = 'releases/cancelFetchReleases';
|
|||||||
export const SET_RELEASES_SORT = 'releases/setReleasesSort';
|
export const SET_RELEASES_SORT = 'releases/setReleasesSort';
|
||||||
export const CLEAR_RELEASES = 'releases/clearReleases';
|
export const CLEAR_RELEASES = 'releases/clearReleases';
|
||||||
export const GRAB_RELEASE = 'releases/grabRelease';
|
export const GRAB_RELEASE = 'releases/grabRelease';
|
||||||
|
export const SAVE_RELEASE = 'releases/saveRelease';
|
||||||
export const BULK_GRAB_RELEASES = 'release/bulkGrabReleases';
|
export const BULK_GRAB_RELEASES = 'release/bulkGrabReleases';
|
||||||
export const UPDATE_RELEASE = 'releases/updateRelease';
|
export const UPDATE_RELEASE = 'releases/updateRelease';
|
||||||
export const SET_RELEASES_FILTER = 'releases/setReleasesFilter';
|
export const SET_RELEASES_FILTER = 'releases/setReleasesFilter';
|
||||||
@@ -243,6 +245,7 @@ export const cancelFetchReleases = createThunk(CANCEL_FETCH_RELEASES);
|
|||||||
export const setReleasesSort = createAction(SET_RELEASES_SORT);
|
export const setReleasesSort = createAction(SET_RELEASES_SORT);
|
||||||
export const clearReleases = createAction(CLEAR_RELEASES);
|
export const clearReleases = createAction(CLEAR_RELEASES);
|
||||||
export const grabRelease = createThunk(GRAB_RELEASE);
|
export const grabRelease = createThunk(GRAB_RELEASE);
|
||||||
|
export const saveRelease = createThunk(SAVE_RELEASE);
|
||||||
export const bulkGrabReleases = createThunk(BULK_GRAB_RELEASES);
|
export const bulkGrabReleases = createThunk(BULK_GRAB_RELEASES);
|
||||||
export const updateRelease = createAction(UPDATE_RELEASE);
|
export const updateRelease = createAction(UPDATE_RELEASE);
|
||||||
export const setReleasesFilter = createAction(SET_RELEASES_FILTER);
|
export const setReleasesFilter = createAction(SET_RELEASES_FILTER);
|
||||||
@@ -304,6 +307,32 @@ export const actionHandlers = handleThunks({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[SAVE_RELEASE]: function(getState, payload, dispatch) {
|
||||||
|
const link = payload.downloadUrl;
|
||||||
|
const file = payload.fileName;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: link,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'X-Prowlarr-Client': true
|
||||||
|
},
|
||||||
|
xhrFields: {
|
||||||
|
responseType: 'blob'
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
const url = window.URL.createObjectURL(data);
|
||||||
|
a.href = url;
|
||||||
|
a.download = file;
|
||||||
|
document.body.append(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
[BULK_GRAB_RELEASES]: function(getState, payload, dispatch) {
|
[BULK_GRAB_RELEASES]: function(getState, payload, dispatch) {
|
||||||
dispatch(set({
|
dispatch(set({
|
||||||
section,
|
section,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const columns = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'size',
|
name: 'size',
|
||||||
label: 'Size',
|
label: translate('Size'),
|
||||||
isVisible: true
|
isVisible: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class Updates extends Component {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div className={styles.message}>
|
<div className={styles.message}>
|
||||||
The latest version of Prowlarr is already installed
|
{translate('TheLatestVersionIsAlreadyInstalled', ['Prowlarr'])}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ function addApiKey(ajaxOptions) {
|
|||||||
ajaxOptions.headers['X-Api-Key'] = window.Prowlarr.apiKey;
|
ajaxOptions.headers['X-Api-Key'] = window.Prowlarr.apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addUIHeader(ajaxOptions) {
|
||||||
|
ajaxOptions.headers = ajaxOptions.headers || {};
|
||||||
|
ajaxOptions.headers['X-Prowlarr-Client'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
function addContentType(ajaxOptions) {
|
function addContentType(ajaxOptions) {
|
||||||
if (
|
if (
|
||||||
ajaxOptions.contentType == null &&
|
ajaxOptions.contentType == null &&
|
||||||
@@ -42,6 +47,7 @@ export default function createAjaxRequest(originalAjaxOptions) {
|
|||||||
if (isRelative(ajaxOptions)) {
|
if (isRelative(ajaxOptions)) {
|
||||||
addRootUrl(ajaxOptions);
|
addRootUrl(ajaxOptions);
|
||||||
addApiKey(ajaxOptions);
|
addApiKey(ajaxOptions);
|
||||||
|
addUIHeader(ajaxOptions);
|
||||||
addContentType(ajaxOptions);
|
addContentType(ajaxOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -11,7 +11,8 @@
|
|||||||
"lint": "esprint check",
|
"lint": "esprint check",
|
||||||
"lint-fix": "esprint check --fix",
|
"lint-fix": "esprint check --fix",
|
||||||
"stylelint-linux": "stylelint $(find frontend -name '*.css') --config frontend/.stylelintrc",
|
"stylelint-linux": "stylelint $(find frontend -name '*.css') --config frontend/.stylelintrc",
|
||||||
"stylelint-windows": "stylelint frontend/**/*.css --config frontend/.stylelintrc"
|
"stylelint-windows": "stylelint frontend/**/*.css --config frontend/.stylelintrc",
|
||||||
|
"check-modules": "are-you-es5 check . -r"
|
||||||
},
|
},
|
||||||
"repository": "https://github.com/Prowlarr/Prowlarr",
|
"repository": "https://github.com/Prowlarr/Prowlarr",
|
||||||
"author": "Team Prowlarr",
|
"author": "Team Prowlarr",
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
"@fortawesome/free-regular-svg-icons": "6.2.1",
|
"@fortawesome/free-regular-svg-icons": "6.2.1",
|
||||||
"@fortawesome/free-solid-svg-icons": "6.2.1",
|
"@fortawesome/free-solid-svg-icons": "6.2.1",
|
||||||
"@fortawesome/react-fontawesome": "0.2.0",
|
"@fortawesome/react-fontawesome": "0.2.0",
|
||||||
"@microsoft/signalr": "6.0.11",
|
"@microsoft/signalr": "6.0.13",
|
||||||
"@sentry/browser": "7.28.0",
|
"@sentry/browser": "7.28.0",
|
||||||
"@sentry/integrations": "7.28.0",
|
"@sentry/integrations": "7.28.0",
|
||||||
"chart.js": "4.1.1",
|
"chart.js": "4.1.1",
|
||||||
@@ -93,6 +94,7 @@
|
|||||||
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
||||||
"@babel/preset-env": "7.20.2",
|
"@babel/preset-env": "7.20.2",
|
||||||
"@babel/preset-react": "7.18.6",
|
"@babel/preset-react": "7.18.6",
|
||||||
|
"are-you-es5": "2.1.2",
|
||||||
"autoprefixer": "10.4.13",
|
"autoprefixer": "10.4.13",
|
||||||
"babel-loader": "9.1.0",
|
"babel-loader": "9.1.0",
|
||||||
"babel-plugin-inline-classnames": "2.0.1",
|
"babel-plugin-inline-classnames": "2.0.1",
|
||||||
@@ -103,6 +105,7 @@
|
|||||||
"eslint-plugin-filenames": "1.3.2",
|
"eslint-plugin-filenames": "1.3.2",
|
||||||
"eslint-plugin-import": "2.26.0",
|
"eslint-plugin-import": "2.26.0",
|
||||||
"eslint-plugin-react": "7.31.11",
|
"eslint-plugin-react": "7.31.11",
|
||||||
|
"eslint-plugin-react-hooks": "4.6.0",
|
||||||
"eslint-plugin-simple-import-sort": "8.0.0",
|
"eslint-plugin-simple-import-sort": "8.0.0",
|
||||||
"esprint": "3.6.0",
|
"esprint": "3.6.0",
|
||||||
"file-loader": "6.2.0",
|
"file-loader": "6.2.0",
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
is_global = true
|
||||||
|
|
||||||
|
dotnet_diagnostic.CA1014.severity = none
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<!-- Common to all Prowlarr Projects -->
|
<!-- Common to all Prowlarr Projects -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<AnalysisLevel>6.0-all</AnalysisLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
|||||||
@@ -53,6 +53,26 @@ namespace NzbDrone.Common.Test.Http
|
|||||||
newUri.FullUri.Should().Be(expected);
|
newUri.FullUri.Should().Be(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("", "./relative", "relative")]
|
||||||
|
[TestCase("/", "./relative", "/relative")]
|
||||||
|
[TestCase("/base", "./relative", "/relative")]
|
||||||
|
[TestCase("/base/sub", "./relative", "/base/relative")]
|
||||||
|
[TestCase("/base/sub/", "./relative", "/base/sub/relative")]
|
||||||
|
[TestCase("base/sub", "./relative", "base/relative")]
|
||||||
|
[TestCase("base/sub/", "./relative", "base/sub/relative")]
|
||||||
|
[TestCase("", "../relative", "relative")]
|
||||||
|
[TestCase("/", "../relative", "/relative")]
|
||||||
|
[TestCase("/base", "../relative", "/relative")]
|
||||||
|
[TestCase("/base/sub", "../relative", "/base/relative")]
|
||||||
|
[TestCase("/base/sub/", "../relative", "/base/sub/relative")]
|
||||||
|
[TestCase("base/sub", "../relative", "base/relative")]
|
||||||
|
[TestCase("base/sub/", "../relative", "base/sub/relative")]
|
||||||
|
public void should_combine_uri_with_dot_segment(string basePath, string relativePath, string expected)
|
||||||
|
{
|
||||||
|
var newUri = new HttpUri(basePath) + new HttpUri(relativePath);
|
||||||
|
newUri.FullUri.Should().Be(expected);
|
||||||
|
}
|
||||||
|
|
||||||
[TestCase("", "", "")]
|
[TestCase("", "", "")]
|
||||||
[TestCase("/", "", "/")]
|
[TestCase("/", "", "/")]
|
||||||
[TestCase("base", "", "base")]
|
[TestCase("base", "", "base")]
|
||||||
|
|||||||
@@ -24,12 +24,16 @@ namespace NzbDrone.Common.Test.InstrumentationTests
|
|||||||
[TestCase(@"https://beyond-hd.me/api/torrents/2b51db35e1912ffc138825a12b9933d2")]
|
[TestCase(@"https://beyond-hd.me/api/torrents/2b51db35e1912ffc138825a12b9933d2")]
|
||||||
[TestCase(@"Req: [POST] https://www3.yggtorrent.nz/user/login: id=mySecret&pass=mySecret&ci_csrf_token=2b51db35e1912ffc138825a12b9933d2")]
|
[TestCase(@"Req: [POST] https://www3.yggtorrent.nz/user/login: id=mySecret&pass=mySecret&ci_csrf_token=2b51db35e1912ffc138825a12b9933d2")]
|
||||||
[TestCase(@"https://torrentseeds.org/api/torrents/filter?api_token=2b51db35e1912ffc138825a12b9933d2&name=&sortField=created_at&sortDirection=desc&perPage=100&page=1")]
|
[TestCase(@"https://torrentseeds.org/api/torrents/filter?api_token=2b51db35e1912ffc138825a12b9933d2&name=&sortField=created_at&sortDirection=desc&perPage=100&page=1")]
|
||||||
|
[TestCase(@"https://beyond-hd.me/torrent/download/the-next-365-days-2022-2160p-nf-web-dl-dual-ddp-51-dovi-hdr-hevc-apex.225146.2b51db35e1912ffc138825a12b9933d2")]
|
||||||
|
[TestCase(@"https://anthelion.me/api.php?api_key=2b51db35e1910123321025a12b9933d2&o=json&t=movie&q=&tmdb=&imdb=&cat=&limit=100&offset=0")]
|
||||||
|
[TestCase(@"https://avistaz.to/api/v1/jackett/auth: username=mySecret&password=mySecret&pid=mySecret")]
|
||||||
|
|
||||||
// Indexer and Download Client Responses
|
// Indexer and Download Client Responses
|
||||||
|
|
||||||
// avistaz response
|
// avistaz response
|
||||||
[TestCase(@"""download"":""https://avistaz.to/rss/download/2b51db35e1910123321025a12b9933d2/tb51db35e1910123321025a12b9933d2.torrent"",")]
|
[TestCase(@"""download"":""https://avistaz.to/rss/download/2b51db35e1910123321025a12b9933d2/tb51db35e1910123321025a12b9933d2.torrent"",")]
|
||||||
[TestCase(@",""info_hash"":""2b51db35e1910123321025a12b9933d2"",")]
|
[TestCase(@",""info_hash"":""2b51db35e1910123321025a12b9933d2"",")]
|
||||||
|
[TestCase(@"""token"":""2b51db35e1910123321025a12b9933d2""")]
|
||||||
|
|
||||||
// animebytes response
|
// animebytes response
|
||||||
[TestCase(@"""Link"":""https://animebytes.tv/torrent/994064/download/tb51db35e1910123321025a12b9933d2"",")]
|
[TestCase(@"""Link"":""https://animebytes.tv/torrent/994064/download/tb51db35e1910123321025a12b9933d2"",")]
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ namespace NzbDrone.Common.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void GetUpdateClientExePath()
|
public void GetUpdateClientExePath()
|
||||||
{
|
{
|
||||||
GetIAppDirectoryInfo().GetUpdateClientExePath(PlatformType.DotNet).Should().BeEquivalentTo(@"C:\Temp\prowlarr_update\Prowlarr.Update.exe".AsOsAgnostic());
|
GetIAppDirectoryInfo().GetUpdateClientExePath().Should().BeEquivalentTo(@"C:\Temp\prowlarr_update\Prowlarr.Update".AsOsAgnostic().ProcessNameToExe());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace NzbDrone.Common.EnvironmentInfo
|
|||||||
bool IsAdmin { get; }
|
bool IsAdmin { get; }
|
||||||
bool IsWindowsService { get; }
|
bool IsWindowsService { get; }
|
||||||
bool IsWindowsTray { get; }
|
bool IsWindowsTray { get; }
|
||||||
|
bool IsStarting { get; set; }
|
||||||
bool IsExiting { get; set; }
|
bool IsExiting { get; set; }
|
||||||
bool IsTray { get; }
|
bool IsTray { get; }
|
||||||
RuntimeMode Mode { get; }
|
RuntimeMode Mode { get; }
|
||||||
|
|||||||
@@ -2,13 +2,6 @@ using System;
|
|||||||
|
|
||||||
namespace NzbDrone.Common.EnvironmentInfo
|
namespace NzbDrone.Common.EnvironmentInfo
|
||||||
{
|
{
|
||||||
public enum PlatformType
|
|
||||||
{
|
|
||||||
DotNet = 0,
|
|
||||||
Mono = 1,
|
|
||||||
NetCore = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IPlatformInfo
|
public interface IPlatformInfo
|
||||||
{
|
{
|
||||||
Version Version { get; }
|
Version Version { get; }
|
||||||
@@ -16,36 +9,18 @@ namespace NzbDrone.Common.EnvironmentInfo
|
|||||||
|
|
||||||
public class PlatformInfo : IPlatformInfo
|
public class PlatformInfo : IPlatformInfo
|
||||||
{
|
{
|
||||||
private static PlatformType _platform;
|
|
||||||
private static Version _version;
|
private static Version _version;
|
||||||
|
|
||||||
static PlatformInfo()
|
static PlatformInfo()
|
||||||
{
|
{
|
||||||
_platform = PlatformType.NetCore;
|
|
||||||
_version = Environment.Version;
|
_version = Environment.Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlatformType Platform => _platform;
|
|
||||||
public static bool IsMono => Platform == PlatformType.Mono;
|
|
||||||
public static bool IsDotNet => Platform == PlatformType.DotNet;
|
|
||||||
public static bool IsNetCore => Platform == PlatformType.NetCore;
|
|
||||||
|
|
||||||
public static string PlatformName
|
public static string PlatformName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (IsDotNet)
|
return ".NET";
|
||||||
{
|
|
||||||
return ".NET";
|
|
||||||
}
|
|
||||||
else if (IsMono)
|
|
||||||
{
|
|
||||||
return "Mono";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ".NET Core";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace NzbDrone.Common.EnvironmentInfo
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
IsWindowsService = hostLifetime is WindowsServiceLifetime;
|
IsWindowsService = hostLifetime is WindowsServiceLifetime;
|
||||||
|
IsStarting = true;
|
||||||
|
|
||||||
// net6.0 will return Radarr.dll for entry assembly, we need the actual
|
// net6.0 will return Radarr.dll for entry assembly, we need the actual
|
||||||
// executable name (Radarr on linux). On mono this will return the location of
|
// executable name (Radarr on linux). On mono this will return the location of
|
||||||
@@ -82,6 +83,7 @@ namespace NzbDrone.Common.EnvironmentInfo
|
|||||||
|
|
||||||
public bool IsWindowsService { get; private set; }
|
public bool IsWindowsService { get; private set; }
|
||||||
|
|
||||||
|
public bool IsStarting { get; set; }
|
||||||
public bool IsExiting { get; set; }
|
public bool IsExiting { get; set; }
|
||||||
public bool IsTray
|
public bool IsTray
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace NzbDrone.Common.Extensions
|
|||||||
|
|
||||||
var info = new FileInfo(path.Trim());
|
var info = new FileInfo(path.Trim());
|
||||||
|
|
||||||
//UNC
|
// UNC
|
||||||
if (OsInfo.IsWindows && info.FullName.StartsWith(@"\\"))
|
if (OsInfo.IsWindows && info.FullName.StartsWith(@"\\"))
|
||||||
{
|
{
|
||||||
return info.FullName.TrimEnd('/', '\\', ' ');
|
return info.FullName.TrimEnd('/', '\\', ' ');
|
||||||
@@ -166,7 +166,7 @@ namespace NzbDrone.Common.Extensions
|
|||||||
var parentDirInfo = dirInfo.Parent;
|
var parentDirInfo = dirInfo.Parent;
|
||||||
if (parentDirInfo == null)
|
if (parentDirInfo == null)
|
||||||
{
|
{
|
||||||
//Drive letter
|
// Drive letter
|
||||||
return dirInfo.Name.ToUpper();
|
return dirInfo.Name.ToUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,9 +238,9 @@ namespace NzbDrone.Common.Extensions
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ProcessNameToExe(this string processName, PlatformType runtime)
|
public static string ProcessNameToExe(this string processName)
|
||||||
{
|
{
|
||||||
if (OsInfo.IsWindows || runtime != PlatformType.NetCore)
|
if (OsInfo.IsWindows)
|
||||||
{
|
{
|
||||||
processName += ".exe";
|
processName += ".exe";
|
||||||
}
|
}
|
||||||
@@ -248,11 +248,6 @@ namespace NzbDrone.Common.Extensions
|
|||||||
return processName;
|
return processName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ProcessNameToExe(this string processName)
|
|
||||||
{
|
|
||||||
return processName.ProcessNameToExe(PlatformInfo.Platform);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetAppDataPath(this IAppFolderInfo appFolderInfo)
|
public static string GetAppDataPath(this IAppFolderInfo appFolderInfo)
|
||||||
{
|
{
|
||||||
return appFolderInfo.AppDataFolder;
|
return appFolderInfo.AppDataFolder;
|
||||||
@@ -318,9 +313,9 @@ namespace NzbDrone.Common.Extensions
|
|||||||
return Path.Combine(GetUpdatePackageFolder(appFolderInfo), UPDATE_CLIENT_FOLDER_NAME);
|
return Path.Combine(GetUpdatePackageFolder(appFolderInfo), UPDATE_CLIENT_FOLDER_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetUpdateClientExePath(this IAppFolderInfo appFolderInfo, PlatformType runtime)
|
public static string GetUpdateClientExePath(this IAppFolderInfo appFolderInfo)
|
||||||
{
|
{
|
||||||
return Path.Combine(GetUpdateSandboxFolder(appFolderInfo), UPDATE_CLIENT_EXE_NAME).ProcessNameToExe(runtime);
|
return Path.Combine(GetUpdateSandboxFolder(appFolderInfo), UPDATE_CLIENT_EXE_NAME).ProcessNameToExe();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetDatabase(this IAppFolderInfo appFolderInfo)
|
public static string GetDatabase(this IAppFolderInfo appFolderInfo)
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ namespace NzbDrone.Common.Extensions
|
|||||||
|
|
||||||
public static string WrapInQuotes(this string text)
|
public static string WrapInQuotes(this string text)
|
||||||
{
|
{
|
||||||
if (!text.Contains(" "))
|
if (!text.Contains(' '))
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,20 @@ namespace NzbDrone.Common.Extensions
|
|||||||
|
|
||||||
public static string ToUrlHost(this string input)
|
public static string ToUrlHost(this string input)
|
||||||
{
|
{
|
||||||
return input.Contains(":") ? $"[{input}]" : input;
|
return input.Contains(':') ? $"[{input}]" : input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsAllDigits(this string input)
|
||||||
|
{
|
||||||
|
foreach (var c in input)
|
||||||
|
{
|
||||||
|
if (c < '0' || c > '9')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace NzbDrone.Common.Http.Dispatchers
|
|||||||
{
|
{
|
||||||
if (request.ResponseStream != null && responseMessage.StatusCode == HttpStatusCode.OK)
|
if (request.ResponseStream != null && responseMessage.StatusCode == HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
responseMessage.Content.CopyTo(request.ResponseStream, null, cts.Token);
|
await responseMessage.Content.CopyToAsync(request.ResponseStream, null, cts.Token);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ namespace NzbDrone.Common.Http
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var newUrl = Headers["Location"];
|
var newUrl = Headers["Location"];
|
||||||
|
|
||||||
if (newUrl == null)
|
if (newUrl == null)
|
||||||
{
|
{
|
||||||
newUrl = Headers["Refresh"];
|
newUrl = Headers["Refresh"];
|
||||||
|
|||||||
@@ -166,6 +166,37 @@ namespace NzbDrone.Common.Http
|
|||||||
return relativePath;
|
return relativePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (relativePath.StartsWith("./"))
|
||||||
|
{
|
||||||
|
relativePath = relativePath.TrimStart('.').TrimStart('/');
|
||||||
|
|
||||||
|
var lastIndex = basePath.LastIndexOf("/");
|
||||||
|
|
||||||
|
if (lastIndex > 0)
|
||||||
|
{
|
||||||
|
basePath = basePath.Substring(0, lastIndex) + "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (relativePath.StartsWith("../"))
|
||||||
|
{
|
||||||
|
relativePath = relativePath.TrimStart('.').TrimStart('/');
|
||||||
|
|
||||||
|
var lastIndex = basePath.LastIndexOf("/");
|
||||||
|
|
||||||
|
if (lastIndex > 0)
|
||||||
|
{
|
||||||
|
basePath = basePath.Substring(0, lastIndex) + "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
var secondLastIndex = basePath.LastIndexOf("/");
|
||||||
|
|
||||||
|
if (lastIndex > 0)
|
||||||
|
{
|
||||||
|
basePath = basePath.Substring(0, secondLastIndex) + "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var baseSlashIndex = basePath.LastIndexOf('/');
|
var baseSlashIndex = basePath.LastIndexOf('/');
|
||||||
|
|
||||||
if (baseSlashIndex >= 0)
|
if (baseSlashIndex >= 0)
|
||||||
|
|||||||
@@ -11,15 +11,13 @@ namespace NzbDrone.Common.Http
|
|||||||
{
|
{
|
||||||
if (response.Headers.ContainsKey("Retry-After"))
|
if (response.Headers.ContainsKey("Retry-After"))
|
||||||
{
|
{
|
||||||
var retryAfter = response.Headers["Retry-After"].ToString();
|
var retryAfter = response.Headers["Retry-After"];
|
||||||
int seconds;
|
|
||||||
DateTime date;
|
|
||||||
|
|
||||||
if (int.TryParse(retryAfter, out seconds))
|
if (int.TryParse(retryAfter, out var seconds))
|
||||||
{
|
{
|
||||||
RetryAfter = TimeSpan.FromSeconds(seconds);
|
RetryAfter = TimeSpan.FromSeconds(seconds);
|
||||||
}
|
}
|
||||||
else if (DateTime.TryParse(retryAfter, out date))
|
else if (DateTime.TryParse(retryAfter, out var date))
|
||||||
{
|
{
|
||||||
RetryAfter = date.ToUniversalTime() - DateTime.UtcNow;
|
RetryAfter = date.ToUniversalTime() - DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace NzbDrone.Common.Http
|
namespace NzbDrone.Common.Http
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -8,10 +7,10 @@ namespace NzbDrone.Common.Instrumentation
|
|||||||
{
|
{
|
||||||
public class CleanseLogMessage
|
public class CleanseLogMessage
|
||||||
{
|
{
|
||||||
private static readonly Regex[] CleansingRules = new[]
|
private static readonly Regex[] CleansingRules =
|
||||||
{
|
{
|
||||||
// Url
|
// Url
|
||||||
new Regex(@"(?<=[?&: ;])(apikey|(?:(?:access|api)[-_]?)?token|pass(?:key|wd)?|auth|authkey|user|u?id|api|[a-z_]*apikey|account|pwd)=(?<secret>[^&=""]+?)(?=[ ""&=]|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"(?<=[?&: ;])(apikey|api_key|(?:(?:access|api)[-_]?)?token|pass(?:key|wd)?|auth|authkey|user|u?id|api|[a-z_]*apikey|account|pid|pwd)=(?<secret>[^&=""]+?)(?=[ ""&=]|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@"(?<=[?& ;])[^=]*?(_?(?<!use|get_)token|username|passwo?rd)=(?<secret>[^&=]+?)(?= |&|$|;)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"(?<=[?& ;])[^=]*?(_?(?<!use|get_)token|username|passwo?rd)=(?<secret>[^&=]+?)(?= |&|$|;)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@"rss\.torrentleech\.org/(?!rss)(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"rss\.torrentleech\.org/(?!rss)(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@"rss\.torrentleech\.org/rss/download/[0-9]+/(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"rss\.torrentleech\.org/rss/download/[0-9]+/(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
@@ -21,6 +20,7 @@ namespace NzbDrone.Common.Instrumentation
|
|||||||
new Regex(@"\b(\w*)?(_?(?<!use|get_)token|username|passwo?rd)=(?<secret>[^&=]+?)(?= |&|$|;)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"\b(\w*)?(_?(?<!use|get_)token|username|passwo?rd)=(?<secret>[^&=]+?)(?= |&|$|;)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@"(?<=authkey = "")(?<secret>[^&=]+?)(?="")", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"(?<=authkey = "")(?<secret>[^&=]+?)(?="")", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@"(?<=beyond-hd\.[a-z]+/api/torrents/)(?<secret>[^&=][a-z0-9]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"(?<=beyond-hd\.[a-z]+/api/torrents/)(?<secret>[^&=][a-z0-9]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
|
new Regex(@"(?<=beyond-hd\.[a-z]+/torrent/download/[\w\d-]+[.]\d+[.])(?<secret>[a-z0-9]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
|
|
||||||
// UNIT3D
|
// UNIT3D
|
||||||
new Regex(@"(?<=[a-z0-9-]+\.[a-z]+/torrent/download/\d+\.)(?<secret>[^&=][a-z0-9]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"(?<=[a-z0-9-]+\.[a-z]+/torrent/download/\d+\.)(?<secret>[^&=][a-z0-9]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
@@ -58,9 +58,10 @@ namespace NzbDrone.Common.Instrumentation
|
|||||||
new Regex(@"(?:avistaz|exoticaz|cinemaz|privatehd)\.[a-z]{2,3}/rss/download/(?<secret>[^&=]+?)/(?<secret>[^&=]+?)\.torrent", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"(?:avistaz|exoticaz|cinemaz|privatehd)\.[a-z]{2,3}/rss/download/(?<secret>[^&=]+?)/(?<secret>[^&=]+?)\.torrent", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@"(?:animebytes)\.[a-z]{2,3}/torrent/[0-9]+/download/(?<secret>[^&=]+?)[""]", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@"(?:animebytes)\.[a-z]{2,3}/torrent/[0-9]+/download/(?<secret>[^&=]+?)[""]", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@",""info_hash"":""(?<secret>[^&=]+?)"",", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@",""info_hash"":""(?<secret>[^&=]+?)"",", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
|
new Regex(@"""token"":""(?<secret>[^&=]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@",""pass[- _]?key"":""(?<secret>[^&=]+?)"",", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@",""pass[- _]?key"":""(?<secret>[^&=]+?)"",", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
new Regex(@",""rss[- _]?key"":""(?<secret>[^&=]+?)"",", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
new Regex(@",""rss[- _]?key"":""(?<secret>[^&=]+?)"",", RegexOptions.Compiled | RegexOptions.IgnoreCase),
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Regex CleanseRemoteIPRegex = new Regex(@"(?:Auth-\w+(?<!Failure|Unauthorized) ip|from) (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", RegexOptions.Compiled);
|
private static readonly Regex CleanseRemoteIPRegex = new Regex(@"(?:Auth-\w+(?<!Failure|Unauthorized) ip|from) (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", RegexOptions.Compiled);
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.Threading;
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Common;
|
using NLog.Common;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
|
using Npgsql;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using Sentry;
|
using Sentry;
|
||||||
@@ -34,6 +35,14 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
|||||||
SQLiteErrorCode.Auth
|
SQLiteErrorCode.Auth
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static readonly HashSet<string> FilteredPostgresErrorCodes = new HashSet<string>
|
||||||
|
{
|
||||||
|
PostgresErrorCodes.OutOfMemory,
|
||||||
|
PostgresErrorCodes.TooManyConnections,
|
||||||
|
PostgresErrorCodes.DiskFull,
|
||||||
|
PostgresErrorCodes.ProgramLimitExceeded
|
||||||
|
};
|
||||||
|
|
||||||
// use string and not Type so we don't need a reference to the project
|
// use string and not Type so we don't need a reference to the project
|
||||||
// where these are defined
|
// where these are defined
|
||||||
private static readonly HashSet<string> FilteredExceptionTypeNames = new HashSet<string>
|
private static readonly HashSet<string> FilteredExceptionTypeNames = new HashSet<string>
|
||||||
@@ -239,6 +248,19 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pgEx = logEvent.Exception as PostgresException;
|
||||||
|
if (pgEx != null && FilteredPostgresErrorCodes.Contains(pgEx.SqlState))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't care about transient network and timeout errors
|
||||||
|
var npgEx = logEvent.Exception as NpgsqlException;
|
||||||
|
if (npgEx != null && npgEx.IsTransient)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (FilteredExceptionTypeNames.Contains(logEvent.Exception.GetType().Name))
|
if (FilteredExceptionTypeNames.Contains(logEvent.Exception.GetType().Name))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ namespace NzbDrone.Common.OAuth
|
|||||||
#if WINRT
|
#if WINRT
|
||||||
return CultureInfo.InvariantCulture.CompareInfo.Compare(left, right, CompareOptions.IgnoreCase) == 0;
|
return CultureInfo.InvariantCulture.CompareInfo.Compare(left, right, CompareOptions.IgnoreCase) == 0;
|
||||||
#else
|
#else
|
||||||
return string.Compare(left, right, StringComparison.InvariantCultureIgnoreCase) == 0;
|
return string.Equals(left, right, StringComparison.InvariantCultureIgnoreCase);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,13 @@
|
|||||||
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64' or '$(RuntimeIdentifier)' == 'linux-musl-arm64'">ISMUSL</DefineConstants>
|
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64' or '$(RuntimeIdentifier)' == 'linux-musl-arm64'">ISMUSL</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DryIoc.dll" Version="5.3.1" />
|
<PackageReference Include="DryIoc.dll" Version="5.3.3" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||||
<PackageReference Include="NLog" Version="5.1.0" />
|
<PackageReference Include="NLog" Version="5.1.0" />
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.0" />
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.0" />
|
||||||
|
<PackageReference Include="Npgsql" Version="5.0.11" />
|
||||||
<PackageReference Include="Sentry" Version="3.24.1" />
|
<PackageReference Include="Sentry" Version="3.24.1" />
|
||||||
<PackageReference Include="NLog.Targets.Syslog" Version="7.0.0" />
|
<PackageReference Include="NLog.Targets.Syslog" Version="7.0.0" />
|
||||||
<PackageReference Include="SharpZipLib" Version="1.3.3" />
|
<PackageReference Include="SharpZipLib" Version="1.3.3" />
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace NzbDrone.Common
|
|||||||
|
|
||||||
var args = $"create {serviceName} " +
|
var args = $"create {serviceName} " +
|
||||||
$"DisplayName= \"{serviceName}\" " +
|
$"DisplayName= \"{serviceName}\" " +
|
||||||
$"binpath= \"{Process.GetCurrentProcess().MainModule.FileName}\" " +
|
$"binpath= \"{Environment.ProcessPath}\" " +
|
||||||
"start= auto " +
|
"start= auto " +
|
||||||
"depend= EventLog/Tcpip/http " +
|
"depend= EventLog/Tcpip/http " +
|
||||||
"obj= \"NT AUTHORITY\\LocalService\"";
|
"obj= \"NT AUTHORITY\\LocalService\"";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -19,7 +19,7 @@ namespace NzbDrone.Common.TPL
|
|||||||
private readonly int _maxDegreeOfParallelism;
|
private readonly int _maxDegreeOfParallelism;
|
||||||
|
|
||||||
/// <summary>Whether the scheduler is currently processing work items.</summary>
|
/// <summary>Whether the scheduler is currently processing work items.</summary>
|
||||||
private int _delegatesQueuedOrRunning = 0;
|
private int _delegatesQueuedOrRunning;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes an instance of the LimitedConcurrencyLevelTaskScheduler class with the
|
/// Initializes an instance of the LimitedConcurrencyLevelTaskScheduler class with the
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.IndexerTests.AvistazTests
|
|||||||
torrentInfo.InfoUrl.Should().Be("https://avistaz.to/torrent/187240-japan-sinks-people-of-hope-2021-s01e05-720p-nf-web-dl-ddp20-x264-seikel");
|
torrentInfo.InfoUrl.Should().Be("https://avistaz.to/torrent/187240-japan-sinks-people-of-hope-2021-s01e05-720p-nf-web-dl-ddp20-x264-seikel");
|
||||||
torrentInfo.CommentUrl.Should().BeNullOrEmpty();
|
torrentInfo.CommentUrl.Should().BeNullOrEmpty();
|
||||||
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
||||||
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2021-11-15 04:26:21"));
|
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2021-11-14 22:26:21"));
|
||||||
torrentInfo.Size.Should().Be(935127615);
|
torrentInfo.Size.Should().Be(935127615);
|
||||||
torrentInfo.InfoHash.Should().Be("a879261d4e6e792402f92401141a21de70d51bf2");
|
torrentInfo.InfoHash.Should().Be("a879261d4e6e792402f92401141a21de70d51bf2");
|
||||||
torrentInfo.MagnetUrl.Should().Be(null);
|
torrentInfo.MagnetUrl.Should().Be(null);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using Moq;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.FileList;
|
using NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@@ -21,10 +21,15 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Subject.Definition = new IndexerDefinition()
|
Subject.Definition = new IndexerDefinition
|
||||||
{
|
{
|
||||||
Name = "FileList",
|
Name = "FileList",
|
||||||
Settings = new FileListSettings() { Username = "someuser", Passkey = "somepass" }
|
Settings = new FileListSettings
|
||||||
|
{
|
||||||
|
BaseUrl = "https://filelist.io/",
|
||||||
|
Username = "someuser",
|
||||||
|
Passkey = "somepass"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,9 +40,9 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
|
|||||||
|
|
||||||
Mocker.GetMock<IIndexerHttpClient>()
|
Mocker.GetMock<IIndexerHttpClient>()
|
||||||
.Setup(o => o.ExecuteProxiedAsync(It.Is<HttpRequest>(v => v.Method == HttpMethod.Get), Subject.Definition))
|
.Setup(o => o.ExecuteProxiedAsync(It.Is<HttpRequest>(v => v.Method == HttpMethod.Get), Subject.Definition))
|
||||||
.Returns<HttpRequest, IndexerDefinition>((r, d) => Task.FromResult(new HttpResponse(r, new HttpHeader(), new CookieCollection(), recentFeed)));
|
.Returns<HttpRequest, IndexerDefinition>((r, d) => Task.FromResult(new HttpResponse(r, new HttpHeader { { "Content-Type", "application/json" } }, new CookieCollection(), recentFeed)));
|
||||||
|
|
||||||
var releases = (await Subject.Fetch(new MovieSearchCriteria { Categories = new int[] { 2000 } })).Releases;
|
var releases = (await Subject.Fetch(new MovieSearchCriteria { Categories = new[] { 2000 } })).Releases;
|
||||||
|
|
||||||
releases.Should().HaveCount(4);
|
releases.Should().HaveCount(4);
|
||||||
releases.First().Should().BeOfType<TorrentInfo>();
|
releases.First().Should().BeOfType<TorrentInfo>();
|
||||||
@@ -50,12 +55,14 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
|
|||||||
torrentInfo.InfoUrl.Should().Be("https://filelist.io/details.php?id=665873");
|
torrentInfo.InfoUrl.Should().Be("https://filelist.io/details.php?id=665873");
|
||||||
torrentInfo.CommentUrl.Should().BeNullOrEmpty();
|
torrentInfo.CommentUrl.Should().BeNullOrEmpty();
|
||||||
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
||||||
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2020-01-25 20:20:19").ToUniversalTime());
|
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2020-01-25 20:20:19"));
|
||||||
torrentInfo.Size.Should().Be(8300512414);
|
torrentInfo.Size.Should().Be(8300512414);
|
||||||
torrentInfo.InfoHash.Should().Be(null);
|
torrentInfo.InfoHash.Should().Be(null);
|
||||||
torrentInfo.MagnetUrl.Should().Be(null);
|
torrentInfo.MagnetUrl.Should().Be(null);
|
||||||
torrentInfo.Peers.Should().Be(2 + 12);
|
torrentInfo.Peers.Should().Be(2 + 12);
|
||||||
torrentInfo.Seeders.Should().Be(12);
|
torrentInfo.Seeders.Should().Be(12);
|
||||||
|
|
||||||
|
releases.Any(t => t.IndexerFlags.Contains(IndexerFlag.Internal)).Should().Be(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-27
@@ -3,7 +3,7 @@ using System.Linq;
|
|||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.FileList;
|
using NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@@ -16,34 +16,35 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Subject.Settings = new FileListSettings()
|
Subject.Settings = new FileListSettings
|
||||||
{
|
{
|
||||||
|
BaseUrl = "https://filelist.io/",
|
||||||
Passkey = "abcd",
|
Passkey = "abcd",
|
||||||
Username = "somename",
|
Username = "somename"
|
||||||
BaseUrl = "https://filelist.io"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Subject.Capabilities = new IndexerCapabilities
|
Subject.Capabilities = new IndexerCapabilities
|
||||||
{
|
{
|
||||||
TvSearchParams = new List<TvSearchParam>
|
TvSearchParams = new List<TvSearchParam>
|
||||||
{
|
{
|
||||||
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep
|
TvSearchParam.Q, TvSearchParam.ImdbId, TvSearchParam.Season, TvSearchParam.Ep
|
||||||
},
|
},
|
||||||
MovieSearchParams = new List<MovieSearchParam>
|
MovieSearchParams = new List<MovieSearchParam>
|
||||||
{
|
{
|
||||||
MovieSearchParam.Q, MovieSearchParam.ImdbId
|
MovieSearchParam.Q, MovieSearchParam.ImdbId
|
||||||
},
|
},
|
||||||
MusicSearchParams = new List<MusicSearchParam>
|
MusicSearchParams = new List<MusicSearchParam>
|
||||||
{
|
{
|
||||||
MusicSearchParam.Q
|
MusicSearchParam.Q
|
||||||
},
|
},
|
||||||
BookSearchParams = new List<BookSearchParam>
|
BookSearchParams = new List<BookSearchParam>
|
||||||
{
|
{
|
||||||
BookSearchParam.Q
|
BookSearchParam.Q
|
||||||
},
|
},
|
||||||
Flags = new List<IndexerFlag>
|
Flags = new List<IndexerFlag>
|
||||||
{
|
{
|
||||||
IndexerFlag.FreeLeech
|
IndexerFlag.FreeLeech,
|
||||||
|
IndexerFlag.Internal,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
|
|||||||
_movieSearchCriteria = new MovieSearchCriteria
|
_movieSearchCriteria = new MovieSearchCriteria
|
||||||
{
|
{
|
||||||
SearchTerm = "Star Wars",
|
SearchTerm = "Star Wars",
|
||||||
Categories = new int[] { 2000 }
|
Categories = new[] { 2000 }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,13 +66,13 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_use_categories_for_feed()
|
public void should_use_categories_for_feed()
|
||||||
{
|
{
|
||||||
var results = Subject.GetSearchRequests(new MovieSearchCriteria { Categories = new int[] { NewznabStandardCategory.MoviesSD.Id, NewznabStandardCategory.MoviesDVD.Id } });
|
var results = Subject.GetSearchRequests(new MovieSearchCriteria { Categories = new[] { NewznabStandardCategory.MoviesSD.Id, NewznabStandardCategory.MoviesDVD.Id } });
|
||||||
|
|
||||||
results.GetAllTiers().Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var page = results.GetAllTiers().First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().Contain("&category=1,2&");
|
page.Url.Query.Should().Contain("&category=1%2C2");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -80,9 +81,9 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
|
|||||||
_movieSearchCriteria.ImdbId = "0076759";
|
_movieSearchCriteria.ImdbId = "0076759";
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
|
|
||||||
results.GetAllTiers().Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var page = results.GetAllTiers().First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().Contain("type=imdb");
|
page.Url.Query.Should().Contain("type=imdb");
|
||||||
page.Url.Query.Should().Contain("query=tt0076759");
|
page.Url.Query.Should().Contain("query=tt0076759");
|
||||||
@@ -95,12 +96,12 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
|
|||||||
|
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
|
|
||||||
results.GetAllTiers().Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var page = results.GetAllTiers().First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().Contain("type=name");
|
page.Url.Query.Should().Contain("type=name");
|
||||||
page.Url.Query.Should().Contain("query=Star Wars");
|
page.Url.Query.Should().Contain("query=Star+Wars");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using NUnit.Framework;
|
|||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Common.Serializer;
|
using NzbDrone.Common.Serializer;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.HDBits;
|
using NzbDrone.Core.Indexers.Definitions.HDBits;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using Newtonsoft.Json;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.HDBits;
|
using NzbDrone.Core.Indexers.Definitions.HDBits;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@@ -14,11 +14,13 @@ namespace NzbDrone.Core.Test.IndexerTests.HDBitsTests
|
|||||||
public class HDBitsRequestGeneratorFixture : CoreTest<HDBitsRequestGenerator>
|
public class HDBitsRequestGeneratorFixture : CoreTest<HDBitsRequestGenerator>
|
||||||
{
|
{
|
||||||
private MovieSearchCriteria _movieSearchCriteria;
|
private MovieSearchCriteria _movieSearchCriteria;
|
||||||
|
private TvSearchCriteria _tvSearchSeasonEpisodeCriteria;
|
||||||
|
private TvSearchCriteria _tvSearchDailyEpisodeCriteria;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Subject.Settings = new HDBitsSettings()
|
Subject.Settings = new HDBitsSettings
|
||||||
{
|
{
|
||||||
ApiKey = "abcd",
|
ApiKey = "abcd",
|
||||||
Username = "somename"
|
Username = "somename"
|
||||||
@@ -47,9 +49,25 @@ namespace NzbDrone.Core.Test.IndexerTests.HDBitsTests
|
|||||||
|
|
||||||
_movieSearchCriteria = new MovieSearchCriteria
|
_movieSearchCriteria = new MovieSearchCriteria
|
||||||
{
|
{
|
||||||
Categories = new int[] { 2000, 2010 },
|
Categories = new[] { 2000, 2010 },
|
||||||
ImdbId = "0076759"
|
ImdbId = "0076759"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_tvSearchSeasonEpisodeCriteria = new TvSearchCriteria
|
||||||
|
{
|
||||||
|
Categories = new[] { 5000, 5010 },
|
||||||
|
TvdbId = 392256,
|
||||||
|
Season = 1,
|
||||||
|
Episode = "3"
|
||||||
|
};
|
||||||
|
|
||||||
|
_tvSearchDailyEpisodeCriteria = new TvSearchCriteria
|
||||||
|
{
|
||||||
|
Categories = new[] { 5000, 5010 },
|
||||||
|
TvdbId = 289574,
|
||||||
|
Season = 2023,
|
||||||
|
Episode = "01/03"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -58,9 +76,9 @@ namespace NzbDrone.Core.Test.IndexerTests.HDBitsTests
|
|||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
var imdbQuery = int.Parse(_movieSearchCriteria.ImdbId);
|
var imdbQuery = int.Parse(_movieSearchCriteria.ImdbId);
|
||||||
|
|
||||||
results.GetAllTiers().Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var page = results.GetAllTiers().First().First();
|
var page = results.First();
|
||||||
|
|
||||||
var encoding = HttpHeader.GetEncodingFromContentType(page.HttpRequest.Headers.ContentType);
|
var encoding = HttpHeader.GetEncodingFromContentType(page.HttpRequest.Headers.ContentType);
|
||||||
|
|
||||||
@@ -70,5 +88,49 @@ namespace NzbDrone.Core.Test.IndexerTests.HDBitsTests
|
|||||||
query.Category.Should().HaveCount(1);
|
query.Category.Should().HaveCount(1);
|
||||||
query.ImdbInfo.Id.Should().Be(imdbQuery);
|
query.ImdbInfo.Id.Should().Be(imdbQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_search_by_tvdbid_season_episode_if_supported()
|
||||||
|
{
|
||||||
|
var results = Subject.GetSearchRequests(_tvSearchSeasonEpisodeCriteria);
|
||||||
|
var tvdbQuery = _tvSearchSeasonEpisodeCriteria.TvdbId;
|
||||||
|
|
||||||
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
|
var page = results.First();
|
||||||
|
|
||||||
|
var encoding = HttpHeader.GetEncodingFromContentType(page.HttpRequest.Headers.ContentType);
|
||||||
|
|
||||||
|
var body = encoding.GetString(page.HttpRequest.ContentData);
|
||||||
|
var query = JsonConvert.DeserializeObject<TorrentQuery>(body);
|
||||||
|
|
||||||
|
query.Category.Should().HaveCount(3);
|
||||||
|
query.TvdbInfo.Id.Should().Be(tvdbQuery);
|
||||||
|
query.Search.Should().BeNullOrWhiteSpace();
|
||||||
|
query.TvdbInfo.Season.Should().Be(1);
|
||||||
|
query.TvdbInfo.Episode.Should().Be("3");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_search_by_tvdbid_daily_episode_if_supported()
|
||||||
|
{
|
||||||
|
var results = Subject.GetSearchRequests(_tvSearchDailyEpisodeCriteria);
|
||||||
|
var tvdbQuery = _tvSearchDailyEpisodeCriteria.TvdbId;
|
||||||
|
|
||||||
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
|
var page = results.First();
|
||||||
|
|
||||||
|
var encoding = HttpHeader.GetEncodingFromContentType(page.HttpRequest.Headers.ContentType);
|
||||||
|
|
||||||
|
var body = encoding.GetString(page.HttpRequest.ContentData);
|
||||||
|
var query = JsonConvert.DeserializeObject<TorrentQuery>(body);
|
||||||
|
|
||||||
|
query.Category.Should().HaveCount(3);
|
||||||
|
query.TvdbInfo.Id.Should().Be(tvdbQuery);
|
||||||
|
query.Search.Should().Be("2023-01-03");
|
||||||
|
query.TvdbInfo.Season.Should().BeNull();
|
||||||
|
query.TvdbInfo.Episode.Should().BeNull();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-22
@@ -51,9 +51,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
_movieSearchCriteria.Offset = 0;
|
_movieSearchCriteria.Offset = 0;
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
|
|
||||||
results.GetAllTiers().Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var pages = results.GetAllTiers().First().Take(3).ToList();
|
var pages = results.Take(3).ToList();
|
||||||
|
|
||||||
pages[0].Url.FullUri.Should().Contain("&offset=0");
|
pages[0].Url.FullUri.Should().Contain("&offset=0");
|
||||||
}
|
}
|
||||||
@@ -63,9 +63,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
{
|
{
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
|
|
||||||
results.GetAllTiers().Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var pages = results.GetAllTiers().First().Take(500).ToList();
|
var pages = results.Take(500).ToList();
|
||||||
|
|
||||||
pages.Count.Should().BeLessThan(500);
|
pages.Count.Should().BeLessThan(500);
|
||||||
}
|
}
|
||||||
@@ -77,9 +77,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
|
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
|
|
||||||
results.GetAllTiers().Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var page = results.GetAllTiers().First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().NotContain("imdbid=0076759");
|
page.Url.Query.Should().NotContain("imdbid=0076759");
|
||||||
page.Url.Query.Should().Contain("q=Star");
|
page.Url.Query.Should().Contain("q=Star");
|
||||||
@@ -92,9 +92,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId };
|
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId };
|
||||||
|
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
results.GetTier(0).Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var page = results.GetAllTiers().First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().Contain("imdbid=0076759");
|
page.Url.Query.Should().Contain("imdbid=0076759");
|
||||||
}
|
}
|
||||||
@@ -106,9 +106,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.TmdbId };
|
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.TmdbId };
|
||||||
|
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
results.GetTier(0).Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var page = results.GetAllTiers().First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().Contain("tmdbid=11");
|
page.Url.Query.Should().Contain("tmdbid=11");
|
||||||
}
|
}
|
||||||
@@ -120,9 +120,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId };
|
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId };
|
||||||
|
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
results.GetTier(0).Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var page = results.GetAllTiers().First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().Contain("tmdbid=11");
|
page.Url.Query.Should().Contain("tmdbid=11");
|
||||||
page.Url.Query.Should().NotContain("imdbid=0076759");
|
page.Url.Query.Should().NotContain("imdbid=0076759");
|
||||||
@@ -136,9 +136,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId };
|
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId };
|
||||||
|
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
results.GetTier(0).Should().HaveCount(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var page = results.GetTier(0).First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().Contain("tmdbid=11");
|
page.Url.Query.Should().Contain("tmdbid=11");
|
||||||
page.Url.Query.Should().Contain("imdbid=0076759");
|
page.Url.Query.Should().Contain("imdbid=0076759");
|
||||||
@@ -150,10 +150,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q };
|
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q };
|
||||||
|
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
results.Tiers.Should().Be(1);
|
results.Should().HaveCount(1);
|
||||||
results.GetTier(0).Should().HaveCount(1);
|
|
||||||
|
|
||||||
var page = results.GetTier(0).First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().Contain("q=");
|
page.Url.Query.Should().Contain("q=");
|
||||||
}
|
}
|
||||||
@@ -167,7 +166,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
|
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
|
|
||||||
var page = results.GetTier(0).First().First();
|
var page = results.First();
|
||||||
|
|
||||||
page.Url.Query.Should().Contain("q=");
|
page.Url.Query.Should().Contain("q=");
|
||||||
}
|
}
|
||||||
@@ -178,9 +177,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId };
|
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId };
|
||||||
|
|
||||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||||
results.Tiers.Should().Be(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var pageTier2 = results.GetTier(0).First().First();
|
var pageTier2 = results.First();
|
||||||
|
|
||||||
pageTier2.Url.Query.Should().NotContain("tmdbid=11");
|
pageTier2.Url.Query.Should().NotContain("tmdbid=11");
|
||||||
pageTier2.Url.Query.Should().NotContain("imdbid=0076759");
|
pageTier2.Url.Query.Should().NotContain("imdbid=0076759");
|
||||||
@@ -193,9 +192,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||||||
_capabilities.TvSearchParams = new List<TvSearchParam> { TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep };
|
_capabilities.TvSearchParams = new List<TvSearchParam> { TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep };
|
||||||
|
|
||||||
var results = Subject.GetSearchRequests(_tvSearchCriteria);
|
var results = Subject.GetSearchRequests(_tvSearchCriteria);
|
||||||
results.Tiers.Should().Be(1);
|
results.Should().HaveCount(1);
|
||||||
|
|
||||||
var pageTier = results.GetTier(0).First().First();
|
var pageTier = results.First();
|
||||||
|
|
||||||
pageTier.Url.Query.Should().Contain("season=00");
|
pageTier.Url.Query.Should().Contain("season=00");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using NUnit.Framework;
|
|||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.Definitions;
|
using NzbDrone.Core.Indexers.Definitions;
|
||||||
using NzbDrone.Core.Indexers.Gazelle;
|
using NzbDrone.Core.Indexers.Definitions.Gazelle;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.IndexerTests.OrpheusTests
|
|||||||
Subject.Definition = new IndexerDefinition()
|
Subject.Definition = new IndexerDefinition()
|
||||||
{
|
{
|
||||||
Name = "Orpheus",
|
Name = "Orpheus",
|
||||||
Settings = new OrpheusSettings() { Apikey = "somekey" }
|
Settings = new OrpheusSettings { Apikey = "somekey" }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,14 +37,14 @@ namespace NzbDrone.Core.Test.IndexerTests.OrpheusTests
|
|||||||
.Setup(o => o.ExecuteProxiedAsync(It.Is<HttpRequest>(v => v.Method == HttpMethod.Get), Subject.Definition))
|
.Setup(o => o.ExecuteProxiedAsync(It.Is<HttpRequest>(v => v.Method == HttpMethod.Get), Subject.Definition))
|
||||||
.Returns<HttpRequest, IndexerDefinition>((r, d) => Task.FromResult(new HttpResponse(r, new HttpHeader { { "Content-Type", "application/json" } }, new CookieCollection(), recentFeed)));
|
.Returns<HttpRequest, IndexerDefinition>((r, d) => Task.FromResult(new HttpResponse(r, new HttpHeader { { "Content-Type", "application/json" } }, new CookieCollection(), recentFeed)));
|
||||||
|
|
||||||
var releases = (await Subject.Fetch(new BasicSearchCriteria { Categories = new int[] { 2000 } })).Releases;
|
var releases = (await Subject.Fetch(new BasicSearchCriteria { Categories = new[] { 2000 } })).Releases;
|
||||||
|
|
||||||
releases.Should().HaveCount(65);
|
releases.Should().HaveCount(65);
|
||||||
releases.First().Should().BeOfType<GazelleInfo>();
|
releases.First().Should().BeOfType<GazelleInfo>();
|
||||||
|
|
||||||
var torrentInfo = releases.First() as GazelleInfo;
|
var torrentInfo = releases.First() as GazelleInfo;
|
||||||
|
|
||||||
torrentInfo.Title.Should().Be("The Beatles - Abbey Road (1969) [MP3 V2 (VBR)] [BD]");
|
torrentInfo.Title.Should().Be("The Beatles - Abbey Road [1969] [Album] [2.0 Mix 2019] [MP3 V2 (VBR)] [BD]");
|
||||||
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
||||||
torrentInfo.DownloadUrl.Should().Be("https://orpheus.network/ajax.php?action=download&id=1902448");
|
torrentInfo.DownloadUrl.Should().Be("https://orpheus.network/ajax.php?action=download&id=1902448");
|
||||||
torrentInfo.InfoUrl.Should().Be("https://orpheus.network/torrents.php?id=466&torrentid=1902448");
|
torrentInfo.InfoUrl.Should().Be("https://orpheus.network/torrents.php?id=466&torrentid=1902448");
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using NUnit.Framework;
|
|||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.Rarbg;
|
using NzbDrone.Core.Indexers.Definitions.Rarbg;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
@@ -23,14 +23,14 @@ namespace NzbDrone.Core.Test.IndexerTests.RarbgTests
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
Subject.Definition = new IndexerDefinition()
|
Subject.Definition = new IndexerDefinition
|
||||||
{
|
{
|
||||||
Name = "Rarbg",
|
Name = "Rarbg",
|
||||||
Settings = new RarbgSettings()
|
Settings = new RarbgSettings()
|
||||||
};
|
};
|
||||||
|
|
||||||
Mocker.GetMock<IRarbgTokenProvider>()
|
Mocker.GetMock<IRarbgTokenProvider>()
|
||||||
.Setup(v => v.GetToken(It.IsAny<RarbgSettings>()))
|
.Setup(v => v.GetToken(It.IsAny<RarbgSettings>(), Subject.RateLimit))
|
||||||
.Returns("validtoken");
|
.Returns("validtoken");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.IndexerTests.RarbgTests
|
|||||||
torrentInfo.Title.Should().Be("Sense8.S01E01.WEBRip.x264-FGT");
|
torrentInfo.Title.Should().Be("Sense8.S01E01.WEBRip.x264-FGT");
|
||||||
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
||||||
torrentInfo.DownloadUrl.Should().Be("magnet:?xt=urn:btih:d8bde635f573acb390c7d7e7efc1556965fdc802&dn=Sense8.S01E01.WEBRip.x264-FGT&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710&tr=udp%3A%2F%2F9.rarbg.to%3A2710&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce");
|
torrentInfo.DownloadUrl.Should().Be("magnet:?xt=urn:btih:d8bde635f573acb390c7d7e7efc1556965fdc802&dn=Sense8.S01E01.WEBRip.x264-FGT&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710&tr=udp%3A%2F%2F9.rarbg.to%3A2710&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce");
|
||||||
torrentInfo.InfoUrl.Should().Be($"https://torrentapi.org/redirect_to_info.php?token=i5cx7b9agd&p=8_6_4_4_5_6__d8bde635f5&app_id={BuildInfo.AppName}");
|
torrentInfo.InfoUrl.Should().Be($"https://torrentapi.org/redirect_to_info.php?token=i5cx7b9agd&p=8_6_4_4_5_6__d8bde635f5&app_id=rralworP_{BuildInfo.Version}");
|
||||||
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
||||||
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2015-06-05 16:58:11 +0000").ToUniversalTime());
|
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2015-06-05 16:58:11 +0000").ToUniversalTime());
|
||||||
torrentInfo.Size.Should().Be(564198371);
|
torrentInfo.Size.Should().Be(564198371);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using NUnit.Framework;
|
|||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.Definitions;
|
using NzbDrone.Core.Indexers.Definitions;
|
||||||
using NzbDrone.Core.Indexers.Gazelle;
|
using NzbDrone.Core.Indexers.Definitions.Gazelle;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorznabTests
|
|||||||
releaseInfo.InfoHash.Should().Be("(removed)");
|
releaseInfo.InfoHash.Should().Be("(removed)");
|
||||||
releaseInfo.Seeders.Should().Be(3);
|
releaseInfo.Seeders.Should().Be(3);
|
||||||
releaseInfo.Peers.Should().Be(3);
|
releaseInfo.Peers.Should().Be(3);
|
||||||
releaseInfo.Categories.Count().Should().Be(4);
|
releaseInfo.Categories.Count.Should().Be(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using FluentValidation.Results;
|
using FluentValidation.Results;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -56,6 +55,11 @@ namespace NzbDrone.Core.Test.NotificationTests
|
|||||||
{
|
{
|
||||||
TestLogger.Info("OnApplicationUpdate was called");
|
TestLogger.Info("OnApplicationUpdate was called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnGrab(GrabMessage message)
|
||||||
|
{
|
||||||
|
TestLogger.Info("OnGrab was called");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestNotificationWithNoEvents : NotificationBase<TestSetting>
|
private class TestNotificationWithNoEvents : NotificationBase<TestSetting>
|
||||||
@@ -76,6 +80,7 @@ namespace NzbDrone.Core.Test.NotificationTests
|
|||||||
|
|
||||||
notification.SupportsOnHealthIssue.Should().BeTrue();
|
notification.SupportsOnHealthIssue.Should().BeTrue();
|
||||||
notification.SupportsOnApplicationUpdate.Should().BeTrue();
|
notification.SupportsOnApplicationUpdate.Should().BeTrue();
|
||||||
|
notification.SupportsOnGrab.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -85,6 +90,7 @@ namespace NzbDrone.Core.Test.NotificationTests
|
|||||||
|
|
||||||
notification.SupportsOnHealthIssue.Should().BeFalse();
|
notification.SupportsOnHealthIssue.Should().BeFalse();
|
||||||
notification.SupportsOnApplicationUpdate.Should().BeFalse();
|
notification.SupportsOnApplicationUpdate.Should().BeFalse();
|
||||||
|
notification.SupportsOnGrab.Should().BeFalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Threading;
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Parser;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.ParserTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class DateTimeUtilFixture : CoreTest
|
||||||
|
{
|
||||||
|
[TestCase("pt-BR")]
|
||||||
|
[TestCase("en-US")]
|
||||||
|
public void should_format_date_invariant(string culture)
|
||||||
|
{
|
||||||
|
Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
|
||||||
|
|
||||||
|
var dateNow = DateTime.Now;
|
||||||
|
|
||||||
|
DateTimeUtil.FromUnknown(dateNow.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture))
|
||||||
|
.ToString(DateTimeUtil.Rfc1123ZPattern, CultureInfo.InvariantCulture)
|
||||||
|
.Should().Be(dateNow.ToString("ddd, dd MMM yyyy HH':'mm':'ss z", CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("2022-08-08 02:07:39 -02:00", "2006-01-02 15:04:05 -07:00", "yyyy-MM-dd HH:mm:ss zzz", "2022-08-08 04:07:39 +00:00")]
|
||||||
|
[TestCase("2022-08-08 02:07:39 -02:00", "yyyy-MM-dd HH:mm:ss zzz", "yyyy-MM-dd HH:mm:ss zzz", "2022-08-08 04:07:39 +00:00")]
|
||||||
|
[TestCase("2022-08-08 -02:00", "2006-01-02 -07:00", "yyyy-MM-dd zzz", "2022-08-08 +00:00")]
|
||||||
|
[TestCase("2022-08-08 -02:00", "yyyy-MM-dd zzz", "yyyy-MM-dd zzz", "2022-08-08 +00:00")]
|
||||||
|
[TestCase("02:07:39 -02:00", "15:04:05 -07:00", "HH:mm:ss zzz", "04:07:39 +00:00")]
|
||||||
|
[TestCase("02:07:39 -02:00", "HH:mm:ss zzz", "HH:mm:ss zzz", "04:07:39 +00:00")]
|
||||||
|
[TestCase("-02:00", "zzz", "zzz", "+00:00")]
|
||||||
|
[TestCase("-02:00", "-07:00", "zzz", "+00:00")]
|
||||||
|
public void parse_datetime_golang(string dateInput, string format, string standardFormat, string expectedDate)
|
||||||
|
{
|
||||||
|
DateTimeUtil.ParseDateTimeGoLang(dateInput, format)
|
||||||
|
.ToUniversalTime()
|
||||||
|
.ToString(standardFormat, CultureInfo.InvariantCulture)
|
||||||
|
.Should().Be(expectedDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,5 +52,16 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||||||
{
|
{
|
||||||
ParseUtil.CoerceDouble(original).Should().Be(parsedInt);
|
ParseUtil.CoerceDouble(original).Should().Be(parsedInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase(null, null)]
|
||||||
|
[TestCase("", null)]
|
||||||
|
[TestCase("1", 1)]
|
||||||
|
[TestCase("1000 grabs", 1000)]
|
||||||
|
[TestCase("asdf123asdf", 123)]
|
||||||
|
[TestCase("asdf123asdf456asdf", 123)]
|
||||||
|
public void should_parse_long_from_string(string original, long? parsedInt)
|
||||||
|
{
|
||||||
|
ParseUtil.GetLongFromString(original).Should().Be(parsedInt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<PackageReference Include="Dapper" Version="2.0.123" />
|
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||||
<PackageReference Include="NBuilder" Version="6.1.0" />
|
<PackageReference Include="NBuilder" Version="6.1.0" />
|
||||||
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
|
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
|
||||||
<PackageReference Include="YamlDotNet" Version="12.3.1" />
|
<PackageReference Include="YamlDotNet" Version="13.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\NzbDrone.Test.Common\Prowlarr.Test.Common.csproj" />
|
<ProjectReference Include="..\NzbDrone.Test.Common\Prowlarr.Test.Common.csproj" />
|
||||||
|
|||||||
@@ -40,12 +40,11 @@ namespace NzbDrone.Core.Test.UpdateTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("TODO No Updates On Server")]
|
|
||||||
public void should_get_recent_updates()
|
public void should_get_recent_updates()
|
||||||
{
|
{
|
||||||
const string branch = "develop";
|
const string branch = "develop";
|
||||||
UseRealHttp();
|
UseRealHttp();
|
||||||
var recent = Subject.GetRecentUpdates(branch, new Version(2, 0), null);
|
var recent = Subject.GetRecentUpdates(branch, new Version(1, 0), null);
|
||||||
var recentWithChanges = recent.Where(c => c.Changes != null);
|
var recentWithChanges = recent.Where(c => c.Changes != null);
|
||||||
|
|
||||||
recent.Should().NotBeEmpty();
|
recent.Should().NotBeEmpty();
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.UpdateTests
|
|||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Setup(v => v.FileExists(It.Is<string>(s => s.EndsWith("Prowlarr.Update.exe"))))
|
.Setup(v => v.FileExists(It.Is<string>(s => s.EndsWith("Prowlarr.Update".ProcessNameToExe()))))
|
||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
|
||||||
_sandboxFolder = Mocker.GetMock<IAppFolderInfo>().Object.GetUpdateSandboxFolder();
|
_sandboxFolder = Mocker.GetMock<IAppFolderInfo>().Object.GetUpdateSandboxFolder();
|
||||||
@@ -165,7 +165,7 @@ namespace NzbDrone.Core.Test.UpdateTests
|
|||||||
public void should_return_with_warning_if_updater_doesnt_exists()
|
public void should_return_with_warning_if_updater_doesnt_exists()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Setup(v => v.FileExists(It.Is<string>(s => s.EndsWith("Prowlarr.Update.exe"))))
|
.Setup(v => v.FileExists(It.Is<string>(s => s.EndsWith("Prowlarr.Update".ProcessNameToExe()))))
|
||||||
.Returns(false);
|
.Returns(false);
|
||||||
|
|
||||||
Subject.Execute(new ApplicationUpdateCommand());
|
Subject.Execute(new ApplicationUpdateCommand());
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
|
|||||||
Categories = string.Join(",", indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray())),
|
Categories = string.Join(",", indexer.Capabilities.Categories.SupportedCategories(Settings.SyncCategories.ToArray())),
|
||||||
Enabled = indexer.Enable,
|
Enabled = indexer.Enable,
|
||||||
Type = schema,
|
Type = schema,
|
||||||
|
Priority = indexer.Priority
|
||||||
};
|
};
|
||||||
|
|
||||||
return lazyLibrarianIndexer;
|
return lazyLibrarianIndexer;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
|
|||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public string Altername { get; set; }
|
public string Altername { get; set; }
|
||||||
public LazyLibrarianProviderType Type { get; set; }
|
public LazyLibrarianProviderType Type { get; set; }
|
||||||
|
public int Priority { get; set; }
|
||||||
|
|
||||||
public bool Equals(LazyLibrarianIndexer other)
|
public bool Equals(LazyLibrarianIndexer other)
|
||||||
{
|
{
|
||||||
@@ -43,7 +44,8 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
|
|||||||
other.Name == Name &&
|
other.Name == Name &&
|
||||||
other.Categories == Categories &&
|
other.Categories == Categories &&
|
||||||
other.Enabled == Enabled &&
|
other.Enabled == Enabled &&
|
||||||
other.Altername == Altername;
|
other.Altername == Altername &&
|
||||||
|
other.Priority == Priority;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
|
|||||||
|
|
||||||
public class LazyLibrarianV1Proxy : ILazyLibrarianV1Proxy
|
public class LazyLibrarianV1Proxy : ILazyLibrarianV1Proxy
|
||||||
{
|
{
|
||||||
|
private const int ProwlarrHighestPriority = 50;
|
||||||
|
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
@@ -90,7 +92,8 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
|
|||||||
{ "host", indexer.Host },
|
{ "host", indexer.Host },
|
||||||
{ "prov_apikey", indexer.Apikey },
|
{ "prov_apikey", indexer.Apikey },
|
||||||
{ "enabled", indexer.Enabled.ToString().ToLower() },
|
{ "enabled", indexer.Enabled.ToString().ToLower() },
|
||||||
{ "categories", indexer.Categories }
|
{ "categories", indexer.Categories },
|
||||||
|
{ "dlpriority", CalculatePriority(indexer.Priority).ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
var request = BuildRequest(settings, "/api", "addProvider", HttpMethod.Get, parameters);
|
var request = BuildRequest(settings, "/api", "addProvider", HttpMethod.Get, parameters);
|
||||||
@@ -108,7 +111,8 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
|
|||||||
{ "prov_apikey", indexer.Apikey },
|
{ "prov_apikey", indexer.Apikey },
|
||||||
{ "enabled", indexer.Enabled.ToString().ToLower() },
|
{ "enabled", indexer.Enabled.ToString().ToLower() },
|
||||||
{ "categories", indexer.Categories },
|
{ "categories", indexer.Categories },
|
||||||
{ "altername", indexer.Altername }
|
{ "altername", indexer.Altername },
|
||||||
|
{ "dlpriority", CalculatePriority(indexer.Priority).ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
var request = BuildRequest(settings, "/api", "changeProvider", HttpMethod.Get, parameters);
|
var request = BuildRequest(settings, "/api", "changeProvider", HttpMethod.Get, parameters);
|
||||||
@@ -191,5 +195,7 @@ namespace NzbDrone.Core.Applications.LazyLibrarian
|
|||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int CalculatePriority(int indexerPriority) => ProwlarrHighestPriority - indexerPriority + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ namespace NzbDrone.Core.Applications.Lidarr
|
|||||||
|
|
||||||
if (indexer.Protocol == DownloadProtocol.Torrent)
|
if (indexer.Protocol == DownloadProtocol.Torrent)
|
||||||
{
|
{
|
||||||
lidarrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = indexer.AppProfile.Value.MinimumSeeders;
|
lidarrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.AppMinimumSeeders ?? indexer.AppProfile.Value.MinimumSeeders;
|
||||||
lidarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
lidarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
||||||
lidarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
lidarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ namespace NzbDrone.Core.Applications.Radarr
|
|||||||
|
|
||||||
if (indexer.Protocol == DownloadProtocol.Torrent)
|
if (indexer.Protocol == DownloadProtocol.Torrent)
|
||||||
{
|
{
|
||||||
radarrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = indexer.AppProfile.Value.MinimumSeeders;
|
radarrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.AppMinimumSeeders ?? indexer.AppProfile.Value.MinimumSeeders;
|
||||||
radarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
radarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
||||||
radarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
radarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace NzbDrone.Core.Applications.Readarr
|
|||||||
|
|
||||||
if (indexer.Protocol == DownloadProtocol.Torrent)
|
if (indexer.Protocol == DownloadProtocol.Torrent)
|
||||||
{
|
{
|
||||||
readarrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = indexer.AppProfile.Value.MinimumSeeders;
|
readarrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.AppMinimumSeeders ?? indexer.AppProfile.Value.MinimumSeeders;
|
||||||
readarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
readarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
||||||
readarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
readarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
||||||
|
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ namespace NzbDrone.Core.Applications.Sonarr
|
|||||||
|
|
||||||
if (indexer.Protocol == DownloadProtocol.Torrent)
|
if (indexer.Protocol == DownloadProtocol.Torrent)
|
||||||
{
|
{
|
||||||
sonarrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = indexer.AppProfile.Value.MinimumSeeders;
|
sonarrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.AppMinimumSeeders ?? indexer.AppProfile.Value.MinimumSeeders;
|
||||||
sonarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
sonarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
||||||
sonarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
sonarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
||||||
sonarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seasonPackSeedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.PackSeedTime ?? ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
sonarrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seasonPackSeedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.PackSeedTime ?? ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace NzbDrone.Core.Applications.Whisparr
|
|||||||
|
|
||||||
if (indexer.Protocol == DownloadProtocol.Torrent)
|
if (indexer.Protocol == DownloadProtocol.Torrent)
|
||||||
{
|
{
|
||||||
whisparrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = indexer.AppProfile.Value.MinimumSeeders;
|
whisparrIndexer.Fields.FirstOrDefault(x => x.Name == "minimumSeeders").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.AppMinimumSeeders ?? indexer.AppProfile.Value.MinimumSeeders;
|
||||||
whisparrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
whisparrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedRatio").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedRatio;
|
||||||
whisparrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
whisparrIndexer.Fields.FirstOrDefault(x => x.Name == "seedCriteria.seedTime").Value = ((ITorrentIndexerSettings)indexer.Settings).TorrentBaseSettings.SeedTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ namespace NzbDrone.Core.Authentication
|
|||||||
|
|
||||||
public class UserService : IUserService
|
public class UserService : IUserService
|
||||||
{
|
{
|
||||||
|
private const int ITERATIONS = 10000;
|
||||||
|
private const int SALT_SIZE = 128 / 8;
|
||||||
|
private const int NUMBER_OF_BYTES = 256 / 8;
|
||||||
|
|
||||||
private readonly IUserRepository _repo;
|
private readonly IUserRepository _repo;
|
||||||
private readonly IAppFolderInfo _appFolderInfo;
|
private readonly IAppFolderInfo _appFolderInfo;
|
||||||
private readonly IDiskProvider _diskProvider;
|
private readonly IDiskProvider _diskProvider;
|
||||||
|
|
||||||
private static readonly int ITERATIONS = 10000;
|
|
||||||
private static readonly int SALT_SIZE = 128 / 8;
|
|
||||||
private static readonly int NUMBER_OF_BYTES = 256 / 8;
|
|
||||||
|
|
||||||
public UserService(IUserRepository repo, IAppFolderInfo appFolderInfo, IDiskProvider diskProvider)
|
public UserService(IUserRepository repo, IAppFolderInfo appFolderInfo, IDiskProvider diskProvider)
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(025)]
|
||||||
|
public class speedcd_userpasssettings_to_speedcdsettings : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Update.Table("Indexers").Set(new { ConfigContract = "SpeedCDSettings" }).Where(new { Implementation = "SpeedCD" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(026)]
|
||||||
|
public class torrentday_cookiesettings_to_torrentdaysettings : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Update.Table("Indexers").Set(new { ConfigContract = "TorrentDaySettings" }).Where(new { Implementation = "TorrentDay" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration;
|
||||||
|
|
||||||
|
[Migration(027)]
|
||||||
|
public class alpharatio_greatposterwall_config_contract : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Update.Table("Indexers").Set(new { ConfigContract = "AlphaRatioSettings" }).Where(new { Implementation = "AlphaRatio" });
|
||||||
|
Update.Table("Indexers").Set(new { ConfigContract = "GreatPosterWallSettings" }).Where(new { Implementation = "GreatPosterWall" });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration;
|
||||||
|
|
||||||
|
[Migration(028)]
|
||||||
|
public class remove_notwhatcd : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
// Remove, site dead
|
||||||
|
Delete.FromTable("Indexers").Row(new { Implementation = "NotWhatCD" });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(029)]
|
||||||
|
public class add_on_grab_to_notifications : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Alter.Table("Notifications").AddColumn("OnGrab").AsBoolean().WithDefaultValue(false);
|
||||||
|
Alter.Table("Notifications").AddColumn("IncludeManualGrabs").AsBoolean().WithDefaultValue(false).NotNullable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -250,7 +250,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
|
|||||||
}
|
}
|
||||||
|
|
||||||
Index = end + 1;
|
Index = end + 1;
|
||||||
identifier.Append(Buffer.Substring(start, end - start));
|
identifier.Append(Buffer.AsSpan(start, end - start));
|
||||||
|
|
||||||
if (Buffer[Index] != escape)
|
if (Buffer[Index] != escape)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ namespace NzbDrone.Core.Datastore
|
|||||||
|
|
||||||
Mapper.Entity<NotificationDefinition>("Notifications").RegisterModel()
|
Mapper.Entity<NotificationDefinition>("Notifications").RegisterModel()
|
||||||
.Ignore(x => x.ImplementationName)
|
.Ignore(x => x.ImplementationName)
|
||||||
|
.Ignore(i => i.SupportsOnGrab)
|
||||||
.Ignore(i => i.SupportsOnHealthIssue)
|
.Ignore(i => i.SupportsOnHealthIssue)
|
||||||
.Ignore(i => i.SupportsOnApplicationUpdate);
|
.Ignore(i => i.SupportsOnApplicationUpdate);
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ namespace NzbDrone.Core.Datastore
|
|||||||
|
|
||||||
private const DbType EnumerableMultiParameter = (DbType)(-1);
|
private const DbType EnumerableMultiParameter = (DbType)(-1);
|
||||||
private readonly string _paramNamePrefix;
|
private readonly string _paramNamePrefix;
|
||||||
private readonly bool _requireConcreteValue = false;
|
private readonly bool _requireConcreteValue;
|
||||||
private int _paramCount = 0;
|
private int _paramCount;
|
||||||
private bool _gotConcreteValue = false;
|
private bool _gotConcreteValue;
|
||||||
|
|
||||||
public WhereBuilderPostgres(Expression filter, bool requireConcreteValue, int seq)
|
public WhereBuilderPostgres(Expression filter, bool requireConcreteValue, int seq)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ namespace NzbDrone.Core.Datastore
|
|||||||
|
|
||||||
private const DbType EnumerableMultiParameter = (DbType)(-1);
|
private const DbType EnumerableMultiParameter = (DbType)(-1);
|
||||||
private readonly string _paramNamePrefix;
|
private readonly string _paramNamePrefix;
|
||||||
private readonly bool _requireConcreteValue = false;
|
private readonly bool _requireConcreteValue;
|
||||||
private int _paramCount = 0;
|
private int _paramCount;
|
||||||
private bool _gotConcreteValue = false;
|
private bool _gotConcreteValue;
|
||||||
|
|
||||||
public WhereBuilderSqlite(Expression filter, bool requireConcreteValue, int seq)
|
public WhereBuilderSqlite(Expression filter, bool requireConcreteValue, int seq)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.EnsureThat;
|
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Common.Instrumentation.Extensions;
|
using NzbDrone.Common.Instrumentation.Extensions;
|
||||||
@@ -61,16 +60,17 @@ namespace NzbDrone.Core.Download
|
|||||||
|
|
||||||
// Get the seed configuration for this release.
|
// Get the seed configuration for this release.
|
||||||
// remoteMovie.SeedConfiguration = _seedConfigProvider.GetSeedConfiguration(remoteMovie);
|
// remoteMovie.SeedConfiguration = _seedConfigProvider.GetSeedConfiguration(remoteMovie);
|
||||||
|
|
||||||
// Limit grabs to 2 per second.
|
|
||||||
if (release.DownloadUrl.IsNotNullOrWhiteSpace() && !release.DownloadUrl.StartsWith("magnet:"))
|
|
||||||
{
|
|
||||||
var url = new HttpUri(release.DownloadUrl);
|
|
||||||
_rateLimitService.WaitAndPulse(url.Host, TimeSpan.FromSeconds(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
var indexer = _indexerFactory.GetInstance(_indexerFactory.Get(release.IndexerId));
|
var indexer = _indexerFactory.GetInstance(_indexerFactory.Get(release.IndexerId));
|
||||||
|
|
||||||
|
var grabEvent = new IndexerDownloadEvent(release, true, source, host, release.Title, release.DownloadUrl)
|
||||||
|
{
|
||||||
|
DownloadClient = downloadClient.Name,
|
||||||
|
DownloadClientId = downloadClient.Definition.Id,
|
||||||
|
DownloadClientName = downloadClient.Definition.Name,
|
||||||
|
Redirect = redirect,
|
||||||
|
GrabTrigger = source == "Prowlarr" ? GrabTrigger.Manual : GrabTrigger.Api
|
||||||
|
};
|
||||||
|
|
||||||
string downloadClientId;
|
string downloadClientId;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -81,19 +81,20 @@ namespace NzbDrone.Core.Download
|
|||||||
catch (ReleaseUnavailableException)
|
catch (ReleaseUnavailableException)
|
||||||
{
|
{
|
||||||
_logger.Trace("Release {0} no longer available on indexer.", release);
|
_logger.Trace("Release {0} no longer available on indexer.", release);
|
||||||
_eventAggregator.PublishEvent(new IndexerDownloadEvent(release.IndexerId, false, source, host, release.Title, release.DownloadUrl, redirect));
|
grabEvent.Successful = false;
|
||||||
|
_eventAggregator.PublishEvent(grabEvent);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (DownloadClientRejectedReleaseException)
|
catch (DownloadClientRejectedReleaseException)
|
||||||
{
|
{
|
||||||
_logger.Trace("Release {0} rejected by download client, possible duplicate.", release);
|
_logger.Trace("Release {0} rejected by download client, possible duplicate.", release);
|
||||||
_eventAggregator.PublishEvent(new IndexerDownloadEvent(release.IndexerId, false, source, host, release.Title, release.DownloadUrl, redirect));
|
grabEvent.Successful = false;
|
||||||
|
_eventAggregator.PublishEvent(grabEvent);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (ReleaseDownloadException ex)
|
catch (ReleaseDownloadException ex)
|
||||||
{
|
{
|
||||||
var http429 = ex.InnerException as TooManyRequestsException;
|
if (ex.InnerException is TooManyRequestsException http429)
|
||||||
if (http429 != null)
|
|
||||||
{
|
{
|
||||||
_indexerStatusService.RecordFailure(release.IndexerId, http429.RetryAfter);
|
_indexerStatusService.RecordFailure(release.IndexerId, http429.RetryAfter);
|
||||||
}
|
}
|
||||||
@@ -102,14 +103,21 @@ namespace NzbDrone.Core.Download
|
|||||||
_indexerStatusService.RecordFailure(release.IndexerId);
|
_indexerStatusService.RecordFailure(release.IndexerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(new IndexerDownloadEvent(release.IndexerId, false, source, host, release.Title, release.DownloadUrl, redirect));
|
grabEvent.Successful = false;
|
||||||
|
|
||||||
|
_eventAggregator.PublishEvent(grabEvent);
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.ProgressInfo("Report sent to {0}. {1}", downloadClient.Definition.Name, downloadTitle);
|
_logger.ProgressInfo("Report sent to {0}. {1}", downloadClient.Definition.Name, downloadTitle);
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(new IndexerDownloadEvent(release.IndexerId, true, source, host, release.Title, release.DownloadUrl, redirect));
|
if (!string.IsNullOrWhiteSpace(downloadClientId))
|
||||||
|
{
|
||||||
|
grabEvent.DownloadId = downloadClientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
_eventAggregator.PublishEvent(grabEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<byte[]> DownloadReport(string link, int indexerId, string source, string host, string title)
|
public async Task<byte[]> DownloadReport(string link, int indexerId, string source, string host, string title)
|
||||||
@@ -127,22 +135,35 @@ namespace NzbDrone.Core.Download
|
|||||||
var success = false;
|
var success = false;
|
||||||
var downloadedBytes = Array.Empty<byte>();
|
var downloadedBytes = Array.Empty<byte>();
|
||||||
|
|
||||||
|
var release = new ReleaseInfo
|
||||||
|
{
|
||||||
|
Title = title,
|
||||||
|
DownloadUrl = link,
|
||||||
|
IndexerId = indexerId,
|
||||||
|
Indexer = indexer.Definition.Name,
|
||||||
|
DownloadProtocol = indexer.Protocol
|
||||||
|
};
|
||||||
|
|
||||||
|
var grabEvent = new IndexerDownloadEvent(release, success, source, host, release.Title, release.DownloadUrl)
|
||||||
|
{
|
||||||
|
GrabTrigger = source == "Prowlarr" ? GrabTrigger.Manual : GrabTrigger.Api
|
||||||
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
downloadedBytes = await indexer.Download(url);
|
downloadedBytes = await indexer.Download(url);
|
||||||
_indexerStatusService.RecordSuccess(indexerId);
|
_indexerStatusService.RecordSuccess(indexerId);
|
||||||
success = true;
|
grabEvent.Successful = true;
|
||||||
}
|
}
|
||||||
catch (ReleaseUnavailableException)
|
catch (ReleaseUnavailableException)
|
||||||
{
|
{
|
||||||
_logger.Trace("Release {0} no longer available on indexer.", link);
|
_logger.Trace("Release {0} no longer available on indexer.", link);
|
||||||
_eventAggregator.PublishEvent(new IndexerDownloadEvent(indexerId, success, source, host, title, url.AbsoluteUri));
|
_eventAggregator.PublishEvent(grabEvent);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (ReleaseDownloadException ex)
|
catch (ReleaseDownloadException ex)
|
||||||
{
|
{
|
||||||
var http429 = ex.InnerException as TooManyRequestsException;
|
if (ex.InnerException is TooManyRequestsException http429)
|
||||||
if (http429 != null)
|
|
||||||
{
|
{
|
||||||
_indexerStatusService.RecordFailure(indexerId, http429.RetryAfter);
|
_indexerStatusService.RecordFailure(indexerId, http429.RetryAfter);
|
||||||
}
|
}
|
||||||
@@ -151,17 +172,36 @@ namespace NzbDrone.Core.Download
|
|||||||
_indexerStatusService.RecordFailure(indexerId);
|
_indexerStatusService.RecordFailure(indexerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(new IndexerDownloadEvent(indexerId, success, source, host, title, url.AbsoluteUri));
|
_eventAggregator.PublishEvent(grabEvent);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(new IndexerDownloadEvent(indexerId, success, source, host, title, url.AbsoluteUri));
|
_logger.Trace("Downloaded {0} bytes from {1}", downloadedBytes.Length, link);
|
||||||
|
_eventAggregator.PublishEvent(grabEvent);
|
||||||
|
|
||||||
return downloadedBytes;
|
return downloadedBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RecordRedirect(string link, int indexerId, string source, string host, string title)
|
public void RecordRedirect(string link, int indexerId, string source, string host, string title)
|
||||||
{
|
{
|
||||||
_eventAggregator.PublishEvent(new IndexerDownloadEvent(indexerId, true, source, host, title, link, true));
|
var indexer = _indexerFactory.GetInstance(_indexerFactory.Get(indexerId));
|
||||||
|
|
||||||
|
var release = new ReleaseInfo
|
||||||
|
{
|
||||||
|
Title = title,
|
||||||
|
DownloadUrl = link,
|
||||||
|
IndexerId = indexerId,
|
||||||
|
Indexer = indexer.Definition.Name,
|
||||||
|
DownloadProtocol = indexer.Protocol
|
||||||
|
};
|
||||||
|
|
||||||
|
var grabEvent = new IndexerDownloadEvent(release, true, source, host, release.Title, release.DownloadUrl)
|
||||||
|
{
|
||||||
|
Redirect = true,
|
||||||
|
GrabTrigger = source == "Prowlarr" ? GrabTrigger.Manual : GrabTrigger.Api
|
||||||
|
};
|
||||||
|
|
||||||
|
_eventAggregator.PublishEvent(grabEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ namespace NzbDrone.Core.HealthCheck
|
|||||||
|
|
||||||
private readonly ICached<HealthCheck> _healthCheckResults;
|
private readonly ICached<HealthCheck> _healthCheckResults;
|
||||||
|
|
||||||
private bool _hasRunHealthChecksAfterGracePeriod = false;
|
private bool _hasRunHealthChecksAfterGracePeriod;
|
||||||
private bool _isRunningHealthChecksAfterGracePeriod = false;
|
private bool _isRunningHealthChecksAfterGracePeriod;
|
||||||
|
|
||||||
public HealthCheckService(IEnumerable<IProvideHealthCheck> healthChecks,
|
public HealthCheckService(IEnumerable<IProvideHealthCheck> healthChecks,
|
||||||
IServerSideNotificationService serverSideNotificationService,
|
IServerSideNotificationService serverSideNotificationService,
|
||||||
@@ -55,7 +55,7 @@ namespace NzbDrone.Core.HealthCheck
|
|||||||
_startupHealthChecks = _healthChecks.Where(v => v.CheckOnStartup).ToArray();
|
_startupHealthChecks = _healthChecks.Where(v => v.CheckOnStartup).ToArray();
|
||||||
_scheduledHealthChecks = _healthChecks.Where(v => v.CheckOnSchedule).ToArray();
|
_scheduledHealthChecks = _healthChecks.Where(v => v.CheckOnSchedule).ToArray();
|
||||||
_eventDrivenHealthChecks = GetEventDrivenHealthChecks();
|
_eventDrivenHealthChecks = GetEventDrivenHealthChecks();
|
||||||
_startupGracePeriodEndTime = runtimeInfo.StartTime + TimeSpan.FromMinutes(15);
|
_startupGracePeriodEndTime = runtimeInfo.StartTime.AddMinutes(15);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HealthCheck> Results()
|
public List<HealthCheck> Results()
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace NzbDrone.Core.HealthCheck
|
|||||||
.AddQueryParam("version", BuildInfo.Version)
|
.AddQueryParam("version", BuildInfo.Version)
|
||||||
.AddQueryParam("os", OsInfo.Os.ToString().ToLowerInvariant())
|
.AddQueryParam("os", OsInfo.Os.ToString().ToLowerInvariant())
|
||||||
.AddQueryParam("arch", RuntimeInformation.OSArchitecture)
|
.AddQueryParam("arch", RuntimeInformation.OSArchitecture)
|
||||||
.AddQueryParam("runtime", PlatformInfo.Platform.ToString().ToLowerInvariant())
|
.AddQueryParam("runtime", "netcore")
|
||||||
.AddQueryParam("branch", _configFileProvider.Branch)
|
.AddQueryParam("branch", _configFileProvider.Branch)
|
||||||
.Build();
|
.Build();
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace NzbDrone.Core.History
|
|||||||
List<History> Since(DateTime date, HistoryEventType? eventType);
|
List<History> Since(DateTime date, HistoryEventType? eventType);
|
||||||
void Cleanup(int days);
|
void Cleanup(int days);
|
||||||
int CountSince(int indexerId, DateTime date, List<HistoryEventType> eventTypes);
|
int CountSince(int indexerId, DateTime date, List<HistoryEventType> eventTypes);
|
||||||
|
History FindFirstForIndexerSince(int indexerId, DateTime date, List<HistoryEventType> eventTypes, int limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HistoryRepository : BasicRepository<History>, IHistoryRepository
|
public class HistoryRepository : BasicRepository<History>, IHistoryRepository
|
||||||
@@ -115,5 +116,24 @@ namespace NzbDrone.Core.History
|
|||||||
return conn.ExecuteScalar<int>(sql.RawSql, sql.Parameters);
|
return conn.ExecuteScalar<int>(sql.RawSql, sql.Parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public History FindFirstForIndexerSince(int indexerId, DateTime date, List<HistoryEventType> eventTypes, int limit)
|
||||||
|
{
|
||||||
|
var intEvents = eventTypes.Select(t => (int)t).ToList();
|
||||||
|
|
||||||
|
var builder = Builder()
|
||||||
|
.Where<History>(x => x.IndexerId == indexerId)
|
||||||
|
.Where<History>(x => x.Date >= date)
|
||||||
|
.Where<History>(x => intEvents.Contains((int)x.EventType));
|
||||||
|
|
||||||
|
var query = Query(builder);
|
||||||
|
|
||||||
|
if (limit > 0)
|
||||||
|
{
|
||||||
|
query = query.OrderByDescending(h => h.Date).Take(limit).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return query.MinBy(h => h.Date);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace NzbDrone.Core.History
|
|||||||
List<History> Between(DateTime start, DateTime end);
|
List<History> Between(DateTime start, DateTime end);
|
||||||
List<History> Since(DateTime date, HistoryEventType? eventType);
|
List<History> Since(DateTime date, HistoryEventType? eventType);
|
||||||
int CountSince(int indexerId, DateTime date, List<HistoryEventType> eventTypes);
|
int CountSince(int indexerId, DateTime date, List<HistoryEventType> eventTypes);
|
||||||
|
History FindFirstForIndexerSince(int indexerId, DateTime date, List<HistoryEventType> eventTypes, int limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HistoryService : IHistoryService,
|
public class HistoryService : IHistoryService,
|
||||||
@@ -121,7 +122,7 @@ namespace NzbDrone.Core.History
|
|||||||
{
|
{
|
||||||
Date = DateTime.UtcNow,
|
Date = DateTime.UtcNow,
|
||||||
IndexerId = message.IndexerId,
|
IndexerId = message.IndexerId,
|
||||||
EventType = message.Query.RssSearch ? HistoryEventType.IndexerRss : HistoryEventType.IndexerQuery,
|
EventType = message.Query.IsRssSearch ? HistoryEventType.IndexerRss : HistoryEventType.IndexerQuery,
|
||||||
Successful = message.QueryResult.Response?.StatusCode == HttpStatusCode.OK
|
Successful = message.QueryResult.Response?.StatusCode == HttpStatusCode.OK
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -173,7 +174,7 @@ namespace NzbDrone.Core.History
|
|||||||
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("Host", message.Query.Host ?? string.Empty);
|
history.Data.Add("Host", message.Query.Host ?? string.Empty);
|
||||||
history.Data.Add("QueryResults", message.QueryResult.Releases?.Count().ToString() ?? string.Empty);
|
history.Data.Add("QueryResults", message.QueryResult.Releases?.Count.ToString() ?? string.Empty);
|
||||||
history.Data.Add("Url", message.QueryResult.Response?.Request.Url.FullUri ?? string.Empty);
|
history.Data.Add("Url", message.QueryResult.Response?.Request.Url.FullUri ?? string.Empty);
|
||||||
|
|
||||||
_historyRepository.Insert(history);
|
_historyRepository.Insert(history);
|
||||||
@@ -184,7 +185,7 @@ namespace NzbDrone.Core.History
|
|||||||
var history = new History
|
var history = new History
|
||||||
{
|
{
|
||||||
Date = DateTime.UtcNow,
|
Date = DateTime.UtcNow,
|
||||||
IndexerId = message.IndexerId,
|
IndexerId = message.Release.IndexerId,
|
||||||
EventType = HistoryEventType.ReleaseGrabbed,
|
EventType = HistoryEventType.ReleaseGrabbed,
|
||||||
Successful = message.Successful
|
Successful = message.Successful
|
||||||
};
|
};
|
||||||
@@ -232,5 +233,10 @@ namespace NzbDrone.Core.History
|
|||||||
{
|
{
|
||||||
return _historyRepository.CountSince(indexerId, date, eventTypes);
|
return _historyRepository.CountSince(indexerId, date, eventTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public History FindFirstForIndexerSince(int indexerId, DateTime date, List<HistoryEventType> eventTypes, int limit)
|
||||||
|
{
|
||||||
|
return _historyRepository.FindFirstForIndexerSince(indexerId, date, eventTypes, limit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Http.CloudFlare
|
namespace NzbDrone.Core.Http.CloudFlare
|
||||||
{
|
{
|
||||||
public class CloudFlareDetectionService
|
public class CloudFlareDetectionService
|
||||||
{
|
{
|
||||||
private static readonly HashSet<string> CloudflareServerNames = new HashSet<string> { "cloudflare", "cloudflare-nginx", "ddos-guard" };
|
private static readonly HashSet<string> CloudflareServerNames = new () { "cloudflare", "cloudflare-nginx", "ddos-guard" };
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public CloudFlareDetectionService(Logger logger)
|
public CloudFlareDetectionService(Logger logger)
|
||||||
@@ -29,7 +30,11 @@ namespace NzbDrone.Core.Http.CloudFlare
|
|||||||
response.StatusCode.Equals(HttpStatusCode.Forbidden))
|
response.StatusCode.Equals(HttpStatusCode.Forbidden))
|
||||||
{
|
{
|
||||||
var responseHtml = response.Content;
|
var responseHtml = response.Content;
|
||||||
if (responseHtml.Contains("<title>Just a moment...") || responseHtml.Contains("<title>DDOS-GUARD"))
|
if (responseHtml.Contains("<title>Just a moment...</title>") ||
|
||||||
|
responseHtml.Contains("<title>Access denied</title>") ||
|
||||||
|
responseHtml.Contains("<title>Attention Required! | Cloudflare</title>") ||
|
||||||
|
responseHtml.Trim().Equals("error code: 1020") ||
|
||||||
|
responseHtml.Contains("<title>DDOS-GUARD</title>", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -37,7 +42,7 @@ namespace NzbDrone.Core.Http.CloudFlare
|
|||||||
|
|
||||||
// detect Custom CloudFlare for EbookParadijs, Film-Paleis, MuziekFabriek and Puur-Hollands
|
// detect Custom CloudFlare for EbookParadijs, Film-Paleis, MuziekFabriek and Puur-Hollands
|
||||||
if (response.Headers.Vary == "Accept-Encoding,User-Agent" &&
|
if (response.Headers.Vary == "Accept-Encoding,User-Agent" &&
|
||||||
response.Headers.ContentEncoding == "" &&
|
response.Headers.ContentEncoding.IsNullOrWhiteSpace() &&
|
||||||
response.Content.ToLower().Contains("ddos"))
|
response.Content.ToLower().Contains("ddos"))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -10,17 +10,15 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
|||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
public string Genre { get; set; }
|
public string Genre { get; set; }
|
||||||
|
|
||||||
public override bool RssSearch
|
public override bool IsRssSearch =>
|
||||||
{
|
SearchTerm.IsNullOrWhiteSpace() &&
|
||||||
get
|
!IsIdSearch;
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace() && Author.IsNullOrWhiteSpace() && Title.IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
public override bool IsIdSearch =>
|
||||||
}
|
Author.IsNotNullOrWhiteSpace() ||
|
||||||
}
|
Title.IsNotNullOrWhiteSpace() ||
|
||||||
|
Publisher.IsNotNullOrWhiteSpace() ||
|
||||||
|
Genre.IsNotNullOrWhiteSpace() ||
|
||||||
|
Year.HasValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,18 +13,17 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
|||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
public string Genre { get; set; }
|
public string Genre { get; set; }
|
||||||
|
|
||||||
public override bool RssSearch
|
public override bool IsRssSearch =>
|
||||||
{
|
SearchTerm.IsNullOrWhiteSpace() &&
|
||||||
get
|
!IsIdSearch;
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TmdbId.HasValue && !TraktId.HasValue)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
public override bool IsIdSearch =>
|
||||||
}
|
ImdbId.IsNotNullOrWhiteSpace() ||
|
||||||
}
|
Genre.IsNotNullOrWhiteSpace() ||
|
||||||
|
TmdbId.HasValue ||
|
||||||
|
TraktId.HasValue ||
|
||||||
|
DoubanId.HasValue ||
|
||||||
|
Year.HasValue;
|
||||||
|
|
||||||
public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId);
|
public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId);
|
||||||
|
|
||||||
|
|||||||
@@ -11,17 +11,16 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
|||||||
public string Track { get; set; }
|
public string Track { get; set; }
|
||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
|
|
||||||
public override bool RssSearch
|
public override bool IsRssSearch =>
|
||||||
{
|
SearchTerm.IsNullOrWhiteSpace() &&
|
||||||
get
|
!IsIdSearch;
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace() && Album.IsNullOrWhiteSpace() && Artist.IsNullOrWhiteSpace() && Label.IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
public override bool IsIdSearch =>
|
||||||
}
|
Album.IsNotNullOrWhiteSpace() ||
|
||||||
}
|
Artist.IsNotNullOrWhiteSpace() ||
|
||||||
|
Label.IsNotNullOrWhiteSpace() ||
|
||||||
|
Genre.IsNotNullOrWhiteSpace() ||
|
||||||
|
Track.IsNotNullOrWhiteSpace() ||
|
||||||
|
Year.HasValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,72 +7,39 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
|||||||
{
|
{
|
||||||
public abstract class SearchCriteriaBase
|
public abstract class SearchCriteriaBase
|
||||||
{
|
{
|
||||||
private static readonly Regex SpecialCharacter = new Regex(@"[`'.]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
private static readonly Regex StandardizeDashesRegex = new (@"\p{Pd}+", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
private static readonly Regex NonWord = new Regex(@"[\W]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
private static readonly Regex StandardizeSingleQuotesRegex = new (@"[\u0060\u00B4\u2018\u2019]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
private static readonly Regex BeginningThe = new Regex(@"^the\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
|
||||||
|
|
||||||
public virtual bool InteractiveSearch { get; set; }
|
public virtual bool InteractiveSearch { get; set; }
|
||||||
public List<int> IndexerIds { get; set; }
|
public List<int> IndexerIds { get; set; }
|
||||||
public string SearchTerm { get; set; }
|
public string SearchTerm { get; set; }
|
||||||
public int[] Categories { get; set; }
|
public int[] Categories { get; set; }
|
||||||
public string SearchType { get; set; }
|
public string SearchType { get; set; }
|
||||||
public int? Limit { get; set; }
|
public int Limit { get; set; }
|
||||||
public int? Offset { get; set; }
|
public int Offset { get; set; }
|
||||||
public string Source { get; set; }
|
public string Source { get; set; }
|
||||||
public string Host { get; set; }
|
public string Host { get; set; }
|
||||||
|
|
||||||
public virtual string SearchQuery
|
public override string ToString() => $"{SearchQuery}, Offset: {Offset}, Limit: {Limit}, Categories: [{string.Join(", ", Categories)}]";
|
||||||
|
|
||||||
|
public virtual string SearchQuery => $"Term: [{SearchTerm}]";
|
||||||
|
|
||||||
|
public virtual bool IsRssSearch => SearchTerm.IsNullOrWhiteSpace();
|
||||||
|
|
||||||
|
public virtual bool IsIdSearch => false;
|
||||||
|
|
||||||
|
public string SanitizedSearchTerm => GetSanitizedTerm(SearchTerm);
|
||||||
|
|
||||||
|
private static string GetSanitizedTerm(string term)
|
||||||
{
|
{
|
||||||
get
|
term ??= "";
|
||||||
{
|
|
||||||
return $"Term: [{SearchTerm}]";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
term = StandardizeDashesRegex.Replace(term, "-");
|
||||||
{
|
term = StandardizeSingleQuotesRegex.Replace(term, "'");
|
||||||
return $"{SearchQuery}, Offset: {Offset ?? 0}, Limit: {Limit ?? 0}, Categories: [{string.Join(", ", Categories)}]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool RssSearch
|
var safeTitle = term.Where(c => char.IsLetterOrDigit(c) || char.IsWhiteSpace(c) || c is '-' or '.' or '_' or '(' or ')' or '@' or '/' or '\'' or '[' or ']' or '+' or '%');
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return string.Concat(safeTitle);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SanitizedSearchTerm
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var term = SearchTerm;
|
|
||||||
if (SearchTerm == null)
|
|
||||||
{
|
|
||||||
term = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
var safeTitle = term.Where(c => (char.IsLetterOrDigit(c)
|
|
||||||
|| char.IsWhiteSpace(c)
|
|
||||||
|| c == '-'
|
|
||||||
|| c == '.'
|
|
||||||
|| c == '_'
|
|
||||||
|| c == '('
|
|
||||||
|| c == ')'
|
|
||||||
|| c == '@'
|
|
||||||
|| c == '/'
|
|
||||||
|| c == '\''
|
|
||||||
|| c == '['
|
|
||||||
|| c == ']'
|
|
||||||
|| c == '+'
|
|
||||||
|| c == '%'));
|
|
||||||
return string.Concat(safeTitle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,23 +21,25 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
|
|||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
public string Genre { get; set; }
|
public string Genre { get; set; }
|
||||||
|
|
||||||
public string SanitizedTvSearchString => (SanitizedSearchTerm + " " + EpisodeSearchString).Trim();
|
public string SanitizedTvSearchString => $"{SanitizedSearchTerm} {EpisodeSearchString}".Trim();
|
||||||
public string EpisodeSearchString => GetEpisodeSearchString();
|
public string EpisodeSearchString => GetEpisodeSearchString();
|
||||||
|
|
||||||
public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId);
|
public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId);
|
||||||
|
|
||||||
public override bool RssSearch
|
public override bool IsRssSearch =>
|
||||||
{
|
SearchTerm.IsNullOrWhiteSpace() &&
|
||||||
get
|
!IsIdSearch;
|
||||||
{
|
|
||||||
if (SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TvdbId.HasValue && !RId.HasValue && !TraktId.HasValue && !TvMazeId.HasValue)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
public override bool IsIdSearch =>
|
||||||
}
|
Episode.IsNotNullOrWhiteSpace() ||
|
||||||
}
|
ImdbId.IsNotNullOrWhiteSpace() ||
|
||||||
|
Season.HasValue ||
|
||||||
|
TvdbId.HasValue ||
|
||||||
|
RId.HasValue ||
|
||||||
|
TraktId.HasValue ||
|
||||||
|
TvMazeId.HasValue ||
|
||||||
|
TmdbId.HasValue ||
|
||||||
|
DoubanId.HasValue;
|
||||||
|
|
||||||
public override string SearchQuery
|
public override string SearchQuery
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ namespace NzbDrone.Core.IndexerSearch
|
|||||||
|
|
||||||
spec.SearchTerm = query.q;
|
spec.SearchTerm = query.q;
|
||||||
spec.SearchType = query.t;
|
spec.SearchType = query.t;
|
||||||
spec.Limit = query.limit;
|
spec.Limit = query.limit ?? 100;
|
||||||
spec.Offset = query.offset;
|
spec.Offset = query.offset ?? 0;
|
||||||
spec.Source = query.source;
|
spec.Source = query.source;
|
||||||
spec.Host = query.host;
|
spec.Host = query.host;
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace NzbDrone.Core.IndexerStats
|
|||||||
var elapsedTimeEvents = sortedEvents.Where(h => int.TryParse(h.Data.GetValueOrDefault("elapsedTime"), out temp))
|
var elapsedTimeEvents = sortedEvents.Where(h => int.TryParse(h.Data.GetValueOrDefault("elapsedTime"), out temp))
|
||||||
.Select(h => temp);
|
.Select(h => temp);
|
||||||
|
|
||||||
indexerStats.AverageResponseTime = elapsedTimeEvents.Count() > 0 ? (int)elapsedTimeEvents.Average() : 0;
|
indexerStats.AverageResponseTime = elapsedTimeEvents.Any() ? (int)elapsedTimeEvents.Average() : 0;
|
||||||
|
|
||||||
foreach (var historyEvent in sortedEvents)
|
foreach (var historyEvent in sortedEvents)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,13 +29,14 @@ namespace NzbDrone.Core.IndexerVersions
|
|||||||
/* Update Service will fall back if version # does not exist for an indexer per Ta */
|
/* Update Service will fall back if version # does not exist for an indexer per Ta */
|
||||||
|
|
||||||
private const string DEFINITION_BRANCH = "master";
|
private const string DEFINITION_BRANCH = "master";
|
||||||
private const int DEFINITION_VERSION = 7;
|
private const int DEFINITION_VERSION = 9;
|
||||||
|
|
||||||
//Used when moving yml to C#
|
// Used when moving yml to C#
|
||||||
private readonly List<string> _defintionBlocklist = new List<string>()
|
private readonly List<string> _definitionBlocklist = new ()
|
||||||
{
|
{
|
||||||
"aither",
|
"aither",
|
||||||
"animeworld",
|
"animeworld",
|
||||||
|
"audiobookbay",
|
||||||
"beyond-hd-oneurl",
|
"beyond-hd-oneurl",
|
||||||
"beyond-hd",
|
"beyond-hd",
|
||||||
"blutopia",
|
"blutopia",
|
||||||
@@ -89,7 +90,7 @@ namespace NzbDrone.Core.IndexerVersions
|
|||||||
{
|
{
|
||||||
var request = new HttpRequest($"https://indexers.prowlarr.com/{DEFINITION_BRANCH}/{DEFINITION_VERSION}");
|
var request = new HttpRequest($"https://indexers.prowlarr.com/{DEFINITION_BRANCH}/{DEFINITION_VERSION}");
|
||||||
var response = _httpClient.Get<List<CardigannMetaDefinition>>(request);
|
var response = _httpClient.Get<List<CardigannMetaDefinition>>(request);
|
||||||
indexerList = response.Resource.Where(i => !_defintionBlocklist.Contains(i.File)).ToList();
|
indexerList = response.Resource.Where(i => !_definitionBlocklist.Contains(i.File)).ToList();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -125,7 +126,7 @@ namespace NzbDrone.Core.IndexerVersions
|
|||||||
|
|
||||||
public List<string> GetBlocklist()
|
public List<string> GetBlocklist()
|
||||||
{
|
{
|
||||||
return _defintionBlocklist;
|
return _definitionBlocklist;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CardigannMetaDefinition> ReadDefinitionsFromDisk(List<CardigannMetaDefinition> defs, string path, SearchOption options = SearchOption.TopDirectoryOnly)
|
private List<CardigannMetaDefinition> ReadDefinitionsFromDisk(List<CardigannMetaDefinition> defs, string path, SearchOption options = SearchOption.TopDirectoryOnly)
|
||||||
@@ -227,10 +228,10 @@ namespace NzbDrone.Core.IndexerVersions
|
|||||||
if (definition.Settings == null)
|
if (definition.Settings == null)
|
||||||
{
|
{
|
||||||
definition.Settings = new List<SettingsField>
|
definition.Settings = new List<SettingsField>
|
||||||
{
|
{
|
||||||
new SettingsField { Name = "username", Label = "Username", Type = "text" },
|
new () { Name = "username", Label = "Username", Type = "text" },
|
||||||
new SettingsField { Name = "password", Label = "Password", Type = "password" }
|
new () { Name = "password", Label = "Password", Type = "password" }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (definition.Encoding == null)
|
if (definition.Encoding == null)
|
||||||
|
|||||||
@@ -1,85 +1,120 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Core.Annotations;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.Indexers.Definitions.Gazelle;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Definitions
|
namespace NzbDrone.Core.Indexers.Definitions;
|
||||||
|
|
||||||
|
public class AlphaRatio : GazelleBase<AlphaRatioSettings>
|
||||||
{
|
{
|
||||||
public class AlphaRatio : Gazelle.Gazelle
|
public override string Name => "AlphaRatio";
|
||||||
|
public override string[] IndexerUrls => new[] { "https://alpharatio.cc/" };
|
||||||
|
public override string Description => "AlphaRatio(AR) is a Private Torrent Tracker for 0DAY / GENERAL";
|
||||||
|
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
|
||||||
|
|
||||||
|
public AlphaRatio(IIndexerHttpClient httpClient,
|
||||||
|
IEventAggregator eventAggregator,
|
||||||
|
IIndexerStatusService indexerStatusService,
|
||||||
|
IConfigService configService,
|
||||||
|
Logger logger)
|
||||||
|
: base(httpClient, eventAggregator, indexerStatusService, configService, logger)
|
||||||
{
|
{
|
||||||
public override string Name => "AlphaRatio";
|
|
||||||
public override string[] IndexerUrls => new string[] { "https://alpharatio.cc/" };
|
|
||||||
public override string Description => "AlphaRatio(AR) is a Private Torrent Tracker for 0DAY / GENERAL";
|
|
||||||
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
|
|
||||||
|
|
||||||
public AlphaRatio(IIndexerHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
|
|
||||||
: base(httpClient, eventAggregator, indexerStatusService, configService, logger)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
|
||||||
{
|
|
||||||
return new AlphaRatioRequestGenerator()
|
|
||||||
{
|
|
||||||
Settings = Settings,
|
|
||||||
HttpClient = _httpClient,
|
|
||||||
Logger = _logger,
|
|
||||||
Capabilities = Capabilities
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override IndexerCapabilities SetCapabilities()
|
|
||||||
{
|
|
||||||
var caps = new IndexerCapabilities
|
|
||||||
{
|
|
||||||
TvSearchParams = new List<TvSearchParam>
|
|
||||||
{
|
|
||||||
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep
|
|
||||||
},
|
|
||||||
MovieSearchParams = new List<MovieSearchParam>
|
|
||||||
{
|
|
||||||
MovieSearchParam.Q
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.TVSD, "TvSD");
|
|
||||||
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TVHD, "TvHD");
|
|
||||||
caps.Categories.AddCategoryMapping(3, NewznabStandardCategory.TVUHD, "TvUHD");
|
|
||||||
caps.Categories.AddCategoryMapping(4, NewznabStandardCategory.TVSD, "TvDVDRip");
|
|
||||||
caps.Categories.AddCategoryMapping(5, NewznabStandardCategory.TVSD, "TvPackSD");
|
|
||||||
caps.Categories.AddCategoryMapping(6, NewznabStandardCategory.TVHD, "TvPackHD");
|
|
||||||
caps.Categories.AddCategoryMapping(7, NewznabStandardCategory.TVUHD, "TvPackUHD");
|
|
||||||
caps.Categories.AddCategoryMapping(8, NewznabStandardCategory.MoviesSD, "MovieSD");
|
|
||||||
caps.Categories.AddCategoryMapping(9, NewznabStandardCategory.MoviesHD, "MovieHD");
|
|
||||||
caps.Categories.AddCategoryMapping(10, NewznabStandardCategory.MoviesUHD, "MovieUHD");
|
|
||||||
caps.Categories.AddCategoryMapping(11, NewznabStandardCategory.MoviesSD, "MoviePackSD");
|
|
||||||
caps.Categories.AddCategoryMapping(12, NewznabStandardCategory.MoviesHD, "MoviePackHD");
|
|
||||||
caps.Categories.AddCategoryMapping(13, NewznabStandardCategory.MoviesUHD, "MoviePackUHD");
|
|
||||||
caps.Categories.AddCategoryMapping(14, NewznabStandardCategory.XXX, "MovieXXX");
|
|
||||||
caps.Categories.AddCategoryMapping(15, NewznabStandardCategory.MoviesBluRay, "Bluray");
|
|
||||||
caps.Categories.AddCategoryMapping(16, NewznabStandardCategory.TVAnime, "AnimeSD");
|
|
||||||
caps.Categories.AddCategoryMapping(17, NewznabStandardCategory.TVAnime, "AnimeHD");
|
|
||||||
caps.Categories.AddCategoryMapping(18, NewznabStandardCategory.PCGames, "GamesPC");
|
|
||||||
caps.Categories.AddCategoryMapping(19, NewznabStandardCategory.ConsoleXBox, "GamesxBox");
|
|
||||||
caps.Categories.AddCategoryMapping(20, NewznabStandardCategory.ConsolePS4, "GamesPS");
|
|
||||||
caps.Categories.AddCategoryMapping(21, NewznabStandardCategory.ConsoleWii, "GamesNin");
|
|
||||||
caps.Categories.AddCategoryMapping(22, NewznabStandardCategory.PC0day, "AppsWindows");
|
|
||||||
caps.Categories.AddCategoryMapping(23, NewznabStandardCategory.PCMac, "AppsMAC");
|
|
||||||
caps.Categories.AddCategoryMapping(24, NewznabStandardCategory.PC0day, "AppsLinux");
|
|
||||||
caps.Categories.AddCategoryMapping(25, NewznabStandardCategory.PCMobileOther, "AppsMobile");
|
|
||||||
caps.Categories.AddCategoryMapping(26, NewznabStandardCategory.XXX, "0dayXXX");
|
|
||||||
caps.Categories.AddCategoryMapping(27, NewznabStandardCategory.Books, "eBook");
|
|
||||||
caps.Categories.AddCategoryMapping(28, NewznabStandardCategory.AudioAudiobook, "AudioBook");
|
|
||||||
caps.Categories.AddCategoryMapping(29, NewznabStandardCategory.AudioOther, "Music");
|
|
||||||
caps.Categories.AddCategoryMapping(30, NewznabStandardCategory.Other, "Misc");
|
|
||||||
|
|
||||||
return caps;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AlphaRatioRequestGenerator : Gazelle.GazelleRequestGenerator
|
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||||
{
|
{
|
||||||
protected override bool ImdbInTags => true;
|
return new AlphaRatioRequestGenerator(Settings, Capabilities, _httpClient, _logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IndexerCapabilities SetCapabilities()
|
||||||
|
{
|
||||||
|
var caps = new IndexerCapabilities
|
||||||
|
{
|
||||||
|
TvSearchParams = new List<TvSearchParam>
|
||||||
|
{
|
||||||
|
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep
|
||||||
|
},
|
||||||
|
MovieSearchParams = new List<MovieSearchParam>
|
||||||
|
{
|
||||||
|
MovieSearchParam.Q
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.TVSD, "TvSD");
|
||||||
|
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TVHD, "TvHD");
|
||||||
|
caps.Categories.AddCategoryMapping(3, NewznabStandardCategory.TVUHD, "TvUHD");
|
||||||
|
caps.Categories.AddCategoryMapping(4, NewznabStandardCategory.TVSD, "TvDVDRip");
|
||||||
|
caps.Categories.AddCategoryMapping(5, NewznabStandardCategory.TVSD, "TvPackSD");
|
||||||
|
caps.Categories.AddCategoryMapping(6, NewznabStandardCategory.TVHD, "TvPackHD");
|
||||||
|
caps.Categories.AddCategoryMapping(7, NewznabStandardCategory.TVUHD, "TvPackUHD");
|
||||||
|
caps.Categories.AddCategoryMapping(8, NewznabStandardCategory.MoviesSD, "MovieSD");
|
||||||
|
caps.Categories.AddCategoryMapping(9, NewznabStandardCategory.MoviesHD, "MovieHD");
|
||||||
|
caps.Categories.AddCategoryMapping(10, NewznabStandardCategory.MoviesUHD, "MovieUHD");
|
||||||
|
caps.Categories.AddCategoryMapping(11, NewznabStandardCategory.MoviesSD, "MoviePackSD");
|
||||||
|
caps.Categories.AddCategoryMapping(12, NewznabStandardCategory.MoviesHD, "MoviePackHD");
|
||||||
|
caps.Categories.AddCategoryMapping(13, NewznabStandardCategory.MoviesUHD, "MoviePackUHD");
|
||||||
|
caps.Categories.AddCategoryMapping(14, NewznabStandardCategory.XXX, "MovieXXX");
|
||||||
|
caps.Categories.AddCategoryMapping(15, NewznabStandardCategory.MoviesBluRay, "Bluray");
|
||||||
|
caps.Categories.AddCategoryMapping(16, NewznabStandardCategory.TVAnime, "AnimeSD");
|
||||||
|
caps.Categories.AddCategoryMapping(17, NewznabStandardCategory.TVAnime, "AnimeHD");
|
||||||
|
caps.Categories.AddCategoryMapping(18, NewznabStandardCategory.PCGames, "GamesPC");
|
||||||
|
caps.Categories.AddCategoryMapping(19, NewznabStandardCategory.ConsoleXBox, "GamesxBox");
|
||||||
|
caps.Categories.AddCategoryMapping(20, NewznabStandardCategory.ConsolePS4, "GamesPS");
|
||||||
|
caps.Categories.AddCategoryMapping(21, NewznabStandardCategory.ConsoleWii, "GamesNin");
|
||||||
|
caps.Categories.AddCategoryMapping(22, NewznabStandardCategory.PC0day, "AppsWindows");
|
||||||
|
caps.Categories.AddCategoryMapping(23, NewznabStandardCategory.PCMac, "AppsMAC");
|
||||||
|
caps.Categories.AddCategoryMapping(24, NewznabStandardCategory.PC0day, "AppsLinux");
|
||||||
|
caps.Categories.AddCategoryMapping(25, NewznabStandardCategory.PCMobileOther, "AppsMobile");
|
||||||
|
caps.Categories.AddCategoryMapping(26, NewznabStandardCategory.XXX, "0dayXXX");
|
||||||
|
caps.Categories.AddCategoryMapping(27, NewznabStandardCategory.Books, "eBook");
|
||||||
|
caps.Categories.AddCategoryMapping(28, NewznabStandardCategory.AudioAudiobook, "AudioBook");
|
||||||
|
caps.Categories.AddCategoryMapping(29, NewznabStandardCategory.AudioOther, "Music");
|
||||||
|
caps.Categories.AddCategoryMapping(30, NewznabStandardCategory.Other, "Misc");
|
||||||
|
|
||||||
|
return caps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AlphaRatioRequestGenerator : GazelleRequestGenerator
|
||||||
|
{
|
||||||
|
protected override bool ImdbInTags => true;
|
||||||
|
private readonly AlphaRatioSettings _settings;
|
||||||
|
|
||||||
|
public AlphaRatioRequestGenerator(AlphaRatioSettings settings,
|
||||||
|
IndexerCapabilities capabilities,
|
||||||
|
IIndexerHttpClient httpClient,
|
||||||
|
Logger logger)
|
||||||
|
: base(settings, capabilities, httpClient, logger)
|
||||||
|
{
|
||||||
|
_settings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override NameValueCollection GetBasicSearchParameters(string term, int[] categories)
|
||||||
|
{
|
||||||
|
var parameters = base.GetBasicSearchParameters(term, categories);
|
||||||
|
|
||||||
|
if (_settings.FreeleechOnly)
|
||||||
|
{
|
||||||
|
parameters.Set("freetorrent", "1");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_settings.ExcludeScene)
|
||||||
|
{
|
||||||
|
parameters.Set("scene", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AlphaRatioSettings : GazelleSettings
|
||||||
|
{
|
||||||
|
[FieldDefinition(6, Label = "Freeleech Only", Type = FieldType.Checkbox, HelpText = "Search freeleech torrents only")]
|
||||||
|
public bool FreeleechOnly { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(7, Label = "Exclude Scene", Type = FieldType.Checkbox, HelpText = "Exclude Scene torrents from results")]
|
||||||
|
public bool ExcludeScene { get; set; }
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,349 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using AngleSharp.Html.Parser;
|
||||||
|
using NLog;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Common.Http;
|
||||||
|
using NzbDrone.Core.Annotations;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.Indexers.Exceptions;
|
||||||
|
using NzbDrone.Core.Indexers.Settings;
|
||||||
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
using NzbDrone.Core.Parser;
|
||||||
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Indexers.Definitions
|
||||||
|
{
|
||||||
|
public class Anidex : TorrentIndexerBase<AnidexSettings>
|
||||||
|
{
|
||||||
|
public override string Name => "Anidex";
|
||||||
|
public override string[] IndexerUrls => new[] { "https://anidex.info/" };
|
||||||
|
public override string Description => "Anidex is a Public torrent tracker and indexer, primarily for English fansub groups of anime";
|
||||||
|
public override string Language => "en-US";
|
||||||
|
public override Encoding Encoding => Encoding.UTF8;
|
||||||
|
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||||
|
public override IndexerPrivacy Privacy => IndexerPrivacy.Public;
|
||||||
|
public override IndexerCapabilities Capabilities => SetCapabilities();
|
||||||
|
|
||||||
|
public Anidex(IIndexerHttpClient httpClient,
|
||||||
|
IEventAggregator eventAggregator,
|
||||||
|
IIndexerStatusService indexerStatusService,
|
||||||
|
IConfigService configService,
|
||||||
|
Logger logger)
|
||||||
|
: base(httpClient, eventAggregator, indexerStatusService, configService, logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||||
|
{
|
||||||
|
return new AnidexRequestGenerator(Settings, Capabilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IParseIndexerResponse GetParser()
|
||||||
|
{
|
||||||
|
return new AnidexParser(Settings, Capabilities.Categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IndexerCapabilities SetCapabilities()
|
||||||
|
{
|
||||||
|
var caps = new IndexerCapabilities
|
||||||
|
{
|
||||||
|
TvSearchParams = new List<TvSearchParam>
|
||||||
|
{
|
||||||
|
TvSearchParam.Q
|
||||||
|
},
|
||||||
|
MusicSearchParams = new List<MusicSearchParam>
|
||||||
|
{
|
||||||
|
MusicSearchParam.Q,
|
||||||
|
},
|
||||||
|
BookSearchParams = new List<BookSearchParam>
|
||||||
|
{
|
||||||
|
BookSearchParam.Q,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
caps.Categories.AddCategoryMapping("1", NewznabStandardCategory.TVAnime, "Anime - Sub");
|
||||||
|
caps.Categories.AddCategoryMapping("2", NewznabStandardCategory.TVAnime, "Anime - Raw");
|
||||||
|
caps.Categories.AddCategoryMapping("3", NewznabStandardCategory.TVAnime, "Anime - Dub");
|
||||||
|
caps.Categories.AddCategoryMapping("4", NewznabStandardCategory.TVAnime, "LA - Sub");
|
||||||
|
caps.Categories.AddCategoryMapping("5", NewznabStandardCategory.TVAnime, "LA - Raw");
|
||||||
|
caps.Categories.AddCategoryMapping("6", NewznabStandardCategory.BooksEBook, "Light Novel");
|
||||||
|
caps.Categories.AddCategoryMapping("7", NewznabStandardCategory.BooksComics, "Manga - TLed");
|
||||||
|
caps.Categories.AddCategoryMapping("8", NewznabStandardCategory.BooksComics, "Manga - Raw");
|
||||||
|
caps.Categories.AddCategoryMapping("9", NewznabStandardCategory.AudioMP3, "♫ - Lossy");
|
||||||
|
caps.Categories.AddCategoryMapping("10", NewznabStandardCategory.AudioLossless, "♫ - Lossless");
|
||||||
|
caps.Categories.AddCategoryMapping("11", NewznabStandardCategory.AudioVideo, "♫ - Video");
|
||||||
|
caps.Categories.AddCategoryMapping("12", NewznabStandardCategory.PCGames, "Games");
|
||||||
|
caps.Categories.AddCategoryMapping("13", NewznabStandardCategory.PC0day, "Applications");
|
||||||
|
caps.Categories.AddCategoryMapping("14", NewznabStandardCategory.XXXImageSet, "Pictures");
|
||||||
|
caps.Categories.AddCategoryMapping("15", NewznabStandardCategory.XXX, "Adult Video");
|
||||||
|
caps.Categories.AddCategoryMapping("16", NewznabStandardCategory.Other, "Other");
|
||||||
|
|
||||||
|
return caps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AnidexRequestGenerator : IIndexerRequestGenerator
|
||||||
|
{
|
||||||
|
private readonly AnidexSettings _settings;
|
||||||
|
private readonly IndexerCapabilities _capabilities;
|
||||||
|
|
||||||
|
public AnidexRequestGenerator(AnidexSettings settings, IndexerCapabilities capabilities)
|
||||||
|
{
|
||||||
|
_settings = settings;
|
||||||
|
_capabilities = capabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||||
|
{
|
||||||
|
return new List<IndexerRequest>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
|
||||||
|
{
|
||||||
|
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
|
||||||
|
{
|
||||||
|
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
|
||||||
|
{
|
||||||
|
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
|
||||||
|
{
|
||||||
|
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories)
|
||||||
|
{
|
||||||
|
var parameters = new NameValueCollection
|
||||||
|
{
|
||||||
|
{ "page", "search" },
|
||||||
|
{ "s", "upload_timestamp" },
|
||||||
|
{ "o", "desc" },
|
||||||
|
{ "group_id", "0" }, // All groups
|
||||||
|
{ "q", term ?? string.Empty }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_settings.AuthorisedOnly)
|
||||||
|
{
|
||||||
|
parameters.Add("a", "1");
|
||||||
|
}
|
||||||
|
|
||||||
|
var searchUrl = $"{_settings.BaseUrl}?{parameters.GetQueryString()}";
|
||||||
|
|
||||||
|
var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(categories);
|
||||||
|
|
||||||
|
if (queryCats.Any())
|
||||||
|
{
|
||||||
|
searchUrl += "&id=" + string.Join(",", queryCats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_settings.LanguagesOnly.Any())
|
||||||
|
{
|
||||||
|
searchUrl += "&lang_id=" + string.Join(",", _settings.LanguagesOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = new IndexerRequest(searchUrl, HttpAccept.Html);
|
||||||
|
|
||||||
|
yield return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Func<IDictionary<string, string>> GetCookies { get; set; }
|
||||||
|
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AnidexParser : IParseIndexerResponse
|
||||||
|
{
|
||||||
|
private readonly AnidexSettings _settings;
|
||||||
|
private readonly IndexerCapabilitiesCategories _categories;
|
||||||
|
|
||||||
|
public AnidexParser(AnidexSettings settings, IndexerCapabilitiesCategories categories)
|
||||||
|
{
|
||||||
|
_settings = settings;
|
||||||
|
_categories = categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||||
|
{
|
||||||
|
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
throw new IndexerException(indexerResponse, $"Anidex search returned unexpected result. Expected 200 OK but got {indexerResponse.HttpResponse.StatusCode}.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var releaseInfos = new List<ReleaseInfo>();
|
||||||
|
|
||||||
|
var parser = new HtmlParser();
|
||||||
|
var dom = parser.ParseDocument(indexerResponse.Content);
|
||||||
|
|
||||||
|
var rows = dom.QuerySelectorAll("div#content table > tbody > tr");
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
var downloadUrl = _settings.BaseUrl + row.QuerySelector("a[href^=\"/dl/\"]")?.GetAttribute("href");
|
||||||
|
var infoUrl = _settings.BaseUrl + row.QuerySelector("td:nth-child(3) a")?.GetAttribute("href");
|
||||||
|
|
||||||
|
var title = row.QuerySelector("td:nth-child(3) span")?.GetAttribute("title")?.Trim();
|
||||||
|
var language = row.QuerySelector("td:nth-child(1) img")?.GetAttribute("title")?.Trim();
|
||||||
|
|
||||||
|
if (language.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
title += $" [{language}]";
|
||||||
|
}
|
||||||
|
|
||||||
|
var categoryLink = row.QuerySelector("td:nth-child(1) a").GetAttribute("href");
|
||||||
|
var cat = ParseUtil.GetArgumentFromQueryString(categoryLink, "id");
|
||||||
|
var categories = _categories.MapTrackerCatToNewznab(cat);
|
||||||
|
|
||||||
|
var seeders = ParseUtil.CoerceInt(row.QuerySelector("td:nth-child(9)")?.TextContent);
|
||||||
|
var peers = seeders + ParseUtil.CoerceInt(row.QuerySelector("td:nth-child(10)")?.TextContent.Trim());
|
||||||
|
|
||||||
|
var added = row.QuerySelector("td:nth-child(8)").GetAttribute("title").Trim();
|
||||||
|
|
||||||
|
var release = new TorrentInfo
|
||||||
|
{
|
||||||
|
Guid = infoUrl,
|
||||||
|
InfoUrl = infoUrl,
|
||||||
|
DownloadUrl = downloadUrl,
|
||||||
|
MagnetUrl = row.QuerySelector("a[href^=\"magnet:?\"]")?.GetAttribute("href"),
|
||||||
|
Title = title,
|
||||||
|
Categories = categories,
|
||||||
|
Seeders = seeders,
|
||||||
|
Peers = peers,
|
||||||
|
Size = ParseUtil.GetBytes(row.QuerySelector("td:nth-child(7)")?.TextContent.Trim()),
|
||||||
|
Grabs = ParseUtil.CoerceInt(row.QuerySelector("td:nth-child(11)")?.TextContent),
|
||||||
|
PublishDate = DateTime.ParseExact(added, "yyyy-MM-dd HH:mm:ss UTC", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal),
|
||||||
|
DownloadVolumeFactor = 0,
|
||||||
|
UploadVolumeFactor = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
releaseInfos.Add(release);
|
||||||
|
}
|
||||||
|
|
||||||
|
return releaseInfos.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AnidexSettings : NoAuthTorrentBaseSettings
|
||||||
|
{
|
||||||
|
public AnidexSettings()
|
||||||
|
{
|
||||||
|
AuthorisedOnly = false;
|
||||||
|
LanguagesOnly = Array.Empty<int>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[FieldDefinition(2, Label = "Authorised Only", Type = FieldType.Checkbox, HelpText = "Search authorised torrents only")]
|
||||||
|
public bool AuthorisedOnly { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(3, Label = "Languages Only", Type = FieldType.Select, SelectOptions = typeof(AnidexLanguage), HelpText = "Search selected languages only. None ticked = ALL.")]
|
||||||
|
public IEnumerable<int> LanguagesOnly { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AnidexLanguage
|
||||||
|
{
|
||||||
|
[FieldOption(Hint = "English")]
|
||||||
|
GB = 1,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Japanese")]
|
||||||
|
JP = 2,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Polish")]
|
||||||
|
PL = 3,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Serbo-Croatian")]
|
||||||
|
RS = 4,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Dutch")]
|
||||||
|
NL = 5,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Italian")]
|
||||||
|
IT = 6,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Russian")]
|
||||||
|
RU = 7,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "German")]
|
||||||
|
DE = 8,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Hungarian")]
|
||||||
|
HU = 9,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "French")]
|
||||||
|
FR = 10,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Finnish")]
|
||||||
|
FI = 11,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Vietnamese")]
|
||||||
|
VN = 12,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Greek")]
|
||||||
|
GR = 13,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Bulgarian")]
|
||||||
|
BG = 14,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Spanish (Spain)")]
|
||||||
|
ES = 15,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Portuguese (Brazil)")]
|
||||||
|
BR = 16,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Portuguese (Portugal)")]
|
||||||
|
PT = 17,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Swedish")]
|
||||||
|
SE = 18,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Arabic")]
|
||||||
|
SA = 19,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Danish")]
|
||||||
|
DK = 20,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Chinese (Simplified)")]
|
||||||
|
CN = 21,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Bengali")]
|
||||||
|
BD = 22,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Romanian")]
|
||||||
|
RO = 23,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Czech")]
|
||||||
|
CZ = 24,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Mongolian")]
|
||||||
|
MN = 25,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Turkish")]
|
||||||
|
TR = 26,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Indonesian")]
|
||||||
|
ID = 27,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Korean")]
|
||||||
|
KR = 28,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Spanish (LATAM)")]
|
||||||
|
MX = 29,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Persian")]
|
||||||
|
IR = 30,
|
||||||
|
|
||||||
|
[FieldOption(Hint = "Malaysian")]
|
||||||
|
MY = 31,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,10 +9,8 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using FluentValidation;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
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.Indexers.Settings;
|
using NzbDrone.Core.Indexers.Settings;
|
||||||
@@ -20,14 +18,13 @@ using NzbDrone.Core.IndexerSearch.Definitions;
|
|||||||
using NzbDrone.Core.Messaging.Events;
|
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.Validation;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Definitions
|
namespace NzbDrone.Core.Indexers.Definitions
|
||||||
{
|
{
|
||||||
public class Anidub : TorrentIndexerBase<UserPassTorrentBaseSettings>
|
public class Anidub : TorrentIndexerBase<UserPassTorrentBaseSettings>
|
||||||
{
|
{
|
||||||
public override string Name => "Anidub";
|
public override string Name => "Anidub";
|
||||||
public override string[] IndexerUrls => new string[] { "https://tr.anidub.com/" };
|
public override string[] IndexerUrls => new[] { "https://tr.anidub.com/" };
|
||||||
public override string Description => "Anidub is russian anime voiceover group and eponymous anime tracker.";
|
public override string Description => "Anidub is russian anime voiceover group and eponymous anime tracker.";
|
||||||
public override string Language => "ru-RU";
|
public override string Language => "ru-RU";
|
||||||
public override Encoding Encoding => Encoding.UTF8;
|
public override Encoding Encoding => Encoding.UTF8;
|
||||||
@@ -42,31 +39,29 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
|
|
||||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||||
{
|
{
|
||||||
return new AnidubRequestGenerator() { Settings = Settings, Capabilities = Capabilities };
|
return new AnidubRequestGenerator(Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IParseIndexerResponse GetParser()
|
public override IParseIndexerResponse GetParser()
|
||||||
{
|
{
|
||||||
return new AnidubParser(Settings, Capabilities.Categories) { HttpClient = _httpClient, Logger = _logger };
|
return new AnidubParser(Settings, Capabilities.Categories, RateLimit, _httpClient, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task DoLogin()
|
protected override async Task DoLogin()
|
||||||
{
|
{
|
||||||
UpdateCookies(null, null);
|
UpdateCookies(null, null);
|
||||||
|
|
||||||
|
var mainPage = await ExecuteAuth(new HttpRequest(Settings.BaseUrl));
|
||||||
|
|
||||||
var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl + "index.php")
|
var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl + "index.php")
|
||||||
{
|
{
|
||||||
LogResponseContent = true,
|
LogResponseContent = true,
|
||||||
AllowAutoRedirect = true
|
AllowAutoRedirect = true,
|
||||||
|
Method = HttpMethod.Post
|
||||||
};
|
};
|
||||||
|
|
||||||
var mainPage = await ExecuteAuth(new HttpRequest(Settings.BaseUrl));
|
|
||||||
|
|
||||||
requestBuilder.Method = HttpMethod.Post;
|
|
||||||
requestBuilder.PostProcess += r => r.RequestTimeout = TimeSpan.FromSeconds(15);
|
|
||||||
requestBuilder.SetCookies(mainPage.GetCookies());
|
|
||||||
|
|
||||||
var authLoginRequest = requestBuilder
|
var authLoginRequest = requestBuilder
|
||||||
|
.SetCookies(mainPage.GetCookies())
|
||||||
.AddFormParameter("login_name", Settings.Username)
|
.AddFormParameter("login_name", Settings.Username)
|
||||||
.AddFormParameter("login_password", Settings.Password)
|
.AddFormParameter("login_password", Settings.Password)
|
||||||
.AddFormParameter("login", "submit")
|
.AddFormParameter("login", "submit")
|
||||||
@@ -77,27 +72,22 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
|
|
||||||
if (response.Content != null && !CheckIfLoginNeeded(response))
|
if (response.Content != null && !CheckIfLoginNeeded(response))
|
||||||
{
|
{
|
||||||
UpdateCookies(response.GetCookies(), DateTime.Now + TimeSpan.FromDays(30));
|
UpdateCookies(response.GetCookies(), DateTime.Now.AddDays(30));
|
||||||
_logger.Debug("Anidub authentication succeeded");
|
_logger.Debug("Anidub authentication succeeded");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const string ErrorSelector = "#content .berror .berror_c";
|
|
||||||
var parser = new HtmlParser();
|
var parser = new HtmlParser();
|
||||||
var document = await parser.ParseDocumentAsync(response.Content);
|
var document = await parser.ParseDocumentAsync(response.Content);
|
||||||
var errorMessage = document.QuerySelector(ErrorSelector).TextContent.Trim();
|
var errorMessage = document.QuerySelector("#content .berror .berror_c")?.TextContent.Trim();
|
||||||
throw new IndexerAuthException("Anidub authentication failed. Error: " + errorMessage);
|
|
||||||
|
throw new IndexerAuthException(errorMessage ?? "Unknown error message, please report.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CheckIfLoginNeeded(HttpResponse httpResponse)
|
protected override bool CheckIfLoginNeeded(HttpResponse httpResponse)
|
||||||
{
|
{
|
||||||
if (httpResponse.Content.Contains("index.php?action=logout"))
|
return !httpResponse.Content.Contains("index.php?action=logout");
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IndexerCapabilities SetCapabilities()
|
private IndexerCapabilities SetCapabilities()
|
||||||
@@ -138,31 +128,32 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
caps.Categories.AddCategoryMapping(15, NewznabStandardCategory.BooksComics, "Манга");
|
caps.Categories.AddCategoryMapping(15, NewznabStandardCategory.BooksComics, "Манга");
|
||||||
caps.Categories.AddCategoryMapping(16, NewznabStandardCategory.Audio, "OST");
|
caps.Categories.AddCategoryMapping(16, NewznabStandardCategory.Audio, "OST");
|
||||||
caps.Categories.AddCategoryMapping(17, NewznabStandardCategory.Audio, "Подкасты");
|
caps.Categories.AddCategoryMapping(17, NewznabStandardCategory.Audio, "Подкасты");
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AnidubRequestGenerator : IIndexerRequestGenerator
|
public class AnidubRequestGenerator : IIndexerRequestGenerator
|
||||||
{
|
{
|
||||||
public UserPassTorrentBaseSettings Settings { get; set; }
|
private readonly UserPassTorrentBaseSettings _settings;
|
||||||
public IndexerCapabilities Capabilities { get; set; }
|
|
||||||
|
|
||||||
public AnidubRequestGenerator()
|
public AnidubRequestGenerator(UserPassTorrentBaseSettings settings)
|
||||||
{
|
{
|
||||||
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories)
|
private IEnumerable<IndexerRequest> GetPagedRequests(string term)
|
||||||
{
|
{
|
||||||
var requestUrl = string.Empty;
|
string requestUrl;
|
||||||
var isSearch = !string.IsNullOrWhiteSpace(term);
|
var isSearch = !string.IsNullOrWhiteSpace(term);
|
||||||
|
|
||||||
if (isSearch)
|
if (isSearch)
|
||||||
{
|
{
|
||||||
requestUrl = string.Format("{0}/index.php?do=search", Settings.BaseUrl.TrimEnd('/'));
|
requestUrl = $"{_settings.BaseUrl.TrimEnd('/')}/index.php?do=search";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
requestUrl = Settings.BaseUrl;
|
requestUrl = _settings.BaseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = new IndexerRequest(requestUrl, HttpAccept.Html);
|
var request = new IndexerRequest(requestUrl, HttpAccept.Html);
|
||||||
@@ -203,49 +194,29 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
yield return request;
|
yield return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
|
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
return GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}");
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
|
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
|
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
|
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Func<IDictionary<string, string>> GetCookies { get; set; }
|
public Func<IDictionary<string, string>> GetCookies { get; set; }
|
||||||
@@ -256,33 +227,37 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
{
|
{
|
||||||
private readonly UserPassTorrentBaseSettings _settings;
|
private readonly UserPassTorrentBaseSettings _settings;
|
||||||
private readonly IndexerCapabilitiesCategories _categories;
|
private readonly IndexerCapabilitiesCategories _categories;
|
||||||
public IIndexerHttpClient HttpClient { get; set; }
|
private readonly TimeSpan _rateLimit;
|
||||||
public Logger Logger { get; set; }
|
private readonly IIndexerHttpClient _httpClient;
|
||||||
|
private readonly Logger _logger;
|
||||||
|
|
||||||
private static Dictionary<string, string> CategoriesMap => new Dictionary<string, string>
|
private static Dictionary<string, string> CategoriesMap => new ()
|
||||||
{
|
{
|
||||||
{ "/anime_tv/full", "14" },
|
{ "/anime_tv/full", "14" },
|
||||||
{ "/anime_tv/anime_ongoing", "10" },
|
{ "/anime_tv/anime_ongoing", "10" },
|
||||||
{ "/anime_tv/shonen", "11" },
|
{ "/anime_tv/shonen", "11" },
|
||||||
{ "/anime_tv", "2" },
|
{ "/anime_tv", "2" },
|
||||||
{ "/xxx", "13" },
|
{ "/xxx", "13" },
|
||||||
{ "/manga", "15" },
|
{ "/manga", "15" },
|
||||||
{ "/ost", "16" },
|
{ "/ost", "16" },
|
||||||
{ "/podcast", "17" },
|
{ "/podcast", "17" },
|
||||||
{ "/anime_movie", "3" },
|
{ "/anime_movie", "3" },
|
||||||
{ "/anime_ova/anime_ona", "5" },
|
{ "/anime_ova/anime_ona", "5" },
|
||||||
{ "/anime_ova", "4" },
|
{ "/anime_ova", "4" },
|
||||||
{ "/dorama/japan_dorama", "6" },
|
{ "/dorama/japan_dorama", "6" },
|
||||||
{ "/dorama/korea_dorama", "7" },
|
{ "/dorama/korea_dorama", "7" },
|
||||||
{ "/dorama/china_dorama", "8" },
|
{ "/dorama/china_dorama", "8" },
|
||||||
{ "/dorama", "9" },
|
{ "/dorama", "9" },
|
||||||
{ "/anons_ongoing", "12" }
|
{ "/anons_ongoing", "12" }
|
||||||
};
|
};
|
||||||
|
|
||||||
public AnidubParser(UserPassTorrentBaseSettings settings, IndexerCapabilitiesCategories categories)
|
public AnidubParser(UserPassTorrentBaseSettings settings, IndexerCapabilitiesCategories categories, TimeSpan rateLimit, IIndexerHttpClient httpClient, Logger logger)
|
||||||
{
|
{
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
_categories = categories;
|
_categories = categories;
|
||||||
|
_rateLimit = rateLimit;
|
||||||
|
_httpClient = httpClient;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetTitle(AngleSharp.Html.Dom.IHtmlDocument content, AngleSharp.Dom.IElement tabNode)
|
private static string GetTitle(AngleSharp.Html.Dom.IHtmlDocument content, AngleSharp.Dom.IElement tabNode)
|
||||||
@@ -327,9 +302,9 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
|
|
||||||
private static int GetReleaseLeechers(AngleSharp.Dom.IElement tabNode)
|
private static int GetReleaseLeechers(AngleSharp.Dom.IElement tabNode)
|
||||||
{
|
{
|
||||||
const string LeechersSelector = ".list.down > .li_swing_m";
|
const string leechersSelector = ".list.down > .li_swing_m";
|
||||||
|
|
||||||
var leechersStr = tabNode.QuerySelector(LeechersSelector).TextContent;
|
var leechersStr = tabNode.QuerySelector(leechersSelector).TextContent;
|
||||||
int.TryParse(leechersStr, out var leechers);
|
int.TryParse(leechersStr, out var leechers);
|
||||||
return leechers;
|
return leechers;
|
||||||
}
|
}
|
||||||
@@ -345,18 +320,18 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
|
|
||||||
private static int GetReleaseGrabs(AngleSharp.Dom.IElement tabNode)
|
private static int GetReleaseGrabs(AngleSharp.Dom.IElement tabNode)
|
||||||
{
|
{
|
||||||
const string GrabsSelector = ".list.down > .li_download_m";
|
const string grabsSelector = ".list.down > .li_download_m";
|
||||||
|
|
||||||
var grabsStr = tabNode.QuerySelector(GrabsSelector).TextContent;
|
var grabsStr = tabNode.QuerySelector(grabsSelector).TextContent;
|
||||||
int.TryParse(grabsStr, out var grabs);
|
int.TryParse(grabsStr, out var grabs);
|
||||||
return grabs;
|
return grabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetDateFromDocument(AngleSharp.Html.Dom.IHtmlDocument content)
|
private static string GetDateFromDocument(AngleSharp.Html.Dom.IHtmlDocument content)
|
||||||
{
|
{
|
||||||
const string DateSelector = ".story_inf > li:nth-child(2)";
|
const string dateSelector = ".story_inf > li:nth-child(2)";
|
||||||
|
|
||||||
var domDate = content.QuerySelector(DateSelector).LastChild;
|
var domDate = content.QuerySelector(dateSelector).LastChild;
|
||||||
|
|
||||||
if (domDate?.NodeName != "#text")
|
if (domDate?.NodeName != "#text")
|
||||||
{
|
{
|
||||||
@@ -397,16 +372,16 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
return utcDate.AddHours(-russianStandardTimeDiff);
|
return utcDate.AddHours(-russianStandardTimeDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Warn($"[AniDub] Date time couldn't be parsed on. Date text: {dateText}");
|
_logger.Warn($"[AniDub] Date time couldn't be parsed on. Date text: {dateText}");
|
||||||
|
|
||||||
return DateTime.UtcNow;
|
return DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long GetReleaseSize(AngleSharp.Dom.IElement tabNode)
|
private static long GetReleaseSize(AngleSharp.Dom.IElement tabNode)
|
||||||
{
|
{
|
||||||
const string SizeSelector = ".list.down > .red";
|
const string sizeSelector = ".list.down > .red";
|
||||||
|
|
||||||
var sizeStr = tabNode.QuerySelector(SizeSelector).TextContent;
|
var sizeStr = tabNode.QuerySelector(sizeSelector).TextContent;
|
||||||
return ParseUtil.GetBytes(sizeStr);
|
return ParseUtil.GetBytes(sizeStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,11 +421,11 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
var release = new TorrentInfo
|
var release = new TorrentInfo
|
||||||
{
|
{
|
||||||
Title = GetTitle(dom, t),
|
Title = GetTitle(dom, t),
|
||||||
InfoUrl = indexerResponse.Request.Url.ToString(),
|
InfoUrl = indexerResponse.Request.Url.FullUri,
|
||||||
DownloadVolumeFactor = 0,
|
DownloadVolumeFactor = 0,
|
||||||
UploadVolumeFactor = 1,
|
UploadVolumeFactor = 1,
|
||||||
|
|
||||||
Guid = indexerResponse.Request.Url.ToString() + t.Id,
|
Guid = indexerResponse.Request.Url.FullUri + t.Id,
|
||||||
Seeders = GetReleaseSeeders(t),
|
Seeders = GetReleaseSeeders(t),
|
||||||
Peers = GetReleaseSeeders(t) + GetReleaseLeechers(t),
|
Peers = GetReleaseSeeders(t) + GetReleaseLeechers(t),
|
||||||
Grabs = GetReleaseGrabs(t),
|
Grabs = GetReleaseGrabs(t),
|
||||||
@@ -472,36 +447,30 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
|
|
||||||
var parser = new HtmlParser();
|
var parser = new HtmlParser();
|
||||||
var dom = parser.ParseDocument(indexerResponse.Content);
|
var dom = parser.ParseDocument(indexerResponse.Content);
|
||||||
var domQuery = string.Empty;
|
|
||||||
|
|
||||||
if (indexerResponse.Request.Url.Query.Contains("do=search"))
|
var links = dom.QuerySelectorAll(".searchitem > h3 > a[href], #dle-content > .story > .story_h > .lcol > h2 > a[href]");
|
||||||
{
|
|
||||||
domQuery = ".searchitem > h3 > a";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
domQuery = "#dle-content > .story > .story_h > .lcol > h2 > a";
|
|
||||||
}
|
|
||||||
|
|
||||||
var links = dom.QuerySelectorAll(domQuery);
|
|
||||||
foreach (var link in links)
|
foreach (var link in links)
|
||||||
{
|
{
|
||||||
var url = link.GetAttribute("href");
|
var url = link.GetAttribute("href");
|
||||||
|
|
||||||
var releaseRequest = new IndexerRequest(url, HttpAccept.Html);
|
var releaseRequest = new HttpRequestBuilder(url)
|
||||||
var releaseResponse = new IndexerResponse(releaseRequest, HttpClient.Execute(releaseRequest.HttpRequest));
|
.WithRateLimit(_rateLimit.TotalSeconds)
|
||||||
|
.SetHeader("Referer", _settings.BaseUrl)
|
||||||
|
.Accept(HttpAccept.Html)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var releaseIndexerRequest = new IndexerRequest(releaseRequest);
|
||||||
|
var releaseResponse = new IndexerResponse(releaseIndexerRequest, _httpClient.Execute(releaseIndexerRequest.HttpRequest));
|
||||||
|
|
||||||
// Throw common http errors here before we try to parse
|
// Throw common http errors here before we try to parse
|
||||||
if (releaseResponse.HttpResponse.HasHttpError)
|
if (releaseResponse.HttpResponse.HasHttpError)
|
||||||
{
|
{
|
||||||
if (releaseResponse.HttpResponse.StatusCode == HttpStatusCode.TooManyRequests)
|
if (releaseResponse.HttpResponse.StatusCode == HttpStatusCode.TooManyRequests)
|
||||||
{
|
{
|
||||||
throw new TooManyRequestsException(releaseRequest.HttpRequest, releaseResponse.HttpResponse);
|
throw new TooManyRequestsException(releaseResponse.HttpRequest, releaseResponse.HttpResponse);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IndexerException(releaseResponse, "Http error code: " + releaseResponse.HttpResponse.StatusCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new IndexerException(releaseResponse, $"HTTP Error - {releaseResponse.HttpResponse.StatusCode}. {url}");
|
||||||
}
|
}
|
||||||
|
|
||||||
torrentInfos.AddRange(ParseRelease(releaseResponse));
|
torrentInfos.AddRange(ParseRelease(releaseResponse));
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user