1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-17 21:26:22 -04:00

New: Calculate custom formats on demand

This commit is contained in:
ta264
2020-01-22 21:47:33 +00:00
parent 13701498ce
commit df101258c5
103 changed files with 1901 additions and 1346 deletions

View File

@@ -44,6 +44,7 @@ class BlacklistRow extends Component {
movie,
sourceTitle,
quality,
customFormats,
languages,
date,
protocol,
@@ -112,11 +113,11 @@ class BlacklistRow extends Component {
);
}
if (name === 'quality.customFormats') {
if (name === 'customFormats') {
return (
<TableRowCell key={name}>
<MovieFormats
formats={quality.customFormats}
formats={customFormats}
/>
</TableRowCell>
);
@@ -186,6 +187,7 @@ BlacklistRow.propTypes = {
movie: PropTypes.object.isRequired,
sourceTitle: PropTypes.string.isRequired,
quality: PropTypes.object.isRequired,
customFormats: PropTypes.arrayOf(PropTypes.object).isRequired,
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
date: PropTypes.string.isRequired,
protocol: PropTypes.string.isRequired,

View File

@@ -54,6 +54,7 @@ class HistoryRow extends Component {
const {
movie,
quality,
customFormats,
languages,
qualityCutoffNotMet,
eventType,
@@ -126,11 +127,11 @@ class HistoryRow extends Component {
);
}
if (name === 'quality.customFormats') {
if (name === 'customFormats') {
return (
<TableRowCell key={name}>
<MovieFormats
formats={quality.customFormats}
formats={customFormats}
/>
</TableRowCell>
);
@@ -219,6 +220,7 @@ HistoryRow.propTypes = {
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
quality: PropTypes.object.isRequired,
qualityCutoffNotMet: PropTypes.bool.isRequired,
customFormats: PropTypes.arrayOf(PropTypes.object).isRequired,
eventType: PropTypes.string.isRequired,
sourceTitle: PropTypes.string.isRequired,
date: PropTypes.string.isRequired,

View File

@@ -72,6 +72,7 @@ class QueueRow extends Component {
errorMessage,
movie,
quality,
customFormats,
languages,
protocol,
indexer,
@@ -169,11 +170,11 @@ class QueueRow extends Component {
);
}
if (name === 'quality.customFormats') {
if (name === 'customFormats') {
return (
<TableRowCell key={name}>
<MovieFormats
formats={quality.customFormats}
formats={customFormats}
/>
</TableRowCell>
);
@@ -329,6 +330,7 @@ QueueRow.propTypes = {
errorMessage: PropTypes.string,
movie: PropTypes.object,
quality: PropTypes.object.isRequired,
customFormats: PropTypes.arrayOf(PropTypes.object),
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
protocol: PropTypes.string.isRequired,
indexer: PropTypes.string,

View File

@@ -113,6 +113,7 @@ class InteractiveSearchRow extends Component {
seeders,
leechers,
quality,
customFormats,
languages,
indexerFlags,
rejections,
@@ -177,7 +178,7 @@ class InteractiveSearchRow extends Component {
<TableRowCell className={styles.customFormat}>
<MovieFormats
formats={quality.customFormats}
formats={customFormats}
/>
</TableRowCell>
@@ -279,6 +280,7 @@ InteractiveSearchRow.propTypes = {
seeders: PropTypes.number,
leechers: PropTypes.number,
quality: PropTypes.object.isRequired,
customFormats: PropTypes.arrayOf(PropTypes.object).isRequired,
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
rejections: PropTypes.arrayOf(PropTypes.string).isRequired,
indexerFlags: PropTypes.arrayOf(PropTypes.string).isRequired,

View File

@@ -9,6 +9,7 @@ import TableRow from 'Components/Table/TableRow';
import TableRowCell from 'Components/Table/Cells/TableRowCell';
import Popover from 'Components/Tooltip/Popover';
import MovieQuality from 'Movie/MovieQuality';
import MovieFormats from 'Movie/MovieFormats';
import MovieLanguage from 'Movie/MovieLanguage';
import HistoryDetailsConnector from 'Activity/History/Details/HistoryDetailsConnector';
import HistoryEventTypeCell from 'Activity/History/HistoryEventTypeCell';
@@ -64,6 +65,7 @@ class MovieHistoryRow extends Component {
eventType,
sourceTitle,
quality,
customFormats,
languages,
qualityCutoffNotMet,
date,
@@ -98,6 +100,12 @@ class MovieHistoryRow extends Component {
/>
</TableRowCell>
<TableRowCell key={name}>
<MovieFormats
formats={customFormats}
/>
</TableRowCell>
<RelativeDateCellConnector
date={date}
/>
@@ -152,6 +160,7 @@ MovieHistoryRow.propTypes = {
sourceTitle: PropTypes.string.isRequired,
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
quality: PropTypes.object.isRequired,
customFormats: PropTypes.arrayOf(PropTypes.object).isRequired,
qualityCutoffNotMet: PropTypes.bool.isRequired,
date: PropTypes.string.isRequired,
data: PropTypes.object.isRequired,

View File

@@ -26,6 +26,12 @@ const columns = [
label: 'Quality',
isVisible: true
},
{
name: 'customFormats',
label: 'Custom Formats',
isSortable: false,
isVisible: true
},
{
name: 'date',
label: 'Date',

View File

@@ -86,6 +86,7 @@ class MovieFileEditorRow extends Component {
size,
quality,
qualityCutoffNotMet,
customFormats,
languages
} = this.props;
@@ -173,7 +174,7 @@ class MovieFileEditorRow extends Component {
className={styles.formats}
>
<MovieFormats
formats={quality.customFormats}
formats={customFormats}
/>
</TableRowCell>
@@ -233,6 +234,7 @@ MovieFileEditorRow.propTypes = {
size: PropTypes.number.isRequired,
relativePath: PropTypes.string.isRequired,
quality: PropTypes.object.isRequired,
customFormats: PropTypes.arrayOf(PropTypes.object).isRequired,
qualityCutoffNotMet: PropTypes.bool.isRequired,
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
mediaInfo: PropTypes.object.isRequired,

View File

@@ -123,9 +123,6 @@ class CustomFormat extends Component {
<div>
Are you sure you want to delete custom format '{name}'?
</div>
<div>
This will remove all associations to this format in the DB. This may result in existing files being updated.
</div>
</div>
}
confirmLabel="Delete"

View File

@@ -16,6 +16,13 @@ const blacklistedProperties = [
'id'
];
function createItemMap(data) {
return data.reduce((acc, d, index, array) => {
acc[d.id] = index;
return acc;
}, {});
}
export default function createHandleActions(handlers, defaultState, section) {
return handleActions({
@@ -42,7 +49,7 @@ export default function createHandleActions(handlers, defaultState, section) {
if (_.isArray(payload.data)) {
newState.items = payload.data;
newState.itemMap = _.zipObject(_.map(payload.data, 'id'), _.range(payload.data.length));
newState.itemMap = createItemMap(newState.items);
} else {
newState.item = payload.data;
}
@@ -67,7 +74,7 @@ export default function createHandleActions(handlers, defaultState, section) {
const items = newState.items;
if (!newState.itemMap) {
newState.itemMap = _.zipObject(_.map(items, 'id'), _.range(items.length));
newState.itemMap = createItemMap(items);
}
const index = payload.id in newState.itemMap ? newState.itemMap[payload.id] : -1;
@@ -126,7 +133,7 @@ export default function createHandleActions(handlers, defaultState, section) {
newState.items = [...newState.items];
_.remove(newState.items, { id: payload.id });
newState.itemMap = _.zipObject(_.map(newState.items, 'id'), _.range(newState.items.length));
newState.itemMap = createItemMap(newState.items);
return updateSectionState(state, payloadSection, newState);
}

View File

@@ -51,9 +51,9 @@ export const defaultState = {
isVisible: true
},
{
name: 'quality.customFormats',
label: 'Custom Formats',
isSortable: true,
name: 'customFormats',
label: 'Formats',
isSortable: false,
isVisible: true
},
{

View File

@@ -52,9 +52,9 @@ export const defaultState = {
isVisible: true
},
{
name: 'quality.customFormats',
label: 'Custom Formats',
isSortable: true,
name: 'customFormats',
label: 'Formats',
isSortable: false,
isVisible: true
},
{

View File

@@ -81,9 +81,9 @@ export const defaultState = {
isVisible: true
},
{
name: 'quality.customFormats',
label: 'Custom Formats',
isSortable: true,
name: 'customFormats',
label: 'Formats',
isSortable: false,
isVisible: true
},
{