mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Monitor Collections from Movie Details Page
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import _ from 'lodash';
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
function createMovieCollectionListSelector() {
|
||||
return createSelector(
|
||||
(state, { tmdbId }) => tmdbId,
|
||||
(state) => state.settings.netImports.items,
|
||||
(tmdbId, netImports) => {
|
||||
const netImportIds = _.reduce(netImports, (acc, list) => {
|
||||
if (list.implementation === 'TMDbCollectionImport') {
|
||||
const collectionIdField = list.fields.find((field) => {
|
||||
return field.name === 'collectionId';
|
||||
});
|
||||
|
||||
if (collectionIdField && parseInt(collectionIdField.value) === tmdbId) {
|
||||
acc.push(list);
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
if (netImportIds.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return netImportIds[0];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export default createMovieCollectionListSelector;
|
Reference in New Issue
Block a user