New: Renamed Blacklist to Blocklist
This commit is contained in:
parent
2f6409226a
commit
ead1371846
|
@ -18,9 +18,9 @@ import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
import BlacklistRowConnector from './BlacklistRowConnector';
|
import BlocklistRowConnector from './BlocklistRowConnector';
|
||||||
|
|
||||||
class Blacklist extends Component {
|
class Blocklist extends Component {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
|
@ -100,8 +100,8 @@ class Blacklist extends Component {
|
||||||
columns,
|
columns,
|
||||||
totalRecords,
|
totalRecords,
|
||||||
isRemoving,
|
isRemoving,
|
||||||
isClearingBlacklistExecuting,
|
isClearingBlocklistExecuting,
|
||||||
onClearBlacklistPress,
|
onClearBlocklistPress,
|
||||||
...otherProps
|
...otherProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class Blacklist extends Component {
|
||||||
const selectedIds = this.getSelectedIds();
|
const selectedIds = this.getSelectedIds();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContent title="Blacklist">
|
<PageContent title="Blocklist">
|
||||||
<PageToolbar>
|
<PageToolbar>
|
||||||
<PageToolbarSection>
|
<PageToolbarSection>
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
|
@ -129,8 +129,8 @@ class Blacklist extends Component {
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
label="Clear"
|
label="Clear"
|
||||||
iconName={icons.CLEAR}
|
iconName={icons.CLEAR}
|
||||||
isSpinning={isClearingBlacklistExecuting}
|
isSpinning={isClearingBlocklistExecuting}
|
||||||
onPress={onClearBlacklistPress}
|
onPress={onClearBlocklistPress}
|
||||||
/>
|
/>
|
||||||
</PageToolbarSection>
|
</PageToolbarSection>
|
||||||
|
|
||||||
|
@ -155,13 +155,13 @@ class Blacklist extends Component {
|
||||||
|
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>Unable to load blacklist</div>
|
<div>Unable to load blocklist</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
isPopulated && !error && !items.length &&
|
isPopulated && !error && !items.length &&
|
||||||
<div>
|
<div>
|
||||||
No history blacklist
|
No history blocklist
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ class Blacklist extends Component {
|
||||||
{
|
{
|
||||||
items.map((item) => {
|
items.map((item) => {
|
||||||
return (
|
return (
|
||||||
<BlacklistRowConnector
|
<BlocklistRowConnector
|
||||||
key={item.id}
|
key={item.id}
|
||||||
isSelected={selectedState[item.id] || false}
|
isSelected={selectedState[item.id] || false}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
@ -206,7 +206,7 @@ class Blacklist extends Component {
|
||||||
isOpen={isConfirmRemoveModalOpen}
|
isOpen={isConfirmRemoveModalOpen}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title="Remove Selected"
|
title="Remove Selected"
|
||||||
message={'Are you sure you want to remove the selected items from the blacklist?'}
|
message={'Are you sure you want to remove the selected items from the blocklist?'}
|
||||||
confirmLabel="Remove Selected"
|
confirmLabel="Remove Selected"
|
||||||
onConfirm={this.onRemoveSelectedConfirmed}
|
onConfirm={this.onRemoveSelectedConfirmed}
|
||||||
onCancel={this.onConfirmRemoveModalClose}
|
onCancel={this.onConfirmRemoveModalClose}
|
||||||
|
@ -216,7 +216,7 @@ class Blacklist extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Blacklist.propTypes = {
|
Blocklist.propTypes = {
|
||||||
isFetching: PropTypes.bool.isRequired,
|
isFetching: PropTypes.bool.isRequired,
|
||||||
isPopulated: PropTypes.bool.isRequired,
|
isPopulated: PropTypes.bool.isRequired,
|
||||||
error: PropTypes.object,
|
error: PropTypes.object,
|
||||||
|
@ -224,9 +224,9 @@ Blacklist.propTypes = {
|
||||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
totalRecords: PropTypes.number,
|
totalRecords: PropTypes.number,
|
||||||
isRemoving: PropTypes.bool.isRequired,
|
isRemoving: PropTypes.bool.isRequired,
|
||||||
isClearingBlacklistExecuting: PropTypes.bool.isRequired,
|
isClearingBlocklistExecuting: PropTypes.bool.isRequired,
|
||||||
onRemoveSelected: PropTypes.func.isRequired,
|
onRemoveSelected: PropTypes.func.isRequired,
|
||||||
onClearBlacklistPress: PropTypes.func.isRequired
|
onClearBlocklistPress: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Blacklist;
|
export default Blocklist;
|
|
@ -5,30 +5,30 @@ import { createSelector } from 'reselect';
|
||||||
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
|
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
|
||||||
import withCurrentPage from 'Components/withCurrentPage';
|
import withCurrentPage from 'Components/withCurrentPage';
|
||||||
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
||||||
import * as blacklistActions from 'Store/Actions/blacklistActions';
|
import * as blocklistActions from 'Store/Actions/blocklistActions';
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
import * as commandNames from 'Commands/commandNames';
|
import * as commandNames from 'Commands/commandNames';
|
||||||
import Blacklist from './Blacklist';
|
import Blocklist from './Blocklist';
|
||||||
|
|
||||||
function createMapStateToProps() {
|
function createMapStateToProps() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state) => state.blacklist,
|
(state) => state.blocklist,
|
||||||
createCommandExecutingSelector(commandNames.CLEAR_BLACKLIST),
|
createCommandExecutingSelector(commandNames.CLEAR_BLOCKLIST),
|
||||||
(blacklist, isClearingBlacklistExecuting) => {
|
(blocklist, isClearingBlocklistExecuting) => {
|
||||||
return {
|
return {
|
||||||
isClearingBlacklistExecuting,
|
isClearingBlocklistExecuting,
|
||||||
...blacklist
|
...blocklist
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
...blacklistActions,
|
...blocklistActions,
|
||||||
executeCommand
|
executeCommand
|
||||||
};
|
};
|
||||||
|
|
||||||
class BlacklistConnector extends Component {
|
class BlocklistConnector extends Component {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
|
@ -36,27 +36,27 @@ class BlacklistConnector extends Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const {
|
const {
|
||||||
useCurrentPage,
|
useCurrentPage,
|
||||||
fetchBlacklist,
|
fetchBlocklist,
|
||||||
gotoBlacklistFirstPage
|
gotoBlocklistFirstPage
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
registerPagePopulator(this.repopulate);
|
registerPagePopulator(this.repopulate);
|
||||||
|
|
||||||
if (useCurrentPage) {
|
if (useCurrentPage) {
|
||||||
fetchBlacklist();
|
fetchBlocklist();
|
||||||
} else {
|
} else {
|
||||||
gotoBlacklistFirstPage();
|
gotoBlocklistFirstPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (prevProps.isClearingBlacklistExecuting && !this.props.isClearingBlacklistExecuting) {
|
if (prevProps.isClearingBlocklistExecuting && !this.props.isClearingBlocklistExecuting) {
|
||||||
this.props.gotoBlacklistFirstPage();
|
this.props.gotoBlocklistFirstPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.props.clearBlacklist();
|
this.props.clearBlocklist();
|
||||||
unregisterPagePopulator(this.repopulate);
|
unregisterPagePopulator(this.repopulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,56 +64,56 @@ class BlacklistConnector extends Component {
|
||||||
// Control
|
// Control
|
||||||
|
|
||||||
repopulate = () => {
|
repopulate = () => {
|
||||||
this.props.fetchBlacklist();
|
this.props.fetchBlocklist();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onFirstPagePress = () => {
|
onFirstPagePress = () => {
|
||||||
this.props.gotoBlacklistFirstPage();
|
this.props.gotoBlocklistFirstPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
onPreviousPagePress = () => {
|
onPreviousPagePress = () => {
|
||||||
this.props.gotoBlacklistPreviousPage();
|
this.props.gotoBlocklistPreviousPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
onNextPagePress = () => {
|
onNextPagePress = () => {
|
||||||
this.props.gotoBlacklistNextPage();
|
this.props.gotoBlocklistNextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
onLastPagePress = () => {
|
onLastPagePress = () => {
|
||||||
this.props.gotoBlacklistLastPage();
|
this.props.gotoBlocklistLastPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageSelect = (page) => {
|
onPageSelect = (page) => {
|
||||||
this.props.gotoBlacklistPage({ page });
|
this.props.gotoBlocklistPage({ page });
|
||||||
}
|
}
|
||||||
|
|
||||||
onRemoveSelected = (ids) => {
|
onRemoveSelected = (ids) => {
|
||||||
this.props.removeBlacklistItems({ ids });
|
this.props.removeBlocklistItems({ ids });
|
||||||
}
|
}
|
||||||
|
|
||||||
onSortPress = (sortKey) => {
|
onSortPress = (sortKey) => {
|
||||||
this.props.setBlacklistSort({ sortKey });
|
this.props.setBlocklistSort({ sortKey });
|
||||||
}
|
}
|
||||||
|
|
||||||
onTableOptionChange = (payload) => {
|
onTableOptionChange = (payload) => {
|
||||||
this.props.setBlacklistTableOption(payload);
|
this.props.setBlocklistTableOption(payload);
|
||||||
|
|
||||||
if (payload.pageSize) {
|
if (payload.pageSize) {
|
||||||
this.props.gotoBlacklistFirstPage();
|
this.props.gotoBlocklistFirstPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClearBlacklistPress = () => {
|
onClearBlocklistPress = () => {
|
||||||
this.props.executeCommand({ name: commandNames.CLEAR_BLACKLIST });
|
this.props.executeCommand({ name: commandNames.CLEAR_BLOCKLIST });
|
||||||
}
|
}
|
||||||
|
|
||||||
onTableOptionChange = (payload) => {
|
onTableOptionChange = (payload) => {
|
||||||
this.props.setBlacklistTableOption(payload);
|
this.props.setBlocklistTableOption(payload);
|
||||||
|
|
||||||
if (payload.pageSize) {
|
if (payload.pageSize) {
|
||||||
this.props.gotoBlacklistFirstPage();
|
this.props.gotoBlocklistFirstPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class BlacklistConnector extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Blacklist
|
<Blocklist
|
||||||
onFirstPagePress={this.onFirstPagePress}
|
onFirstPagePress={this.onFirstPagePress}
|
||||||
onPreviousPagePress={this.onPreviousPagePress}
|
onPreviousPagePress={this.onPreviousPagePress}
|
||||||
onNextPagePress={this.onNextPagePress}
|
onNextPagePress={this.onNextPagePress}
|
||||||
|
@ -131,30 +131,30 @@ class BlacklistConnector extends Component {
|
||||||
onRemoveSelected={this.onRemoveSelected}
|
onRemoveSelected={this.onRemoveSelected}
|
||||||
onSortPress={this.onSortPress}
|
onSortPress={this.onSortPress}
|
||||||
onTableOptionChange={this.onTableOptionChange}
|
onTableOptionChange={this.onTableOptionChange}
|
||||||
onClearBlacklistPress={this.onClearBlacklistPress}
|
onClearBlocklistPress={this.onClearBlocklistPress}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BlacklistConnector.propTypes = {
|
BlocklistConnector.propTypes = {
|
||||||
useCurrentPage: PropTypes.bool.isRequired,
|
useCurrentPage: PropTypes.bool.isRequired,
|
||||||
isClearingBlacklistExecuting: PropTypes.bool.isRequired,
|
isClearingBlocklistExecuting: PropTypes.bool.isRequired,
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
fetchBlacklist: PropTypes.func.isRequired,
|
fetchBlocklist: PropTypes.func.isRequired,
|
||||||
gotoBlacklistFirstPage: PropTypes.func.isRequired,
|
gotoBlocklistFirstPage: PropTypes.func.isRequired,
|
||||||
gotoBlacklistPreviousPage: PropTypes.func.isRequired,
|
gotoBlocklistPreviousPage: PropTypes.func.isRequired,
|
||||||
gotoBlacklistNextPage: PropTypes.func.isRequired,
|
gotoBlocklistNextPage: PropTypes.func.isRequired,
|
||||||
gotoBlacklistLastPage: PropTypes.func.isRequired,
|
gotoBlocklistLastPage: PropTypes.func.isRequired,
|
||||||
gotoBlacklistPage: PropTypes.func.isRequired,
|
gotoBlocklistPage: PropTypes.func.isRequired,
|
||||||
removeBlacklistItems: PropTypes.func.isRequired,
|
removeBlocklistItems: PropTypes.func.isRequired,
|
||||||
setBlacklistSort: PropTypes.func.isRequired,
|
setBlocklistSort: PropTypes.func.isRequired,
|
||||||
setBlacklistTableOption: PropTypes.func.isRequired,
|
setBlocklistTableOption: PropTypes.func.isRequired,
|
||||||
clearBlacklist: PropTypes.func.isRequired,
|
clearBlocklist: PropTypes.func.isRequired,
|
||||||
executeCommand: PropTypes.func.isRequired
|
executeCommand: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withCurrentPage(
|
export default withCurrentPage(
|
||||||
connect(createMapStateToProps, mapDispatchToProps)(BlacklistConnector)
|
connect(createMapStateToProps, mapDispatchToProps)(BlocklistConnector)
|
||||||
);
|
);
|
|
@ -9,7 +9,7 @@ import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
import ModalBody from 'Components/Modal/ModalBody';
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
|
||||||
class BlacklistDetailsModal extends Component {
|
class BlocklistDetailsModal extends Component {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render
|
// Render
|
||||||
|
@ -77,7 +77,7 @@ class BlacklistDetailsModal extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BlacklistDetailsModal.propTypes = {
|
BlocklistDetailsModal.propTypes = {
|
||||||
isOpen: PropTypes.bool.isRequired,
|
isOpen: PropTypes.bool.isRequired,
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
sourceTitle: PropTypes.string.isRequired,
|
||||||
protocol: PropTypes.string.isRequired,
|
protocol: PropTypes.string.isRequired,
|
||||||
|
@ -86,4 +86,4 @@ BlacklistDetailsModal.propTypes = {
|
||||||
onModalClose: PropTypes.func.isRequired
|
onModalClose: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BlacklistDetailsModal;
|
export default BlocklistDetailsModal;
|
|
@ -9,10 +9,10 @@ import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
import EpisodeLanguage from 'Episode/EpisodeLanguage';
|
import EpisodeLanguage from 'Episode/EpisodeLanguage';
|
||||||
import EpisodeQuality from 'Episode/EpisodeQuality';
|
import EpisodeQuality from 'Episode/EpisodeQuality';
|
||||||
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
||||||
import BlacklistDetailsModal from './BlacklistDetailsModal';
|
import BlocklistDetailsModal from './BlocklistDetailsModal';
|
||||||
import styles from './BlacklistRow.css';
|
import styles from './BlocklistRow.css';
|
||||||
|
|
||||||
class BlacklistRow extends Component {
|
class BlocklistRow extends Component {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
|
@ -152,7 +152,7 @@ class BlacklistRow extends Component {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
title="Remove from blacklist"
|
title="Remove from blocklist"
|
||||||
name={icons.REMOVE}
|
name={icons.REMOVE}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
onPress={onRemovePress}
|
onPress={onRemovePress}
|
||||||
|
@ -165,7 +165,7 @@ class BlacklistRow extends Component {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
<BlacklistDetailsModal
|
<BlocklistDetailsModal
|
||||||
isOpen={this.state.isDetailsModalOpen}
|
isOpen={this.state.isDetailsModalOpen}
|
||||||
sourceTitle={sourceTitle}
|
sourceTitle={sourceTitle}
|
||||||
protocol={protocol}
|
protocol={protocol}
|
||||||
|
@ -179,7 +179,7 @@ class BlacklistRow extends Component {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlacklistRow.propTypes = {
|
BlocklistRow.propTypes = {
|
||||||
id: PropTypes.number.isRequired,
|
id: PropTypes.number.isRequired,
|
||||||
series: PropTypes.object.isRequired,
|
series: PropTypes.object.isRequired,
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
sourceTitle: PropTypes.string.isRequired,
|
||||||
|
@ -195,4 +195,4 @@ BlacklistRow.propTypes = {
|
||||||
onRemovePress: PropTypes.func.isRequired
|
onRemovePress: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BlacklistRow;
|
export default BlocklistRow;
|
|
@ -1,8 +1,8 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { removeBlacklistItem } from 'Store/Actions/blacklistActions';
|
import { removeBlocklistItem } from 'Store/Actions/blocklistActions';
|
||||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
||||||
import BlacklistRow from './BlacklistRow';
|
import BlocklistRow from './BlocklistRow';
|
||||||
|
|
||||||
function createMapStateToProps() {
|
function createMapStateToProps() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
|
@ -18,9 +18,9 @@ function createMapStateToProps() {
|
||||||
function createMapDispatchToProps(dispatch, props) {
|
function createMapDispatchToProps(dispatch, props) {
|
||||||
return {
|
return {
|
||||||
onRemovePress() {
|
onRemovePress() {
|
||||||
dispatch(removeBlacklistItem({ id: props.id }));
|
dispatch(removeBlocklistItem({ id: props.id }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(createMapStateToProps, createMapDispatchToProps)(BlacklistRow);
|
export default connect(createMapStateToProps, createMapDispatchToProps)(BlocklistRow);
|
|
@ -42,14 +42,14 @@ class QueueRow extends Component {
|
||||||
this.setState({ isRemoveQueueItemModalOpen: true });
|
this.setState({ isRemoveQueueItemModalOpen: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
onRemoveQueueItemModalConfirmed = (blacklist) => {
|
onRemoveQueueItemModalConfirmed = (blocklist) => {
|
||||||
const {
|
const {
|
||||||
onRemoveQueueItemPress,
|
onRemoveQueueItemPress,
|
||||||
onQueueRowModalOpenOrClose
|
onQueueRowModalOpenOrClose
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
onQueueRowModalOpenOrClose(false);
|
onQueueRowModalOpenOrClose(false);
|
||||||
onRemoveQueueItemPress(blacklist);
|
onRemoveQueueItemPress(blocklist);
|
||||||
|
|
||||||
this.setState({ isRemoveQueueItemModalOpen: false });
|
this.setState({ isRemoveQueueItemModalOpen: false });
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class RemoveQueueItemModal extends Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
remove: true,
|
remove: true,
|
||||||
blacklist: false
|
blocklist: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class RemoveQueueItemModal extends Component {
|
||||||
resetState = function() {
|
resetState = function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
remove: true,
|
remove: true,
|
||||||
blacklist: false
|
blocklist: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ class RemoveQueueItemModal extends Component {
|
||||||
this.setState({ remove: value });
|
this.setState({ remove: value });
|
||||||
}
|
}
|
||||||
|
|
||||||
onBlacklistChange = ({ value }) => {
|
onBlocklistChange = ({ value }) => {
|
||||||
this.setState({ blacklist: value });
|
this.setState({ blocklist: value });
|
||||||
}
|
}
|
||||||
|
|
||||||
onRemoveConfirmed = () => {
|
onRemoveConfirmed = () => {
|
||||||
|
@ -68,7 +68,7 @@ class RemoveQueueItemModal extends Component {
|
||||||
canIgnore
|
canIgnore
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { remove, blacklist } = this.state;
|
const { remove, blocklist } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -102,14 +102,14 @@ class RemoveQueueItemModal extends Component {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>Blacklist Release</FormLabel>
|
<FormLabel>Add Release To Blocklist</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="blacklist"
|
name="blocklist"
|
||||||
value={blacklist}
|
value={blocklist}
|
||||||
helpText="Starts a search for this episode again and prevents this release from being grabbed again"
|
helpText="Starts a search for this episode again and prevents this release from being grabbed again"
|
||||||
onChange={this.onBlacklistChange}
|
onChange={this.onBlocklistChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class RemoveQueueItemsModal extends Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
remove: true,
|
remove: true,
|
||||||
blacklist: false
|
blocklist: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class RemoveQueueItemsModal extends Component {
|
||||||
resetState = function() {
|
resetState = function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
remove: true,
|
remove: true,
|
||||||
blacklist: false
|
blocklist: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ class RemoveQueueItemsModal extends Component {
|
||||||
this.setState({ remove: value });
|
this.setState({ remove: value });
|
||||||
}
|
}
|
||||||
|
|
||||||
onBlacklistChange = ({ value }) => {
|
onBlocklistChange = ({ value }) => {
|
||||||
this.setState({ blacklist: value });
|
this.setState({ blocklist: value });
|
||||||
}
|
}
|
||||||
|
|
||||||
onRemoveConfirmed = () => {
|
onRemoveConfirmed = () => {
|
||||||
|
@ -69,7 +69,7 @@ class RemoveQueueItemsModal extends Component {
|
||||||
canIgnore
|
canIgnore
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { remove, blacklist } = this.state;
|
const { remove, blocklist } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -104,15 +104,15 @@ class RemoveQueueItemsModal extends Component {
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>
|
<FormLabel>
|
||||||
Blacklist Release{selectedCount > 1 ? 's' : ''}
|
Add Release{selectedCount > 1 ? 's' : ''} To Blocklist
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="blacklist"
|
name="blocklist"
|
||||||
value={blacklist}
|
value={blocklist}
|
||||||
helpText="Prevents Sonarr from automatically grabbing this episode again"
|
helpText="Prevents Sonarr from automatically grabbing this episode again"
|
||||||
onChange={this.onBlacklistChange}
|
onChange={this.onBlocklistChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import SeriesDetailsPageConnector from 'Series/Details/SeriesDetailsPageConnecto
|
||||||
import CalendarPageConnector from 'Calendar/CalendarPageConnector';
|
import CalendarPageConnector from 'Calendar/CalendarPageConnector';
|
||||||
import HistoryConnector from 'Activity/History/HistoryConnector';
|
import HistoryConnector from 'Activity/History/HistoryConnector';
|
||||||
import QueueConnector from 'Activity/Queue/QueueConnector';
|
import QueueConnector from 'Activity/Queue/QueueConnector';
|
||||||
import BlacklistConnector from 'Activity/Blacklist/BlacklistConnector';
|
import BlocklistConnector from 'Activity/Blocklist/BlocklistConnector';
|
||||||
import MissingConnector from 'Wanted/Missing/MissingConnector';
|
import MissingConnector from 'Wanted/Missing/MissingConnector';
|
||||||
import CutoffUnmetConnector from 'Wanted/CutoffUnmet/CutoffUnmetConnector';
|
import CutoffUnmetConnector from 'Wanted/CutoffUnmet/CutoffUnmetConnector';
|
||||||
import Settings from 'Settings/Settings';
|
import Settings from 'Settings/Settings';
|
||||||
|
@ -118,8 +118,8 @@ function AppRoutes(props) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/activity/blacklist"
|
path="/activity/blocklist"
|
||||||
component={BlacklistConnector}
|
component={BlocklistConnector}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/*
|
{/*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export const APPLICATION_UPDATE = 'ApplicationUpdate';
|
export const APPLICATION_UPDATE = 'ApplicationUpdate';
|
||||||
export const BACKUP = 'Backup';
|
export const BACKUP = 'Backup';
|
||||||
export const REFRESH_MONITORED_DOWNLOADS = 'RefreshMonitoredDownloads';
|
export const REFRESH_MONITORED_DOWNLOADS = 'RefreshMonitoredDownloads';
|
||||||
export const CLEAR_BLACKLIST = 'ClearBlacklist';
|
export const CLEAR_BLOCKLIST = 'ClearBlocklist';
|
||||||
export const CLEAR_LOGS = 'ClearLog';
|
export const CLEAR_LOGS = 'ClearLog';
|
||||||
export const CUTOFF_UNMET_EPISODE_SEARCH = 'CutoffUnmetEpisodeSearch';
|
export const CUTOFF_UNMET_EPISODE_SEARCH = 'CutoffUnmetEpisodeSearch';
|
||||||
export const DELETE_LOG_FILES = 'DeleteLogFiles';
|
export const DELETE_LOG_FILES = 'DeleteLogFiles';
|
||||||
|
|
|
@ -64,8 +64,8 @@ const links = [
|
||||||
to: '/activity/history'
|
to: '/activity/history'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Blacklist',
|
title: 'Blocklist',
|
||||||
to: '/activity/blacklist'
|
to: '/activity/blocklist'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
REMOVE_ITEM
|
REMOVE_ITEM
|
||||||
} from 'Store/Actions/baseActions';
|
} from 'Store/Actions/baseActions';
|
||||||
|
|
||||||
const blacklistedProperties = [
|
const omittedProperties = [
|
||||||
'section',
|
'section',
|
||||||
'id'
|
'id'
|
||||||
];
|
];
|
||||||
|
@ -32,7 +32,7 @@ export default function createHandleActions(handlers, defaultState, section) {
|
||||||
|
|
||||||
if (section === baseSection) {
|
if (section === baseSection) {
|
||||||
const newState = Object.assign(getSectionState(state, payloadSection),
|
const newState = Object.assign(getSectionState(state, payloadSection),
|
||||||
_.omit(payload, blacklistedProperties));
|
_.omit(payload, omittedProperties));
|
||||||
|
|
||||||
return updateSectionState(state, payloadSection, newState);
|
return updateSectionState(state, payloadSection, newState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { set, updateItem } from './baseActions';
|
||||||
//
|
//
|
||||||
// Variables
|
// Variables
|
||||||
|
|
||||||
export const section = 'blacklist';
|
export const section = 'blocklist';
|
||||||
|
|
||||||
//
|
//
|
||||||
// State
|
// State
|
||||||
|
@ -74,41 +74,41 @@ export const defaultState = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const persistState = [
|
export const persistState = [
|
||||||
'blacklist.pageSize',
|
'blocklist.pageSize',
|
||||||
'blacklist.sortKey',
|
'blocklist.sortKey',
|
||||||
'blacklist.sortDirection',
|
'blocklist.sortDirection',
|
||||||
'blacklist.columns'
|
'blocklist.columns'
|
||||||
];
|
];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Action Types
|
// Action Types
|
||||||
|
|
||||||
export const FETCH_BLACKLIST = 'blacklist/fetchBlacklist';
|
export const FETCH_BLOCKLIST = 'blocklist/fetchBlocklist';
|
||||||
export const GOTO_FIRST_BLACKLIST_PAGE = 'blacklist/gotoBlacklistFirstPage';
|
export const GOTO_FIRST_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistFirstPage';
|
||||||
export const GOTO_PREVIOUS_BLACKLIST_PAGE = 'blacklist/gotoBlacklistPreviousPage';
|
export const GOTO_PREVIOUS_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistPreviousPage';
|
||||||
export const GOTO_NEXT_BLACKLIST_PAGE = 'blacklist/gotoBlacklistNextPage';
|
export const GOTO_NEXT_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistNextPage';
|
||||||
export const GOTO_LAST_BLACKLIST_PAGE = 'blacklist/gotoBlacklistLastPage';
|
export const GOTO_LAST_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistLastPage';
|
||||||
export const GOTO_BLACKLIST_PAGE = 'blacklist/gotoBlacklistPage';
|
export const GOTO_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistPage';
|
||||||
export const SET_BLACKLIST_SORT = 'blacklist/setBlacklistSort';
|
export const SET_BLOCKLIST_SORT = 'blocklist/setBlocklistSort';
|
||||||
export const SET_BLACKLIST_TABLE_OPTION = 'blacklist/setBlacklistTableOption';
|
export const SET_BLOCKLIST_TABLE_OPTION = 'blocklist/setBlocklistTableOption';
|
||||||
export const REMOVE_BLACKLIST_ITEM = 'blacklist/removeBlacklistItem';
|
export const REMOVE_BLOCKLIST_ITEM = 'blocklist/removeBlocklistItem';
|
||||||
export const REMOVE_BLACKLIST_ITEMS = 'blacklist/removeBlacklistItems';
|
export const REMOVE_BLOCKLIST_ITEMS = 'blocklist/removeBlocklistItems';
|
||||||
export const CLEAR_BLACKLIST = 'blacklist/clearBlacklist';
|
export const CLEAR_BLOCKLIST = 'blocklist/clearBlocklist';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Action Creators
|
// Action Creators
|
||||||
|
|
||||||
export const fetchBlacklist = createThunk(FETCH_BLACKLIST);
|
export const fetchBlocklist = createThunk(FETCH_BLOCKLIST);
|
||||||
export const gotoBlacklistFirstPage = createThunk(GOTO_FIRST_BLACKLIST_PAGE);
|
export const gotoBlocklistFirstPage = createThunk(GOTO_FIRST_BLOCKLIST_PAGE);
|
||||||
export const gotoBlacklistPreviousPage = createThunk(GOTO_PREVIOUS_BLACKLIST_PAGE);
|
export const gotoBlocklistPreviousPage = createThunk(GOTO_PREVIOUS_BLOCKLIST_PAGE);
|
||||||
export const gotoBlacklistNextPage = createThunk(GOTO_NEXT_BLACKLIST_PAGE);
|
export const gotoBlocklistNextPage = createThunk(GOTO_NEXT_BLOCKLIST_PAGE);
|
||||||
export const gotoBlacklistLastPage = createThunk(GOTO_LAST_BLACKLIST_PAGE);
|
export const gotoBlocklistLastPage = createThunk(GOTO_LAST_BLOCKLIST_PAGE);
|
||||||
export const gotoBlacklistPage = createThunk(GOTO_BLACKLIST_PAGE);
|
export const gotoBlocklistPage = createThunk(GOTO_BLOCKLIST_PAGE);
|
||||||
export const setBlacklistSort = createThunk(SET_BLACKLIST_SORT);
|
export const setBlocklistSort = createThunk(SET_BLOCKLIST_SORT);
|
||||||
export const setBlacklistTableOption = createAction(SET_BLACKLIST_TABLE_OPTION);
|
export const setBlocklistTableOption = createAction(SET_BLOCKLIST_TABLE_OPTION);
|
||||||
export const removeBlacklistItem = createThunk(REMOVE_BLACKLIST_ITEM);
|
export const removeBlocklistItem = createThunk(REMOVE_BLOCKLIST_ITEM);
|
||||||
export const removeBlacklistItems = createThunk(REMOVE_BLACKLIST_ITEMS);
|
export const removeBlocklistItems = createThunk(REMOVE_BLOCKLIST_ITEMS);
|
||||||
export const clearBlacklist = createAction(CLEAR_BLACKLIST);
|
export const clearBlocklist = createAction(CLEAR_BLOCKLIST);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Action Handlers
|
// Action Handlers
|
||||||
|
@ -116,21 +116,21 @@ export const clearBlacklist = createAction(CLEAR_BLACKLIST);
|
||||||
export const actionHandlers = handleThunks({
|
export const actionHandlers = handleThunks({
|
||||||
...createServerSideCollectionHandlers(
|
...createServerSideCollectionHandlers(
|
||||||
section,
|
section,
|
||||||
'/blacklist',
|
'/blocklist',
|
||||||
fetchBlacklist,
|
fetchBlocklist,
|
||||||
{
|
{
|
||||||
[serverSideCollectionHandlers.FETCH]: FETCH_BLACKLIST,
|
[serverSideCollectionHandlers.FETCH]: FETCH_BLOCKLIST,
|
||||||
[serverSideCollectionHandlers.FIRST_PAGE]: GOTO_FIRST_BLACKLIST_PAGE,
|
[serverSideCollectionHandlers.FIRST_PAGE]: GOTO_FIRST_BLOCKLIST_PAGE,
|
||||||
[serverSideCollectionHandlers.PREVIOUS_PAGE]: GOTO_PREVIOUS_BLACKLIST_PAGE,
|
[serverSideCollectionHandlers.PREVIOUS_PAGE]: GOTO_PREVIOUS_BLOCKLIST_PAGE,
|
||||||
[serverSideCollectionHandlers.NEXT_PAGE]: GOTO_NEXT_BLACKLIST_PAGE,
|
[serverSideCollectionHandlers.NEXT_PAGE]: GOTO_NEXT_BLOCKLIST_PAGE,
|
||||||
[serverSideCollectionHandlers.LAST_PAGE]: GOTO_LAST_BLACKLIST_PAGE,
|
[serverSideCollectionHandlers.LAST_PAGE]: GOTO_LAST_BLOCKLIST_PAGE,
|
||||||
[serverSideCollectionHandlers.EXACT_PAGE]: GOTO_BLACKLIST_PAGE,
|
[serverSideCollectionHandlers.EXACT_PAGE]: GOTO_BLOCKLIST_PAGE,
|
||||||
[serverSideCollectionHandlers.SORT]: SET_BLACKLIST_SORT
|
[serverSideCollectionHandlers.SORT]: SET_BLOCKLIST_SORT
|
||||||
}),
|
}),
|
||||||
|
|
||||||
[REMOVE_BLACKLIST_ITEM]: createRemoveItemHandler(section, '/blacklist'),
|
[REMOVE_BLOCKLIST_ITEM]: createRemoveItemHandler(section, '/blocklist'),
|
||||||
|
|
||||||
[REMOVE_BLACKLIST_ITEMS]: function(getState, payload, dispatch) {
|
[REMOVE_BLOCKLIST_ITEMS]: function(getState, payload, dispatch) {
|
||||||
const {
|
const {
|
||||||
ids
|
ids
|
||||||
} = payload;
|
} = payload;
|
||||||
|
@ -148,7 +148,7 @@ export const actionHandlers = handleThunks({
|
||||||
]));
|
]));
|
||||||
|
|
||||||
const promise = createAjaxRequest({
|
const promise = createAjaxRequest({
|
||||||
url: '/blacklist/bulk',
|
url: '/blocklist/bulk',
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: JSON.stringify({ ids })
|
data: JSON.stringify({ ids })
|
||||||
|
@ -156,7 +156,7 @@ export const actionHandlers = handleThunks({
|
||||||
|
|
||||||
promise.done((data) => {
|
promise.done((data) => {
|
||||||
// Don't use batchActions with thunks
|
// Don't use batchActions with thunks
|
||||||
dispatch(fetchBlacklist());
|
dispatch(fetchBlocklist());
|
||||||
|
|
||||||
dispatch(set({ section, isRemoving: false }));
|
dispatch(set({ section, isRemoving: false }));
|
||||||
});
|
});
|
||||||
|
@ -182,9 +182,9 @@ export const actionHandlers = handleThunks({
|
||||||
|
|
||||||
export const reducers = createHandleActions({
|
export const reducers = createHandleActions({
|
||||||
|
|
||||||
[SET_BLACKLIST_TABLE_OPTION]: createSetTableOptionReducer(section),
|
[SET_BLOCKLIST_TABLE_OPTION]: createSetTableOptionReducer(section),
|
||||||
|
|
||||||
[CLEAR_BLACKLIST]: createClearReducer(section, {
|
[CLEAR_BLOCKLIST]: createClearReducer(section, {
|
||||||
isFetching: false,
|
isFetching: false,
|
||||||
isPopulated: false,
|
isPopulated: false,
|
||||||
error: null,
|
error: null,
|
|
@ -1,6 +1,6 @@
|
||||||
import * as addSeries from './addSeriesActions';
|
import * as addSeries from './addSeriesActions';
|
||||||
import * as app from './appActions';
|
import * as app from './appActions';
|
||||||
import * as blacklist from './blacklistActions';
|
import * as blocklist from './blocklistActions';
|
||||||
import * as calendar from './calendarActions';
|
import * as calendar from './calendarActions';
|
||||||
import * as captcha from './captchaActions';
|
import * as captcha from './captchaActions';
|
||||||
import * as customFilters from './customFilterActions';
|
import * as customFilters from './customFilterActions';
|
||||||
|
@ -31,7 +31,7 @@ import * as wanted from './wantedActions';
|
||||||
export default [
|
export default [
|
||||||
addSeries,
|
addSeries,
|
||||||
app,
|
app,
|
||||||
blacklist,
|
blocklist,
|
||||||
calendar,
|
calendar,
|
||||||
captcha,
|
captcha,
|
||||||
commands,
|
commands,
|
||||||
|
|
|
@ -364,13 +364,13 @@ export const actionHandlers = handleThunks({
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
remove,
|
remove,
|
||||||
blacklist
|
blocklist
|
||||||
} = payload;
|
} = payload;
|
||||||
|
|
||||||
dispatch(updateItem({ section: paged, id, isRemoving: true }));
|
dispatch(updateItem({ section: paged, id, isRemoving: true }));
|
||||||
|
|
||||||
const promise = createAjaxRequest({
|
const promise = createAjaxRequest({
|
||||||
url: `/queue/${id}?removeFromClient=${remove}&blacklist=${blacklist}`,
|
url: `/queue/${id}?removeFromClient=${remove}&blocklist=${blocklist}`,
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
}).request;
|
}).request;
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ export const actionHandlers = handleThunks({
|
||||||
const {
|
const {
|
||||||
ids,
|
ids,
|
||||||
remove,
|
remove,
|
||||||
blacklist
|
blocklist
|
||||||
} = payload;
|
} = payload;
|
||||||
|
|
||||||
dispatch(batchActions([
|
dispatch(batchActions([
|
||||||
|
@ -403,7 +403,7 @@ export const actionHandlers = handleThunks({
|
||||||
]));
|
]));
|
||||||
|
|
||||||
const promise = createAjaxRequest({
|
const promise = createAjaxRequest({
|
||||||
url: `/queue/bulk?removeFromClient=${remove}&blacklist=${blacklist}`,
|
url: `/queue/bulk?removeFromClient=${remove}&blocklist=${blocklist}`,
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: JSON.stringify({ ids })
|
data: JSON.stringify({ ids })
|
||||||
|
|
|
@ -1,30 +1,32 @@
|
||||||
using NzbDrone.Core.Blacklisting;
|
// Blacklist has been deprecated for blocklist.
|
||||||
|
using NzbDrone.Api.Blocklist;
|
||||||
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using Sonarr.Http;
|
using Sonarr.Http;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Blacklist
|
namespace NzbDrone.Api.Blacklist
|
||||||
{
|
{
|
||||||
public class BlacklistModule : SonarrRestModule<BlacklistResource>
|
public class BlacklistModule : SonarrRestModule<BlocklistResource>
|
||||||
{
|
{
|
||||||
private readonly IBlacklistService _blacklistService;
|
private readonly BlocklistService _blocklistService;
|
||||||
|
|
||||||
public BlacklistModule(IBlacklistService blacklistService)
|
public BlacklistModule(BlocklistService blocklistService)
|
||||||
{
|
{
|
||||||
_blacklistService = blacklistService;
|
_blocklistService = blocklistService;
|
||||||
GetResourcePaged = GetBlacklist;
|
GetResourcePaged = Blocklist;
|
||||||
DeleteResource = DeleteBlacklist;
|
DeleteResource = DeleteBlockList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PagingResource<BlacklistResource> GetBlacklist(PagingResource<BlacklistResource> pagingResource)
|
private PagingResource<BlocklistResource> Blocklist(PagingResource<BlocklistResource> pagingResource)
|
||||||
{
|
{
|
||||||
var pagingSpec = pagingResource.MapToPagingSpec<BlacklistResource, Core.Blacklisting.Blacklist>("id", SortDirection.Ascending);
|
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, Core.Blocklisting.Blocklist>("id", SortDirection.Ascending);
|
||||||
|
|
||||||
return ApplyToPage(_blacklistService.Paged, pagingSpec, BlacklistResourceMapper.MapToResource);
|
return ApplyToPage(_blocklistService.Paged, pagingSpec, BlocklistResourceMapper.MapToResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteBlacklist(int id)
|
private void DeleteBlockList(int id)
|
||||||
{
|
{
|
||||||
_blacklistService.Delete(id);
|
_blocklistService.Delete(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
using NzbDrone.Core.Blocklisting;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
using Sonarr.Http;
|
||||||
|
|
||||||
|
namespace NzbDrone.Api.Blocklist
|
||||||
|
{
|
||||||
|
public class BlocklistModule : SonarrRestModule<BlocklistResource>
|
||||||
|
{
|
||||||
|
private readonly BlocklistService _blocklistService;
|
||||||
|
|
||||||
|
public BlocklistModule(BlocklistService blocklistService)
|
||||||
|
{
|
||||||
|
_blocklistService = blocklistService;
|
||||||
|
GetResourcePaged = Blocklist;
|
||||||
|
DeleteResource = DeleteBlockList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PagingResource<BlocklistResource> Blocklist(PagingResource<BlocklistResource> pagingResource)
|
||||||
|
{
|
||||||
|
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, Core.Blocklisting.Blocklist>("id", SortDirection.Ascending);
|
||||||
|
|
||||||
|
return ApplyToPage(_blocklistService.Paged, pagingSpec, BlocklistResourceMapper.MapToResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteBlockList(int id)
|
||||||
|
{
|
||||||
|
_blocklistService.Delete(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,9 +6,9 @@ using NzbDrone.Api.Series;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Blacklist
|
namespace NzbDrone.Api.Blocklist
|
||||||
{
|
{
|
||||||
public class BlacklistResource : RestResource
|
public class BlocklistResource : RestResource
|
||||||
{
|
{
|
||||||
public int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
public List<int> EpisodeIds { get; set; }
|
public List<int> EpisodeIds { get; set; }
|
||||||
|
@ -23,13 +23,13 @@ namespace NzbDrone.Api.Blacklist
|
||||||
public SeriesResource Series { get; set; }
|
public SeriesResource Series { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BlacklistResourceMapper
|
public static class BlocklistResourceMapper
|
||||||
{
|
{
|
||||||
public static BlacklistResource MapToResource(this Core.Blacklisting.Blacklist model)
|
public static BlocklistResource MapToResource(this Core.Blocklisting.Blocklist model)
|
||||||
{
|
{
|
||||||
if (model == null) return null;
|
if (model == null) return null;
|
||||||
|
|
||||||
return new BlacklistResource
|
return new BlocklistResource
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
|
|
|
@ -43,12 +43,19 @@ namespace NzbDrone.Api.Queue
|
||||||
|
|
||||||
private object Remove(int id)
|
private object Remove(int id)
|
||||||
{
|
{
|
||||||
var blacklist = false;
|
var blocklist = false;
|
||||||
|
var blocklistQuery = Request.Query.blocklist;
|
||||||
|
|
||||||
|
// blacklist maintained for backwards compatability, UI uses blocklist.
|
||||||
var blacklistQuery = Request.Query.blacklist;
|
var blacklistQuery = Request.Query.blacklist;
|
||||||
|
|
||||||
if (blacklistQuery.HasValue)
|
if (blocklistQuery.HasValue)
|
||||||
{
|
{
|
||||||
blacklist = Convert.ToBoolean(blacklistQuery.Value);
|
blocklist = Convert.ToBoolean(blocklistQuery.Value);
|
||||||
|
}
|
||||||
|
else if (blacklistQuery.HasValue)
|
||||||
|
{
|
||||||
|
blocklist = Convert.ToBoolean(blacklistQuery.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pendingRelease = _pendingReleaseService.FindPendingQueueItem(id);
|
var pendingRelease = _pendingReleaseService.FindPendingQueueItem(id);
|
||||||
|
@ -76,7 +83,7 @@ namespace NzbDrone.Api.Queue
|
||||||
|
|
||||||
downloadClient.RemoveItem(trackedDownload.DownloadItem, true);
|
downloadClient.RemoveItem(trackedDownload.DownloadItem, true);
|
||||||
|
|
||||||
if (blacklist)
|
if (blocklist)
|
||||||
{
|
{
|
||||||
_failedDownloadService.MarkAsFailed(trackedDownload.DownloadItem.DownloadId);
|
_failedDownloadService.MarkAsFailed(trackedDownload.DownloadItem.DownloadId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace NzbDrone.Automation.Test
|
||||||
|
|
||||||
page.Find(By.LinkText("Queue")).Should().NotBeNull();
|
page.Find(By.LinkText("Queue")).Should().NotBeNull();
|
||||||
page.Find(By.LinkText("History")).Should().NotBeNull();
|
page.Find(By.LinkText("History")).Should().NotBeNull();
|
||||||
page.Find(By.LinkText("Blacklist")).Should().NotBeNull();
|
page.Find(By.LinkText("Blocklist")).Should().NotBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -77,4 +77,4 @@ namespace NzbDrone.Automation.Test
|
||||||
page.Find(By.CssSelector("input[class*='AddNewSeries/searchInput']")).Should().NotBeNull();
|
page.Find(By.CssSelector("input[class*='AddNewSeries/searchInput']")).Should().NotBeNull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,21 +3,21 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Blacklisting;
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Blacklisting
|
namespace NzbDrone.Core.Test.Blocklisting
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class BlacklistRepositoryFixture : DbTest<BlacklistRepository, Blacklist>
|
public class BlocklistRepositoryFixture : DbTest<BlocklistRepository, Blocklist>
|
||||||
{
|
{
|
||||||
private Blacklist _blacklist;
|
private Blocklist _blocklist;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_blacklist = new Blacklist
|
_blocklist = new Blocklist
|
||||||
{
|
{
|
||||||
SeriesId = 12345,
|
SeriesId = 12345,
|
||||||
EpisodeIds = new List<int> { 1 },
|
EpisodeIds = new List<int> { 1 },
|
||||||
|
@ -30,24 +30,24 @@ namespace NzbDrone.Core.Test.Blacklisting
|
||||||
[Test]
|
[Test]
|
||||||
public void should_be_able_to_write_to_database()
|
public void should_be_able_to_write_to_database()
|
||||||
{
|
{
|
||||||
Subject.Insert(_blacklist);
|
Subject.Insert(_blocklist);
|
||||||
Subject.All().Should().HaveCount(1);
|
Subject.All().Should().HaveCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_should_have_episode_ids()
|
public void should_should_have_episode_ids()
|
||||||
{
|
{
|
||||||
Subject.Insert(_blacklist);
|
Subject.Insert(_blocklist);
|
||||||
|
|
||||||
Subject.All().First().EpisodeIds.Should().Contain(_blacklist.EpisodeIds);
|
Subject.All().First().EpisodeIds.Should().Contain(_blocklist.EpisodeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_check_for_blacklisted_title_case_insensative()
|
public void should_check_for_blocklisted_title_case_insensative()
|
||||||
{
|
{
|
||||||
Subject.Insert(_blacklist);
|
Subject.Insert(_blocklist);
|
||||||
|
|
||||||
Subject.BlacklistedByTitle(_blacklist.SeriesId, _blacklist.SourceTitle.ToUpperInvariant()).Should().HaveCount(1);
|
Subject.BlocklistedByTitle(_blocklist.SeriesId, _blocklist.SourceTitle.ToUpperInvariant()).Should().HaveCount(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,15 +2,15 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Blacklisting;
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Blacklisting
|
namespace NzbDrone.Core.Test.Blocklisting
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class BlacklistServiceFixture : CoreTest<BlacklistService>
|
public class BlocklistServiceFixture : CoreTest<BlocklistService>
|
||||||
{
|
{
|
||||||
private DownloadFailedEvent _event;
|
private DownloadFailedEvent _event;
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ namespace NzbDrone.Core.Test.Blacklisting
|
||||||
{
|
{
|
||||||
Subject.Handle(_event);
|
Subject.Handle(_event);
|
||||||
|
|
||||||
Mocker.GetMock<IBlacklistRepository>()
|
Mocker.GetMock<IBlocklistRepository>()
|
||||||
.Verify(v => v.Insert(It.Is<Blacklist>(b => b.EpisodeIds == _event.EpisodeIds)), Times.Once());
|
.Verify(v => v.Insert(It.Is<Blocklist>(b => b.EpisodeIds == _event.EpisodeIds)), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -51,8 +51,8 @@ namespace NzbDrone.Core.Test.Blacklisting
|
||||||
_event.Data.Remove("size");
|
_event.Data.Remove("size");
|
||||||
_event.Data.Remove("protocol");
|
_event.Data.Remove("protocol");
|
||||||
|
|
||||||
Mocker.GetMock<IBlacklistRepository>()
|
Mocker.GetMock<IBlocklistRepository>()
|
||||||
.Verify(v => v.Insert(It.Is<Blacklist>(b => b.EpisodeIds == _event.EpisodeIds)), Times.Once());
|
.Verify(v => v.Insert(It.Is<Blocklist>(b => b.EpisodeIds == _event.EpisodeIds)), Times.Once());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Blacklisting;
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
@ -11,35 +11,35 @@ using System.Collections.Generic;
|
||||||
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class CleanupOrphanedBlacklistFixture : DbTest<CleanupOrphanedBlacklist, Blacklist>
|
public class CleanupOrphanedBlocklistFixture : DbTest<CleanupOrphanedBlocklist, Blocklist>
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void should_delete_orphaned_blacklist_items()
|
public void should_delete_orphaned_blocklist_items()
|
||||||
{
|
{
|
||||||
var blacklist = Builder<Blacklist>.CreateNew()
|
var blocklist = Builder<Blocklist>.CreateNew()
|
||||||
.With(h => h.EpisodeIds = new List<int>())
|
.With(h => h.EpisodeIds = new List<int>())
|
||||||
.With(h => h.Quality = new QualityModel())
|
.With(h => h.Quality = new QualityModel())
|
||||||
.BuildNew();
|
.BuildNew();
|
||||||
|
|
||||||
Db.Insert(blacklist);
|
Db.Insert(blocklist);
|
||||||
Subject.Clean();
|
Subject.Clean();
|
||||||
AllStoredModels.Should().BeEmpty();
|
AllStoredModels.Should().BeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_delete_unorphaned_blacklist_items()
|
public void should_not_delete_unorphaned_blocklist_items()
|
||||||
{
|
{
|
||||||
var series = Builder<Series>.CreateNew().BuildNew();
|
var series = Builder<Series>.CreateNew().BuildNew();
|
||||||
|
|
||||||
Db.Insert(series);
|
Db.Insert(series);
|
||||||
|
|
||||||
var blacklist = Builder<Blacklist>.CreateNew()
|
var blocklist = Builder<Blocklist>.CreateNew()
|
||||||
.With(h => h.EpisodeIds = new List<int>())
|
.With(h => h.EpisodeIds = new List<int>())
|
||||||
.With(h => h.Quality = new QualityModel())
|
.With(h => h.Quality = new QualityModel())
|
||||||
.With(b => b.SeriesId = series.Id)
|
.With(b => b.SeriesId = series.Id)
|
||||||
.BuildNew();
|
.BuildNew();
|
||||||
|
|
||||||
Db.Insert(blacklist);
|
Db.Insert(blocklist);
|
||||||
|
|
||||||
Subject.Clean();
|
Subject.Clean();
|
||||||
AllStoredModels.Should().HaveCount(1);
|
AllStoredModels.Should().HaveCount(1);
|
|
@ -6,9 +6,9 @@ using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Blacklisting
|
namespace NzbDrone.Core.Blocklisting
|
||||||
{
|
{
|
||||||
public class Blacklist : ModelBase
|
public class Blocklist : ModelBase
|
||||||
{
|
{
|
||||||
public int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
public Series Series { get; set; }
|
public Series Series { get; set; }
|
|
@ -4,42 +4,42 @@ using NzbDrone.Core.Messaging.Events;
|
||||||
using Marr.Data.QGen;
|
using Marr.Data.QGen;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Blacklisting
|
namespace NzbDrone.Core.Blocklisting
|
||||||
{
|
{
|
||||||
public interface IBlacklistRepository : IBasicRepository<Blacklist>
|
public interface IBlocklistRepository : IBasicRepository<Blocklist>
|
||||||
{
|
{
|
||||||
List<Blacklist> BlacklistedByTitle(int seriesId, string sourceTitle);
|
List<Blocklist> BlocklistedByTitle(int seriesId, string sourceTitle);
|
||||||
List<Blacklist> BlacklistedByTorrentInfoHash(int seriesId, string torrentInfoHash);
|
List<Blocklist> BlocklistedByTorrentInfoHash(int seriesId, string torrentInfoHash);
|
||||||
List<Blacklist> BlacklistedBySeries(int seriesId);
|
List<Blocklist> BlocklistedBySeries(int seriesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BlacklistRepository : BasicRepository<Blacklist>, IBlacklistRepository
|
public class BlocklistRepository : BasicRepository<Blocklist>, IBlocklistRepository
|
||||||
{
|
{
|
||||||
public BlacklistRepository(IMainDatabase database, IEventAggregator eventAggregator) :
|
public BlocklistRepository(IMainDatabase database, IEventAggregator eventAggregator) :
|
||||||
base(database, eventAggregator)
|
base(database, eventAggregator)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Blacklist> BlacklistedByTitle(int seriesId, string sourceTitle)
|
public List<Blocklist> BlocklistedByTitle(int seriesId, string sourceTitle)
|
||||||
{
|
{
|
||||||
return Query.Where(e => e.SeriesId == seriesId)
|
return Query.Where(e => e.SeriesId == seriesId)
|
||||||
.AndWhere(e => e.SourceTitle.Contains(sourceTitle));
|
.AndWhere(e => e.SourceTitle.Contains(sourceTitle));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Blacklist> BlacklistedByTorrentInfoHash(int seriesId, string torrentInfoHash)
|
public List<Blocklist> BlocklistedByTorrentInfoHash(int seriesId, string torrentInfoHash)
|
||||||
{
|
{
|
||||||
return Query.Where(e => e.SeriesId == seriesId)
|
return Query.Where(e => e.SeriesId == seriesId)
|
||||||
.AndWhere(e => e.TorrentInfoHash.Contains(torrentInfoHash));
|
.AndWhere(e => e.TorrentInfoHash.Contains(torrentInfoHash));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Blacklist> BlacklistedBySeries(int seriesId)
|
public List<Blocklist> BlocklistedBySeries(int seriesId)
|
||||||
{
|
{
|
||||||
return Query.Where(b => b.SeriesId == seriesId);
|
return Query.Where(b => b.SeriesId == seriesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SortBuilder<Blacklist> GetPagedQuery(QueryBuilder<Blacklist> query, PagingSpec<Blacklist> pagingSpec)
|
protected override SortBuilder<Blocklist> GetPagedQuery(QueryBuilder<Blocklist> query, PagingSpec<Blocklist> pagingSpec)
|
||||||
{
|
{
|
||||||
var baseQuery = query.Join<Blacklist, Series>(JoinType.Inner, h => h.Series, (h, s) => h.SeriesId == s.Id);
|
var baseQuery = query.Join<Blocklist, Series>(JoinType.Inner, h => h.Series, (h, s) => h.SeriesId == s.Id);
|
||||||
|
|
||||||
return base.GetPagedQuery(baseQuery, pagingSpec);
|
return base.GetPagedQuery(baseQuery, pagingSpec);
|
||||||
}
|
}
|
|
@ -10,31 +10,30 @@ using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Tv.Events;
|
using NzbDrone.Core.Tv.Events;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Blacklisting
|
namespace NzbDrone.Core.Blocklisting
|
||||||
{
|
{
|
||||||
public interface IBlacklistService
|
public interface IBlocklistService
|
||||||
{
|
{
|
||||||
bool Blacklisted(int seriesId, ReleaseInfo release);
|
bool Blocklisted(int seriesId, ReleaseInfo release);
|
||||||
PagingSpec<Blacklist> Paged(PagingSpec<Blacklist> pagingSpec);
|
PagingSpec<Blocklist> Paged(PagingSpec<Blocklist> pagingSpec);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
void Delete(List<int> ids);
|
void Delete(List<int> ids);
|
||||||
}
|
}
|
||||||
public class BlacklistService : IBlacklistService,
|
public class BlocklistService : IBlocklistService,
|
||||||
|
IExecute<ClearBlocklistCommand>,
|
||||||
IExecute<ClearBlacklistCommand>,
|
|
||||||
IHandle<DownloadFailedEvent>,
|
IHandle<DownloadFailedEvent>,
|
||||||
IHandleAsync<SeriesDeletedEvent>
|
IHandleAsync<SeriesDeletedEvent>
|
||||||
{
|
{
|
||||||
private readonly IBlacklistRepository _blacklistRepository;
|
private readonly IBlocklistRepository _blocklistRepository;
|
||||||
|
|
||||||
public BlacklistService(IBlacklistRepository blacklistRepository)
|
public BlocklistService(IBlocklistRepository blocklistRepository)
|
||||||
{
|
{
|
||||||
_blacklistRepository = blacklistRepository;
|
_blocklistRepository = blocklistRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Blacklisted(int seriesId, ReleaseInfo release)
|
public bool Blocklisted(int seriesId, ReleaseInfo release)
|
||||||
{
|
{
|
||||||
var blacklistedByTitle = _blacklistRepository.BlacklistedByTitle(seriesId, release.Title);
|
var blocklistedByTitle = _blocklistRepository.BlocklistedByTitle(seriesId, release.Title);
|
||||||
|
|
||||||
if (release.DownloadProtocol == DownloadProtocol.Torrent)
|
if (release.DownloadProtocol == DownloadProtocol.Torrent)
|
||||||
{
|
{
|
||||||
|
@ -44,35 +43,35 @@ namespace NzbDrone.Core.Blacklisting
|
||||||
|
|
||||||
if (torrentInfo.InfoHash.IsNullOrWhiteSpace())
|
if (torrentInfo.InfoHash.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
return blacklistedByTitle.Where(b => b.Protocol == DownloadProtocol.Torrent)
|
return blocklistedByTitle.Where(b => b.Protocol == DownloadProtocol.Torrent)
|
||||||
.Any(b => SameTorrent(b, torrentInfo));
|
.Any(b => SameTorrent(b, torrentInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
var blacklistedByTorrentInfohash = _blacklistRepository.BlacklistedByTorrentInfoHash(seriesId, torrentInfo.InfoHash);
|
var blocklistedByTorrentInfohash = _blocklistRepository.BlocklistedByTorrentInfoHash(seriesId, torrentInfo.InfoHash);
|
||||||
|
|
||||||
return blacklistedByTorrentInfohash.Any(b => SameTorrent(b, torrentInfo));
|
return blocklistedByTorrentInfohash.Any(b => SameTorrent(b, torrentInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
return blacklistedByTitle.Where(b => b.Protocol == DownloadProtocol.Usenet)
|
return blocklistedByTitle.Where(b => b.Protocol == DownloadProtocol.Usenet)
|
||||||
.Any(b => SameNzb(b, release));
|
.Any(b => SameNzb(b, release));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PagingSpec<Blacklist> Paged(PagingSpec<Blacklist> pagingSpec)
|
public PagingSpec<Blocklist> Paged(PagingSpec<Blocklist> pagingSpec)
|
||||||
{
|
{
|
||||||
return _blacklistRepository.GetPaged(pagingSpec);
|
return _blocklistRepository.GetPaged(pagingSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_blacklistRepository.Delete(id);
|
_blocklistRepository.Delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(List<int> ids)
|
public void Delete(List<int> ids)
|
||||||
{
|
{
|
||||||
_blacklistRepository.DeleteMany(ids);
|
_blocklistRepository.DeleteMany(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SameNzb(Blacklist item, ReleaseInfo release)
|
private bool SameNzb(Blocklist item, ReleaseInfo release)
|
||||||
{
|
{
|
||||||
if (item.PublishedDate == release.PublishDate)
|
if (item.PublishedDate == release.PublishDate)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +88,7 @@ namespace NzbDrone.Core.Blacklisting
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SameTorrent(Blacklist item, TorrentInfo release)
|
private bool SameTorrent(Blocklist item, TorrentInfo release)
|
||||||
{
|
{
|
||||||
if (release.InfoHash.IsNotNullOrWhiteSpace())
|
if (release.InfoHash.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
|
@ -99,7 +98,7 @@ namespace NzbDrone.Core.Blacklisting
|
||||||
return item.Indexer.Equals(release.Indexer, StringComparison.InvariantCultureIgnoreCase);
|
return item.Indexer.Equals(release.Indexer, StringComparison.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasSameIndexer(Blacklist item, string indexer)
|
private bool HasSameIndexer(Blocklist item, string indexer)
|
||||||
{
|
{
|
||||||
if (item.Indexer.IsNullOrWhiteSpace())
|
if (item.Indexer.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
|
@ -109,7 +108,7 @@ namespace NzbDrone.Core.Blacklisting
|
||||||
return item.Indexer.Equals(indexer, StringComparison.InvariantCultureIgnoreCase);
|
return item.Indexer.Equals(indexer, StringComparison.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasSamePublishedDate(Blacklist item, DateTime publishedDate)
|
private bool HasSamePublishedDate(Blocklist item, DateTime publishedDate)
|
||||||
{
|
{
|
||||||
if (!item.PublishedDate.HasValue) return true;
|
if (!item.PublishedDate.HasValue) return true;
|
||||||
|
|
||||||
|
@ -117,7 +116,7 @@ namespace NzbDrone.Core.Blacklisting
|
||||||
item.PublishedDate.Value.AddMinutes(2) >= publishedDate;
|
item.PublishedDate.Value.AddMinutes(2) >= publishedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasSameSize(Blacklist item, long size)
|
private bool HasSameSize(Blocklist item, long size)
|
||||||
{
|
{
|
||||||
if (!item.Size.HasValue) return true;
|
if (!item.Size.HasValue) return true;
|
||||||
|
|
||||||
|
@ -126,14 +125,14 @@ namespace NzbDrone.Core.Blacklisting
|
||||||
return difference <= 2.Megabytes();
|
return difference <= 2.Megabytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(ClearBlacklistCommand message)
|
public void Execute(ClearBlocklistCommand message)
|
||||||
{
|
{
|
||||||
_blacklistRepository.Purge();
|
_blocklistRepository.Purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Handle(DownloadFailedEvent message)
|
public void Handle(DownloadFailedEvent message)
|
||||||
{
|
{
|
||||||
var blacklist = new Blacklist
|
var blocklist = new Blocklist
|
||||||
{
|
{
|
||||||
SeriesId = message.SeriesId,
|
SeriesId = message.SeriesId,
|
||||||
EpisodeIds = message.EpisodeIds,
|
EpisodeIds = message.EpisodeIds,
|
||||||
|
@ -149,14 +148,14 @@ namespace NzbDrone.Core.Blacklisting
|
||||||
Language = message.Language
|
Language = message.Language
|
||||||
};
|
};
|
||||||
|
|
||||||
_blacklistRepository.Insert(blacklist);
|
_blocklistRepository.Insert(blocklist);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleAsync(SeriesDeletedEvent message)
|
public void HandleAsync(SeriesDeletedEvent message)
|
||||||
{
|
{
|
||||||
var blacklisted = _blacklistRepository.BlacklistedBySeries(message.Series.Id);
|
var blocklisted = _blocklistRepository.BlocklistedBySeries(message.Series.Id);
|
||||||
|
|
||||||
_blacklistRepository.DeleteMany(blacklisted);
|
_blocklistRepository.DeleteMany(blocklisted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
using NzbDrone.Core.Messaging.Commands;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Blacklisting
|
namespace NzbDrone.Core.Blocklisting
|
||||||
{
|
{
|
||||||
public class ClearBlacklistCommand : Command
|
public class ClearBlocklistCommand : Command
|
||||||
{
|
{
|
||||||
public override bool SendUpdatesToClient => true;
|
public override bool SendUpdatesToClient => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(160)]
|
||||||
|
public class rename_blacklist_to_blocklist : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Rename.Table("Blacklist").To("Blocklist");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using Marr.Data;
|
using Marr.Data;
|
||||||
using Marr.Data.Mapping;
|
using Marr.Data.Mapping;
|
||||||
using NzbDrone.Common.Reflection;
|
using NzbDrone.Common.Reflection;
|
||||||
using NzbDrone.Core.Blacklisting;
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.DataAugmentation.Scene;
|
using NzbDrone.Core.DataAugmentation.Scene;
|
||||||
using NzbDrone.Core.Datastore.Converters;
|
using NzbDrone.Core.Datastore.Converters;
|
||||||
|
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Datastore
|
||||||
Mapper.Entity<Log>().RegisterModel("Logs");
|
Mapper.Entity<Log>().RegisterModel("Logs");
|
||||||
Mapper.Entity<NamingConfig>().RegisterModel("NamingConfig");
|
Mapper.Entity<NamingConfig>().RegisterModel("NamingConfig");
|
||||||
Mapper.Entity<SeasonStatistics>().MapResultSet();
|
Mapper.Entity<SeasonStatistics>().MapResultSet();
|
||||||
Mapper.Entity<Blacklist>().RegisterModel("Blacklist");
|
Mapper.Entity<Blocklist>().RegisterModel("Blocklist");
|
||||||
Mapper.Entity<MetadataFile>().RegisterModel("MetadataFiles");
|
Mapper.Entity<MetadataFile>().RegisterModel("MetadataFiles");
|
||||||
Mapper.Entity<SubtitleFile>().RegisterModel("SubtitleFiles");
|
Mapper.Entity<SubtitleFile>().RegisterModel("SubtitleFiles");
|
||||||
Mapper.Entity<OtherExtraFile>().RegisterModel("ExtraFiles");
|
Mapper.Entity<OtherExtraFile>().RegisterModel("ExtraFiles");
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.Blacklisting;
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.DecisionEngine.Specifications
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||||
{
|
{
|
||||||
public class BlacklistSpecification : IDecisionEngineSpecification
|
public class BlocklistSpecification : IDecisionEngineSpecification
|
||||||
{
|
{
|
||||||
private readonly IBlacklistService _blacklistService;
|
private readonly IBlocklistService _blocklistService;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public BlacklistSpecification(IBlacklistService blacklistService, Logger logger)
|
public BlocklistSpecification(IBlocklistService blocklistService, Logger logger)
|
||||||
{
|
{
|
||||||
_blacklistService = blacklistService;
|
_blocklistService = blocklistService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||||
|
|
||||||
public Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
public Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
if (_blacklistService.Blacklisted(subject.Series.Id, subject.Release))
|
if (_blocklistService.Blocklisted(subject.Series.Id, subject.Release))
|
||||||
{
|
{
|
||||||
_logger.Debug("{0} is blacklisted, rejecting.", subject.Release.Title);
|
_logger.Debug("{0} is blocklisted, rejecting.", subject.Release.Title);
|
||||||
return Decision.Reject("Release is blacklisted");
|
return Decision.Reject("Release is blocklisted");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Decision.Accept();
|
return Decision.Accept();
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||||
{
|
{
|
||||||
public class CleanupOrphanedBlacklist : IHousekeepingTask
|
public class CleanupOrphanedBlocklist : IHousekeepingTask
|
||||||
{
|
{
|
||||||
private readonly IMainDatabase _database;
|
private readonly IMainDatabase _database;
|
||||||
|
|
||||||
public CleanupOrphanedBlacklist(IMainDatabase database)
|
public CleanupOrphanedBlocklist(IMainDatabase database)
|
||||||
{
|
{
|
||||||
_database = database;
|
_database = database;
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,11 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||||
{
|
{
|
||||||
var mapper = _database.GetDataMapper();
|
var mapper = _database.GetDataMapper();
|
||||||
|
|
||||||
mapper.ExecuteNonQuery(@"DELETE FROM Blacklist
|
mapper.ExecuteNonQuery(@"DELETE FROM Blocklist
|
||||||
WHERE Id IN (
|
WHERE Id IN (
|
||||||
SELECT Blacklist.Id FROM Blacklist
|
SELECT Blocklist.Id FROM Blocklist
|
||||||
LEFT OUTER JOIN Series
|
LEFT OUTER JOIN Series
|
||||||
ON Blacklist.SeriesId = Series.Id
|
ON Blocklist.SeriesId = Series.Id
|
||||||
WHERE Series.Id IS NULL)");
|
WHERE Series.Id IS NULL)");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,17 +5,17 @@ using NzbDrone.Api.Series;
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class BlacklistFixture : IntegrationTest
|
public class BlocklistFixture : IntegrationTest
|
||||||
{
|
{
|
||||||
private SeriesResource _series;
|
private SeriesResource _series;
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("Adding to blacklist not supported")]
|
[Ignore("Adding to blocklist not supported")]
|
||||||
public void should_be_able_to_add_to_blacklist()
|
public void should_be_able_to_add_to_blocklist()
|
||||||
{
|
{
|
||||||
_series = EnsureSeries(266189, "The Blacklist");
|
_series = EnsureSeries(266189, "The Blacklist");
|
||||||
|
|
||||||
Blacklist.Post(new Api.Blacklist.BlacklistResource
|
Blocklist.Post(new Api.Blocklist.BlocklistResource
|
||||||
{
|
{
|
||||||
SeriesId = _series.Id,
|
SeriesId = _series.Id,
|
||||||
SourceTitle = "Blacklist.S01E01.Brought.To.You.By-BoomBoxHD"
|
SourceTitle = "Blacklist.S01E01.Brought.To.You.By-BoomBoxHD"
|
||||||
|
@ -23,10 +23,10 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("Adding to blacklist not supported")]
|
[Ignore("Adding to blocklist not supported")]
|
||||||
public void should_be_able_to_get_all_blacklisted()
|
public void should_be_able_to_get_all_blocklisted()
|
||||||
{
|
{
|
||||||
var result = Blacklist.GetPaged(0, 1000, "date", "desc");
|
var result = Blocklist.GetPaged(0, 1000, "date", "desc");
|
||||||
|
|
||||||
result.Should().NotBeNull();
|
result.Should().NotBeNull();
|
||||||
result.TotalRecords.Should().Be(1);
|
result.TotalRecords.Should().Be(1);
|
||||||
|
@ -34,12 +34,12 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("Adding to blacklist not supported")]
|
[Ignore("Adding to blocklist not supported")]
|
||||||
public void should_be_able_to_remove_from_blacklist()
|
public void should_be_able_to_remove_from_blocklist()
|
||||||
{
|
{
|
||||||
Blacklist.Delete(1);
|
Blocklist.Delete(1);
|
||||||
|
|
||||||
var result = Blacklist.GetPaged(0, 1000, "date", "desc");
|
var result = Blocklist.GetPaged(0, 1000, "date", "desc");
|
||||||
|
|
||||||
result.Should().NotBeNull();
|
result.Should().NotBeNull();
|
||||||
result.TotalRecords.Should().Be(0);
|
result.TotalRecords.Should().Be(0);
|
|
@ -11,7 +11,7 @@ using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Api.Blacklist;
|
using NzbDrone.Api.Blocklist;
|
||||||
using NzbDrone.Api.Commands;
|
using NzbDrone.Api.Commands;
|
||||||
using NzbDrone.Api.Config;
|
using NzbDrone.Api.Config;
|
||||||
using NzbDrone.Api.DownloadClient;
|
using NzbDrone.Api.DownloadClient;
|
||||||
|
@ -39,7 +39,7 @@ namespace NzbDrone.Integration.Test
|
||||||
protected RestClient RestClient { get; private set; }
|
protected RestClient RestClient { get; private set; }
|
||||||
protected RestClient RestClientv3 { get; private set; }
|
protected RestClient RestClientv3 { get; private set; }
|
||||||
|
|
||||||
public ClientBase<BlacklistResource> Blacklist;
|
public ClientBase<BlocklistResource> Blocklist;
|
||||||
public CommandClient Commands;
|
public CommandClient Commands;
|
||||||
public DownloadClientClient DownloadClients;
|
public DownloadClientClient DownloadClients;
|
||||||
public EpisodeClient Episodes;
|
public EpisodeClient Episodes;
|
||||||
|
@ -106,7 +106,7 @@ namespace NzbDrone.Integration.Test
|
||||||
RestClientv3.AddDefaultHeader("Authentication", ApiKey);
|
RestClientv3.AddDefaultHeader("Authentication", ApiKey);
|
||||||
RestClientv3.AddDefaultHeader("X-Api-Key", ApiKey);
|
RestClientv3.AddDefaultHeader("X-Api-Key", ApiKey);
|
||||||
|
|
||||||
Blacklist = new ClientBase<BlacklistResource>(RestClient, ApiKey);
|
Blocklist = new ClientBase<BlocklistResource>(RestClient, ApiKey);
|
||||||
Commands = new CommandClient(RestClient, ApiKey);
|
Commands = new CommandClient(RestClient, ApiKey);
|
||||||
DownloadClients = new DownloadClientClient(RestClient, ApiKey);
|
DownloadClients = new DownloadClientClient(RestClient, ApiKey);
|
||||||
Episodes = new EpisodeClient(RestClient, ApiKey);
|
Episodes = new EpisodeClient(RestClient, ApiKey);
|
||||||
|
|
|
@ -1,42 +1,44 @@
|
||||||
using NzbDrone.Core.Blacklisting;
|
// Blacklist has been deprecated for blocklist.
|
||||||
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
|
using Sonarr.Api.V3.Blocklist;
|
||||||
using Sonarr.Http;
|
using Sonarr.Http;
|
||||||
using Sonarr.Http.Extensions;
|
using Sonarr.Http.Extensions;
|
||||||
|
|
||||||
namespace Sonarr.Api.V3.Blacklist
|
namespace Sonarr.Api.V3.Blacklist
|
||||||
{
|
{
|
||||||
public class BlacklistModule : SonarrRestModule<BlacklistResource>
|
public class BlacklistModule : SonarrRestModule<BlocklistResource>
|
||||||
{
|
{
|
||||||
private readonly IBlacklistService _blacklistService;
|
private readonly BlocklistService _blocklistService;
|
||||||
|
|
||||||
public BlacklistModule(IBlacklistService blacklistService)
|
public BlacklistModule(BlocklistService blocklistService)
|
||||||
{
|
{
|
||||||
_blacklistService = blacklistService;
|
_blocklistService = blocklistService;
|
||||||
GetResourcePaged = GetBlacklist;
|
GetResourcePaged = Blocklist;
|
||||||
DeleteResource = DeleteBlacklist;
|
DeleteResource = DeleteBlockList;
|
||||||
|
|
||||||
Delete("/bulk", x => Remove());
|
Delete("/bulk", x => Remove());
|
||||||
}
|
}
|
||||||
|
|
||||||
private PagingResource<BlacklistResource> GetBlacklist(PagingResource<BlacklistResource> pagingResource)
|
private PagingResource<BlocklistResource> Blocklist(PagingResource<BlocklistResource> pagingResource)
|
||||||
{
|
{
|
||||||
var pagingSpec = pagingResource.MapToPagingSpec<BlacklistResource, NzbDrone.Core.Blacklisting.Blacklist>("date", SortDirection.Descending);
|
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, NzbDrone.Core.Blocklisting.Blocklist>("date", SortDirection.Descending);
|
||||||
|
|
||||||
return ApplyToPage(_blacklistService.Paged, pagingSpec, BlacklistResourceMapper.MapToResource);
|
return ApplyToPage(_blocklistService.Paged, pagingSpec, BlocklistResourceMapper.MapToResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteBlacklist(int id)
|
private void DeleteBlockList(int id)
|
||||||
{
|
{
|
||||||
_blacklistService.Delete(id);
|
_blocklistService.Delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private object Remove()
|
private object Remove()
|
||||||
{
|
{
|
||||||
var resource = Request.Body.FromJson<BlacklistBulkResource>();
|
var resource = Request.Body.FromJson<BlocklistBulkResource>();
|
||||||
|
|
||||||
_blacklistService.Delete(resource.Ids);
|
_blocklistService.Delete(resource.Ids);
|
||||||
|
|
||||||
return new object();
|
return new object();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Sonarr.Api.V3.Blacklist
|
namespace Sonarr.Api.V3.Blocklist
|
||||||
{
|
{
|
||||||
public class BlacklistBulkResource
|
public class BlocklistBulkResource
|
||||||
{
|
{
|
||||||
public List<int> Ids { get; set; }
|
public List<int> Ids { get; set; }
|
||||||
}
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
using NzbDrone.Core.Blocklisting;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
using Sonarr.Http;
|
||||||
|
using Sonarr.Http.Extensions;
|
||||||
|
|
||||||
|
namespace Sonarr.Api.V3.Blocklist
|
||||||
|
{
|
||||||
|
public class BlocklistModule : SonarrRestModule<BlocklistResource>
|
||||||
|
{
|
||||||
|
private readonly BlocklistService _blocklistService;
|
||||||
|
|
||||||
|
public BlocklistModule(BlocklistService blocklistService)
|
||||||
|
{
|
||||||
|
_blocklistService = blocklistService;
|
||||||
|
GetResourcePaged = Blocklist;
|
||||||
|
DeleteResource = DeleteBlockList;
|
||||||
|
|
||||||
|
Delete("/bulk", x => Remove());
|
||||||
|
}
|
||||||
|
|
||||||
|
private PagingResource<BlocklistResource> Blocklist(PagingResource<BlocklistResource> pagingResource)
|
||||||
|
{
|
||||||
|
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, NzbDrone.Core.Blocklisting.Blocklist>("date", SortDirection.Descending);
|
||||||
|
|
||||||
|
return ApplyToPage(_blocklistService.Paged, pagingSpec, BlocklistResourceMapper.MapToResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteBlockList(int id)
|
||||||
|
{
|
||||||
|
_blocklistService.Delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private object Remove()
|
||||||
|
{
|
||||||
|
var resource = Request.Body.FromJson<BlocklistBulkResource>();
|
||||||
|
|
||||||
|
_blocklistService.Delete(resource.Ids);
|
||||||
|
|
||||||
|
return new object();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,9 +6,9 @@ using NzbDrone.Core.Qualities;
|
||||||
using Sonarr.Api.V3.Series;
|
using Sonarr.Api.V3.Series;
|
||||||
using Sonarr.Http.REST;
|
using Sonarr.Http.REST;
|
||||||
|
|
||||||
namespace Sonarr.Api.V3.Blacklist
|
namespace Sonarr.Api.V3.Blocklist
|
||||||
{
|
{
|
||||||
public class BlacklistResource : RestResource
|
public class BlocklistResource : RestResource
|
||||||
{
|
{
|
||||||
public int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
public List<int> EpisodeIds { get; set; }
|
public List<int> EpisodeIds { get; set; }
|
||||||
|
@ -23,13 +23,13 @@ namespace Sonarr.Api.V3.Blacklist
|
||||||
public SeriesResource Series { get; set; }
|
public SeriesResource Series { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BlacklistResourceMapper
|
public static class BlocklistResourceMapper
|
||||||
{
|
{
|
||||||
public static BlacklistResource MapToResource(this NzbDrone.Core.Blacklisting.Blacklist model)
|
public static BlocklistResource MapToResource(this NzbDrone.Core.Blocklisting.Blocklist model)
|
||||||
{
|
{
|
||||||
if (model == null) return null;
|
if (model == null) return null;
|
||||||
|
|
||||||
return new BlacklistResource
|
return new BlocklistResource
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
|
|
|
@ -81,9 +81,11 @@ namespace Sonarr.Api.V3.Queue
|
||||||
private object Remove(int id)
|
private object Remove(int id)
|
||||||
{
|
{
|
||||||
var removeFromClient = Request.GetBooleanQueryParameter("removeFromClient", true);
|
var removeFromClient = Request.GetBooleanQueryParameter("removeFromClient", true);
|
||||||
var blacklist = Request.GetBooleanQueryParameter("blacklist");
|
|
||||||
|
|
||||||
var trackedDownload = Remove(id, removeFromClient, blacklist);
|
// blacklist maintained for backwards compatability, UI uses blocklist.
|
||||||
|
var blocklist = Request.GetBooleanQueryParameter("blocklist") ? Request.GetBooleanQueryParameter("blocklist") : Request.GetBooleanQueryParameter("blacklist");
|
||||||
|
|
||||||
|
var trackedDownload = Remove(id, removeFromClient, blocklist);
|
||||||
|
|
||||||
if (trackedDownload != null)
|
if (trackedDownload != null)
|
||||||
{
|
{
|
||||||
|
@ -96,14 +98,16 @@ namespace Sonarr.Api.V3.Queue
|
||||||
private object Remove()
|
private object Remove()
|
||||||
{
|
{
|
||||||
var removeFromClient = Request.GetBooleanQueryParameter("removeFromClient", true);
|
var removeFromClient = Request.GetBooleanQueryParameter("removeFromClient", true);
|
||||||
var blacklist = Request.GetBooleanQueryParameter("blacklist");
|
|
||||||
|
// blacklist maintained for backwards compatability, UI uses blocklist.
|
||||||
|
var blocklist = Request.GetBooleanQueryParameter("blocklist") ? Request.GetBooleanQueryParameter("blocklist") : Request.GetBooleanQueryParameter("blacklist");
|
||||||
|
|
||||||
var resource = Request.Body.FromJson<QueueBulkResource>();
|
var resource = Request.Body.FromJson<QueueBulkResource>();
|
||||||
var trackedDownloadIds = new List<string>();
|
var trackedDownloadIds = new List<string>();
|
||||||
|
|
||||||
foreach (var id in resource.Ids)
|
foreach (var id in resource.Ids)
|
||||||
{
|
{
|
||||||
var trackedDownload = Remove(id, removeFromClient, blacklist);
|
var trackedDownload = Remove(id, removeFromClient, blocklist);
|
||||||
|
|
||||||
if (trackedDownload != null)
|
if (trackedDownload != null)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +120,7 @@ namespace Sonarr.Api.V3.Queue
|
||||||
return new object();
|
return new object();
|
||||||
}
|
}
|
||||||
|
|
||||||
private TrackedDownload Remove(int id, bool removeFromClient, bool blacklist)
|
private TrackedDownload Remove(int id, bool removeFromClient, bool blocklist)
|
||||||
{
|
{
|
||||||
var pendingRelease = _pendingReleaseService.FindPendingQueueItem(id);
|
var pendingRelease = _pendingReleaseService.FindPendingQueueItem(id);
|
||||||
|
|
||||||
|
@ -146,12 +150,12 @@ namespace Sonarr.Api.V3.Queue
|
||||||
downloadClient.RemoveItem(trackedDownload.DownloadItem, true);
|
downloadClient.RemoveItem(trackedDownload.DownloadItem, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blacklist)
|
if (blocklist)
|
||||||
{
|
{
|
||||||
_failedDownloadService.MarkAsFailed(trackedDownload.DownloadItem.DownloadId);
|
_failedDownloadService.MarkAsFailed(trackedDownload.DownloadItem.DownloadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!removeFromClient && !blacklist)
|
if (!removeFromClient && !blocklist)
|
||||||
{
|
{
|
||||||
if (!_ignoredDownloadService.IgnoreDownload(trackedDownload))
|
if (!_ignoredDownloadService.IgnoreDownload(trackedDownload))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue