mirror of https://github.com/Radarr/Radarr
New: Renamed Blacklist to Blocklist
This commit is contained in:
parent
8024f4658c
commit
13224f03cc
|
@ -1,160 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import * as commandNames from 'Commands/commandNames';
|
|
||||||
import withCurrentPage from 'Components/withCurrentPage';
|
|
||||||
import * as blacklistActions from 'Store/Actions/blacklistActions';
|
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
|
||||||
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
|
||||||
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
|
|
||||||
import Blacklist from './Blacklist';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.blacklist,
|
|
||||||
createCommandExecutingSelector(commandNames.CLEAR_BLACKLIST),
|
|
||||||
(blacklist, isClearingBlacklistExecuting) => {
|
|
||||||
return {
|
|
||||||
isClearingBlacklistExecuting,
|
|
||||||
...blacklist
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
...blacklistActions,
|
|
||||||
executeCommand
|
|
||||||
};
|
|
||||||
|
|
||||||
class BlacklistConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const {
|
|
||||||
useCurrentPage,
|
|
||||||
fetchBlacklist,
|
|
||||||
gotoBlacklistFirstPage
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
registerPagePopulator(this.repopulate);
|
|
||||||
|
|
||||||
if (useCurrentPage) {
|
|
||||||
fetchBlacklist();
|
|
||||||
} else {
|
|
||||||
gotoBlacklistFirstPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (prevProps.isClearingBlacklistExecuting && !this.props.isClearingBlacklistExecuting) {
|
|
||||||
this.props.gotoBlacklistFirstPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
this.props.clearBlacklist();
|
|
||||||
unregisterPagePopulator(this.repopulate);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
repopulate = () => {
|
|
||||||
this.props.fetchBlacklist();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onFirstPagePress = () => {
|
|
||||||
this.props.gotoBlacklistFirstPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
onPreviousPagePress = () => {
|
|
||||||
this.props.gotoBlacklistPreviousPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
onNextPagePress = () => {
|
|
||||||
this.props.gotoBlacklistNextPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
onLastPagePress = () => {
|
|
||||||
this.props.gotoBlacklistLastPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
onPageSelect = (page) => {
|
|
||||||
this.props.gotoBlacklistPage({ page });
|
|
||||||
}
|
|
||||||
|
|
||||||
onRemoveSelected = (ids) => {
|
|
||||||
this.props.removeBlacklistItems({ ids });
|
|
||||||
}
|
|
||||||
|
|
||||||
onSortPress = (sortKey) => {
|
|
||||||
this.props.setBlacklistSort({ sortKey });
|
|
||||||
}
|
|
||||||
|
|
||||||
onTableOptionChange = (payload) => {
|
|
||||||
this.props.setBlacklistTableOption(payload);
|
|
||||||
|
|
||||||
if (payload.pageSize) {
|
|
||||||
this.props.gotoBlacklistFirstPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClearBlacklistPress = () => {
|
|
||||||
this.props.executeCommand({ name: commandNames.CLEAR_BLACKLIST });
|
|
||||||
}
|
|
||||||
|
|
||||||
onTableOptionChange = (payload) => {
|
|
||||||
this.props.setBlacklistTableOption(payload);
|
|
||||||
|
|
||||||
if (payload.pageSize) {
|
|
||||||
this.props.gotoBlacklistFirstPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<Blacklist
|
|
||||||
onFirstPagePress={this.onFirstPagePress}
|
|
||||||
onPreviousPagePress={this.onPreviousPagePress}
|
|
||||||
onNextPagePress={this.onNextPagePress}
|
|
||||||
onLastPagePress={this.onLastPagePress}
|
|
||||||
onPageSelect={this.onPageSelect}
|
|
||||||
onRemoveSelected={this.onRemoveSelected}
|
|
||||||
onSortPress={this.onSortPress}
|
|
||||||
onTableOptionChange={this.onTableOptionChange}
|
|
||||||
onClearBlacklistPress={this.onClearBlacklistPress}
|
|
||||||
{...this.props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BlacklistConnector.propTypes = {
|
|
||||||
useCurrentPage: PropTypes.bool.isRequired,
|
|
||||||
isClearingBlacklistExecuting: PropTypes.bool.isRequired,
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
fetchBlacklist: PropTypes.func.isRequired,
|
|
||||||
gotoBlacklistFirstPage: PropTypes.func.isRequired,
|
|
||||||
gotoBlacklistPreviousPage: PropTypes.func.isRequired,
|
|
||||||
gotoBlacklistNextPage: PropTypes.func.isRequired,
|
|
||||||
gotoBlacklistLastPage: PropTypes.func.isRequired,
|
|
||||||
gotoBlacklistPage: PropTypes.func.isRequired,
|
|
||||||
removeBlacklistItems: PropTypes.func.isRequired,
|
|
||||||
setBlacklistSort: PropTypes.func.isRequired,
|
|
||||||
setBlacklistTableOption: PropTypes.func.isRequired,
|
|
||||||
clearBlacklist: PropTypes.func.isRequired,
|
|
||||||
executeCommand: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withCurrentPage(
|
|
||||||
connect(createMapStateToProps, mapDispatchToProps)(BlacklistConnector)
|
|
||||||
);
|
|
|
@ -19,9 +19,9 @@ import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
||||||
import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState';
|
import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState';
|
||||||
import selectAll from 'Utilities/Table/selectAll';
|
import selectAll from 'Utilities/Table/selectAll';
|
||||||
import toggleSelected from 'Utilities/Table/toggleSelected';
|
import toggleSelected from 'Utilities/Table/toggleSelected';
|
||||||
import BlacklistRowConnector from './BlacklistRowConnector';
|
import BlocklistRowConnector from './BlocklistRowConnector';
|
||||||
|
|
||||||
class Blacklist extends Component {
|
class Blocklist extends Component {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
|
@ -101,8 +101,8 @@ class Blacklist extends Component {
|
||||||
columns,
|
columns,
|
||||||
totalRecords,
|
totalRecords,
|
||||||
isRemoving,
|
isRemoving,
|
||||||
isClearingBlacklistExecuting,
|
isClearingBlocklistExecuting,
|
||||||
onClearBlacklistPress,
|
onClearBlocklistPress,
|
||||||
...otherProps
|
...otherProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class Blacklist extends Component {
|
||||||
const selectedIds = this.getSelectedIds();
|
const selectedIds = this.getSelectedIds();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContent title={translate('Blacklist')}>
|
<PageContent title={translate('Blocklist')}>
|
||||||
<PageToolbar>
|
<PageToolbar>
|
||||||
<PageToolbarSection>
|
<PageToolbarSection>
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
|
@ -130,8 +130,8 @@ class Blacklist extends Component {
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
label={translate('Clear')}
|
label={translate('Clear')}
|
||||||
iconName={icons.CLEAR}
|
iconName={icons.CLEAR}
|
||||||
isSpinning={isClearingBlacklistExecuting}
|
isSpinning={isClearingBlocklistExecuting}
|
||||||
onPress={onClearBlacklistPress}
|
onPress={onClearBlocklistPress}
|
||||||
/>
|
/>
|
||||||
</PageToolbarSection>
|
</PageToolbarSection>
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class Blacklist extends Component {
|
||||||
{
|
{
|
||||||
!isFetching && !!error &&
|
!isFetching && !!error &&
|
||||||
<div>
|
<div>
|
||||||
{translate('UnableToLoadBlacklist')}
|
{translate('UnableToLoadBlocklist')}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,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}
|
||||||
|
@ -209,7 +209,7 @@ class Blacklist extends Component {
|
||||||
isOpen={isConfirmRemoveModalOpen}
|
isOpen={isConfirmRemoveModalOpen}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title={translate('RemoveSelected')}
|
title={translate('RemoveSelected')}
|
||||||
message={translate('AreYouSureYouWantToRemoveTheSelectedItemsFromBlacklist')}
|
message={translate('AreYouSureYouWantToRemoveTheSelectedItemsFromBlocklist')}
|
||||||
confirmLabel={translate('RemoveSelected')}
|
confirmLabel={translate('RemoveSelected')}
|
||||||
onConfirm={this.onRemoveSelectedConfirmed}
|
onConfirm={this.onRemoveSelectedConfirmed}
|
||||||
onCancel={this.onConfirmRemoveModalClose}
|
onCancel={this.onConfirmRemoveModalClose}
|
||||||
|
@ -219,7 +219,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,
|
||||||
|
@ -227,9 +227,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;
|
|
@ -0,0 +1,152 @@
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
import * as commandNames from 'Commands/commandNames';
|
||||||
|
import withCurrentPage from 'Components/withCurrentPage';
|
||||||
|
import * as blocklistActions from 'Store/Actions/blocklistActions';
|
||||||
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
|
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
||||||
|
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
|
||||||
|
import Blocklist from './Blocklist';
|
||||||
|
|
||||||
|
function createMapStateToProps() {
|
||||||
|
return createSelector(
|
||||||
|
(state) => state.blocklist,
|
||||||
|
createCommandExecutingSelector(commandNames.CLEAR_BLOCKLIST),
|
||||||
|
(blocklist, isClearingBlocklistExecuting) => {
|
||||||
|
return {
|
||||||
|
isClearingBlocklistExecuting,
|
||||||
|
...blocklist
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapDispatchToProps = {
|
||||||
|
...blocklistActions,
|
||||||
|
executeCommand
|
||||||
|
};
|
||||||
|
|
||||||
|
class BlocklistConnector extends Component {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lifecycle
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const {
|
||||||
|
useCurrentPage,
|
||||||
|
fetchBlocklist,
|
||||||
|
gotoBlocklistFirstPage
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
registerPagePopulator(this.repopulate);
|
||||||
|
|
||||||
|
if (useCurrentPage) {
|
||||||
|
fetchBlocklist();
|
||||||
|
} else {
|
||||||
|
gotoBlocklistFirstPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps) {
|
||||||
|
if (prevProps.isClearingBlocklistExecuting && !this.props.isClearingBlocklistExecuting) {
|
||||||
|
this.props.gotoBlocklistFirstPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.props.clearBlocklist();
|
||||||
|
unregisterPagePopulator(this.repopulate);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Control
|
||||||
|
|
||||||
|
repopulate = () => {
|
||||||
|
this.props.fetchBlocklist();
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Listeners
|
||||||
|
|
||||||
|
onFirstPagePress = () => {
|
||||||
|
this.props.gotoBlocklistFirstPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
onPreviousPagePress = () => {
|
||||||
|
this.props.gotoBlocklistPreviousPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
onNextPagePress = () => {
|
||||||
|
this.props.gotoBlocklistNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
onLastPagePress = () => {
|
||||||
|
this.props.gotoBlocklistLastPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
onPageSelect = (page) => {
|
||||||
|
this.props.gotoBlocklistPage({ page });
|
||||||
|
}
|
||||||
|
|
||||||
|
onRemoveSelected = (ids) => {
|
||||||
|
this.props.removeBlocklistItems({ ids });
|
||||||
|
}
|
||||||
|
|
||||||
|
onSortPress = (sortKey) => {
|
||||||
|
this.props.setBlocklistSort({ sortKey });
|
||||||
|
}
|
||||||
|
|
||||||
|
onTableOptionChange = (payload) => {
|
||||||
|
this.props.setBlocklistTableOption(payload);
|
||||||
|
|
||||||
|
if (payload.pageSize) {
|
||||||
|
this.props.gotoBlocklistFirstPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClearBlocklistPress = () => {
|
||||||
|
this.props.executeCommand({ name: commandNames.CLEAR_BLOCKLIST });
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Render
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<Blocklist
|
||||||
|
onFirstPagePress={this.onFirstPagePress}
|
||||||
|
onPreviousPagePress={this.onPreviousPagePress}
|
||||||
|
onNextPagePress={this.onNextPagePress}
|
||||||
|
onLastPagePress={this.onLastPagePress}
|
||||||
|
onPageSelect={this.onPageSelect}
|
||||||
|
onRemoveSelected={this.onRemoveSelected}
|
||||||
|
onSortPress={this.onSortPress}
|
||||||
|
onTableOptionChange={this.onTableOptionChange}
|
||||||
|
onClearBlocklistPress={this.onClearBlocklistPress}
|
||||||
|
{...this.props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BlocklistConnector.propTypes = {
|
||||||
|
useCurrentPage: PropTypes.bool.isRequired,
|
||||||
|
isClearingBlocklistExecuting: PropTypes.bool.isRequired,
|
||||||
|
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
fetchBlocklist: PropTypes.func.isRequired,
|
||||||
|
gotoBlocklistFirstPage: PropTypes.func.isRequired,
|
||||||
|
gotoBlocklistPreviousPage: PropTypes.func.isRequired,
|
||||||
|
gotoBlocklistNextPage: PropTypes.func.isRequired,
|
||||||
|
gotoBlocklistLastPage: PropTypes.func.isRequired,
|
||||||
|
gotoBlocklistPage: PropTypes.func.isRequired,
|
||||||
|
removeBlocklistItems: PropTypes.func.isRequired,
|
||||||
|
setBlocklistSort: PropTypes.func.isRequired,
|
||||||
|
setBlocklistTableOption: PropTypes.func.isRequired,
|
||||||
|
clearBlocklist: PropTypes.func.isRequired,
|
||||||
|
executeCommand: PropTypes.func.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
export default withCurrentPage(
|
||||||
|
connect(createMapStateToProps, mapDispatchToProps)(BlocklistConnector)
|
||||||
|
);
|
|
@ -10,7 +10,7 @@ import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
class BlacklistDetailsModal extends Component {
|
class BlocklistDetailsModal extends Component {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render
|
// Render
|
||||||
|
@ -78,7 +78,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,
|
||||||
|
@ -87,4 +87,4 @@ BlacklistDetailsModal.propTypes = {
|
||||||
onModalClose: PropTypes.func.isRequired
|
onModalClose: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BlacklistDetailsModal;
|
export default BlocklistDetailsModal;
|
|
@ -11,10 +11,10 @@ import MovieLanguage from 'Movie/MovieLanguage';
|
||||||
import MovieQuality from 'Movie/MovieQuality';
|
import MovieQuality from 'Movie/MovieQuality';
|
||||||
import MovieTitleLink from 'Movie/MovieTitleLink';
|
import MovieTitleLink from 'Movie/MovieTitleLink';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
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
|
||||||
|
@ -166,7 +166,7 @@ class BlacklistRow extends Component {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
title={translate('RemoveFromBlacklist')}
|
title={translate('RemoveFromBlocklist')}
|
||||||
name={icons.REMOVE}
|
name={icons.REMOVE}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
onPress={onRemovePress}
|
onPress={onRemovePress}
|
||||||
|
@ -179,7 +179,7 @@ class BlacklistRow extends Component {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
<BlacklistDetailsModal
|
<BlocklistDetailsModal
|
||||||
isOpen={this.state.isDetailsModalOpen}
|
isOpen={this.state.isDetailsModalOpen}
|
||||||
sourceTitle={sourceTitle}
|
sourceTitle={sourceTitle}
|
||||||
protocol={protocol}
|
protocol={protocol}
|
||||||
|
@ -193,7 +193,7 @@ class BlacklistRow extends Component {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlacklistRow.propTypes = {
|
BlocklistRow.propTypes = {
|
||||||
id: PropTypes.number.isRequired,
|
id: PropTypes.number.isRequired,
|
||||||
movie: PropTypes.object.isRequired,
|
movie: PropTypes.object.isRequired,
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
sourceTitle: PropTypes.string.isRequired,
|
||||||
|
@ -210,4 +210,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 createMovieSelector from 'Store/Selectors/createMovieSelector';
|
import createMovieSelector from 'Store/Selectors/createMovieSelector';
|
||||||
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 });
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ class RemoveQueueItemModal extends Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
remove: true,
|
remove: true,
|
||||||
blacklist: false
|
blocklist: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class RemoveQueueItemModal extends Component {
|
||||||
resetState = function() {
|
resetState = function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
remove: true,
|
remove: true,
|
||||||
blacklist: false
|
blocklist: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,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 = () => {
|
||||||
|
@ -69,7 +69,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
|
||||||
|
@ -103,13 +103,13 @@ class RemoveQueueItemModal extends Component {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>{translate('BlacklistRelease')}</FormLabel>
|
<FormLabel>{translate('BlocklistRelease')}</FormLabel>
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="blacklist"
|
name="blocklist"
|
||||||
value={blacklist}
|
value={blocklist}
|
||||||
helpText={translate('BlacklistHelpText')}
|
helpText={translate('BlocklistHelpText')}
|
||||||
onChange={this.onBlacklistChange}
|
onChange={this.onBlocklistChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ class RemoveQueueItemsModal extends Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
remove: true,
|
remove: true,
|
||||||
blacklist: false
|
blocklist: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class RemoveQueueItemsModal extends Component {
|
||||||
resetState = function() {
|
resetState = function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
remove: true,
|
remove: true,
|
||||||
blacklist: false
|
blocklist: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,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 = () => {
|
||||||
|
@ -70,7 +70,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
|
||||||
|
@ -105,15 +105,15 @@ class RemoveQueueItemsModal extends Component {
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>
|
<FormLabel>
|
||||||
Blacklist Release{selectedCount > 1 ? 's' : ''}
|
Blocklist Release{selectedCount > 1 ? 's' : ''}
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="blacklist"
|
name="blocklist"
|
||||||
value={blacklist}
|
value={blocklist}
|
||||||
helpText={translate('BlacklistHelpText')}
|
helpText={translate('BlocklistHelpText')}
|
||||||
onChange={this.onBlacklistChange}
|
onChange={this.onBlocklistChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Redirect, Route } from 'react-router-dom';
|
import { Redirect, Route } from 'react-router-dom';
|
||||||
import BlacklistConnector from 'Activity/Blacklist/BlacklistConnector';
|
import BlocklistConnector from 'Activity/Blocklist/BlocklistConnector';
|
||||||
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 AddNewMovieConnector from 'AddMovie/AddNewMovie/AddNewMovieConnector';
|
import AddNewMovieConnector from 'AddMovie/AddNewMovie/AddNewMovieConnector';
|
||||||
|
@ -111,8 +111,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_MOVIES_SEARCH = 'CutoffUnmetMoviesSearch';
|
export const CUTOFF_UNMET_MOVIES_SEARCH = 'CutoffUnmetMoviesSearch';
|
||||||
export const DELETE_LOG_FILES = 'DeleteLogFiles';
|
export const DELETE_LOG_FILES = 'DeleteLogFiles';
|
||||||
|
|
|
@ -61,8 +61,8 @@ const links = [
|
||||||
to: '/activity/history'
|
to: '/activity/history'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: translate('Blacklist'),
|
title: translate('Blocklist'),
|
||||||
to: '/activity/blacklist'
|
to: '/activity/blocklist'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -225,4 +225,4 @@ export const UNSAVED_SETTING = farDotCircle;
|
||||||
export const VIEW = fasEye;
|
export const VIEW = fasEye;
|
||||||
export const WARNING = fasExclamationTriangle;
|
export const WARNING = fasExclamationTriangle;
|
||||||
export const WIKI = fasBookReader;
|
export const WIKI = fasBookReader;
|
||||||
export const BLACKLIST = fasBan;
|
export const BLOCKLIST = fasBan;
|
||||||
|
|
|
@ -67,6 +67,6 @@
|
||||||
width: 75px;
|
width: 75px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.blacklist {
|
.blocklist {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ class InteractiveSearchRow extends Component {
|
||||||
grabError,
|
grabError,
|
||||||
historyGrabbedData,
|
historyGrabbedData,
|
||||||
historyFailedData,
|
historyFailedData,
|
||||||
blacklistData
|
blocklistData
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -221,12 +221,12 @@ class InteractiveSearchRow extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
blacklistData?.date &&
|
blocklistData?.date &&
|
||||||
<Icon
|
<Icon
|
||||||
className={historyGrabbedData || historyFailedData ? styles.blacklist : ''}
|
className={historyGrabbedData || historyFailedData ? styles.blocklist : ''}
|
||||||
name={icons.BLACKLIST}
|
name={icons.BLOCKLIST}
|
||||||
kind={kinds.DANGER}
|
kind={kinds.DANGER}
|
||||||
title={`${translate('Blacklisted')}: ${formatDateTime(blacklistData.date, longDateFormat, timeFormat, { includeSeconds: true })}`}
|
title={`${translate('Blocklisted')}: ${formatDateTime(blocklistData.date, longDateFormat, timeFormat, { includeSeconds: true })}`}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
</TableRowCell>
|
</TableRowCell>
|
||||||
|
@ -341,7 +341,7 @@ InteractiveSearchRow.propTypes = {
|
||||||
onGrabPress: PropTypes.func.isRequired,
|
onGrabPress: PropTypes.func.isRequired,
|
||||||
historyFailedData: PropTypes.object,
|
historyFailedData: PropTypes.object,
|
||||||
historyGrabbedData: PropTypes.object,
|
historyGrabbedData: PropTypes.object,
|
||||||
blacklistData: PropTypes.object
|
blocklistData: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
InteractiveSearchRow.defaultProps = {
|
InteractiveSearchRow.defaultProps = {
|
||||||
|
|
|
@ -8,22 +8,22 @@ function createMapStateToProps() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state, { guid }) => guid,
|
(state, { guid }) => guid,
|
||||||
(state) => state.movieHistory.items,
|
(state) => state.movieHistory.items,
|
||||||
(state) => state.movieBlacklist.items,
|
(state) => state.movieBlocklist.items,
|
||||||
(guid, movieHistory, movieBlacklist) => {
|
(guid, movieHistory, movieBlocklist) => {
|
||||||
|
|
||||||
let blacklistData = {};
|
let blocklistData = {};
|
||||||
let historyFailedData = {};
|
let historyFailedData = {};
|
||||||
|
|
||||||
const historyGrabbedData = movieHistory.find((movie) => movie.eventType === 'grabbed' && movie.data.guid === guid);
|
const historyGrabbedData = movieHistory.find((movie) => movie.eventType === 'grabbed' && movie.data.guid === guid);
|
||||||
if (historyGrabbedData) {
|
if (historyGrabbedData) {
|
||||||
historyFailedData = movieHistory.find((movie) => movie.eventType === 'downloadFailed' && movie.sourceTitle === historyGrabbedData.sourceTitle);
|
historyFailedData = movieHistory.find((movie) => movie.eventType === 'downloadFailed' && movie.sourceTitle === historyGrabbedData.sourceTitle);
|
||||||
blacklistData = movieBlacklist.find((item) => item.sourceTitle === historyGrabbedData.sourceTitle);
|
blocklistData = movieBlocklist.find((item) => item.sourceTitle === historyGrabbedData.sourceTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
historyGrabbedData,
|
historyGrabbedData,
|
||||||
historyFailedData,
|
historyFailedData,
|
||||||
blacklistData
|
blocklistData
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -38,7 +38,7 @@ class InteractiveSearchRowConnector extends Component {
|
||||||
const {
|
const {
|
||||||
historyGrabbedData,
|
historyGrabbedData,
|
||||||
historyFailedData,
|
historyFailedData,
|
||||||
blacklistData,
|
blocklistData,
|
||||||
...otherProps
|
...otherProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class InteractiveSearchRowConnector extends Component {
|
||||||
<InteractiveSearchRow
|
<InteractiveSearchRow
|
||||||
historyGrabbedData={historyGrabbedData}
|
historyGrabbedData={historyGrabbedData}
|
||||||
historyFailedData={historyFailedData}
|
historyFailedData={historyFailedData}
|
||||||
blacklistData={blacklistData}
|
blocklistData={blocklistData}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -56,7 +56,7 @@ class InteractiveSearchRowConnector extends Component {
|
||||||
InteractiveSearchRowConnector.propTypes = {
|
InteractiveSearchRowConnector.propTypes = {
|
||||||
historyGrabbedData: PropTypes.object,
|
historyGrabbedData: PropTypes.object,
|
||||||
historyFailedData: PropTypes.object,
|
historyFailedData: PropTypes.object,
|
||||||
blacklistData: PropTypes.object
|
blocklistData: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(InteractiveSearchRowConnector);
|
export default connect(createMapStateToProps)(InteractiveSearchRowConnector);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import * as commandNames from 'Commands/commandNames';
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
import { clearExtraFiles, fetchExtraFiles } from 'Store/Actions/extraFileActions';
|
import { clearExtraFiles, fetchExtraFiles } from 'Store/Actions/extraFileActions';
|
||||||
import { toggleMovieMonitored } from 'Store/Actions/movieActions';
|
import { toggleMovieMonitored } from 'Store/Actions/movieActions';
|
||||||
import { clearMovieBlacklist, fetchMovieBlacklist } from 'Store/Actions/movieBlacklistActions';
|
import { clearMovieBlocklist, fetchMovieBlocklist } from 'Store/Actions/movieBlocklistActions';
|
||||||
import { clearMovieCredits, fetchMovieCredits } from 'Store/Actions/movieCreditsActions';
|
import { clearMovieCredits, fetchMovieCredits } from 'Store/Actions/movieCreditsActions';
|
||||||
import { clearMovieFiles, fetchMovieFiles } from 'Store/Actions/movieFileActions';
|
import { clearMovieFiles, fetchMovieFiles } from 'Store/Actions/movieFileActions';
|
||||||
import { clearMovieHistory, fetchMovieHistory } from 'Store/Actions/movieHistoryActions';
|
import { clearMovieHistory, fetchMovieHistory } from 'Store/Actions/movieHistoryActions';
|
||||||
|
@ -222,11 +222,11 @@ function createMapDispatchToProps(dispatch, props) {
|
||||||
onGoToMovie(titleSlug) {
|
onGoToMovie(titleSlug) {
|
||||||
dispatch(push(`${window.Radarr.urlBase}/movie/${titleSlug}`));
|
dispatch(push(`${window.Radarr.urlBase}/movie/${titleSlug}`));
|
||||||
},
|
},
|
||||||
dispatchFetchMovieBlacklist({ movieId }) {
|
dispatchFetchMovieBlocklist({ movieId }) {
|
||||||
dispatch(fetchMovieBlacklist({ movieId }));
|
dispatch(fetchMovieBlocklist({ movieId }));
|
||||||
},
|
},
|
||||||
dispatchClearMovieBlacklist() {
|
dispatchClearMovieBlocklist() {
|
||||||
dispatch(clearMovieBlacklist());
|
dispatch(clearMovieBlocklist());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ class MovieDetailsConnector extends Component {
|
||||||
const movieId = this.props.id;
|
const movieId = this.props.id;
|
||||||
|
|
||||||
this.props.dispatchFetchMovieFiles({ movieId });
|
this.props.dispatchFetchMovieFiles({ movieId });
|
||||||
this.props.dispatchFetchMovieBlacklist({ movieId });
|
this.props.dispatchFetchMovieBlocklist({ movieId });
|
||||||
this.props.dispatchFetchMovieHistory({ movieId });
|
this.props.dispatchFetchMovieHistory({ movieId });
|
||||||
this.props.dispatchFetchExtraFiles({ movieId });
|
this.props.dispatchFetchExtraFiles({ movieId });
|
||||||
this.props.dispatchFetchMovieCredits({ movieId });
|
this.props.dispatchFetchMovieCredits({ movieId });
|
||||||
|
@ -290,7 +290,7 @@ class MovieDetailsConnector extends Component {
|
||||||
|
|
||||||
unpopulate = () => {
|
unpopulate = () => {
|
||||||
this.props.dispatchCancelFetchReleases();
|
this.props.dispatchCancelFetchReleases();
|
||||||
this.props.dispatchClearMovieBlacklist();
|
this.props.dispatchClearMovieBlocklist();
|
||||||
this.props.dispatchClearMovieFiles();
|
this.props.dispatchClearMovieFiles();
|
||||||
this.props.dispatchClearMovieHistory();
|
this.props.dispatchClearMovieHistory();
|
||||||
this.props.dispatchClearExtraFiles();
|
this.props.dispatchClearExtraFiles();
|
||||||
|
@ -362,8 +362,8 @@ MovieDetailsConnector.propTypes = {
|
||||||
dispatchClearQueueDetails: PropTypes.func.isRequired,
|
dispatchClearQueueDetails: PropTypes.func.isRequired,
|
||||||
dispatchFetchImportListSchema: PropTypes.func.isRequired,
|
dispatchFetchImportListSchema: PropTypes.func.isRequired,
|
||||||
dispatchExecuteCommand: PropTypes.func.isRequired,
|
dispatchExecuteCommand: PropTypes.func.isRequired,
|
||||||
dispatchFetchMovieBlacklist: PropTypes.func.isRequired,
|
dispatchFetchMovieBlocklist: PropTypes.func.isRequired,
|
||||||
dispatchClearMovieBlacklist: PropTypes.func.isRequired,
|
dispatchClearMovieBlocklist: PropTypes.func.isRequired,
|
||||||
onGoToMovie: PropTypes.func.isRequired
|
onGoToMovie: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ import { fetchCustomFormatSpecifications } from 'Store/Actions/settingsActions';
|
||||||
import createProviderSettingsSelector from 'Store/Selectors/createProviderSettingsSelector';
|
import createProviderSettingsSelector from 'Store/Selectors/createProviderSettingsSelector';
|
||||||
import ExportCustomFormatModalContent from './ExportCustomFormatModalContent';
|
import ExportCustomFormatModalContent from './ExportCustomFormatModalContent';
|
||||||
|
|
||||||
const blacklistedProperties = ['id', 'implementationName', 'infoLink'];
|
const omittedProperties = ['id', 'implementationName', 'infoLink'];
|
||||||
|
|
||||||
function replacer(key, value) {
|
function replacer(key, value) {
|
||||||
if (blacklistedProperties.includes(key)) {
|
if (omittedProperties.includes(key)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
import getSectionState from 'Utilities/State/getSectionState';
|
import getSectionState from 'Utilities/State/getSectionState';
|
||||||
import updateSectionState from 'Utilities/State/updateSectionState';
|
import updateSectionState from 'Utilities/State/updateSectionState';
|
||||||
|
|
||||||
const blacklistedProperties = [
|
const omittedProperties = [
|
||||||
'section',
|
'section',
|
||||||
'id'
|
'id'
|
||||||
];
|
];
|
||||||
|
@ -31,7 +31,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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import createSetTableOptionReducer from './Creators/Reducers/createSetTableOptio
|
||||||
//
|
//
|
||||||
// Variables
|
// Variables
|
||||||
|
|
||||||
export const section = 'blacklist';
|
export const section = 'blocklist';
|
||||||
|
|
||||||
//
|
//
|
||||||
// State
|
// State
|
||||||
|
@ -83,41 +83,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
|
||||||
|
@ -125,21 +125,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;
|
||||||
|
@ -157,7 +157,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 })
|
||||||
|
@ -165,7 +165,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 }));
|
||||||
});
|
});
|
||||||
|
@ -191,9 +191,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 addMovie from './addMovieActions';
|
import * as addMovie from './addMovieActions';
|
||||||
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 commands from './commandActions';
|
import * as commands from './commandActions';
|
||||||
|
@ -11,7 +11,7 @@ import * as history from './historyActions';
|
||||||
import * as importMovie from './importMovieActions';
|
import * as importMovie from './importMovieActions';
|
||||||
import * as interactiveImportActions from './interactiveImportActions';
|
import * as interactiveImportActions from './interactiveImportActions';
|
||||||
import * as movies from './movieActions';
|
import * as movies from './movieActions';
|
||||||
import * as movieBlacklist from './movieBlacklistActions';
|
import * as movieBlocklist from './movieBlocklistActions';
|
||||||
import * as movieCredits from './movieCreditsActions';
|
import * as movieCredits from './movieCreditsActions';
|
||||||
import * as movieFiles from './movieFileActions';
|
import * as movieFiles from './movieFileActions';
|
||||||
import * as movieHistory from './movieHistoryActions';
|
import * as movieHistory from './movieHistoryActions';
|
||||||
|
@ -30,7 +30,7 @@ import * as tags from './tagActions';
|
||||||
export default [
|
export default [
|
||||||
addMovie,
|
addMovie,
|
||||||
app,
|
app,
|
||||||
blacklist,
|
blocklist,
|
||||||
calendar,
|
calendar,
|
||||||
captcha,
|
captcha,
|
||||||
commands,
|
commands,
|
||||||
|
@ -49,7 +49,7 @@ export default [
|
||||||
releases,
|
releases,
|
||||||
rootFolders,
|
rootFolders,
|
||||||
movies,
|
movies,
|
||||||
movieBlacklist,
|
movieBlocklist,
|
||||||
movieHistory,
|
movieHistory,
|
||||||
movieIndex,
|
movieIndex,
|
||||||
movieCredits,
|
movieCredits,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import createHandleActions from './Creators/createHandleActions';
|
||||||
//
|
//
|
||||||
// Variables
|
// Variables
|
||||||
|
|
||||||
export const section = 'movieBlacklist';
|
export const section = 'movieBlocklist';
|
||||||
|
|
||||||
//
|
//
|
||||||
// State
|
// State
|
||||||
|
@ -23,25 +23,25 @@ export const defaultState = {
|
||||||
//
|
//
|
||||||
// Actions Types
|
// Actions Types
|
||||||
|
|
||||||
export const FETCH_MOVIE_BLACKLIST = 'movieBlacklist/fetchMovieBlacklist';
|
export const FETCH_MOVIE_BLOCKLIST = 'movieBlocklist/fetchMovieBlocklist';
|
||||||
export const CLEAR_MOVIE_BLACKLIST = 'movieBlacklist/clearMovieBlacklist';
|
export const CLEAR_MOVIE_BLOCKLIST = 'movieBlocklist/clearMovieBlocklist';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Action Creators
|
// Action Creators
|
||||||
|
|
||||||
export const fetchMovieBlacklist = createThunk(FETCH_MOVIE_BLACKLIST);
|
export const fetchMovieBlocklist = createThunk(FETCH_MOVIE_BLOCKLIST);
|
||||||
export const clearMovieBlacklist = createAction(CLEAR_MOVIE_BLACKLIST);
|
export const clearMovieBlocklist = createAction(CLEAR_MOVIE_BLOCKLIST);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Action Handlers
|
// Action Handlers
|
||||||
|
|
||||||
export const actionHandlers = handleThunks({
|
export const actionHandlers = handleThunks({
|
||||||
|
|
||||||
[FETCH_MOVIE_BLACKLIST]: function(getState, payload, dispatch) {
|
[FETCH_MOVIE_BLOCKLIST]: function(getState, payload, dispatch) {
|
||||||
dispatch(set({ section, isFetching: true }));
|
dispatch(set({ section, isFetching: true }));
|
||||||
|
|
||||||
const promise = createAjaxRequest({
|
const promise = createAjaxRequest({
|
||||||
url: '/blacklist/movie',
|
url: '/blocklist/movie',
|
||||||
data: payload
|
data: payload
|
||||||
}).request;
|
}).request;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ export const actionHandlers = handleThunks({
|
||||||
|
|
||||||
export const reducers = createHandleActions({
|
export const reducers = createHandleActions({
|
||||||
|
|
||||||
[CLEAR_MOVIE_BLACKLIST]: (state) => {
|
[CLEAR_MOVIE_BLOCKLIST]: (state) => {
|
||||||
return Object.assign({}, state, defaultState);
|
return Object.assign({}, state, defaultState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,13 +354,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;
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ export const actionHandlers = handleThunks({
|
||||||
const {
|
const {
|
||||||
ids,
|
ids,
|
||||||
remove,
|
remove,
|
||||||
blacklist
|
blocklist
|
||||||
} = payload;
|
} = payload;
|
||||||
|
|
||||||
dispatch(batchActions([
|
dispatch(batchActions([
|
||||||
|
@ -393,7 +393,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,6 +1,7 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import persistState from 'redux-localstorage';
|
import persistState from 'redux-localstorage';
|
||||||
import actions from 'Store/Actions';
|
import actions from 'Store/Actions';
|
||||||
|
import migrate from 'Store/Migrators/migrate';
|
||||||
|
|
||||||
const columnPaths = [];
|
const columnPaths = [];
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ const config = {
|
||||||
export default function createPersistState() {
|
export default function createPersistState() {
|
||||||
// Migrate existing local storage before proceeding
|
// Migrate existing local storage before proceeding
|
||||||
const persistedState = JSON.parse(localStorage.getItem(config.key));
|
const persistedState = JSON.parse(localStorage.getItem(config.key));
|
||||||
|
migrate(persistedState);
|
||||||
localStorage.setItem(config.key, serialize(persistedState));
|
localStorage.setItem(config.key, serialize(persistedState));
|
||||||
|
|
||||||
return persistState(paths, config);
|
return persistState(paths, config);
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
import migrateBlacklistToBlocklist from './migrateBlacklistToBlocklist';
|
||||||
|
|
||||||
|
export default function migrate(persistedState) {
|
||||||
|
migrateBlacklistToBlocklist(persistedState);
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
import _, { get } from 'lodash';
|
||||||
|
|
||||||
|
export default function migrateBlacklistToBlocklist(persistedState) {
|
||||||
|
const blocklist = get(persistedState, 'blacklist');
|
||||||
|
|
||||||
|
if (!blocklist) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
persistedState.blocklist = blocklist;
|
||||||
|
_.remove(persistedState, 'blacklist');
|
||||||
|
}
|
|
@ -52,7 +52,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]
|
||||||
|
|
|
@ -4,25 +4,25 @@ using System.Linq;
|
||||||
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.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
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;
|
||||||
private Movie _movie1;
|
private Movie _movie1;
|
||||||
private Movie _movie2;
|
private Movie _movie2;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_blacklist = new Blacklist
|
_blocklist = new Blocklist
|
||||||
{
|
{
|
||||||
MovieId = 1234,
|
MovieId = 1234,
|
||||||
Quality = new QualityModel(),
|
Quality = new QualityModel(),
|
||||||
|
@ -43,30 +43,30 @@ 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_movie_id()
|
public void should_should_have_movie_id()
|
||||||
{
|
{
|
||||||
Subject.Insert(_blacklist);
|
Subject.Insert(_blocklist);
|
||||||
|
|
||||||
Subject.All().First().MovieId.Should().Be(_blacklist.MovieId);
|
Subject.All().First().MovieId.Should().Be(_blocklist.MovieId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[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.MovieId, _blacklist.SourceTitle.ToUpperInvariant()).Should().HaveCount(1);
|
Subject.BlocklistedByTitle(_blocklist.MovieId, _blocklist.SourceTitle.ToUpperInvariant()).Should().HaveCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_delete_blacklists_by_movieId()
|
public void should_delete_blocklists_by_movieId()
|
||||||
{
|
{
|
||||||
var blacklistItems = Builder<Blacklist>.CreateListOfSize(5)
|
var blocklistItems = Builder<Blocklist>.CreateListOfSize(5)
|
||||||
.TheFirst(1)
|
.TheFirst(1)
|
||||||
.With(c => c.MovieId = _movie2.Id)
|
.With(c => c.MovieId = _movie2.Id)
|
||||||
.TheRest()
|
.TheRest()
|
||||||
|
@ -77,15 +77,15 @@ namespace NzbDrone.Core.Test.Blacklisting
|
||||||
.With(c => c.Id = 0)
|
.With(c => c.Id = 0)
|
||||||
.BuildListOfNew();
|
.BuildListOfNew();
|
||||||
|
|
||||||
Db.InsertMany(blacklistItems);
|
Db.InsertMany(blocklistItems);
|
||||||
|
|
||||||
Subject.DeleteForMovies(new List<int> { _movie1.Id });
|
Subject.DeleteForMovies(new List<int> { _movie1.Id });
|
||||||
|
|
||||||
var removedMovieBlacklists = Subject.BlacklistedByMovie(_movie1.Id);
|
var removedMovieBlocklists = Subject.BlocklistedByMovie(_movie1.Id);
|
||||||
var nonRemovedMovieBlacklists = Subject.BlacklistedByMovie(_movie2.Id);
|
var nonRemovedMovieBlocklists = Subject.BlocklistedByMovie(_movie2.Id);
|
||||||
|
|
||||||
removedMovieBlacklists.Should().HaveCount(0);
|
removedMovieBlocklists.Should().HaveCount(0);
|
||||||
nonRemovedMovieBlacklists.Should().HaveCount(1);
|
nonRemovedMovieBlocklists.Should().HaveCount(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
using System;
|
using System;
|
||||||
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;
|
||||||
|
|
||||||
|
@ -37,8 +37,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.MovieId == _event.MovieId)), Times.Once());
|
.Verify(v => v.Insert(It.Is<Blocklist>(b => b.MovieId == _event.MovieId)), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -49,8 +49,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.MovieId == _event.MovieId)), Times.Once());
|
.Verify(v => v.Insert(It.Is<Blocklist>(b => b.MovieId == _event.MovieId)), Times.Once());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -663,4 +663,4 @@
|
||||||
<pubDate>2015-02-05 22:38:43</pubDate>
|
<pubDate>2015-02-05 22:38:43</pubDate>
|
||||||
</item>
|
</item>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||||
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.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
|
@ -12,37 +12,37 @@ using NzbDrone.Core.Test.Framework;
|
||||||
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.MovieId = default)
|
.With(h => h.MovieId = default)
|
||||||
.With(h => h.Quality = new QualityModel())
|
.With(h => h.Quality = new QualityModel())
|
||||||
.With(h => h.Languages = new List<Language>())
|
.With(h => h.Languages = new List<Language>())
|
||||||
.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 movie = Builder<Movie>.CreateNew().BuildNew();
|
var movie = Builder<Movie>.CreateNew().BuildNew();
|
||||||
|
|
||||||
Db.Insert(movie);
|
Db.Insert(movie);
|
||||||
|
|
||||||
var blacklist = Builder<Blacklist>.CreateNew()
|
var blocklist = Builder<Blocklist>.CreateNew()
|
||||||
.With(h => h.MovieId = default)
|
.With(h => h.MovieId = default)
|
||||||
.With(h => h.Quality = new QualityModel())
|
.With(h => h.Quality = new QualityModel())
|
||||||
.With(h => h.Languages = new List<Language>())
|
.With(h => h.Languages = new List<Language>())
|
||||||
.With(b => b.MovieId = movie.Id)
|
.With(b => b.MovieId = movie.Id)
|
||||||
.BuildNew();
|
.BuildNew();
|
||||||
|
|
||||||
Db.Insert(blacklist);
|
Db.Insert(blocklist);
|
||||||
|
|
||||||
Subject.Clean();
|
Subject.Clean();
|
||||||
AllStoredModels.Should().HaveCount(1);
|
AllStoredModels.Should().HaveCount(1);
|
|
@ -47,25 +47,25 @@ namespace NzbDrone.Core.Test.MetadataSource
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_prefer_blacklist_over_the_blacklist_when_searching_for_blacklist()
|
public void should_prefer_blocklist_over_the_blocklist_when_searching_for_blocklist()
|
||||||
{
|
{
|
||||||
WithSeries("The Blacklist");
|
WithSeries("The Blocklist");
|
||||||
WithSeries("Blacklist");
|
WithSeries("Blocklist");
|
||||||
|
|
||||||
_series.Sort(new SearchMovieComparer("blacklist"));
|
_series.Sort(new SearchMovieComparer("blocklist"));
|
||||||
|
|
||||||
_series.First().Title.Should().Be("Blacklist");
|
_series.First().Title.Should().Be("Blocklist");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_prefer_the_blacklist_over_blacklist_when_searching_for_the_blacklist()
|
public void should_prefer_the_blocklist_over_blocklist_when_searching_for_the_blocklist()
|
||||||
{
|
{
|
||||||
WithSeries("Blacklist");
|
WithSeries("Blocklist");
|
||||||
WithSeries("The Blacklist");
|
WithSeries("The Blocklist");
|
||||||
|
|
||||||
_series.Sort(new SearchMovieComparer("the blacklist"));
|
_series.Sort(new SearchMovieComparer("the blocklist"));
|
||||||
|
|
||||||
_series.First().Title.Should().Be("The Blacklist");
|
_series.First().Title.Should().Be("The Blocklist");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@ using NzbDrone.Core.Movies;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Blacklisting
|
namespace NzbDrone.Core.Blocklisting
|
||||||
{
|
{
|
||||||
public class Blacklist : ModelBase
|
public class Blocklist : ModelBase
|
||||||
{
|
{
|
||||||
public int MovieId { get; set; }
|
public int MovieId { get; set; }
|
||||||
public Movie Movie { get; set; }
|
public Movie Movie { get; set; }
|
|
@ -3,34 +3,34 @@ using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Blacklisting
|
namespace NzbDrone.Core.Blocklisting
|
||||||
{
|
{
|
||||||
public interface IBlacklistRepository : IBasicRepository<Blacklist>
|
public interface IBlocklistRepository : IBasicRepository<Blocklist>
|
||||||
{
|
{
|
||||||
List<Blacklist> BlacklistedByTitle(int movieId, string sourceTitle);
|
List<Blocklist> BlocklistedByTitle(int movieId, string sourceTitle);
|
||||||
List<Blacklist> BlacklistedByTorrentInfoHash(int movieId, string torrentInfoHash);
|
List<Blocklist> BlocklistedByTorrentInfoHash(int movieId, string torrentInfoHash);
|
||||||
List<Blacklist> BlacklistedByMovie(int movieId);
|
List<Blocklist> BlocklistedByMovie(int movieId);
|
||||||
void DeleteForMovies(List<int> movieIds);
|
void DeleteForMovies(List<int> movieIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 movieId, string sourceTitle)
|
public List<Blocklist> BlocklistedByTitle(int movieId, string sourceTitle)
|
||||||
{
|
{
|
||||||
return Query(x => x.MovieId == movieId && x.SourceTitle.Contains(sourceTitle));
|
return Query(x => x.MovieId == movieId && x.SourceTitle.Contains(sourceTitle));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Blacklist> BlacklistedByTorrentInfoHash(int movieId, string torrentInfoHash)
|
public List<Blocklist> BlocklistedByTorrentInfoHash(int movieId, string torrentInfoHash)
|
||||||
{
|
{
|
||||||
return Query(x => x.MovieId == movieId && x.TorrentInfoHash.Contains(torrentInfoHash));
|
return Query(x => x.MovieId == movieId && x.TorrentInfoHash.Contains(torrentInfoHash));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Blacklist> BlacklistedByMovie(int movieId)
|
public List<Blocklist> BlocklistedByMovie(int movieId)
|
||||||
{
|
{
|
||||||
return Query(x => x.MovieId == movieId);
|
return Query(x => x.MovieId == movieId);
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ namespace NzbDrone.Core.Blacklisting
|
||||||
Delete(x => movieIds.Contains(x.MovieId));
|
Delete(x => movieIds.Contains(x.MovieId));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SqlBuilder PagedBuilder() => new SqlBuilder().Join<Blacklist, Movie>((b, m) => b.MovieId == m.Id);
|
protected override SqlBuilder PagedBuilder() => new SqlBuilder().Join<Blocklist, Movie>((b, m) => b.MovieId == m.Id);
|
||||||
protected override IEnumerable<Blacklist> PagedQuery(SqlBuilder sql) => _database.QueryJoined<Blacklist, Movie>(sql, (bl, movie) =>
|
protected override IEnumerable<Blocklist> PagedQuery(SqlBuilder sql) => _database.QueryJoined<Blocklist, Movie>(sql, (bl, movie) =>
|
||||||
{
|
{
|
||||||
bl.Movie = movie;
|
bl.Movie = movie;
|
||||||
return bl;
|
return bl;
|
|
@ -10,33 +10,33 @@ using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Movies.Events;
|
using NzbDrone.Core.Movies.Events;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Blacklisting
|
namespace NzbDrone.Core.Blocklisting
|
||||||
{
|
{
|
||||||
public interface IBlacklistService
|
public interface IBlocklistService
|
||||||
{
|
{
|
||||||
bool Blacklisted(int movieId, ReleaseInfo release);
|
bool Blocklisted(int movieId, ReleaseInfo release);
|
||||||
PagingSpec<Blacklist> Paged(PagingSpec<Blacklist> pagingSpec);
|
PagingSpec<Blocklist> Paged(PagingSpec<Blocklist> pagingSpec);
|
||||||
List<Blacklist> GetByMovieId(int movieId);
|
List<Blocklist> GetByMovieId(int movieId);
|
||||||
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<ClearBlacklistCommand>,
|
IExecute<ClearBlocklistCommand>,
|
||||||
IHandle<DownloadFailedEvent>,
|
IHandle<DownloadFailedEvent>,
|
||||||
IHandleAsync<MoviesDeletedEvent>
|
IHandleAsync<MoviesDeletedEvent>
|
||||||
{
|
{
|
||||||
private readonly IBlacklistRepository _blacklistRepository;
|
private readonly IBlocklistRepository _blocklistRepository;
|
||||||
|
|
||||||
public BlacklistService(IBlacklistRepository blacklistRepository)
|
public BlocklistService(IBlocklistRepository blocklistRepository)
|
||||||
{
|
{
|
||||||
_blacklistRepository = blacklistRepository;
|
_blocklistRepository = blocklistRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Blacklisted(int movieId, ReleaseInfo release)
|
public bool Blocklisted(int movieId, ReleaseInfo release)
|
||||||
{
|
{
|
||||||
var blacklistedByTitle = _blacklistRepository.BlacklistedByTitle(movieId, release.Title);
|
var blocklistedByTitle = _blocklistRepository.BlocklistedByTitle(movieId, release.Title);
|
||||||
|
|
||||||
if (release.DownloadProtocol == DownloadProtocol.Torrent)
|
if (release.DownloadProtocol == DownloadProtocol.Torrent)
|
||||||
{
|
{
|
||||||
|
@ -49,40 +49,40 @@ 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(movieId, torrentInfo.InfoHash);
|
var blocklistedByTorrentInfohash = _blocklistRepository.BlocklistedByTorrentInfoHash(movieId, 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 List<Blacklist> GetByMovieId(int movieId)
|
public List<Blocklist> GetByMovieId(int movieId)
|
||||||
{
|
{
|
||||||
return _blacklistRepository.BlacklistedByMovie(movieId);
|
return _blocklistRepository.BlocklistedByMovie(movieId);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,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())
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,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())
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,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)
|
if (!item.PublishedDate.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,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)
|
if (!item.Size.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -142,14 +142,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
|
||||||
{
|
{
|
||||||
MovieId = message.MovieId,
|
MovieId = message.MovieId,
|
||||||
SourceTitle = message.SourceTitle,
|
SourceTitle = message.SourceTitle,
|
||||||
|
@ -166,15 +166,15 @@ namespace NzbDrone.Core.Blacklisting
|
||||||
|
|
||||||
if (Enum.TryParse(message.Data.GetValueOrDefault("indexerFlags"), true, out IndexerFlags flags))
|
if (Enum.TryParse(message.Data.GetValueOrDefault("indexerFlags"), true, out IndexerFlags flags))
|
||||||
{
|
{
|
||||||
blacklist.IndexerFlags = flags;
|
blocklist.IndexerFlags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
_blacklistRepository.Insert(blacklist);
|
_blocklistRepository.Insert(blocklist);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleAsync(MoviesDeletedEvent message)
|
public void HandleAsync(MoviesDeletedEvent message)
|
||||||
{
|
{
|
||||||
_blacklistRepository.DeleteForMovies(message.Movies.Select(m => m.Id).ToList());
|
_blocklistRepository.DeleteForMovies(message.Movies.Select(m => m.Id).ToList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
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;
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Blacklisting;
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.History;
|
using NzbDrone.Core.History;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
|
@ -16,7 +16,7 @@ namespace NzbDrone.Core.CustomFormats
|
||||||
{
|
{
|
||||||
List<CustomFormat> ParseCustomFormat(ParsedMovieInfo movieInfo);
|
List<CustomFormat> ParseCustomFormat(ParsedMovieInfo movieInfo);
|
||||||
List<CustomFormat> ParseCustomFormat(MovieFile movieFile);
|
List<CustomFormat> ParseCustomFormat(MovieFile movieFile);
|
||||||
List<CustomFormat> ParseCustomFormat(Blacklist blacklist);
|
List<CustomFormat> ParseCustomFormat(Blocklist blocklist);
|
||||||
List<CustomFormat> ParseCustomFormat(MovieHistory history);
|
List<CustomFormat> ParseCustomFormat(MovieHistory history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,25 +105,25 @@ namespace NzbDrone.Core.CustomFormats
|
||||||
return ParseCustomFormat(movieFile, _formatService.All());
|
return ParseCustomFormat(movieFile, _formatService.All());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CustomFormat> ParseCustomFormat(Blacklist blacklist)
|
public List<CustomFormat> ParseCustomFormat(Blocklist blocklist)
|
||||||
{
|
{
|
||||||
var movie = _movieService.GetMovie(blacklist.MovieId);
|
var movie = _movieService.GetMovie(blocklist.MovieId);
|
||||||
var parsed = _parsingService.ParseMovieInfo(blacklist.SourceTitle, null);
|
var parsed = _parsingService.ParseMovieInfo(blocklist.SourceTitle, null);
|
||||||
|
|
||||||
var info = new ParsedMovieInfo
|
var info = new ParsedMovieInfo
|
||||||
{
|
{
|
||||||
MovieTitle = movie.Title,
|
MovieTitle = movie.Title,
|
||||||
SimpleReleaseTitle = parsed?.SimpleReleaseTitle ?? blacklist.SourceTitle.SimplifyReleaseTitle(),
|
SimpleReleaseTitle = parsed?.SimpleReleaseTitle ?? blocklist.SourceTitle.SimplifyReleaseTitle(),
|
||||||
Quality = blacklist.Quality,
|
Quality = blocklist.Quality,
|
||||||
Languages = blacklist.Languages,
|
Languages = blocklist.Languages,
|
||||||
ReleaseGroup = parsed?.ReleaseGroup,
|
ReleaseGroup = parsed?.ReleaseGroup,
|
||||||
Edition = parsed?.Edition,
|
Edition = parsed?.Edition,
|
||||||
Year = movie.Year,
|
Year = movie.Year,
|
||||||
ImdbId = movie.ImdbId,
|
ImdbId = movie.ImdbId,
|
||||||
ExtraInfo = new Dictionary<string, object>
|
ExtraInfo = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "IndexerFlags", blacklist.IndexerFlags },
|
{ "IndexerFlags", blocklist.IndexerFlags },
|
||||||
{ "Size", blacklist.Size }
|
{ "Size", blocklist.Size }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(197)]
|
||||||
|
public class rename_blacklist_to_blocklist : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Rename.Table("Blacklist").To("Blocklist");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using NzbDrone.Common.Reflection;
|
using NzbDrone.Common.Reflection;
|
||||||
using NzbDrone.Core.Authentication;
|
using NzbDrone.Core.Authentication;
|
||||||
using NzbDrone.Core.Blacklisting;
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.CustomFilters;
|
using NzbDrone.Core.CustomFilters;
|
||||||
using NzbDrone.Core.CustomFormats;
|
using NzbDrone.Core.CustomFormats;
|
||||||
|
@ -129,7 +129,7 @@ namespace NzbDrone.Core.Datastore
|
||||||
Mapper.Entity<Profile>("Profiles").RegisterModel();
|
Mapper.Entity<Profile>("Profiles").RegisterModel();
|
||||||
Mapper.Entity<Log>("Logs").RegisterModel();
|
Mapper.Entity<Log>("Logs").RegisterModel();
|
||||||
Mapper.Entity<NamingConfig>("NamingConfig").RegisterModel();
|
Mapper.Entity<NamingConfig>("NamingConfig").RegisterModel();
|
||||||
Mapper.Entity<Blacklist>("Blacklist").RegisterModel();
|
Mapper.Entity<Blocklist>("Blocklist").RegisterModel();
|
||||||
Mapper.Entity<MetadataFile>("MetadataFiles").RegisterModel();
|
Mapper.Entity<MetadataFile>("MetadataFiles").RegisterModel();
|
||||||
Mapper.Entity<SubtitleFile>("SubtitleFiles").RegisterModel();
|
Mapper.Entity<SubtitleFile>("SubtitleFiles").RegisterModel();
|
||||||
Mapper.Entity<OtherExtraFile>("ExtraFiles").RegisterModel();
|
Mapper.Entity<OtherExtraFile>("ExtraFiles").RegisterModel();
|
||||||
|
|
|
@ -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(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
if (_blacklistService.Blacklisted(subject.Movie.Id, subject.Release))
|
if (_blocklistService.Blocklisted(subject.Movie.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();
|
|
@ -3,11 +3,11 @@ using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,11 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||||
{
|
{
|
||||||
using (var mapper = _database.OpenConnection())
|
using (var mapper = _database.OpenConnection())
|
||||||
{
|
{
|
||||||
mapper.Execute(@"DELETE FROM Blacklist
|
mapper.Execute(@"DELETE FROM Blocklist
|
||||||
WHERE Id IN (
|
WHERE Id IN (
|
||||||
SELECT Blacklist.Id FROM Blacklist
|
SELECT Blocklist.Id FROM Blocklist
|
||||||
LEFT OUTER JOIN Movies
|
LEFT OUTER JOIN Movies
|
||||||
ON Blacklist.MovieId = Movies.Id
|
ON Blocklist.MovieId = Movies.Id
|
||||||
WHERE Movies.Id IS NULL)");
|
WHERE Movies.Id IS NULL)");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -63,7 +63,7 @@
|
||||||
"AreYouSureYouWantToDeleteThisImportListExclusion": "Are you sure you want to delete this import list exclusion?",
|
"AreYouSureYouWantToDeleteThisImportListExclusion": "Are you sure you want to delete this import list exclusion?",
|
||||||
"AreYouSureYouWantToDeleteThisRemotePathMapping": "Are you sure you want to delete this remote path mapping?",
|
"AreYouSureYouWantToDeleteThisRemotePathMapping": "Are you sure you want to delete this remote path mapping?",
|
||||||
"AreYouSureYouWantToRemoveSelectedItemsFromQueue": "Are you sure you want to remove {0} item{1} from the queue?",
|
"AreYouSureYouWantToRemoveSelectedItemsFromQueue": "Are you sure you want to remove {0} item{1} from the queue?",
|
||||||
"AreYouSureYouWantToRemoveTheSelectedItemsFromBlacklist": "Are you sure you want to remove the selected items from the blacklist?",
|
"AreYouSureYouWantToRemoveTheSelectedItemsFromBlocklist": "Are you sure you want to remove the selected items from the blocklist?",
|
||||||
"AreYouSureYouWantToResetYourAPIKey": "Are you sure you want to reset your API Key?",
|
"AreYouSureYouWantToResetYourAPIKey": "Are you sure you want to reset your API Key?",
|
||||||
"AsAllDayHelpText": "Events will appear as all-day events in your calendar",
|
"AsAllDayHelpText": "Events will appear as all-day events in your calendar",
|
||||||
"AudioInfo": "Audio Info",
|
"AudioInfo": "Audio Info",
|
||||||
|
@ -86,10 +86,10 @@
|
||||||
"BeforeUpdate": "Before update",
|
"BeforeUpdate": "Before update",
|
||||||
"BindAddress": "Bind Address",
|
"BindAddress": "Bind Address",
|
||||||
"BindAddressHelpText": "Valid IP4 address or '*' for all interfaces",
|
"BindAddressHelpText": "Valid IP4 address or '*' for all interfaces",
|
||||||
"Blacklist": "Blacklist",
|
"Blocklist": "Blocklist",
|
||||||
"Blacklisted": "Blacklisted",
|
"Blocklisted": "Blocklisted",
|
||||||
"BlacklistHelpText": "Prevents Radarr from automatically grabbing this release again",
|
"BlocklistHelpText": "Prevents Radarr from automatically grabbing this release again",
|
||||||
"BlacklistRelease": "Blacklist Release",
|
"BlocklistRelease": "Blocklist Release",
|
||||||
"Branch": "Branch",
|
"Branch": "Branch",
|
||||||
"BranchUpdate": "Branch to use to update Radarr",
|
"BranchUpdate": "Branch to use to update Radarr",
|
||||||
"BranchUpdateMechanism": "Branch used by external update mechanism",
|
"BranchUpdateMechanism": "Branch used by external update mechanism",
|
||||||
|
@ -788,7 +788,7 @@
|
||||||
"RemovedMovieCheckSingleMessage": "Movie {0} was removed from TMDb",
|
"RemovedMovieCheckSingleMessage": "Movie {0} was removed from TMDb",
|
||||||
"RemoveFailedDownloadsHelpText": "Remove failed downloads from download client history",
|
"RemoveFailedDownloadsHelpText": "Remove failed downloads from download client history",
|
||||||
"RemoveFilter": "Remove filter",
|
"RemoveFilter": "Remove filter",
|
||||||
"RemoveFromBlacklist": "Remove from blacklist",
|
"RemoveFromBlocklist": "Remove from blocklist",
|
||||||
"RemoveFromDownloadClient": "Remove From Download Client",
|
"RemoveFromDownloadClient": "Remove From Download Client",
|
||||||
"RemoveFromQueue": "Remove from queue",
|
"RemoveFromQueue": "Remove from queue",
|
||||||
"RemoveFromQueueText": "Are you sure you want to remove {0} from the queue?",
|
"RemoveFromQueueText": "Are you sure you want to remove {0} from the queue?",
|
||||||
|
@ -1014,7 +1014,7 @@
|
||||||
"UnableToImportCheckLogs": "Downloaded - Unable to Import: check logs for details",
|
"UnableToImportCheckLogs": "Downloaded - Unable to Import: check logs for details",
|
||||||
"UnableToLoadAltTitle": "Unable to load alternative titles.",
|
"UnableToLoadAltTitle": "Unable to load alternative titles.",
|
||||||
"UnableToLoadBackups": "Unable to load backups",
|
"UnableToLoadBackups": "Unable to load backups",
|
||||||
"UnableToLoadBlacklist": "Unable to load blacklist",
|
"UnableToLoadBlocklist": "Unable to load blocklist",
|
||||||
"UnableToLoadCustomFormats": "Unable to load Custom Formats",
|
"UnableToLoadCustomFormats": "Unable to load Custom Formats",
|
||||||
"UnableToLoadDelayProfiles": "Unable to load Delay Profiles",
|
"UnableToLoadDelayProfiles": "Unable to load Delay Profiles",
|
||||||
"UnableToLoadDownloadClientOptions": "Unable to load download client options",
|
"UnableToLoadDownloadClientOptions": "Unable to load download client options",
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
using FluentAssertions;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using Radarr.Api.V3.Movies;
|
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class BlacklistFixture : IntegrationTest
|
|
||||||
{
|
|
||||||
private MovieResource _movie;
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[Ignore("Adding to blacklist not supported")]
|
|
||||||
public void should_be_able_to_add_to_blacklist()
|
|
||||||
{
|
|
||||||
_movie = EnsureMovie(11, "The Blacklist");
|
|
||||||
|
|
||||||
Blacklist.Post(new Radarr.Api.V3.Blacklist.BlacklistResource
|
|
||||||
{
|
|
||||||
MovieId = _movie.Id,
|
|
||||||
SourceTitle = "Blacklist.S01E01.Brought.To.You.By-BoomBoxHD"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[Ignore("Adding to blacklist not supported")]
|
|
||||||
public void should_be_able_to_get_all_blacklisted()
|
|
||||||
{
|
|
||||||
var result = Blacklist.GetPaged(0, 1000, "date", "desc");
|
|
||||||
|
|
||||||
result.Should().NotBeNull();
|
|
||||||
result.TotalRecords.Should().Be(1);
|
|
||||||
result.Records.Should().NotBeNullOrEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[Ignore("Adding to blacklist not supported")]
|
|
||||||
public void should_be_able_to_remove_from_blacklist()
|
|
||||||
{
|
|
||||||
Blacklist.Delete(1);
|
|
||||||
|
|
||||||
var result = Blacklist.GetPaged(0, 1000, "date", "desc");
|
|
||||||
|
|
||||||
result.Should().NotBeNull();
|
|
||||||
result.TotalRecords.Should().Be(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Radarr.Api.V3.Movies;
|
||||||
|
|
||||||
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class BlocklistFixture : IntegrationTest
|
||||||
|
{
|
||||||
|
private MovieResource _movie;
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("Adding to blocklist not supported")]
|
||||||
|
public void should_be_able_to_add_to_blocklist()
|
||||||
|
{
|
||||||
|
_movie = EnsureMovie(11, "The Blocklist");
|
||||||
|
|
||||||
|
Blocklist.Post(new Radarr.Api.V3.Blocklist.BlocklistResource
|
||||||
|
{
|
||||||
|
MovieId = _movie.Id,
|
||||||
|
SourceTitle = "Blocklist.S01E01.Brought.To.You.By-BoomBoxHD"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("Adding to blocklist not supported")]
|
||||||
|
public void should_be_able_to_get_all_blocklisted()
|
||||||
|
{
|
||||||
|
var result = Blocklist.GetPaged(0, 1000, "date", "desc");
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result.TotalRecords.Should().Be(1);
|
||||||
|
result.Records.Should().NotBeNullOrEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("Adding to blocklist not supported")]
|
||||||
|
public void should_be_able_to_remove_from_blocklist()
|
||||||
|
{
|
||||||
|
Blocklist.Delete(1);
|
||||||
|
|
||||||
|
var result = Blocklist.GetPaged(0, 1000, "date", "desc");
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result.TotalRecords.Should().Be(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Integration.Test.Client;
|
using NzbDrone.Integration.Test.Client;
|
||||||
using NzbDrone.SignalR;
|
using NzbDrone.SignalR;
|
||||||
using NzbDrone.Test.Common.Categories;
|
using NzbDrone.Test.Common.Categories;
|
||||||
using Radarr.Api.V3.Blacklist;
|
using Radarr.Api.V3.Blocklist;
|
||||||
using Radarr.Api.V3.Config;
|
using Radarr.Api.V3.Config;
|
||||||
using Radarr.Api.V3.DownloadClient;
|
using Radarr.Api.V3.DownloadClient;
|
||||||
using Radarr.Api.V3.History;
|
using Radarr.Api.V3.History;
|
||||||
|
@ -36,7 +36,7 @@ namespace NzbDrone.Integration.Test
|
||||||
{
|
{
|
||||||
protected RestClient RestClient { get; private set; }
|
protected RestClient RestClient { get; private set; }
|
||||||
|
|
||||||
public ClientBase<BlacklistResource> Blacklist;
|
public ClientBase<BlocklistResource> Blocklist;
|
||||||
public CommandClient Commands;
|
public CommandClient Commands;
|
||||||
public ClientBase<TaskResource> Tasks;
|
public ClientBase<TaskResource> Tasks;
|
||||||
public DownloadClientClient DownloadClients;
|
public DownloadClientClient DownloadClients;
|
||||||
|
@ -98,7 +98,7 @@ namespace NzbDrone.Integration.Test
|
||||||
RestClient.AddDefaultHeader("Authentication", ApiKey);
|
RestClient.AddDefaultHeader("Authentication", ApiKey);
|
||||||
RestClient.AddDefaultHeader("X-Api-Key", ApiKey);
|
RestClient.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);
|
||||||
Tasks = new ClientBase<TaskResource>(RestClient, ApiKey, "system/task");
|
Tasks = new ClientBase<TaskResource>(RestClient, ApiKey, "system/task");
|
||||||
DownloadClients = new DownloadClientClient(RestClient, ApiKey);
|
DownloadClients = new DownloadClientClient(RestClient, ApiKey);
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using NzbDrone.Core.Blacklisting;
|
|
||||||
using NzbDrone.Core.CustomFormats;
|
|
||||||
using NzbDrone.Core.Datastore;
|
|
||||||
using Radarr.Http;
|
|
||||||
using Radarr.Http.Extensions;
|
|
||||||
using Radarr.Http.REST;
|
|
||||||
|
|
||||||
namespace Radarr.Api.V3.Blacklist
|
|
||||||
{
|
|
||||||
public class BlacklistModule : RadarrRestModule<BlacklistResource>
|
|
||||||
{
|
|
||||||
private readonly IBlacklistService _blacklistService;
|
|
||||||
private readonly ICustomFormatCalculationService _formatCalculator;
|
|
||||||
|
|
||||||
public BlacklistModule(IBlacklistService blacklistService,
|
|
||||||
ICustomFormatCalculationService formatCalculator)
|
|
||||||
{
|
|
||||||
_blacklistService = blacklistService;
|
|
||||||
_formatCalculator = formatCalculator;
|
|
||||||
|
|
||||||
GetResourcePaged = GetBlacklist;
|
|
||||||
DeleteResource = DeleteBlacklist;
|
|
||||||
|
|
||||||
Get("/movie", x => GetMovieBlacklist());
|
|
||||||
Delete("/bulk", x => Remove());
|
|
||||||
}
|
|
||||||
|
|
||||||
private PagingResource<BlacklistResource> GetBlacklist(PagingResource<BlacklistResource> pagingResource)
|
|
||||||
{
|
|
||||||
var pagingSpec = pagingResource.MapToPagingSpec<BlacklistResource, NzbDrone.Core.Blacklisting.Blacklist>("date", SortDirection.Descending);
|
|
||||||
|
|
||||||
return ApplyToPage(_blacklistService.Paged, pagingSpec, (blacklist) => BlacklistResourceMapper.MapToResource(blacklist, _formatCalculator));
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<BlacklistResource> GetMovieBlacklist()
|
|
||||||
{
|
|
||||||
var queryMovieId = Request.Query.MovieId;
|
|
||||||
|
|
||||||
if (!queryMovieId.HasValue)
|
|
||||||
{
|
|
||||||
throw new BadRequestException("movieId is missing");
|
|
||||||
}
|
|
||||||
|
|
||||||
int movieId = Convert.ToInt32(queryMovieId.Value);
|
|
||||||
|
|
||||||
return _blacklistService.GetByMovieId(movieId).Select(h => BlacklistResourceMapper.MapToResource(h, _formatCalculator)).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteBlacklist(int id)
|
|
||||||
{
|
|
||||||
_blacklistService.Delete(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private object Remove()
|
|
||||||
{
|
|
||||||
var resource = Request.Body.FromJson<BlacklistBulkResource>();
|
|
||||||
|
|
||||||
_blacklistService.Delete(resource.Ids);
|
|
||||||
|
|
||||||
return new object();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Radarr.Api.V3.Blacklist
|
namespace Radarr.Api.V3.Blocklist
|
||||||
{
|
{
|
||||||
public class BlacklistBulkResource
|
public class BlocklistBulkResource
|
||||||
{
|
{
|
||||||
public List<int> Ids { get; set; }
|
public List<int> Ids { get; set; }
|
||||||
}
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NzbDrone.Core.Blocklisting;
|
||||||
|
using NzbDrone.Core.CustomFormats;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
using Radarr.Http;
|
||||||
|
using Radarr.Http.Extensions;
|
||||||
|
using Radarr.Http.REST;
|
||||||
|
|
||||||
|
namespace Radarr.Api.V3.Blocklist
|
||||||
|
{
|
||||||
|
public class BlocklistModule : RadarrRestModule<BlocklistResource>
|
||||||
|
{
|
||||||
|
private readonly IBlocklistService _blocklistService;
|
||||||
|
private readonly ICustomFormatCalculationService _formatCalculator;
|
||||||
|
|
||||||
|
public BlocklistModule(IBlocklistService blocklistService,
|
||||||
|
ICustomFormatCalculationService formatCalculator)
|
||||||
|
{
|
||||||
|
_blocklistService = blocklistService;
|
||||||
|
_formatCalculator = formatCalculator;
|
||||||
|
|
||||||
|
GetResourcePaged = GetBlocklist;
|
||||||
|
DeleteResource = DeleteBlocklist;
|
||||||
|
|
||||||
|
Get("/movie", x => GetMovieBlocklist());
|
||||||
|
Delete("/bulk", x => Remove());
|
||||||
|
}
|
||||||
|
|
||||||
|
private PagingResource<BlocklistResource> GetBlocklist(PagingResource<BlocklistResource> pagingResource)
|
||||||
|
{
|
||||||
|
var pagingSpec = pagingResource.MapToPagingSpec<BlocklistResource, NzbDrone.Core.Blocklisting.Blocklist>("date", SortDirection.Descending);
|
||||||
|
|
||||||
|
return ApplyToPage(_blocklistService.Paged, pagingSpec, (blocklist) => BlocklistResourceMapper.MapToResource(blocklist, _formatCalculator));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<BlocklistResource> GetMovieBlocklist()
|
||||||
|
{
|
||||||
|
var queryMovieId = Request.Query.MovieId;
|
||||||
|
|
||||||
|
if (!queryMovieId.HasValue)
|
||||||
|
{
|
||||||
|
throw new BadRequestException("movieId is missing");
|
||||||
|
}
|
||||||
|
|
||||||
|
int movieId = Convert.ToInt32(queryMovieId.Value);
|
||||||
|
|
||||||
|
return _blocklistService.GetByMovieId(movieId).Select(h => BlocklistResourceMapper.MapToResource(h, _formatCalculator)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteBlocklist(int id)
|
||||||
|
{
|
||||||
|
_blocklistService.Delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private object Remove()
|
||||||
|
{
|
||||||
|
var resource = Request.Body.FromJson<BlocklistBulkResource>();
|
||||||
|
|
||||||
|
_blocklistService.Delete(resource.Ids);
|
||||||
|
|
||||||
|
return new object();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,9 +8,9 @@ using Radarr.Api.V3.CustomFormats;
|
||||||
using Radarr.Api.V3.Movies;
|
using Radarr.Api.V3.Movies;
|
||||||
using Radarr.Http.REST;
|
using Radarr.Http.REST;
|
||||||
|
|
||||||
namespace Radarr.Api.V3.Blacklist
|
namespace Radarr.Api.V3.Blocklist
|
||||||
{
|
{
|
||||||
public class BlacklistResource : RestResource
|
public class BlocklistResource : RestResource
|
||||||
{
|
{
|
||||||
public int MovieId { get; set; }
|
public int MovieId { get; set; }
|
||||||
public string SourceTitle { get; set; }
|
public string SourceTitle { get; set; }
|
||||||
|
@ -25,16 +25,16 @@ namespace Radarr.Api.V3.Blacklist
|
||||||
public MovieResource Movie { get; set; }
|
public MovieResource Movie { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BlacklistResourceMapper
|
public static class BlocklistResourceMapper
|
||||||
{
|
{
|
||||||
public static BlacklistResource MapToResource(this NzbDrone.Core.Blacklisting.Blacklist model, ICustomFormatCalculationService formatCalculator)
|
public static BlocklistResource MapToResource(this NzbDrone.Core.Blocklisting.Blocklist model, ICustomFormatCalculationService formatCalculator)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BlacklistResource
|
return new BlocklistResource
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
|
|
|
@ -79,9 +79,9 @@ namespace Radarr.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 blocklist = Request.GetBooleanQueryParameter("blocklist");
|
||||||
|
|
||||||
var trackedDownload = Remove(id, removeFromClient, blacklist);
|
var trackedDownload = Remove(id, removeFromClient, blocklist);
|
||||||
|
|
||||||
if (trackedDownload != null)
|
if (trackedDownload != null)
|
||||||
{
|
{
|
||||||
|
@ -94,14 +94,14 @@ namespace Radarr.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");
|
var blocklist = Request.GetBooleanQueryParameter("blocklist");
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ namespace Radarr.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);
|
||||||
|
|
||||||
|
@ -144,12 +144,12 @@ namespace Radarr.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 && !_ignoredDownloadService.IgnoreDownload(trackedDownload))
|
if (!removeFromClient && !blocklist && !_ignoredDownloadService.IgnoreDownload(trackedDownload))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -817,7 +817,7 @@
|
||||||
"description": "Invalid API Key"
|
"description": "Invalid API Key"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": "Pushes commands to Radarr using a key:value pair. The main key is \"name\" and below are acceptable values but it can also accept other key:value pairs (listed under each command):\n\n* ApplicationUpdate - Trigger an update of Radarr\n* Backup - Trigger a backup routine\n* CheckHealth - Trigger a system health check\n* ClearBlacklist - Triggers the removal of all blacklisted movies\n* CleanUpRecycleBin - Trigger a recycle bin cleanup check\n* DeleteLogFiles - Triggers the removal of all Info/Debug/Trace log files\n* DeleteUpdateLogFiles - Triggers the removal of all Update log files\n* DownloadedMoviesScan - Triggers the scan of downloaded movies\n* MissingMoviesSearch - Triggers a search of all missing movies\n* RefreshMonitoredDownloads - Triggers the scan of monitored downloads\n* RefreshMovie - Trigger a refresh / scan of library\n * movieIds:int[] - Specify a list of ids (comma separated) for individual movies to refresh",
|
"description": "Pushes commands to Radarr using a key:value pair. The main key is \"name\" and below are acceptable values but it can also accept other key:value pairs (listed under each command):\n\n* ApplicationUpdate - Trigger an update of Radarr\n* Backup - Trigger a backup routine\n* CheckHealth - Trigger a system health check\n* ClearBlocklist - Triggers the removal of all blocklisted movies\n* CleanUpRecycleBin - Trigger a recycle bin cleanup check\n* DeleteLogFiles - Triggers the removal of all Info/Debug/Trace log files\n* DeleteUpdateLogFiles - Triggers the removal of all Update log files\n* DownloadedMoviesScan - Triggers the scan of downloaded movies\n* MissingMoviesSearch - Triggers a search of all missing movies\n* RefreshMonitoredDownloads - Triggers the scan of monitored downloads\n* RefreshMovie - Trigger a refresh / scan of library\n * movieIds:int[] - Specify a list of ids (comma separated) for individual movies to refresh",
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
"X-API-Key": []
|
"X-API-Key": []
|
||||||
|
@ -1650,11 +1650,11 @@
|
||||||
},
|
},
|
||||||
"parameters": []
|
"parameters": []
|
||||||
},
|
},
|
||||||
"/blacklist": {
|
"/blocklist": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Get Blacklisted Releases",
|
"summary": "Get Blocklisted Releases",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Blacklist"
|
"Blocklist"
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
|
@ -1686,7 +1686,7 @@
|
||||||
"records": {
|
"records": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/components/schemas/Blacklist"
|
"$ref": "#/components/schemas/Blocklist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1704,8 +1704,8 @@
|
||||||
"description": "Invalid API Key"
|
"description": "Invalid API Key"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"operationId": "get-blackList",
|
"operationId": "get-blockList",
|
||||||
"description": "Returns blacklisted releases",
|
"description": "Returns blocklisted releases",
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
"X-API-Key": []
|
"X-API-Key": []
|
||||||
|
@ -1751,8 +1751,8 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
"summary": "Delete a Blacklisted Release",
|
"summary": "Delete a Blocklisted Release",
|
||||||
"operationId": "delete-blackList",
|
"operationId": "delete-blockList",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "Successful request"
|
"description": "Successful request"
|
||||||
|
@ -1761,7 +1761,7 @@
|
||||||
"description": "Invalid API Key"
|
"description": "Invalid API Key"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": "Removes a specific release (the id provided) from the blacklist",
|
"description": "Removes a specific release (the id provided) from the blocklist",
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
"X-API-Key": []
|
"X-API-Key": []
|
||||||
|
@ -1781,16 +1781,16 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Blacklist"
|
"Blocklist"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"parameters": []
|
"parameters": []
|
||||||
},
|
},
|
||||||
"/blacklist/movie": {
|
"/blocklist/movie": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Get Blacklisted Releases for a Movie",
|
"summary": "Get Blocklisted Releases for a Movie",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Blacklist"
|
"Blocklist"
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
|
@ -1800,7 +1800,7 @@
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/components/schemas/Blacklist"
|
"$ref": "#/components/schemas/Blocklist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1810,8 +1810,8 @@
|
||||||
"description": "Unauthorized"
|
"description": "Unauthorized"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"operationId": "get-blacklist-movie",
|
"operationId": "get-blocklist-movie",
|
||||||
"description": "Retrieves blacklisted releases that are tied to a given movie in the database",
|
"description": "Retrieves blocklisted releases that are tied to a given movie in the database",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"schema": {
|
"schema": {
|
||||||
|
@ -1833,16 +1833,16 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/blacklist/bulk": {
|
"/blocklist/bulk": {
|
||||||
"delete": {
|
"delete": {
|
||||||
"summary": "Delete Blacklisted Releases",
|
"summary": "Delete Blocklisted Releases",
|
||||||
"operationId": "delete-blacklist-bulk",
|
"operationId": "delete-blocklist-bulk",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK"
|
"description": "OK"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": "Delete blacklisted releases in bulk",
|
"description": "Delete blocklisted releases in bulk",
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
"X-API-Key": []
|
"X-API-Key": []
|
||||||
|
@ -1857,7 +1857,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"ids": {
|
"ids": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Database ids of the blacklist items to delete",
|
"description": "Database ids of the blocklist items to delete",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
}
|
}
|
||||||
|
@ -1872,7 +1872,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
"Blacklist"
|
"Blocklist"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3314,7 +3314,7 @@
|
||||||
"description": "Invalid API Key"
|
"description": "Invalid API Key"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": "Remove an item from the queue and optionally blacklist it",
|
"description": "Remove an item from the queue and optionally blocklist it",
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
"X-API-Key": []
|
"X-API-Key": []
|
||||||
|
@ -3336,7 +3336,7 @@
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"in": "query",
|
"in": "query",
|
||||||
"name": "blacklist"
|
"name": "blocklist"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -3377,7 +3377,7 @@
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"in": "query",
|
"in": "query",
|
||||||
"name": "blacklist"
|
"name": "blocklist"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
|
@ -4732,7 +4732,7 @@
|
||||||
"id"
|
"id"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Blacklist": {
|
"Blocklist": {
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -4976,7 +4976,7 @@
|
||||||
"name": "History"
|
"name": "History"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Blacklist"
|
"name": "Blocklist"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Queue"
|
"name": "Queue"
|
||||||
|
@ -5009,4 +5009,4 @@
|
||||||
"name": "System"
|
"name": "System"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue