mirror of https://github.com/lidarr/Lidarr
New: Artist folder hint when selecting a root folder while adding a new artist
Closes #1214 Closes #1467
This commit is contained in:
parent
86130751c2
commit
a16463eeb3
|
@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from 'Components/Link/Button';
|
import Button from 'Components/Link/Button';
|
||||||
import { kinds } from 'Helpers/Props';
|
import { kinds } from 'Helpers/Props';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
import styles from './NoArtist.css';
|
import styles from './NoArtist.css';
|
||||||
|
|
||||||
function NoArtist(props) {
|
function NoArtist(props) {
|
||||||
|
@ -28,7 +29,7 @@ function NoArtist(props) {
|
||||||
to="/settings/mediamanagement"
|
to="/settings/mediamanagement"
|
||||||
kind={kinds.PRIMARY}
|
kind={kinds.PRIMARY}
|
||||||
>
|
>
|
||||||
Add Root Folder
|
{translate('AddRootFolder')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ function NoArtist(props) {
|
||||||
to="/add/search"
|
to="/add/search"
|
||||||
kind={kinds.PRIMARY}
|
kind={kinds.PRIMARY}
|
||||||
>
|
>
|
||||||
Add New Artist
|
{translate('AddNewArtist')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,6 +13,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.artistFolder {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
color: var(--disabledColor);
|
||||||
|
}
|
||||||
|
|
||||||
.freeSpace {
|
.freeSpace {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
color: var(--darkGray);
|
color: var(--darkGray);
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
// This file is automatically generated.
|
// This file is automatically generated.
|
||||||
// Please do not change this file!
|
// Please do not change this file!
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
|
'artistFolder': string;
|
||||||
'freeSpace': string;
|
'freeSpace': string;
|
||||||
'isMobile': string;
|
'isMobile': string;
|
||||||
'optionText': string;
|
'optionText': string;
|
||||||
|
'value': string;
|
||||||
}
|
}
|
||||||
export const cssExports: CssExports;
|
export const cssExports: CssExports;
|
||||||
export default cssExports;
|
export default cssExports;
|
||||||
|
|
|
@ -7,17 +7,25 @@ import styles from './RootFolderSelectInputOption.css';
|
||||||
|
|
||||||
function RootFolderSelectInputOption(props) {
|
function RootFolderSelectInputOption(props) {
|
||||||
const {
|
const {
|
||||||
|
id,
|
||||||
value,
|
value,
|
||||||
name,
|
name,
|
||||||
freeSpace,
|
freeSpace,
|
||||||
|
artistFolder,
|
||||||
isMobile,
|
isMobile,
|
||||||
|
isWindows,
|
||||||
...otherProps
|
...otherProps
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const text = value === '' ? name : `${name} [${value}]`;
|
const slashCharacter = isWindows ? '\\' : '/';
|
||||||
|
|
||||||
|
const text = value === '' ? name : `[${name}] ${value}`;
|
||||||
|
|
||||||
|
console.debug(props);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EnhancedSelectInputOption
|
<EnhancedSelectInputOption
|
||||||
|
id={id}
|
||||||
isMobile={isMobile}
|
isMobile={isMobile}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
>
|
>
|
||||||
|
@ -26,7 +34,18 @@ function RootFolderSelectInputOption(props) {
|
||||||
isMobile && styles.isMobile
|
isMobile && styles.isMobile
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div>{text}</div>
|
<div className={styles.value}>
|
||||||
|
{text}
|
||||||
|
|
||||||
|
{
|
||||||
|
artistFolder && id !== 'addNew' ?
|
||||||
|
<div className={styles.artistFolder}>
|
||||||
|
{slashCharacter}
|
||||||
|
{artistFolder}
|
||||||
|
</div> :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
freeSpace != null &&
|
freeSpace != null &&
|
||||||
|
@ -40,10 +59,13 @@ function RootFolderSelectInputOption(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
RootFolderSelectInputOption.propTypes = {
|
RootFolderSelectInputOption.propTypes = {
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
value: PropTypes.string.isRequired,
|
value: PropTypes.string.isRequired,
|
||||||
freeSpace: PropTypes.number,
|
freeSpace: PropTypes.number,
|
||||||
isMobile: PropTypes.bool.isRequired
|
artistFolder: PropTypes.string,
|
||||||
|
isMobile: PropTypes.bool.isRequired,
|
||||||
|
isWindows: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
export default RootFolderSelectInputOption;
|
export default RootFolderSelectInputOption;
|
||||||
|
|
|
@ -7,12 +7,22 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.path {
|
.pathContainer {
|
||||||
@add-mixin truncate;
|
@add-mixin truncate;
|
||||||
|
display: flex;
|
||||||
flex: 1 0 0;
|
flex: 1 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.path {
|
||||||
|
flex: 0 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.artistFolder {
|
||||||
|
@add-mixin truncate;
|
||||||
|
flex: 0 1 auto;
|
||||||
|
color: var(--disabledColor);
|
||||||
|
}
|
||||||
|
|
||||||
.freeSpace {
|
.freeSpace {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// This file is automatically generated.
|
// This file is automatically generated.
|
||||||
// Please do not change this file!
|
// Please do not change this file!
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
|
'artistFolder': string;
|
||||||
'freeSpace': string;
|
'freeSpace': string;
|
||||||
'path': string;
|
'path': string;
|
||||||
|
'pathContainer': string;
|
||||||
'selectedValue': string;
|
'selectedValue': string;
|
||||||
}
|
}
|
||||||
export const cssExports: CssExports;
|
export const cssExports: CssExports;
|
||||||
|
|
|
@ -9,19 +9,34 @@ function RootFolderSelectInputSelectedValue(props) {
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
freeSpace,
|
freeSpace,
|
||||||
|
artistFolder,
|
||||||
includeFreeSpace,
|
includeFreeSpace,
|
||||||
|
isWindows,
|
||||||
...otherProps
|
...otherProps
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const text = value === '' ? name : `${name} [${value}]`;
|
const slashCharacter = isWindows ? '\\' : '/';
|
||||||
|
|
||||||
|
const text = value === '' ? name : `[${name}] ${value}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EnhancedSelectInputSelectedValue
|
<EnhancedSelectInputSelectedValue
|
||||||
className={styles.selectedValue}
|
className={styles.selectedValue}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
>
|
>
|
||||||
<div className={styles.path}>
|
<div className={styles.pathContainer}>
|
||||||
{text}
|
<div className={styles.path}>
|
||||||
|
{text}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{
|
||||||
|
artistFolder ?
|
||||||
|
<div className={styles.artistFolder}>
|
||||||
|
{slashCharacter}
|
||||||
|
{artistFolder}
|
||||||
|
</div> :
|
||||||
|
null
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -38,6 +53,8 @@ RootFolderSelectInputSelectedValue.propTypes = {
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
freeSpace: PropTypes.number,
|
freeSpace: PropTypes.number,
|
||||||
|
artistFolder: PropTypes.string,
|
||||||
|
isWindows: PropTypes.bool,
|
||||||
includeFreeSpace: PropTypes.bool.isRequired
|
includeFreeSpace: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,20 @@
|
||||||
.message {
|
.message {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: $largeFontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.helpText {
|
.helpText {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-weight: 300;
|
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.noArtistsText {
|
||||||
|
margin-top: 80px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.noResults {
|
.noResults {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
|
|
|
@ -4,6 +4,7 @@ interface CssExports {
|
||||||
'clearLookupButton': string;
|
'clearLookupButton': string;
|
||||||
'helpText': string;
|
'helpText': string;
|
||||||
'message': string;
|
'message': string;
|
||||||
|
'noArtistsText': string;
|
||||||
'noResults': string;
|
'noResults': string;
|
||||||
'searchContainer': string;
|
'searchContainer': string;
|
||||||
'searchIconContainer': string;
|
'searchIconContainer': string;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import Link from 'Components/Link/Link';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
import { icons } from 'Helpers/Props';
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import AddNewAlbumSearchResultConnector from './Album/AddNewAlbumSearchResultConnector';
|
import AddNewAlbumSearchResultConnector from './Album/AddNewAlbumSearchResultConnector';
|
||||||
|
@ -81,7 +81,8 @@ class AddNewItem extends Component {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
error,
|
error,
|
||||||
items
|
items,
|
||||||
|
hasExistingArtists
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const term = this.state.term;
|
const term = this.state.term;
|
||||||
|
@ -178,7 +179,8 @@ class AddNewItem extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
!term &&
|
term ?
|
||||||
|
null :
|
||||||
<div className={styles.message}>
|
<div className={styles.message}>
|
||||||
<div className={styles.helpText}>
|
<div className={styles.helpText}>
|
||||||
{translate('ItsEasyToAddANewArtistJustStartTypingTheNameOfTheArtistYouWantToAdd')}
|
{translate('ItsEasyToAddANewArtistJustStartTypingTheNameOfTheArtistYouWantToAdd')}
|
||||||
|
@ -191,6 +193,24 @@ class AddNewItem extends Component {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
!term && !hasExistingArtists ?
|
||||||
|
<div className={styles.message}>
|
||||||
|
<div className={styles.noArtistsText}>
|
||||||
|
You haven't added any artists yet, do you want to add an existing library location (Root Folder) and update?
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
to="/settings/mediamanagement"
|
||||||
|
kind={kinds.PRIMARY}
|
||||||
|
>
|
||||||
|
Add Root Folder
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div> :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
<div />
|
<div />
|
||||||
</PageContentBody>
|
</PageContentBody>
|
||||||
</PageContent>
|
</PageContent>
|
||||||
|
@ -205,6 +225,7 @@ AddNewItem.propTypes = {
|
||||||
isAdding: PropTypes.bool.isRequired,
|
isAdding: PropTypes.bool.isRequired,
|
||||||
addError: PropTypes.object,
|
addError: PropTypes.object,
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
hasExistingArtists: PropTypes.bool.isRequired,
|
||||||
onSearchChange: PropTypes.func.isRequired,
|
onSearchChange: PropTypes.func.isRequired,
|
||||||
onClearSearch: PropTypes.func.isRequired
|
onClearSearch: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,13 +10,15 @@ import AddNewItem from './AddNewItem';
|
||||||
function createMapStateToProps() {
|
function createMapStateToProps() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state) => state.search,
|
(state) => state.search,
|
||||||
|
(state) => state.artist.items.length,
|
||||||
(state) => state.router.location,
|
(state) => state.router.location,
|
||||||
(search, location) => {
|
(search, existingArtistsCount, location) => {
|
||||||
const { params } = parseUrl(location.search);
|
const { params } = parseUrl(location.search);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
...search,
|
||||||
term: params.term,
|
term: params.term,
|
||||||
...search
|
hasExistingArtists: existingArtistsCount > 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,6 +11,7 @@ import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
import { kinds } from 'Helpers/Props';
|
import { kinds } from 'Helpers/Props';
|
||||||
import AddArtistOptionsForm from '../Common/AddArtistOptionsForm.js';
|
import AddArtistOptionsForm from '../Common/AddArtistOptionsForm.js';
|
||||||
import styles from './AddNewAlbumModalContent.css';
|
import styles from './AddNewAlbumModalContent.css';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
class AddNewAlbumModalContent extends Component {
|
class AddNewAlbumModalContent extends Component {
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ class AddNewAlbumModalContent extends Component {
|
||||||
return (
|
return (
|
||||||
<ModalContent onModalClose={onModalClose}>
|
<ModalContent onModalClose={onModalClose}>
|
||||||
<ModalHeader>
|
<ModalHeader>
|
||||||
Add new Album
|
{translate('AddNewAlbum')}
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
|
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { createSelector } from 'reselect';
|
||||||
import { metadataProfileNames } from 'Helpers/Props';
|
import { metadataProfileNames } from 'Helpers/Props';
|
||||||
import { addAlbum, setAddDefault } from 'Store/Actions/searchActions';
|
import { addAlbum, setAddDefault } from 'Store/Actions/searchActions';
|
||||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
|
import createSystemStatusSelector from 'Store/Selectors/createSystemStatusSelector';
|
||||||
import selectSettings from 'Store/Selectors/selectSettings';
|
import selectSettings from 'Store/Selectors/selectSettings';
|
||||||
import AddNewAlbumModalContent from './AddNewAlbumModalContent';
|
import AddNewAlbumModalContent from './AddNewAlbumModalContent';
|
||||||
|
|
||||||
|
@ -14,7 +15,8 @@ function createMapStateToProps() {
|
||||||
(state) => state.search,
|
(state) => state.search,
|
||||||
(state) => state.settings.metadataProfiles,
|
(state) => state.settings.metadataProfiles,
|
||||||
createDimensionsSelector(),
|
createDimensionsSelector(),
|
||||||
(isExistingArtist, searchState, metadataProfiles, dimensions) => {
|
createSystemStatusSelector(),
|
||||||
|
(isExistingArtist, searchState, metadataProfiles, dimensions, systemStatus) => {
|
||||||
const {
|
const {
|
||||||
isAdding,
|
isAdding,
|
||||||
addError,
|
addError,
|
||||||
|
@ -38,6 +40,7 @@ function createMapStateToProps() {
|
||||||
validationErrors,
|
validationErrors,
|
||||||
validationWarnings,
|
validationWarnings,
|
||||||
noneMetadataProfileId: noneProfile.id,
|
noneMetadataProfileId: noneProfile.id,
|
||||||
|
isWindows: systemStatus.isWindows,
|
||||||
...settings
|
...settings
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,7 @@ class AddNewAlbumSearchResult extends Component {
|
||||||
disambiguation={disambiguation}
|
disambiguation={disambiguation}
|
||||||
artistName={artist.artistName}
|
artistName={artist.artistName}
|
||||||
overview={overview}
|
overview={overview}
|
||||||
|
folder={artist.folder}
|
||||||
images={images}
|
images={images}
|
||||||
onModalClose={this.onAddAlbumModalClose}
|
onModalClose={this.onAddAlbumModalClose}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
import { kinds } from 'Helpers/Props';
|
import { kinds } from 'Helpers/Props';
|
||||||
import AddArtistOptionsForm from '../Common/AddArtistOptionsForm.js';
|
import AddArtistOptionsForm from '../Common/AddArtistOptionsForm.js';
|
||||||
import styles from './AddNewArtistModalContent.css';
|
import styles from './AddNewArtistModalContent.css';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
class AddNewArtistModalContent extends Component {
|
class AddNewArtistModalContent extends Component {
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ class AddNewArtistModalContent extends Component {
|
||||||
return (
|
return (
|
||||||
<ModalContent onModalClose={onModalClose}>
|
<ModalContent onModalClose={onModalClose}>
|
||||||
<ModalHeader>
|
<ModalHeader>
|
||||||
Add new Artist
|
{translate('AddNewArtist')}
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
|
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
|
@ -139,6 +140,7 @@ AddNewArtistModalContent.propTypes = {
|
||||||
isAdding: PropTypes.bool.isRequired,
|
isAdding: PropTypes.bool.isRequired,
|
||||||
addError: PropTypes.object,
|
addError: PropTypes.object,
|
||||||
isSmallScreen: PropTypes.bool.isRequired,
|
isSmallScreen: PropTypes.bool.isRequired,
|
||||||
|
isWindows: PropTypes.bool.isRequired,
|
||||||
onModalClose: PropTypes.func.isRequired,
|
onModalClose: PropTypes.func.isRequired,
|
||||||
onAddArtistPress: PropTypes.func.isRequired
|
onAddArtistPress: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { addArtist, setAddDefault } from 'Store/Actions/searchActions';
|
import { addArtist, setAddDefault } from 'Store/Actions/searchActions';
|
||||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
|
import createSystemStatusSelector from 'Store/Selectors/createSystemStatusSelector';
|
||||||
import selectSettings from 'Store/Selectors/selectSettings';
|
import selectSettings from 'Store/Selectors/selectSettings';
|
||||||
import AddNewArtistModalContent from './AddNewArtistModalContent';
|
import AddNewArtistModalContent from './AddNewArtistModalContent';
|
||||||
|
|
||||||
|
@ -12,7 +13,8 @@ function createMapStateToProps() {
|
||||||
(state) => state.search,
|
(state) => state.search,
|
||||||
(state) => state.settings.metadataProfiles,
|
(state) => state.settings.metadataProfiles,
|
||||||
createDimensionsSelector(),
|
createDimensionsSelector(),
|
||||||
(searchState, metadataProfiles, dimensions) => {
|
createSystemStatusSelector(),
|
||||||
|
(searchState, metadataProfiles, dimensions, systemStatus) => {
|
||||||
const {
|
const {
|
||||||
isAdding,
|
isAdding,
|
||||||
addError,
|
addError,
|
||||||
|
@ -32,6 +34,7 @@ function createMapStateToProps() {
|
||||||
isSmallScreen: dimensions.isSmallScreen,
|
isSmallScreen: dimensions.isSmallScreen,
|
||||||
validationErrors,
|
validationErrors,
|
||||||
validationWarnings,
|
validationWarnings,
|
||||||
|
isWindows: systemStatus.isWindows,
|
||||||
...settings
|
...settings
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ class AddNewArtistSearchResult extends Component {
|
||||||
status,
|
status,
|
||||||
overview,
|
overview,
|
||||||
ratings,
|
ratings,
|
||||||
|
folder,
|
||||||
images,
|
images,
|
||||||
isExistingArtist,
|
isExistingArtist,
|
||||||
isSmallScreen
|
isSmallScreen
|
||||||
|
@ -208,6 +209,7 @@ class AddNewArtistSearchResult extends Component {
|
||||||
disambiguation={disambiguation}
|
disambiguation={disambiguation}
|
||||||
year={year}
|
year={year}
|
||||||
overview={overview}
|
overview={overview}
|
||||||
|
folder={folder}
|
||||||
images={images}
|
images={images}
|
||||||
onModalClose={this.onAddArtistModalClose}
|
onModalClose={this.onAddArtistModalClose}
|
||||||
/>
|
/>
|
||||||
|
@ -225,6 +227,7 @@ AddNewArtistSearchResult.propTypes = {
|
||||||
status: PropTypes.string.isRequired,
|
status: PropTypes.string.isRequired,
|
||||||
overview: PropTypes.string,
|
overview: PropTypes.string,
|
||||||
ratings: PropTypes.object.isRequired,
|
ratings: PropTypes.object.isRequired,
|
||||||
|
folder: PropTypes.string.isRequired,
|
||||||
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
isExistingArtist: PropTypes.bool.isRequired,
|
isExistingArtist: PropTypes.bool.isRequired,
|
||||||
isSmallScreen: PropTypes.bool.isRequired
|
isSmallScreen: PropTypes.bool.isRequired
|
||||||
|
|
|
@ -38,7 +38,9 @@ class AddArtistOptionsForm extends Component {
|
||||||
metadataProfileId,
|
metadataProfileId,
|
||||||
includeNoneMetadataProfile,
|
includeNoneMetadataProfile,
|
||||||
showMetadataProfile,
|
showMetadataProfile,
|
||||||
|
folder,
|
||||||
tags,
|
tags,
|
||||||
|
isWindows,
|
||||||
onInputChange,
|
onInputChange,
|
||||||
...otherProps
|
...otherProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
@ -53,6 +55,15 @@ class AddArtistOptionsForm extends Component {
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.ROOT_FOLDER_SELECT}
|
type={inputTypes.ROOT_FOLDER_SELECT}
|
||||||
name="rootFolderPath"
|
name="rootFolderPath"
|
||||||
|
valueOptions={{
|
||||||
|
artistFolder: folder,
|
||||||
|
isWindows
|
||||||
|
}}
|
||||||
|
selectedValueOptions={{
|
||||||
|
artistFolder: folder,
|
||||||
|
isWindows
|
||||||
|
}}
|
||||||
|
helpText={translate('AddNewArtistRootFolderHelpText', { folder })}
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
{...rootFolderPath}
|
{...rootFolderPath}
|
||||||
/>
|
/>
|
||||||
|
@ -176,7 +187,9 @@ AddArtistOptionsForm.propTypes = {
|
||||||
metadataProfileId: PropTypes.object,
|
metadataProfileId: PropTypes.object,
|
||||||
showMetadataProfile: PropTypes.bool.isRequired,
|
showMetadataProfile: PropTypes.bool.isRequired,
|
||||||
includeNoneMetadataProfile: PropTypes.bool.isRequired,
|
includeNoneMetadataProfile: PropTypes.bool.isRequired,
|
||||||
|
folder: PropTypes.string.isRequired,
|
||||||
tags: PropTypes.object.isRequired,
|
tags: PropTypes.object.isRequired,
|
||||||
|
isWindows: PropTypes.bool.isRequired,
|
||||||
onInputChange: PropTypes.func.isRequired
|
onInputChange: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,8 @@ namespace Lidarr.Api.V1.Artist
|
||||||
ArtistAncestorValidator artistAncestorValidator,
|
ArtistAncestorValidator artistAncestorValidator,
|
||||||
SystemFolderValidator systemFolderValidator,
|
SystemFolderValidator systemFolderValidator,
|
||||||
QualityProfileExistsValidator qualityProfileExistsValidator,
|
QualityProfileExistsValidator qualityProfileExistsValidator,
|
||||||
MetadataProfileExistsValidator metadataProfileExistsValidator)
|
MetadataProfileExistsValidator metadataProfileExistsValidator,
|
||||||
|
ArtistFolderAsRootFolderValidator artistFolderAsRootFolderValidator)
|
||||||
: base(signalRBroadcaster)
|
: base(signalRBroadcaster)
|
||||||
{
|
{
|
||||||
_artistService = artistService;
|
_artistService = artistService;
|
||||||
|
@ -91,7 +92,10 @@ namespace Lidarr.Api.V1.Artist
|
||||||
SharedValidator.RuleFor(s => s.MetadataProfileId).SetValidator(metadataProfileExistsValidator);
|
SharedValidator.RuleFor(s => s.MetadataProfileId).SetValidator(metadataProfileExistsValidator);
|
||||||
|
|
||||||
PostValidator.RuleFor(s => s.Path).IsValidPath().When(s => s.RootFolderPath.IsNullOrWhiteSpace());
|
PostValidator.RuleFor(s => s.Path).IsValidPath().When(s => s.RootFolderPath.IsNullOrWhiteSpace());
|
||||||
PostValidator.RuleFor(s => s.RootFolderPath).IsValidPath().When(s => s.Path.IsNullOrWhiteSpace());
|
PostValidator.RuleFor(s => s.RootFolderPath)
|
||||||
|
.IsValidPath()
|
||||||
|
.SetValidator(artistFolderAsRootFolderValidator)
|
||||||
|
.When(s => s.Path.IsNullOrWhiteSpace());
|
||||||
PostValidator.RuleFor(s => s.ArtistName).NotEmpty();
|
PostValidator.RuleFor(s => s.ArtistName).NotEmpty();
|
||||||
PostValidator.RuleFor(s => s.ForeignArtistId).NotEmpty().SetValidator(artistExistsValidator);
|
PostValidator.RuleFor(s => s.ForeignArtistId).NotEmpty().SetValidator(artistExistsValidator);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using FluentValidation.Validators;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Core.Organizer;
|
||||||
|
|
||||||
|
namespace Lidarr.Api.V1.Artist
|
||||||
|
{
|
||||||
|
public class ArtistFolderAsRootFolderValidator : PropertyValidator
|
||||||
|
{
|
||||||
|
private readonly IBuildFileNames _fileNameBuilder;
|
||||||
|
|
||||||
|
public ArtistFolderAsRootFolderValidator(IBuildFileNames fileNameBuilder)
|
||||||
|
{
|
||||||
|
_fileNameBuilder = fileNameBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string GetDefaultMessageTemplate() => "Root folder path '{rootFolderPath}' contains artist folder '{artistFolder}'";
|
||||||
|
|
||||||
|
protected override bool IsValid(PropertyValidatorContext context)
|
||||||
|
{
|
||||||
|
if (context.PropertyValue == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.InstanceToValidate is not ArtistResource artistResource)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rootFolderPath = context.PropertyValue.ToString();
|
||||||
|
|
||||||
|
if (rootFolderPath.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rootFolder = new DirectoryInfo(rootFolderPath!).Name;
|
||||||
|
var artist = artistResource.ToModel();
|
||||||
|
var artistFolder = _fileNameBuilder.GetArtistFolder(artist);
|
||||||
|
|
||||||
|
context.MessageFormatter.AppendArgument("rootFolderPath", rootFolderPath);
|
||||||
|
context.MessageFormatter.AppendArgument("artistFolder", artistFolder);
|
||||||
|
|
||||||
|
if (artistFolder == rootFolder)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var distance = artistFolder.LevenshteinDistance(rootFolder);
|
||||||
|
|
||||||
|
return distance >= Math.Max(1, artistFolder.Length * 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ using Lidarr.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NzbDrone.Core.MediaCover;
|
using NzbDrone.Core.MediaCover;
|
||||||
using NzbDrone.Core.MetadataSource;
|
using NzbDrone.Core.MetadataSource;
|
||||||
|
using NzbDrone.Core.Organizer;
|
||||||
|
|
||||||
namespace Lidarr.Api.V1.Artist
|
namespace Lidarr.Api.V1.Artist
|
||||||
{
|
{
|
||||||
|
@ -11,11 +12,13 @@ namespace Lidarr.Api.V1.Artist
|
||||||
public class ArtistLookupController : Controller
|
public class ArtistLookupController : Controller
|
||||||
{
|
{
|
||||||
private readonly ISearchForNewArtist _searchProxy;
|
private readonly ISearchForNewArtist _searchProxy;
|
||||||
|
private readonly IBuildFileNames _fileNameBuilder;
|
||||||
private readonly IMapCoversToLocal _coverMapper;
|
private readonly IMapCoversToLocal _coverMapper;
|
||||||
|
|
||||||
public ArtistLookupController(ISearchForNewArtist searchProxy, IMapCoversToLocal coverMapper)
|
public ArtistLookupController(ISearchForNewArtist searchProxy, IBuildFileNames fileNameBuilder, IMapCoversToLocal coverMapper)
|
||||||
{
|
{
|
||||||
_searchProxy = searchProxy;
|
_searchProxy = searchProxy;
|
||||||
|
_fileNameBuilder = fileNameBuilder;
|
||||||
_coverMapper = coverMapper;
|
_coverMapper = coverMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,11 +38,14 @@ namespace Lidarr.Api.V1.Artist
|
||||||
_coverMapper.ConvertToLocalUrls(resource.Id, MediaCoverEntity.Artist, resource.Images);
|
_coverMapper.ConvertToLocalUrls(resource.Id, MediaCoverEntity.Artist, resource.Images);
|
||||||
|
|
||||||
var poster = currentArtist.Metadata.Value.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
|
var poster = currentArtist.Metadata.Value.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
|
||||||
|
|
||||||
if (poster != null)
|
if (poster != null)
|
||||||
{
|
{
|
||||||
resource.RemotePoster = poster.RemoteUrl;
|
resource.RemotePoster = poster.RemoteUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource.Folder = _fileNameBuilder.GetArtistFolder(currentArtist);
|
||||||
|
|
||||||
yield return resource;
|
yield return resource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace Lidarr.Api.V1.Artist
|
||||||
public NewItemMonitorTypes MonitorNewItems { get; set; }
|
public NewItemMonitorTypes MonitorNewItems { get; set; }
|
||||||
|
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
|
public string Folder { get; set; }
|
||||||
public List<string> Genres { get; set; }
|
public List<string> Genres { get; set; }
|
||||||
public string CleanName { get; set; }
|
public string CleanName { get; set; }
|
||||||
public string SortName { get; set; }
|
public string SortName { get; set; }
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Lidarr.Http.REST;
|
using Lidarr.Http.REST;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Music;
|
using NzbDrone.Core.Music;
|
||||||
using NzbDrone.Core.RootFolders;
|
using NzbDrone.Core.RootFolders;
|
||||||
|
|
||||||
|
@ -35,7 +36,8 @@ namespace Lidarr.Api.V1.RootFolders
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
|
|
||||||
Name = model.Name,
|
Name = model.Name,
|
||||||
Path = model.Path,
|
Path = model.Path.GetCleanPath(),
|
||||||
|
|
||||||
DefaultMetadataProfileId = model.DefaultMetadataProfileId,
|
DefaultMetadataProfileId = model.DefaultMetadataProfileId,
|
||||||
DefaultQualityProfileId = model.DefaultQualityProfileId,
|
DefaultQualityProfileId = model.DefaultQualityProfileId,
|
||||||
DefaultMonitorOption = model.DefaultMonitorOption,
|
DefaultMonitorOption = model.DefaultMonitorOption,
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Lidarr.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NzbDrone.Core.MediaCover;
|
using NzbDrone.Core.MediaCover;
|
||||||
using NzbDrone.Core.MetadataSource;
|
using NzbDrone.Core.MetadataSource;
|
||||||
|
using NzbDrone.Core.Organizer;
|
||||||
|
|
||||||
namespace Lidarr.Api.V1.Search
|
namespace Lidarr.Api.V1.Search
|
||||||
{
|
{
|
||||||
|
@ -14,10 +15,12 @@ namespace Lidarr.Api.V1.Search
|
||||||
public class SearchController : Controller
|
public class SearchController : Controller
|
||||||
{
|
{
|
||||||
private readonly ISearchForNewEntity _searchProxy;
|
private readonly ISearchForNewEntity _searchProxy;
|
||||||
|
private readonly IBuildFileNames _fileNameBuilder;
|
||||||
|
|
||||||
public SearchController(ISearchForNewEntity searchProxy)
|
public SearchController(ISearchForNewEntity searchProxy, IBuildFileNames fileNameBuilder)
|
||||||
{
|
{
|
||||||
_searchProxy = searchProxy;
|
_searchProxy = searchProxy;
|
||||||
|
_fileNameBuilder = fileNameBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
@ -27,7 +30,7 @@ namespace Lidarr.Api.V1.Search
|
||||||
return MapToResource(searchResults).ToList();
|
return MapToResource(searchResults).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<SearchResource> MapToResource(IEnumerable<object> results)
|
private IEnumerable<SearchResource> MapToResource(IEnumerable<object> results)
|
||||||
{
|
{
|
||||||
var id = 1;
|
var id = 1;
|
||||||
foreach (var result in results)
|
foreach (var result in results)
|
||||||
|
@ -35,29 +38,33 @@ namespace Lidarr.Api.V1.Search
|
||||||
var resource = new SearchResource();
|
var resource = new SearchResource();
|
||||||
resource.Id = id++;
|
resource.Id = id++;
|
||||||
|
|
||||||
if (result is NzbDrone.Core.Music.Artist)
|
if (result is NzbDrone.Core.Music.Artist artist)
|
||||||
{
|
{
|
||||||
var artist = (NzbDrone.Core.Music.Artist)result;
|
|
||||||
resource.Artist = artist.ToResource();
|
resource.Artist = artist.ToResource();
|
||||||
resource.ForeignId = artist.ForeignArtistId;
|
resource.ForeignId = artist.ForeignArtistId;
|
||||||
|
|
||||||
var poster = artist.Metadata.Value.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
|
var poster = artist.Metadata.Value.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
|
||||||
|
|
||||||
if (poster != null)
|
if (poster != null)
|
||||||
{
|
{
|
||||||
resource.Artist.RemotePoster = poster.Url;
|
resource.Artist.RemotePoster = poster.Url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource.Artist.Folder = _fileNameBuilder.GetArtistFolder(artist);
|
||||||
}
|
}
|
||||||
else if (result is NzbDrone.Core.Music.Album)
|
else if (result is NzbDrone.Core.Music.Album album)
|
||||||
{
|
{
|
||||||
var album = (NzbDrone.Core.Music.Album)result;
|
|
||||||
resource.Album = album.ToResource();
|
resource.Album = album.ToResource();
|
||||||
resource.ForeignId = album.ForeignAlbumId;
|
resource.ForeignId = album.ForeignAlbumId;
|
||||||
|
|
||||||
var cover = album.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Cover);
|
var cover = album.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Cover);
|
||||||
|
|
||||||
if (cover != null)
|
if (cover != null)
|
||||||
{
|
{
|
||||||
resource.Album.RemoteCover = cover.Url;
|
resource.Album.RemoteCover = cover.Url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource.Album.Artist.Folder = _fileNameBuilder.GetArtistFolder(album.Artist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,6 +107,15 @@ namespace NzbDrone.Common.Extensions
|
||||||
return Directory.GetParent(cleanPath)?.FullName;
|
return Directory.GetParent(cleanPath)?.FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetCleanPath(this string path)
|
||||||
|
{
|
||||||
|
var cleanPath = OsInfo.IsWindows
|
||||||
|
? PARENT_PATH_END_SLASH_REGEX.Replace(path, "")
|
||||||
|
: path.TrimEnd(Path.DirectorySeparatorChar);
|
||||||
|
|
||||||
|
return cleanPath;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool IsParentPath(this string parentPath, string childPath)
|
public static bool IsParentPath(this string parentPath, string childPath)
|
||||||
{
|
{
|
||||||
if (parentPath != "/" && !parentPath.EndsWith(":\\"))
|
if (parentPath != "/" && !parentPath.EndsWith(":\\"))
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
"AddMetadataProfile": "Add Metadata Profile",
|
"AddMetadataProfile": "Add Metadata Profile",
|
||||||
"AddMissing": "Add missing",
|
"AddMissing": "Add missing",
|
||||||
"AddNew": "Add New",
|
"AddNew": "Add New",
|
||||||
|
"AddNewAlbum": "Add New Album",
|
||||||
|
"AddNewArtist": "Add New Artist",
|
||||||
|
"AddNewArtistRootFolderHelpText": "'{folder}' subfolder will be created automatically",
|
||||||
"AddNewItem": "Add New Item",
|
"AddNewItem": "Add New Item",
|
||||||
"AddQualityProfile": "Add Quality Profile",
|
"AddQualityProfile": "Add Quality Profile",
|
||||||
"AddReleaseProfile": "Add Release Profile",
|
"AddReleaseProfile": "Add Release Profile",
|
||||||
|
|
Loading…
Reference in New Issue