From 50d6c5e61e1bd919893f49eb503143316e777d21 Mon Sep 17 00:00:00 2001 From: ta264 Date: Tue, 25 Feb 2020 22:10:52 +0000 Subject: [PATCH] New: User defined scores for each Custom Format Brings it more into line with Sonarr preferred words --- .../InteractiveSearchContent.js | 9 + .../InteractiveSearchRow.css | 8 + .../InteractiveSearch/InteractiveSearchRow.js | 7 + .../CustomFormats/CustomFormat.js | 10 +- .../AddSpecificationModalContent.js | 5 +- .../Specifications/Specification.js | 4 +- frontend/src/Settings/Profiles/Profiles.css | 6 + frontend/src/Settings/Profiles/Profiles.js | 7 + .../Quality/EditQualityProfileModalContent.js | 37 +++-- ...EditQualityProfileModalContentConnector.js | 101 ++--------- .../Quality/QualityProfileFormatItem.css | 47 +++--- .../Quality/QualityProfileFormatItem.js | 69 +++----- .../QualityProfileFormatItemDragPreview.css | 4 - .../QualityProfileFormatItemDragPreview.js | 88 ---------- .../QualityProfileFormatItemDragSource.css | 18 -- .../QualityProfileFormatItemDragSource.js | 157 ------------------ .../Quality/QualityProfileFormatItems.css | 27 ++- .../Quality/QualityProfileFormatItems.js | 108 +++++++++--- src/NzbDrone.Api/Profiles/ProfileModule.cs | 3 - src/NzbDrone.Api/Profiles/ProfileResource.cs | 32 +--- .../Profiles/ProfileSchemaModule.cs | 21 +-- .../CustomFormatComparerFixture.cs | 130 --------------- .../CustomFormats/CustomFormatsFixture.cs | 17 +- ...matAllowedByProfileSpecificationFixture.cs | 33 +++- .../CutoffSpecificationFixture.cs | 14 +- .../HistorySpecificationFixture.cs | 16 +- .../PrioritizeDownloadDecisionFixture.cs | 12 +- .../QualityUpgradeSpecificationFixture.cs | 5 +- .../QueueSpecificationFixture.cs | 10 +- .../UpgradeDiskSpecificationFixture.cs | 6 +- .../MovieRepositoryFixture.cs | 2 +- .../Profiles/ProfileRepositoryFixture.cs | 2 +- .../CustomFormats/CustomFormat.cs | 7 - .../CustomFormats/CustomFormatsComparer.cs | 34 ---- .../Migration/169_custom_format_scores.cs | 156 +++++++++++++++++ .../DownloadDecisionComparer.cs | 2 +- .../DecisionEngine/DownloadDecisionMaker.cs | 1 + ...stomFormatAllowedByProfileSpecification.cs | 23 +-- .../Specifications/UpgradableSpecification.cs | 19 +-- src/NzbDrone.Core/Parser/Model/RemoteMovie.cs | 1 + src/NzbDrone.Core/Profiles/Profile.cs | 8 +- .../Profiles/ProfileFormatItem.cs | 2 +- .../Profiles/ProfileRepository.cs | 2 +- src/NzbDrone.Core/Profiles/ProfileService.cs | 24 +-- .../CustomFormats/CustomFormatModule.cs | 2 +- .../CustomFormats/CustomFormatResource.cs | 5 - src/Radarr.Api.V3/Indexers/ReleaseResource.cs | 2 + .../Profiles/Quality/QualityProfileModule.cs | 10 +- .../Quality/QualityProfileResource.cs | 25 +-- 49 files changed, 547 insertions(+), 791 deletions(-) create mode 100644 frontend/src/Settings/Profiles/Profiles.css delete mode 100644 frontend/src/Settings/Profiles/Quality/QualityProfileFormatItemDragPreview.css delete mode 100644 frontend/src/Settings/Profiles/Quality/QualityProfileFormatItemDragPreview.js delete mode 100644 frontend/src/Settings/Profiles/Quality/QualityProfileFormatItemDragSource.css delete mode 100644 frontend/src/Settings/Profiles/Quality/QualityProfileFormatItemDragSource.js delete mode 100644 src/NzbDrone.Core.Test/CustomFormats/CustomFormatComparerFixture.cs delete mode 100644 src/NzbDrone.Core/CustomFormats/CustomFormatsComparer.cs create mode 100644 src/NzbDrone.Core/Datastore/Migration/169_custom_format_scores.cs diff --git a/frontend/src/InteractiveSearch/InteractiveSearchContent.js b/frontend/src/InteractiveSearch/InteractiveSearchContent.js index fd5729198..d47f44c24 100644 --- a/frontend/src/InteractiveSearch/InteractiveSearchContent.js +++ b/frontend/src/InteractiveSearch/InteractiveSearchContent.js @@ -63,6 +63,15 @@ const columns = [ isSortable: true, isVisible: true }, + { + name: 'customFormatScore', + label: React.createElement(Icon, { + name: icons.SCORE, + title: 'Custom Format score' + }), + isSortable: true, + isVisible: true + }, { name: 'indexerFlags', label: React.createElement(Icon, { name: icons.FLAG }), diff --git a/frontend/src/InteractiveSearch/InteractiveSearchRow.css b/frontend/src/InteractiveSearch/InteractiveSearchRow.css index fd37e6736..edda17abc 100644 --- a/frontend/src/InteractiveSearch/InteractiveSearchRow.css +++ b/frontend/src/InteractiveSearch/InteractiveSearchRow.css @@ -20,6 +20,14 @@ width: 100px; } +.customFormatScore { + composes: cell from '~Components/Table/Cells/TableRowCell.css'; + + width: 55px; + font-weight: bold; + cursor: default; +} + .rejected, .indexerFlags, .download { diff --git a/frontend/src/InteractiveSearch/InteractiveSearchRow.js b/frontend/src/InteractiveSearch/InteractiveSearchRow.js index 69d1c4ad2..6e2dfd0fc 100644 --- a/frontend/src/InteractiveSearch/InteractiveSearchRow.js +++ b/frontend/src/InteractiveSearch/InteractiveSearchRow.js @@ -114,6 +114,7 @@ class InteractiveSearchRow extends Component { leechers, quality, customFormats, + customFormatScore, languages, indexerFlags, rejections, @@ -182,6 +183,11 @@ class InteractiveSearchRow extends Component { /> + + {customFormatScore > 0 && `+${customFormatScore}`} + {customFormatScore < 0 && customFormatScore} + + { !!indexerFlags.length && @@ -281,6 +287,7 @@ InteractiveSearchRow.propTypes = { leechers: PropTypes.number, quality: PropTypes.object.isRequired, customFormats: PropTypes.arrayOf(PropTypes.object).isRequired, + customFormatScore: PropTypes.number.isRequired, languages: PropTypes.arrayOf(PropTypes.object).isRequired, rejections: PropTypes.arrayOf(PropTypes.string).isRequired, indexerFlags: PropTypes.arrayOf(PropTypes.string).isRequired, diff --git a/frontend/src/Settings/CustomFormats/CustomFormats/CustomFormat.js b/frontend/src/Settings/CustomFormats/CustomFormats/CustomFormat.js index 49f4463de..c81b6771a 100644 --- a/frontend/src/Settings/CustomFormats/CustomFormats/CustomFormat.js +++ b/frontend/src/Settings/CustomFormats/CustomFormats/CustomFormat.js @@ -94,10 +94,18 @@ class CustomFormat extends Component { return null; } + let kind = kinds.DEFAULT; + if (item.required) { + kind = kinds.SUCCESS; + } + if (item.negate) { + kind = kinds.DANGER; + } + return ( diff --git a/frontend/src/Settings/CustomFormats/CustomFormats/Specifications/AddSpecificationModalContent.js b/frontend/src/Settings/CustomFormats/CustomFormats/Specifications/AddSpecificationModalContent.js index fa526a451..fbec16ef9 100644 --- a/frontend/src/Settings/CustomFormats/CustomFormats/Specifications/AddSpecificationModalContent.js +++ b/frontend/src/Settings/CustomFormats/CustomFormats/Specifications/AddSpecificationModalContent.js @@ -2,6 +2,7 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { kinds } from 'Helpers/Props'; import Alert from 'Components/Alert'; +import Link from 'Components/Link/Link'; import Button from 'Components/Link/Button'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import ModalContent from 'Components/Modal/ModalContent'; @@ -48,8 +49,8 @@ class AddSpecificationModalContent extends Component {
-
Radarr supports custom conditions against the following release properties
-
Visit github for more details
+
Radarr supports custom conditions against the release properties below.
+
Visit GitHub for more details.
diff --git a/frontend/src/Settings/CustomFormats/CustomFormats/Specifications/Specification.js b/frontend/src/Settings/CustomFormats/CustomFormats/Specifications/Specification.js index 55dbec520..9869112bc 100644 --- a/frontend/src/Settings/CustomFormats/CustomFormats/Specifications/Specification.js +++ b/frontend/src/Settings/CustomFormats/CustomFormats/Specifications/Specification.js @@ -90,14 +90,14 @@ class Specification extends Component { { negate && -