|
|
|
@ -2,8 +2,9 @@ import _ from 'lodash';
|
|
|
|
|
import { createAction } from 'redux-actions';
|
|
|
|
|
import { batchActions } from 'redux-batched-actions';
|
|
|
|
|
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
|
|
|
|
import sortByName from 'Utilities/Array/sortByName';
|
|
|
|
|
import dateFilterPredicate from 'Utilities/Date/dateFilterPredicate';
|
|
|
|
|
import { filterTypePredicates, filterTypes, sortDirections } from 'Helpers/Props';
|
|
|
|
|
import { filterBuilderTypes, filterBuilderValueTypes, filterTypePredicates, filterTypes, sortDirections } from 'Helpers/Props';
|
|
|
|
|
import { createThunk, handleThunks } from 'Store/thunks';
|
|
|
|
|
import createSetSettingValueReducer from './Creators/Reducers/createSetSettingValueReducer';
|
|
|
|
|
import createFetchHandler from './Creators/createFetchHandler';
|
|
|
|
@ -89,6 +90,23 @@ export const filters = [
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const filterPredicates = {
|
|
|
|
|
episodeProgress: function(item, filterValue, type) {
|
|
|
|
|
const { statistics = {} } = item;
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
episodeCount = 0,
|
|
|
|
|
episodeFileCount
|
|
|
|
|
} = statistics;
|
|
|
|
|
|
|
|
|
|
const progress = episodeCount ?
|
|
|
|
|
episodeFileCount / episodeCount * 100 :
|
|
|
|
|
100;
|
|
|
|
|
|
|
|
|
|
const predicate = filterTypePredicates[type];
|
|
|
|
|
|
|
|
|
|
return predicate(progress, filterValue);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
missing: function(item) {
|
|
|
|
|
const { statistics = {} } = item;
|
|
|
|
|
|
|
|
|
@ -130,6 +148,142 @@ export const filterPredicates = {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const filterBuilderProps = [
|
|
|
|
|
{
|
|
|
|
|
name: 'monitored',
|
|
|
|
|
label: 'Monitored',
|
|
|
|
|
type: filterBuilderTypes.EXACT,
|
|
|
|
|
valueType: filterBuilderValueTypes.BOOL
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'status',
|
|
|
|
|
label: 'Status',
|
|
|
|
|
type: filterBuilderTypes.EXACT,
|
|
|
|
|
valueType: filterBuilderValueTypes.SERIES_STATUS
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'seriesType',
|
|
|
|
|
label: 'Type',
|
|
|
|
|
type: filterBuilderTypes.EXACT,
|
|
|
|
|
valueType: filterBuilderValueTypes.SERIES_TYPES
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'network',
|
|
|
|
|
label: 'Network',
|
|
|
|
|
type: filterBuilderTypes.STRING,
|
|
|
|
|
optionsSelector: function(items) {
|
|
|
|
|
const tagList = items.reduce((acc, series) => {
|
|
|
|
|
if (series.network) {
|
|
|
|
|
acc.push({
|
|
|
|
|
id: series.network,
|
|
|
|
|
name: series.network
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return acc;
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return tagList.sort(sortByName);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'qualityProfileId',
|
|
|
|
|
label: 'Quality Profile',
|
|
|
|
|
type: filterBuilderTypes.EXACT,
|
|
|
|
|
valueType: filterBuilderValueTypes.QUALITY_PROFILE
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'languageProfileId',
|
|
|
|
|
label: 'Language Profile',
|
|
|
|
|
type: filterBuilderTypes.EXACT,
|
|
|
|
|
valueType: filterBuilderValueTypes.LANGUAGE_PROFILE
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'nextAiring',
|
|
|
|
|
label: 'Next Airing',
|
|
|
|
|
type: filterBuilderTypes.DATE,
|
|
|
|
|
valueType: filterBuilderValueTypes.DATE
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'previousAiring',
|
|
|
|
|
label: 'Previous Airing',
|
|
|
|
|
type: filterBuilderTypes.DATE,
|
|
|
|
|
valueType: filterBuilderValueTypes.DATE
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'added',
|
|
|
|
|
label: 'Added',
|
|
|
|
|
type: filterBuilderTypes.DATE,
|
|
|
|
|
valueType: filterBuilderValueTypes.DATE
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'seasonCount',
|
|
|
|
|
label: 'Season Count',
|
|
|
|
|
type: filterBuilderTypes.NUMBER
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'episodeProgress',
|
|
|
|
|
label: 'Episode Progress',
|
|
|
|
|
type: filterBuilderTypes.NUMBER
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'path',
|
|
|
|
|
label: 'Path',
|
|
|
|
|
type: filterBuilderTypes.STRING
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'rootFolderPath',
|
|
|
|
|
label: 'Root Folder Path',
|
|
|
|
|
type: filterBuilderTypes.EXACT
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'sizeOnDisk',
|
|
|
|
|
label: 'Size on Disk',
|
|
|
|
|
type: filterBuilderTypes.NUMBER,
|
|
|
|
|
valueType: filterBuilderValueTypes.BYTES
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'genres',
|
|
|
|
|
label: 'Genres',
|
|
|
|
|
type: filterBuilderTypes.ARRAY,
|
|
|
|
|
optionsSelector: function(items) {
|
|
|
|
|
const tagList = items.reduce((acc, series) => {
|
|
|
|
|
series.genres.forEach((genre) => {
|
|
|
|
|
acc.push({
|
|
|
|
|
id: genre,
|
|
|
|
|
name: genre
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return acc;
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return tagList.sort(sortByName);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'ratings',
|
|
|
|
|
label: 'Rating',
|
|
|
|
|
type: filterBuilderTypes.NUMBER
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'certification',
|
|
|
|
|
label: 'Certification',
|
|
|
|
|
type: filterBuilderTypes.EXACT
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'tags',
|
|
|
|
|
label: 'Tags',
|
|
|
|
|
type: filterBuilderTypes.ARRAY,
|
|
|
|
|
valueType: filterBuilderValueTypes.TAG
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'useSceneNumbering',
|
|
|
|
|
label: 'Scene Numbering',
|
|
|
|
|
type: filterBuilderTypes.EXACT
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const sortPredicates = {
|
|
|
|
|
status: function(item) {
|
|
|
|
|
let result = 0;
|
|
|
|
|