New: Renamed Blacklist to Blocklist

pull/6603/head
Robin Dadswell 3 years ago committed by Qstick
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 selectAll from 'Utilities/Table/selectAll';
import toggleSelected from 'Utilities/Table/toggleSelected';
import BlacklistRowConnector from './BlacklistRowConnector';
import BlocklistRowConnector from './BlocklistRowConnector';
class Blacklist extends Component {
class Blocklist extends Component {
//
// Lifecycle
@ -101,8 +101,8 @@ class Blacklist extends Component {
columns,
totalRecords,
isRemoving,
isClearingBlacklistExecuting,
onClearBlacklistPress,
isClearingBlocklistExecuting,
onClearBlocklistPress,
...otherProps
} = this.props;
@ -116,7 +116,7 @@ class Blacklist extends Component {
const selectedIds = this.getSelectedIds();
return (
<PageContent title={translate('Blacklist')}>
<PageContent title={translate('Blocklist')}>
<PageToolbar>
<PageToolbarSection>
<PageToolbarButton
@ -130,8 +130,8 @@ class Blacklist extends Component {
<PageToolbarButton
label={translate('Clear')}
iconName={icons.CLEAR}
isSpinning={isClearingBlacklistExecuting}
onPress={onClearBlacklistPress}
isSpinning={isClearingBlocklistExecuting}
onPress={onClearBlocklistPress}
/>
</PageToolbarSection>
@ -157,7 +157,7 @@ class Blacklist extends Component {
{
!isFetching && !!error &&
<div>
{translate('UnableToLoadBlacklist')}
{translate('UnableToLoadBlocklist')}
</div>
}
@ -183,7 +183,7 @@ class Blacklist extends Component {
{
items.map((item) => {
return (
<BlacklistRowConnector
<BlocklistRowConnector
key={item.id}
isSelected={selectedState[item.id] || false}
columns={columns}
@ -209,7 +209,7 @@ class Blacklist extends Component {
isOpen={isConfirmRemoveModalOpen}
kind={kinds.DANGER}
title={translate('RemoveSelected')}
message={translate('AreYouSureYouWantToRemoveTheSelectedItemsFromBlacklist')}
message={translate('AreYouSureYouWantToRemoveTheSelectedItemsFromBlocklist')}
confirmLabel={translate('RemoveSelected')}
onConfirm={this.onRemoveSelectedConfirmed}
onCancel={this.onConfirmRemoveModalClose}
@ -219,7 +219,7 @@ class Blacklist extends Component {
}
}
Blacklist.propTypes = {
Blocklist.propTypes = {
isFetching: PropTypes.bool.isRequired,
isPopulated: PropTypes.bool.isRequired,
error: PropTypes.object,
@ -227,9 +227,9 @@ Blacklist.propTypes = {
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
totalRecords: PropTypes.number,
isRemoving: PropTypes.bool.isRequired,
isClearingBlacklistExecuting: PropTypes.bool.isRequired,
isClearingBlocklistExecuting: PropTypes.bool.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 translate from 'Utilities/String/translate';
class BlacklistDetailsModal extends Component {
class BlocklistDetailsModal extends Component {
//
// Render
@ -78,7 +78,7 @@ class BlacklistDetailsModal extends Component {
}
}
BlacklistDetailsModal.propTypes = {
BlocklistDetailsModal.propTypes = {
isOpen: PropTypes.bool.isRequired,
sourceTitle: PropTypes.string.isRequired,
protocol: PropTypes.string.isRequired,
@ -87,4 +87,4 @@ BlacklistDetailsModal.propTypes = {
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 MovieTitleLink from 'Movie/MovieTitleLink';
import translate from 'Utilities/String/translate';
import BlacklistDetailsModal from './BlacklistDetailsModal';
import styles from './BlacklistRow.css';
import BlocklistDetailsModal from './BlocklistDetailsModal';
import styles from './BlocklistRow.css';
class BlacklistRow extends Component {
class BlocklistRow extends Component {
//
// Lifecycle
@ -166,7 +166,7 @@ class BlacklistRow extends Component {
/>
<IconButton
title={translate('RemoveFromBlacklist')}
title={translate('RemoveFromBlocklist')}
name={icons.REMOVE}
kind={kinds.DANGER}
onPress={onRemovePress}
@ -179,7 +179,7 @@ class BlacklistRow extends Component {
})
}
<BlacklistDetailsModal
<BlocklistDetailsModal
isOpen={this.state.isDetailsModalOpen}
sourceTitle={sourceTitle}
protocol={protocol}
@ -193,7 +193,7 @@ class BlacklistRow extends Component {
}
BlacklistRow.propTypes = {
BlocklistRow.propTypes = {
id: PropTypes.number.isRequired,
movie: PropTypes.object.isRequired,
sourceTitle: PropTypes.string.isRequired,
@ -210,4 +210,4 @@ BlacklistRow.propTypes = {
onRemovePress: PropTypes.func.isRequired
};
export default BlacklistRow;
export default BlocklistRow;

@ -1,8 +1,8 @@
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { removeBlacklistItem } from 'Store/Actions/blacklistActions';
import { removeBlocklistItem } from 'Store/Actions/blocklistActions';
import createMovieSelector from 'Store/Selectors/createMovieSelector';
import BlacklistRow from './BlacklistRow';
import BlocklistRow from './BlocklistRow';
function createMapStateToProps() {
return createSelector(
@ -18,9 +18,9 @@ function createMapStateToProps() {
function createMapDispatchToProps(dispatch, props) {
return {
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 });
}
onRemoveQueueItemModalConfirmed = (blacklist) => {
onRemoveQueueItemModalConfirmed = (blocklist) => {
const {
onRemoveQueueItemPress,
onQueueRowModalOpenOrClose
} = this.props;
onQueueRowModalOpenOrClose(false);
onRemoveQueueItemPress(blacklist);
onRemoveQueueItemPress(blocklist);
this.setState({ isRemoveQueueItemModalOpen: false });
}

@ -22,7 +22,7 @@ class RemoveQueueItemModal extends Component {
this.state = {
remove: true,
blacklist: false
blocklist: false
};
}
@ -32,7 +32,7 @@ class RemoveQueueItemModal extends Component {
resetState = function() {
this.setState({
remove: true,
blacklist: false
blocklist: false
});
}
@ -43,8 +43,8 @@ class RemoveQueueItemModal extends Component {
this.setState({ remove: value });
}
onBlacklistChange = ({ value }) => {
this.setState({ blacklist: value });
onBlocklistChange = ({ value }) => {
this.setState({ blocklist: value });
}
onRemoveConfirmed = () => {
@ -69,7 +69,7 @@ class RemoveQueueItemModal extends Component {
canIgnore
} = this.props;
const { remove, blacklist } = this.state;
const { remove, blocklist } = this.state;
return (
<Modal
@ -103,13 +103,13 @@ class RemoveQueueItemModal extends Component {
</FormGroup>
<FormGroup>
<FormLabel>{translate('BlacklistRelease')}</FormLabel>
<FormLabel>{translate('BlocklistRelease')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="blacklist"
value={blacklist}
helpText={translate('BlacklistHelpText')}
onChange={this.onBlacklistChange}
name="blocklist"
value={blocklist}
helpText={translate('BlocklistHelpText')}
onChange={this.onBlocklistChange}
/>
</FormGroup>

@ -23,7 +23,7 @@ class RemoveQueueItemsModal extends Component {
this.state = {
remove: true,
blacklist: false
blocklist: false
};
}
@ -33,7 +33,7 @@ class RemoveQueueItemsModal extends Component {
resetState = function() {
this.setState({
remove: true,
blacklist: false
blocklist: false
});
}
@ -44,8 +44,8 @@ class RemoveQueueItemsModal extends Component {
this.setState({ remove: value });
}
onBlacklistChange = ({ value }) => {
this.setState({ blacklist: value });
onBlocklistChange = ({ value }) => {
this.setState({ blocklist: value });
}
onRemoveConfirmed = () => {
@ -70,7 +70,7 @@ class RemoveQueueItemsModal extends Component {
canIgnore
} = this.props;
const { remove, blacklist } = this.state;
const { remove, blocklist } = this.state;
return (
<Modal
@ -105,15 +105,15 @@ class RemoveQueueItemsModal extends Component {
<FormGroup>
<FormLabel>
Blacklist Release{selectedCount > 1 ? 's' : ''}
Blocklist Release{selectedCount > 1 ? 's' : ''}
</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="blacklist"
value={blacklist}
helpText={translate('BlacklistHelpText')}
onChange={this.onBlacklistChange}
name="blocklist"
value={blocklist}
helpText={translate('BlocklistHelpText')}
onChange={this.onBlocklistChange}
/>
</FormGroup>

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
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 QueueConnector from 'Activity/Queue/QueueConnector';
import AddNewMovieConnector from 'AddMovie/AddNewMovie/AddNewMovieConnector';
@ -111,8 +111,8 @@ function AppRoutes(props) {
/>
<Route
path="/activity/blacklist"
component={BlacklistConnector}
path="/activity/blocklist"
component={BlocklistConnector}
/>
{/*

@ -1,7 +1,7 @@
export const APPLICATION_UPDATE = 'ApplicationUpdate';
export const BACKUP = 'Backup';
export const REFRESH_MONITORED_DOWNLOADS = 'RefreshMonitoredDownloads';
export const CLEAR_BLACKLIST = 'ClearBlacklist';
export const CLEAR_BLOCKLIST = 'ClearBlocklist';
export const CLEAR_LOGS = 'ClearLog';
export const CUTOFF_UNMET_MOVIES_SEARCH = 'CutoffUnmetMoviesSearch';
export const DELETE_LOG_FILES = 'DeleteLogFiles';

@ -61,8 +61,8 @@ const links = [
to: '/activity/history'
},
{
title: translate('Blacklist'),
to: '/activity/blacklist'
title: translate('Blocklist'),
to: '/activity/blocklist'
}
]
},

@ -225,4 +225,4 @@ export const UNSAVED_SETTING = farDotCircle;
export const VIEW = fasEye;
export const WARNING = fasExclamationTriangle;
export const WIKI = fasBookReader;
export const BLACKLIST = fasBan;
export const BLOCKLIST = fasBan;

@ -67,6 +67,6 @@
width: 75px;
}
.blacklist {
.blocklist {
margin-left: 5px;
}

@ -127,7 +127,7 @@ class InteractiveSearchRow extends Component {
grabError,
historyGrabbedData,
historyFailedData,
blacklistData
blocklistData
} = this.props;
return (
@ -221,12 +221,12 @@ class InteractiveSearchRow extends Component {
}
{
blacklistData?.date &&
blocklistData?.date &&
<Icon
className={historyGrabbedData || historyFailedData ? styles.blacklist : ''}
name={icons.BLACKLIST}
className={historyGrabbedData || historyFailedData ? styles.blocklist : ''}
name={icons.BLOCKLIST}
kind={kinds.DANGER}
title={`${translate('Blacklisted')}: ${formatDateTime(blacklistData.date, longDateFormat, timeFormat, { includeSeconds: true })}`}
title={`${translate('Blocklisted')}: ${formatDateTime(blocklistData.date, longDateFormat, timeFormat, { includeSeconds: true })}`}
/>
}
</TableRowCell>
@ -341,7 +341,7 @@ InteractiveSearchRow.propTypes = {
onGrabPress: PropTypes.func.isRequired,
historyFailedData: PropTypes.object,
historyGrabbedData: PropTypes.object,
blacklistData: PropTypes.object
blocklistData: PropTypes.object
};
InteractiveSearchRow.defaultProps = {

@ -8,22 +8,22 @@ function createMapStateToProps() {
return createSelector(
(state, { guid }) => guid,
(state) => state.movieHistory.items,
(state) => state.movieBlacklist.items,
(guid, movieHistory, movieBlacklist) => {
(state) => state.movieBlocklist.items,
(guid, movieHistory, movieBlocklist) => {
let blacklistData = {};
let blocklistData = {};
let historyFailedData = {};
const historyGrabbedData = movieHistory.find((movie) => movie.eventType === 'grabbed' && movie.data.guid === guid);
if (historyGrabbedData) {
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 {
historyGrabbedData,
historyFailedData,
blacklistData
blocklistData
};
}
);
@ -38,7 +38,7 @@ class InteractiveSearchRowConnector extends Component {
const {
historyGrabbedData,
historyFailedData,
blacklistData,
blocklistData,
...otherProps
} = this.props;
@ -46,7 +46,7 @@ class InteractiveSearchRowConnector extends Component {
<InteractiveSearchRow
historyGrabbedData={historyGrabbedData}
historyFailedData={historyFailedData}
blacklistData={blacklistData}
blocklistData={blocklistData}
{...otherProps}
/>
);
@ -56,7 +56,7 @@ class InteractiveSearchRowConnector extends Component {
InteractiveSearchRowConnector.propTypes = {
historyGrabbedData: PropTypes.object,
historyFailedData: PropTypes.object,
blacklistData: PropTypes.object
blocklistData: PropTypes.object
};
export default connect(createMapStateToProps)(InteractiveSearchRowConnector);

@ -8,7 +8,7 @@ import * as commandNames from 'Commands/commandNames';
import { executeCommand } from 'Store/Actions/commandActions';
import { clearExtraFiles, fetchExtraFiles } from 'Store/Actions/extraFileActions';
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 { clearMovieFiles, fetchMovieFiles } from 'Store/Actions/movieFileActions';
import { clearMovieHistory, fetchMovieHistory } from 'Store/Actions/movieHistoryActions';
@ -222,11 +222,11 @@ function createMapDispatchToProps(dispatch, props) {
onGoToMovie(titleSlug) {
dispatch(push(`${window.Radarr.urlBase}/movie/${titleSlug}`));
},
dispatchFetchMovieBlacklist({ movieId }) {
dispatch(fetchMovieBlacklist({ movieId }));
dispatchFetchMovieBlocklist({ movieId }) {
dispatch(fetchMovieBlocklist({ movieId }));
},
dispatchClearMovieBlacklist() {
dispatch(clearMovieBlacklist());
dispatchClearMovieBlocklist() {
dispatch(clearMovieBlocklist());
}
};
}
@ -280,7 +280,7 @@ class MovieDetailsConnector extends Component {
const movieId = this.props.id;
this.props.dispatchFetchMovieFiles({ movieId });
this.props.dispatchFetchMovieBlacklist({ movieId });
this.props.dispatchFetchMovieBlocklist({ movieId });
this.props.dispatchFetchMovieHistory({ movieId });
this.props.dispatchFetchExtraFiles({ movieId });
this.props.dispatchFetchMovieCredits({ movieId });
@ -290,7 +290,7 @@ class MovieDetailsConnector extends Component {
unpopulate = () => {
this.props.dispatchCancelFetchReleases();
this.props.dispatchClearMovieBlacklist();
this.props.dispatchClearMovieBlocklist();
this.props.dispatchClearMovieFiles();
this.props.dispatchClearMovieHistory();
this.props.dispatchClearExtraFiles();
@ -362,8 +362,8 @@ MovieDetailsConnector.propTypes = {
dispatchClearQueueDetails: PropTypes.func.isRequired,
dispatchFetchImportListSchema: PropTypes.func.isRequired,
dispatchExecuteCommand: PropTypes.func.isRequired,
dispatchFetchMovieBlacklist: PropTypes.func.isRequired,
dispatchClearMovieBlacklist: PropTypes.func.isRequired,
dispatchFetchMovieBlocklist: PropTypes.func.isRequired,
dispatchClearMovieBlocklist: PropTypes.func.isRequired,
onGoToMovie: PropTypes.func.isRequired
};

@ -6,10 +6,10 @@ import { fetchCustomFormatSpecifications } from 'Store/Actions/settingsActions';
import createProviderSettingsSelector from 'Store/Selectors/createProviderSettingsSelector';
import ExportCustomFormatModalContent from './ExportCustomFormatModalContent';
const blacklistedProperties = ['id', 'implementationName', 'infoLink'];
const omittedProperties = ['id', 'implementationName', 'infoLink'];
function replacer(key, value) {
if (blacklistedProperties.includes(key)) {
if (omittedProperties.includes(key)) {
return undefined;
}

@ -10,7 +10,7 @@ import {
import getSectionState from 'Utilities/State/getSectionState';
import updateSectionState from 'Utilities/State/updateSectionState';
const blacklistedProperties = [
const omittedProperties = [
'section',
'id'
];
@ -31,7 +31,7 @@ export default function createHandleActions(handlers, defaultState, section) {
if (section === baseSection) {
const newState = Object.assign(getSectionState(state, payloadSection),
_.omit(payload, blacklistedProperties));
_.omit(payload, omittedProperties));
return updateSectionState(state, payloadSection, newState);
}

@ -15,7 +15,7 @@ import createSetTableOptionReducer from './Creators/Reducers/createSetTableOptio
//
// Variables
export const section = 'blacklist';
export const section = 'blocklist';
//
// State
@ -83,41 +83,41 @@ export const defaultState = {
};
export const persistState = [
'blacklist.pageSize',
'blacklist.sortKey',
'blacklist.sortDirection',
'blacklist.columns'
'blocklist.pageSize',
'blocklist.sortKey',
'blocklist.sortDirection',
'blocklist.columns'
];
//
// Action Types
export const FETCH_BLACKLIST = 'blacklist/fetchBlacklist';
export const GOTO_FIRST_BLACKLIST_PAGE = 'blacklist/gotoBlacklistFirstPage';
export const GOTO_PREVIOUS_BLACKLIST_PAGE = 'blacklist/gotoBlacklistPreviousPage';
export const GOTO_NEXT_BLACKLIST_PAGE = 'blacklist/gotoBlacklistNextPage';
export const GOTO_LAST_BLACKLIST_PAGE = 'blacklist/gotoBlacklistLastPage';
export const GOTO_BLACKLIST_PAGE = 'blacklist/gotoBlacklistPage';
export const SET_BLACKLIST_SORT = 'blacklist/setBlacklistSort';
export const SET_BLACKLIST_TABLE_OPTION = 'blacklist/setBlacklistTableOption';
export const REMOVE_BLACKLIST_ITEM = 'blacklist/removeBlacklistItem';
export const REMOVE_BLACKLIST_ITEMS = 'blacklist/removeBlacklistItems';
export const CLEAR_BLACKLIST = 'blacklist/clearBlacklist';
export const FETCH_BLOCKLIST = 'blocklist/fetchBlocklist';
export const GOTO_FIRST_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistFirstPage';
export const GOTO_PREVIOUS_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistPreviousPage';
export const GOTO_NEXT_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistNextPage';
export const GOTO_LAST_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistLastPage';
export const GOTO_BLOCKLIST_PAGE = 'blocklist/gotoBlocklistPage';
export const SET_BLOCKLIST_SORT = 'blocklist/setBlocklistSort';
export const SET_BLOCKLIST_TABLE_OPTION = 'blocklist/setBlocklistTableOption';
export const REMOVE_BLOCKLIST_ITEM = 'blocklist/removeBlocklistItem';
export const REMOVE_BLOCKLIST_ITEMS = 'blocklist/removeBlocklistItems';
export const CLEAR_BLOCKLIST = 'blocklist/clearBlocklist';
//
// Action Creators
export const fetchBlacklist = createThunk(FETCH_BLACKLIST);
export const gotoBlacklistFirstPage = createThunk(GOTO_FIRST_BLACKLIST_PAGE);
export const gotoBlacklistPreviousPage = createThunk(GOTO_PREVIOUS_BLACKLIST_PAGE);
export const gotoBlacklistNextPage = createThunk(GOTO_NEXT_BLACKLIST_PAGE);
export const gotoBlacklistLastPage = createThunk(GOTO_LAST_BLACKLIST_PAGE);
export const gotoBlacklistPage = createThunk(GOTO_BLACKLIST_PAGE);
export const setBlacklistSort = createThunk(SET_BLACKLIST_SORT);
export const setBlacklistTableOption = createAction(SET_BLACKLIST_TABLE_OPTION);
export const removeBlacklistItem = createThunk(REMOVE_BLACKLIST_ITEM);
export const removeBlacklistItems = createThunk(REMOVE_BLACKLIST_ITEMS);
export const clearBlacklist = createAction(CLEAR_BLACKLIST);
export const fetchBlocklist = createThunk(FETCH_BLOCKLIST);
export const gotoBlocklistFirstPage = createThunk(GOTO_FIRST_BLOCKLIST_PAGE);
export const gotoBlocklistPreviousPage = createThunk(GOTO_PREVIOUS_BLOCKLIST_PAGE);
export const gotoBlocklistNextPage = createThunk(GOTO_NEXT_BLOCKLIST_PAGE);
export const gotoBlocklistLastPage = createThunk(GOTO_LAST_BLOCKLIST_PAGE);
export const gotoBlocklistPage = createThunk(GOTO_BLOCKLIST_PAGE);
export const setBlocklistSort = createThunk(SET_BLOCKLIST_SORT);
export const setBlocklistTableOption = createAction(SET_BLOCKLIST_TABLE_OPTION);
export const removeBlocklistItem = createThunk(REMOVE_BLOCKLIST_ITEM);
export const removeBlocklistItems = createThunk(REMOVE_BLOCKLIST_ITEMS);
export const clearBlocklist = createAction(CLEAR_BLOCKLIST);
//
// Action Handlers
@ -125,21 +125,21 @@ export const clearBlacklist = createAction(CLEAR_BLACKLIST);
export const actionHandlers = handleThunks({
...createServerSideCollectionHandlers(
section,
'/blacklist',
fetchBlacklist,
'/blocklist',
fetchBlocklist,
{
[serverSideCollectionHandlers.FETCH]: FETCH_BLACKLIST,
[serverSideCollectionHandlers.FIRST_PAGE]: GOTO_FIRST_BLACKLIST_PAGE,
[serverSideCollectionHandlers.PREVIOUS_PAGE]: GOTO_PREVIOUS_BLACKLIST_PAGE,
[serverSideCollectionHandlers.NEXT_PAGE]: GOTO_NEXT_BLACKLIST_PAGE,
[serverSideCollectionHandlers.LAST_PAGE]: GOTO_LAST_BLACKLIST_PAGE,
[serverSideCollectionHandlers.EXACT_PAGE]: GOTO_BLACKLIST_PAGE,
[serverSideCollectionHandlers.SORT]: SET_BLACKLIST_SORT
[serverSideCollectionHandlers.FETCH]: FETCH_BLOCKLIST,
[serverSideCollectionHandlers.FIRST_PAGE]: GOTO_FIRST_BLOCKLIST_PAGE,
[serverSideCollectionHandlers.PREVIOUS_PAGE]: GOTO_PREVIOUS_BLOCKLIST_PAGE,
[serverSideCollectionHandlers.NEXT_PAGE]: GOTO_NEXT_BLOCKLIST_PAGE,
[serverSideCollectionHandlers.LAST_PAGE]: GOTO_LAST_BLOCKLIST_PAGE,
[serverSideCollectionHandlers.EXACT_PAGE]: GOTO_BLOCKLIST_PAGE,
[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 {
ids
} = payload;
@ -157,7 +157,7 @@ export const actionHandlers = handleThunks({
]));
const promise = createAjaxRequest({
url: '/blacklist/bulk',
url: '/blocklist/bulk',
method: 'DELETE',
dataType: 'json',
data: JSON.stringify({ ids })
@ -165,7 +165,7 @@ export const actionHandlers = handleThunks({
promise.done((data) => {
// Don't use batchActions with thunks
dispatch(fetchBlacklist());
dispatch(fetchBlocklist());
dispatch(set({ section, isRemoving: false }));
});
@ -191,9 +191,9 @@ export const actionHandlers = handleThunks({
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,
isPopulated: false,
error: null,

@ -1,6 +1,6 @@
import * as addMovie from './addMovieActions';
import * as app from './appActions';
import * as blacklist from './blacklistActions';
import * as blocklist from './blocklistActions';
import * as calendar from './calendarActions';
import * as captcha from './captchaActions';
import * as commands from './commandActions';
@ -11,7 +11,7 @@ import * as history from './historyActions';
import * as importMovie from './importMovieActions';
import * as interactiveImportActions from './interactiveImportActions';
import * as movies from './movieActions';
import * as movieBlacklist from './movieBlacklistActions';
import * as movieBlocklist from './movieBlocklistActions';
import * as movieCredits from './movieCreditsActions';
import * as movieFiles from './movieFileActions';
import * as movieHistory from './movieHistoryActions';
@ -30,7 +30,7 @@ import * as tags from './tagActions';
export default [
addMovie,
app,
blacklist,
blocklist,
calendar,
captcha,
commands,
@ -49,7 +49,7 @@ export default [
releases,
rootFolders,
movies,
movieBlacklist,
movieBlocklist,
movieHistory,
movieIndex,
movieCredits,

@ -8,7 +8,7 @@ import createHandleActions from './Creators/createHandleActions';
//
// Variables
export const section = 'movieBlacklist';
export const section = 'movieBlocklist';
//
// State
@ -23,25 +23,25 @@ export const defaultState = {
//
// Actions Types
export const FETCH_MOVIE_BLACKLIST = 'movieBlacklist/fetchMovieBlacklist';
export const CLEAR_MOVIE_BLACKLIST = 'movieBlacklist/clearMovieBlacklist';
export const FETCH_MOVIE_BLOCKLIST = 'movieBlocklist/fetchMovieBlocklist';
export const CLEAR_MOVIE_BLOCKLIST = 'movieBlocklist/clearMovieBlocklist';
//
// Action Creators
export const fetchMovieBlacklist = createThunk(FETCH_MOVIE_BLACKLIST);
export const clearMovieBlacklist = createAction(CLEAR_MOVIE_BLACKLIST);
export const fetchMovieBlocklist = createThunk(FETCH_MOVIE_BLOCKLIST);
export const clearMovieBlocklist = createAction(CLEAR_MOVIE_BLOCKLIST);
//
// Action Handlers
export const actionHandlers = handleThunks({
[FETCH_MOVIE_BLACKLIST]: function(getState, payload, dispatch) {
[FETCH_MOVIE_BLOCKLIST]: function(getState, payload, dispatch) {
dispatch(set({ section, isFetching: true }));
const promise = createAjaxRequest({
url: '/blacklist/movie',
url: '/blocklist/movie',
data: payload
}).request;
@ -74,7 +74,7 @@ export const actionHandlers = handleThunks({
export const reducers = createHandleActions({
[CLEAR_MOVIE_BLACKLIST]: (state) => {
[CLEAR_MOVIE_BLOCKLIST]: (state) => {
return Object.assign({}, state, defaultState);
}

@ -354,13 +354,13 @@ export const actionHandlers = handleThunks({
const {
id,
remove,
blacklist
blocklist
} = payload;
dispatch(updateItem({ section: paged, id, isRemoving: true }));
const promise = createAjaxRequest({
url: `/queue/${id}?removeFromClient=${remove}&blacklist=${blacklist}`,
url: `/queue/${id}?removeFromClient=${remove}&blocklist=${blocklist}`,
method: 'DELETE'
}).request;
@ -377,7 +377,7 @@ export const actionHandlers = handleThunks({
const {
ids,
remove,
blacklist
blocklist
} = payload;
dispatch(batchActions([
@ -393,7 +393,7 @@ export const actionHandlers = handleThunks({
]));
const promise = createAjaxRequest({
url: `/queue/bulk?removeFromClient=${remove}&blacklist=${blacklist}`,
url: `/queue/bulk?removeFromClient=${remove}&blocklist=${blocklist}`,
method: 'DELETE',
dataType: 'json',
data: JSON.stringify({ ids })

@ -1,6 +1,7 @@
import _ from 'lodash';
import persistState from 'redux-localstorage';
import actions from 'Store/Actions';
import migrate from 'Store/Migrators/migrate';
const columnPaths = [];
@ -98,6 +99,7 @@ const config = {
export default function createPersistState() {
// Migrate existing local storage before proceeding
const persistedState = JSON.parse(localStorage.getItem(config.key));
migrate(persistedState);
localStorage.setItem(config.key, serialize(persistedState));
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("History")).Should().NotBeNull();
_page.Find(By.LinkText("Blacklist")).Should().NotBeNull();
_page.Find(By.LinkText("Blocklist")).Should().NotBeNull();
}
[Test]

@ -4,25 +4,25 @@ using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Blacklisting
namespace NzbDrone.Core.Test.Blocklisting
{
[TestFixture]
public class BlacklistRepositoryFixture : DbTest<BlacklistRepository, Blacklist>
public class BlocklistRepositoryFixture : DbTest<BlocklistRepository, Blocklist>
{
private Blacklist _blacklist;
private Blocklist _blocklist;
private Movie _movie1;
private Movie _movie2;
[SetUp]
public void Setup()
{
_blacklist = new Blacklist
_blocklist = new Blocklist
{
MovieId = 1234,
Quality = new QualityModel(),
@ -43,30 +43,30 @@ namespace NzbDrone.Core.Test.Blacklisting
[Test]
public void should_be_able_to_write_to_database()
{
Subject.Insert(_blacklist);
Subject.Insert(_blocklist);
Subject.All().Should().HaveCount(1);
}
[Test]
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]
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]
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)
.With(c => c.MovieId = _movie2.Id)
.TheRest()
@ -77,15 +77,15 @@ namespace NzbDrone.Core.Test.Blacklisting
.With(c => c.Id = 0)
.BuildListOfNew();
Db.InsertMany(blacklistItems);
Db.InsertMany(blocklistItems);
Subject.DeleteForMovies(new List<int> { _movie1.Id });
var removedMovieBlacklists = Subject.BlacklistedByMovie(_movie1.Id);
var nonRemovedMovieBlacklists = Subject.BlacklistedByMovie(_movie2.Id);
var removedMovieBlocklists = Subject.BlocklistedByMovie(_movie1.Id);
var nonRemovedMovieBlocklists = Subject.BlocklistedByMovie(_movie2.Id);
removedMovieBlacklists.Should().HaveCount(0);
nonRemovedMovieBlacklists.Should().HaveCount(1);
removedMovieBlocklists.Should().HaveCount(0);
nonRemovedMovieBlocklists.Should().HaveCount(1);
}
}
}

@ -1,15 +1,15 @@
using System;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Download;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Blacklisting
namespace NzbDrone.Core.Test.Blocklisting
{
[TestFixture]
public class BlacklistServiceFixture : CoreTest<BlacklistService>
public class BlocklistServiceFixture : CoreTest<BlocklistService>
{
private DownloadFailedEvent _event;
@ -37,8 +37,8 @@ namespace NzbDrone.Core.Test.Blacklisting
{
Subject.Handle(_event);
Mocker.GetMock<IBlacklistRepository>()
.Verify(v => v.Insert(It.Is<Blacklist>(b => b.MovieId == _event.MovieId)), Times.Once());
Mocker.GetMock<IBlocklistRepository>()
.Verify(v => v.Insert(It.Is<Blocklist>(b => b.MovieId == _event.MovieId)), Times.Once());
}
[Test]
@ -49,8 +49,8 @@ namespace NzbDrone.Core.Test.Blacklisting
_event.Data.Remove("size");
_event.Data.Remove("protocol");
Mocker.GetMock<IBlacklistRepository>()
.Verify(v => v.Insert(It.Is<Blacklist>(b => b.MovieId == _event.MovieId)), Times.Once());
Mocker.GetMock<IBlocklistRepository>()
.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>
</item>
</channel>
</rss>
</rss>

@ -2,7 +2,7 @@ using System.Collections.Generic;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Housekeeping.Housekeepers;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Movies;
@ -12,37 +12,37 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
{
[TestFixture]
public class CleanupOrphanedBlacklistFixture : DbTest<CleanupOrphanedBlacklist, Blacklist>
public class CleanupOrphanedBlocklistFixture : DbTest<CleanupOrphanedBlocklist, Blocklist>
{
[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.Quality = new QualityModel())
.With(h => h.Languages = new List<Language>())
.BuildNew();
Db.Insert(blacklist);
Db.Insert(blocklist);
Subject.Clean();
AllStoredModels.Should().BeEmpty();
}
[Test]
public void should_not_delete_unorphaned_blacklist_items()
public void should_not_delete_unorphaned_blocklist_items()
{
var movie = Builder<Movie>.CreateNew().BuildNew();
Db.Insert(movie);
var blacklist = Builder<Blacklist>.CreateNew()
var blocklist = Builder<Blocklist>.CreateNew()
.With(h => h.MovieId = default)
.With(h => h.Quality = new QualityModel())
.With(h => h.Languages = new List<Language>())
.With(b => b.MovieId = movie.Id)
.BuildNew();
Db.Insert(blacklist);
Db.Insert(blocklist);
Subject.Clean();
AllStoredModels.Should().HaveCount(1);

@ -47,25 +47,25 @@ namespace NzbDrone.Core.Test.MetadataSource
}
[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("Blacklist");
WithSeries("The Blocklist");
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]
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("The Blacklist");
WithSeries("Blocklist");
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.Qualities;
namespace NzbDrone.Core.Blacklisting
namespace NzbDrone.Core.Blocklisting
{
public class Blacklist : ModelBase
public class Blocklist : ModelBase
{
public int MovieId { get; set; }
public Movie Movie { get; set; }

@ -3,34 +3,34 @@ using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
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<Blacklist> BlacklistedByTorrentInfoHash(int movieId, string torrentInfoHash);
List<Blacklist> BlacklistedByMovie(int movieId);
List<Blocklist> BlocklistedByTitle(int movieId, string sourceTitle);
List<Blocklist> BlocklistedByTorrentInfoHash(int movieId, string torrentInfoHash);
List<Blocklist> BlocklistedByMovie(int movieId);
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)
{
}
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));
}
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));
}
public List<Blacklist> BlacklistedByMovie(int movieId)
public List<Blocklist> BlocklistedByMovie(int movieId)
{
return Query(x => x.MovieId == movieId);
}
@ -40,8 +40,8 @@ namespace NzbDrone.Core.Blacklisting
Delete(x => movieIds.Contains(x.MovieId));
}
protected override SqlBuilder PagedBuilder() => new SqlBuilder().Join<Blacklist, Movie>((b, m) => b.MovieId == m.Id);
protected override IEnumerable<Blacklist> PagedQuery(SqlBuilder sql) => _database.QueryJoined<Blacklist, Movie>(sql, (bl, movie) =>
protected override SqlBuilder PagedBuilder() => new SqlBuilder().Join<Blocklist, Movie>((b, m) => b.MovieId == m.Id);
protected override IEnumerable<Blocklist> PagedQuery(SqlBuilder sql) => _database.QueryJoined<Blocklist, Movie>(sql, (bl, movie) =>
{
bl.Movie = movie;
return bl;

@ -10,33 +10,33 @@ using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies.Events;
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);
PagingSpec<Blacklist> Paged(PagingSpec<Blacklist> pagingSpec);
List<Blacklist> GetByMovieId(int movieId);
bool Blocklisted(int movieId, ReleaseInfo release);
PagingSpec<Blocklist> Paged(PagingSpec<Blocklist> pagingSpec);
List<Blocklist> GetByMovieId(int movieId);
void Delete(int id);
void Delete(List<int> ids);
}
public class BlacklistService : IBlacklistService,
public class BlocklistService : IBlocklistService,
IExecute<ClearBlacklistCommand>,
IExecute<ClearBlocklistCommand>,
IHandle<DownloadFailedEvent>,
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)
{
@ -49,40 +49,40 @@ namespace NzbDrone.Core.Blacklisting
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));
}
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));
}
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)
{
_blacklistRepository.Delete(id);
_blocklistRepository.Delete(id);
}
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)
{
@ -99,7 +99,7 @@ namespace NzbDrone.Core.Blacklisting
return false;
}
private bool SameTorrent(Blacklist item, TorrentInfo release)
private bool SameTorrent(Blocklist item, TorrentInfo release)
{
if (release.InfoHash.IsNotNullOrWhiteSpace())
{
@ -109,7 +109,7 @@ namespace NzbDrone.Core.Blacklisting
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())
{
@ -119,7 +119,7 @@ namespace NzbDrone.Core.Blacklisting
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)
{
@ -130,7 +130,7 @@ namespace NzbDrone.Core.Blacklisting
item.PublishedDate.Value.AddMinutes(2) >= publishedDate;
}
private bool HasSameSize(Blacklist item, long size)
private bool HasSameSize(Blocklist item, long size)
{
if (!item.Size.HasValue)
{
@ -142,14 +142,14 @@ namespace NzbDrone.Core.Blacklisting
return difference <= 2.Megabytes();
}
public void Execute(ClearBlacklistCommand message)
public void Execute(ClearBlocklistCommand message)
{
_blacklistRepository.Purge();
_blocklistRepository.Purge();
}
public void Handle(DownloadFailedEvent message)
{
var blacklist = new Blacklist
var blocklist = new Blocklist
{
MovieId = message.MovieId,
SourceTitle = message.SourceTitle,
@ -166,15 +166,15 @@ namespace NzbDrone.Core.Blacklisting
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)
{
_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;
namespace NzbDrone.Core.Blacklisting
namespace NzbDrone.Core.Blocklisting
{
public class ClearBlacklistCommand : Command
public class ClearBlocklistCommand : Command
{
public override bool SendUpdatesToClient => true;
}

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.History;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Movies;
@ -16,7 +16,7 @@ namespace NzbDrone.Core.CustomFormats
{
List<CustomFormat> ParseCustomFormat(ParsedMovieInfo movieInfo);
List<CustomFormat> ParseCustomFormat(MovieFile movieFile);
List<CustomFormat> ParseCustomFormat(Blacklist blacklist);
List<CustomFormat> ParseCustomFormat(Blocklist blocklist);
List<CustomFormat> ParseCustomFormat(MovieHistory history);
}
@ -105,25 +105,25 @@ namespace NzbDrone.Core.CustomFormats
return ParseCustomFormat(movieFile, _formatService.All());
}
public List<CustomFormat> ParseCustomFormat(Blacklist blacklist)
public List<CustomFormat> ParseCustomFormat(Blocklist blocklist)
{
var movie = _movieService.GetMovie(blacklist.MovieId);
var parsed = _parsingService.ParseMovieInfo(blacklist.SourceTitle, null);
var movie = _movieService.GetMovie(blocklist.MovieId);
var parsed = _parsingService.ParseMovieInfo(blocklist.SourceTitle, null);
var info = new ParsedMovieInfo
{
MovieTitle = movie.Title,
SimpleReleaseTitle = parsed?.SimpleReleaseTitle ?? blacklist.SourceTitle.SimplifyReleaseTitle(),
Quality = blacklist.Quality,
Languages = blacklist.Languages,
SimpleReleaseTitle = parsed?.SimpleReleaseTitle ?? blocklist.SourceTitle.SimplifyReleaseTitle(),
Quality = blocklist.Quality,
Languages = blocklist.Languages,
ReleaseGroup = parsed?.ReleaseGroup,
Edition = parsed?.Edition,
Year = movie.Year,
ImdbId = movie.ImdbId,
ExtraInfo = new Dictionary<string, object>
{
{ "IndexerFlags", blacklist.IndexerFlags },
{ "Size", blacklist.Size }
{ "IndexerFlags", blocklist.IndexerFlags },
{ "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 NzbDrone.Common.Reflection;
using NzbDrone.Core.Authentication;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.CustomFilters;
using NzbDrone.Core.CustomFormats;
@ -129,7 +129,7 @@ namespace NzbDrone.Core.Datastore
Mapper.Entity<Profile>("Profiles").RegisterModel();
Mapper.Entity<Log>("Logs").RegisterModel();
Mapper.Entity<NamingConfig>("NamingConfig").RegisterModel();
Mapper.Entity<Blacklist>("Blacklist").RegisterModel();
Mapper.Entity<Blocklist>("Blocklist").RegisterModel();
Mapper.Entity<MetadataFile>("MetadataFiles").RegisterModel();
Mapper.Entity<SubtitleFile>("SubtitleFiles").RegisterModel();
Mapper.Entity<OtherExtraFile>("ExtraFiles").RegisterModel();

@ -1,18 +1,18 @@
using NLog;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Blocklisting;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
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;
public BlacklistSpecification(IBlacklistService blacklistService, Logger logger)
public BlocklistSpecification(IBlocklistService blocklistService, Logger logger)
{
_blacklistService = blacklistService;
_blocklistService = blocklistService;
_logger = logger;
}
@ -21,10 +21,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
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);
return Decision.Reject("Release is blacklisted");
_logger.Debug("{0} is blocklisted, rejecting.", subject.Release.Title);
return Decision.Reject("Release is blocklisted");
}
return Decision.Accept();

@ -3,11 +3,11 @@ using NzbDrone.Core.Datastore;
namespace NzbDrone.Core.Housekeeping.Housekeepers
{
public class CleanupOrphanedBlacklist : IHousekeepingTask
public class CleanupOrphanedBlocklist : IHousekeepingTask
{
private readonly IMainDatabase _database;
public CleanupOrphanedBlacklist(IMainDatabase database)
public CleanupOrphanedBlocklist(IMainDatabase database)
{
_database = database;
}
@ -16,11 +16,11 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{
using (var mapper = _database.OpenConnection())
{
mapper.Execute(@"DELETE FROM Blacklist
mapper.Execute(@"DELETE FROM Blocklist
WHERE Id IN (
SELECT Blacklist.Id FROM Blacklist
SELECT Blocklist.Id FROM Blocklist
LEFT OUTER JOIN Movies
ON Blacklist.MovieId = Movies.Id
ON Blocklist.MovieId = Movies.Id
WHERE Movies.Id IS NULL)");
}
}

@ -63,7 +63,7 @@
"AreYouSureYouWantToDeleteThisImportListExclusion": "Are you sure you want to delete this import list exclusion?",
"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?",
"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?",
"AsAllDayHelpText": "Events will appear as all-day events in your calendar",
"AudioInfo": "Audio Info",
@ -86,10 +86,10 @@
"BeforeUpdate": "Before update",
"BindAddress": "Bind Address",
"BindAddressHelpText": "Valid IP4 address or '*' for all interfaces",
"Blacklist": "Blacklist",
"Blacklisted": "Blacklisted",
"BlacklistHelpText": "Prevents Radarr from automatically grabbing this release again",
"BlacklistRelease": "Blacklist Release",
"Blocklist": "Blocklist",
"Blocklisted": "Blocklisted",
"BlocklistHelpText": "Prevents Radarr from automatically grabbing this release again",
"BlocklistRelease": "Blocklist Release",
"Branch": "Branch",
"BranchUpdate": "Branch to use to update Radarr",
"BranchUpdateMechanism": "Branch used by external update mechanism",
@ -788,7 +788,7 @@
"RemovedMovieCheckSingleMessage": "Movie {0} was removed from TMDb",
"RemoveFailedDownloadsHelpText": "Remove failed downloads from download client history",
"RemoveFilter": "Remove filter",
"RemoveFromBlacklist": "Remove from blacklist",
"RemoveFromBlocklist": "Remove from blocklist",
"RemoveFromDownloadClient": "Remove From Download Client",
"RemoveFromQueue": "Remove from 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",
"UnableToLoadAltTitle": "Unable to load alternative titles.",
"UnableToLoadBackups": "Unable to load backups",
"UnableToLoadBlacklist": "Unable to load blacklist",
"UnableToLoadBlocklist": "Unable to load blocklist",
"UnableToLoadCustomFormats": "Unable to load Custom Formats",
"UnableToLoadDelayProfiles": "Unable to load Delay Profiles",
"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.SignalR;
using NzbDrone.Test.Common.Categories;
using Radarr.Api.V3.Blacklist;
using Radarr.Api.V3.Blocklist;
using Radarr.Api.V3.Config;
using Radarr.Api.V3.DownloadClient;
using Radarr.Api.V3.History;
@ -36,7 +36,7 @@ namespace NzbDrone.Integration.Test
{
protected RestClient RestClient { get; private set; }
public ClientBase<BlacklistResource> Blacklist;
public ClientBase<BlocklistResource> Blocklist;
public CommandClient Commands;
public ClientBase<TaskResource> Tasks;
public DownloadClientClient DownloadClients;
@ -98,7 +98,7 @@ namespace NzbDrone.Integration.Test
RestClient.AddDefaultHeader("Authentication", ApiKey);
RestClient.AddDefaultHeader("X-Api-Key", ApiKey);
Blacklist = new ClientBase<BlacklistResource>(RestClient, ApiKey);
Blocklist = new ClientBase<BlocklistResource>(RestClient, ApiKey);
Commands = new CommandClient(RestClient, ApiKey);
Tasks = new ClientBase<TaskResource>(RestClient, ApiKey, "system/task");
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;
namespace Radarr.Api.V3.Blacklist
namespace Radarr.Api.V3.Blocklist
{
public class BlacklistBulkResource
public class BlocklistBulkResource
{
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.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 string SourceTitle { get; set; }
@ -25,16 +25,16 @@ namespace Radarr.Api.V3.Blacklist
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)
{
return null;
}
return new BlacklistResource
return new BlocklistResource
{
Id = model.Id,

@ -79,9 +79,9 @@ namespace Radarr.Api.V3.Queue
private object Remove(int id)
{
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)
{
@ -94,14 +94,14 @@ namespace Radarr.Api.V3.Queue
private object Remove()
{
var removeFromClient = Request.GetBooleanQueryParameter("removeFromClient", true);
var blacklist = Request.GetBooleanQueryParameter("blacklist");
var blocklist = Request.GetBooleanQueryParameter("blocklist");
var resource = Request.Body.FromJson<QueueBulkResource>();
var trackedDownloadIds = new List<string>();
foreach (var id in resource.Ids)
{
var trackedDownload = Remove(id, removeFromClient, blacklist);
var trackedDownload = Remove(id, removeFromClient, blocklist);
if (trackedDownload != null)
{
@ -114,7 +114,7 @@ namespace Radarr.Api.V3.Queue
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);
@ -144,12 +144,12 @@ namespace Radarr.Api.V3.Queue
downloadClient.RemoveItem(trackedDownload.DownloadItem, true);
}
if (blacklist)
if (blocklist)
{
_failedDownloadService.MarkAsFailed(trackedDownload.DownloadItem.DownloadId);
}
if (!removeFromClient && !blacklist && !_ignoredDownloadService.IgnoreDownload(trackedDownload))
if (!removeFromClient && !blocklist && !_ignoredDownloadService.IgnoreDownload(trackedDownload))
{
return null;
}

@ -817,7 +817,7 @@
"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": [
{
"X-API-Key": []
@ -1650,11 +1650,11 @@
},
"parameters": []
},
"/blacklist": {
"/blocklist": {
"get": {
"summary": "Get Blacklisted Releases",
"summary": "Get Blocklisted Releases",
"tags": [
"Blacklist"
"Blocklist"
],
"responses": {
"200": {
@ -1686,7 +1686,7 @@
"records": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Blacklist"
"$ref": "#/components/schemas/Blocklist"
}
}
},
@ -1704,8 +1704,8 @@
"description": "Invalid API Key"
}
},
"operationId": "get-blackList",
"description": "Returns blacklisted releases",
"operationId": "get-blockList",
"description": "Returns blocklisted releases",
"security": [
{
"X-API-Key": []
@ -1751,8 +1751,8 @@
]
},
"delete": {
"summary": "Delete a Blacklisted Release",
"operationId": "delete-blackList",
"summary": "Delete a Blocklisted Release",
"operationId": "delete-blockList",
"responses": {
"200": {
"description": "Successful request"
@ -1761,7 +1761,7 @@
"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": [
{
"X-API-Key": []
@ -1781,16 +1781,16 @@
}
],
"tags": [
"Blacklist"
"Blocklist"
]
},
"parameters": []
},
"/blacklist/movie": {
"/blocklist/movie": {
"get": {
"summary": "Get Blacklisted Releases for a Movie",
"summary": "Get Blocklisted Releases for a Movie",
"tags": [
"Blacklist"
"Blocklist"
],
"responses": {
"200": {
@ -1800,7 +1800,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Blacklist"
"$ref": "#/components/schemas/Blocklist"
}
}
}
@ -1810,8 +1810,8 @@
"description": "Unauthorized"
}
},
"operationId": "get-blacklist-movie",
"description": "Retrieves blacklisted releases that are tied to a given movie in the database",
"operationId": "get-blocklist-movie",
"description": "Retrieves blocklisted releases that are tied to a given movie in the database",
"parameters": [
{
"schema": {
@ -1833,16 +1833,16 @@
]
}
},
"/blacklist/bulk": {
"/blocklist/bulk": {
"delete": {
"summary": "Delete Blacklisted Releases",
"operationId": "delete-blacklist-bulk",
"summary": "Delete Blocklisted Releases",
"operationId": "delete-blocklist-bulk",
"responses": {
"200": {
"description": "OK"
}
},
"description": "Delete blacklisted releases in bulk",
"description": "Delete blocklisted releases in bulk",
"security": [
{
"X-API-Key": []
@ -1857,7 +1857,7 @@
"properties": {
"ids": {
"type": "array",
"description": "Database ids of the blacklist items to delete",
"description": "Database ids of the blocklist items to delete",
"items": {
"type": "integer"
}
@ -1872,7 +1872,7 @@
}
},
"tags": [
"Blacklist"
"Blocklist"
]
}
},
@ -3314,7 +3314,7 @@
"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": [
{
"X-API-Key": []
@ -3336,7 +3336,7 @@
"type": "boolean"
},
"in": "query",
"name": "blacklist"
"name": "blocklist"
}
],
"tags": [
@ -3377,7 +3377,7 @@
"type": "boolean"
},
"in": "query",
"name": "blacklist"
"name": "blocklist"
}
],
"requestBody": {
@ -4732,7 +4732,7 @@
"id"
]
},
"Blacklist": {
"Blocklist": {
"description": "",
"type": "object",
"properties": {
@ -4976,7 +4976,7 @@
"name": "History"
},
{
"name": "Blacklist"
"name": "Blocklist"
},
{
"name": "Queue"
@ -5009,4 +5009,4 @@
"name": "System"
}
]
}
}

Loading…
Cancel
Save