mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
New: Group Import Lists by Type
This commit is contained in:
parent
fb26ff286d
commit
af26ac849a
15 changed files with 70 additions and 22 deletions
|
@ -11,6 +11,7 @@ import ModalBody from 'Components/Modal/ModalBody';
|
||||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
import AddImportListItem from './AddImportListItem';
|
import AddImportListItem from './AddImportListItem';
|
||||||
import styles from './AddImportListModalContent.css';
|
import styles from './AddImportListModalContent.css';
|
||||||
|
import titleCase from 'Utilities/String/titleCase';
|
||||||
|
|
||||||
class AddImportListModalContent extends Component {
|
class AddImportListModalContent extends Component {
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ class AddImportListModalContent extends Component {
|
||||||
isSchemaFetching,
|
isSchemaFetching,
|
||||||
isSchemaPopulated,
|
isSchemaPopulated,
|
||||||
schemaError,
|
schemaError,
|
||||||
allLists,
|
listGroups,
|
||||||
onImportListSelect,
|
onImportListSelect,
|
||||||
onModalClose
|
onModalClose
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
@ -52,11 +53,13 @@ class AddImportListModalContent extends Component {
|
||||||
<div>Lidarr supports multiple lists for importing Albums and Artists into the database.</div>
|
<div>Lidarr supports multiple lists for importing Albums and Artists into the database.</div>
|
||||||
<div>For more information on the individual lists, click on the info buttons.</div>
|
<div>For more information on the individual lists, click on the info buttons.</div>
|
||||||
</Alert>
|
</Alert>
|
||||||
|
{
|
||||||
<FieldSet legend="Import Lists">
|
Object.keys(listGroups).map((key) => {
|
||||||
|
return (
|
||||||
|
<FieldSet legend={`${titleCase(key)} List`} key={key}>
|
||||||
<div className={styles.lists}>
|
<div className={styles.lists}>
|
||||||
{
|
{
|
||||||
allLists.map((list) => {
|
listGroups[key].map((list) => {
|
||||||
return (
|
return (
|
||||||
<AddImportListItem
|
<AddImportListItem
|
||||||
key={list.implementation}
|
key={list.implementation}
|
||||||
|
@ -69,6 +72,9 @@ class AddImportListModalContent extends Component {
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</FieldSet>
|
</FieldSet>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
@ -88,7 +94,7 @@ AddImportListModalContent.propTypes = {
|
||||||
isSchemaFetching: PropTypes.bool.isRequired,
|
isSchemaFetching: PropTypes.bool.isRequired,
|
||||||
isSchemaPopulated: PropTypes.bool.isRequired,
|
isSchemaPopulated: PropTypes.bool.isRequired,
|
||||||
schemaError: PropTypes.object,
|
schemaError: PropTypes.object,
|
||||||
allLists: PropTypes.arrayOf(PropTypes.object).isRequired,
|
listGroups: PropTypes.object.isRequired,
|
||||||
onImportListSelect: PropTypes.func.isRequired,
|
onImportListSelect: PropTypes.func.isRequired,
|
||||||
onModalClose: PropTypes.func.isRequired
|
onModalClose: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import _ from 'lodash';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
@ -16,13 +17,13 @@ function createMapStateToProps() {
|
||||||
schema
|
schema
|
||||||
} = importLists;
|
} = importLists;
|
||||||
|
|
||||||
const allLists = schema;
|
const listGroups = _.groupBy(schema, 'listType');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isSchemaFetching,
|
isSchemaFetching,
|
||||||
isSchemaPopulated,
|
isSchemaPopulated,
|
||||||
schemaError,
|
schemaError,
|
||||||
allLists
|
listGroups
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Lidarr.Api.V1.ImportLists
|
||||||
public int QualityProfileId { get; set; }
|
public int QualityProfileId { get; set; }
|
||||||
public int LanguageProfileId { get; set; }
|
public int LanguageProfileId { get; set; }
|
||||||
public int MetadataProfileId { get; set; }
|
public int MetadataProfileId { get; set; }
|
||||||
|
public ImportListType ListType { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ImportListResourceMapper : ProviderResourceMapper<ImportListResource, ImportListDefinition>
|
public class ImportListResourceMapper : ProviderResourceMapper<ImportListResource, ImportListDefinition>
|
||||||
|
@ -29,6 +30,7 @@ namespace Lidarr.Api.V1.ImportLists
|
||||||
resource.QualityProfileId = definition.ProfileId;
|
resource.QualityProfileId = definition.ProfileId;
|
||||||
resource.LanguageProfileId = definition.LanguageProfileId;
|
resource.LanguageProfileId = definition.LanguageProfileId;
|
||||||
resource.MetadataProfileId = definition.MetadataProfileId;
|
resource.MetadataProfileId = definition.MetadataProfileId;
|
||||||
|
resource.ListType = definition.ListType;
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +50,7 @@ namespace Lidarr.Api.V1.ImportLists
|
||||||
definition.ProfileId = resource.QualityProfileId;
|
definition.ProfileId = resource.QualityProfileId;
|
||||||
definition.LanguageProfileId = resource.LanguageProfileId;
|
definition.LanguageProfileId = resource.LanguageProfileId;
|
||||||
definition.MetadataProfileId = resource.MetadataProfileId;
|
definition.MetadataProfileId = resource.MetadataProfileId;
|
||||||
|
definition.ListType = resource.ListType;
|
||||||
|
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,8 @@ namespace NzbDrone.Core.Datastore
|
||||||
.Ignore(d => d.Tags);
|
.Ignore(d => d.Tags);
|
||||||
|
|
||||||
Mapper.Entity<ImportListDefinition>().RegisterDefinition("ImportLists")
|
Mapper.Entity<ImportListDefinition>().RegisterDefinition("ImportLists")
|
||||||
.Ignore(i => i.Enable);
|
.Ignore(i => i.Enable)
|
||||||
|
.Ignore(i => i.ListType);
|
||||||
|
|
||||||
Mapper.Entity<NotificationDefinition>().RegisterDefinition("Notifications")
|
Mapper.Entity<NotificationDefinition>().RegisterDefinition("Notifications")
|
||||||
.Ignore(i => i.SupportsOnGrab)
|
.Ignore(i => i.SupportsOnGrab)
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace NzbDrone.Core.ImportLists.HeadphonesImport
|
||||||
{
|
{
|
||||||
public override string Name => "Headphones";
|
public override string Name => "Headphones";
|
||||||
|
|
||||||
|
public override ImportListType ListType => ImportListType.Other;
|
||||||
|
|
||||||
public override int PageSize => 1000;
|
public override int PageSize => 1000;
|
||||||
|
|
||||||
public HeadphonesImport(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
public HeadphonesImport(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace NzbDrone.Core.ImportLists
|
||||||
{
|
{
|
||||||
public interface IImportList : IProvider
|
public interface IImportList : IProvider
|
||||||
{
|
{
|
||||||
|
ImportListType ListType { get; }
|
||||||
IList<ImportListItemInfo> Fetch();
|
IList<ImportListItemInfo> Fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ namespace NzbDrone.Core.ImportLists
|
||||||
|
|
||||||
public abstract string Name { get; }
|
public abstract string Name { get; }
|
||||||
|
|
||||||
|
public abstract ImportListType ListType {get; }
|
||||||
|
|
||||||
public ImportListBase(IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
public ImportListBase(IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||||
{
|
{
|
||||||
_importListStatusService = importListStatusService;
|
_importListStatusService = importListStatusService;
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace NzbDrone.Core.ImportLists
|
||||||
public override bool Enable => EnableAutomaticAdd;
|
public override bool Enable => EnableAutomaticAdd;
|
||||||
|
|
||||||
public ImportListStatus Status { get; set; }
|
public ImportListStatus Status { get; set; }
|
||||||
|
public ImportListType ListType { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ImportListMonitorType
|
public enum ImportListMonitorType
|
||||||
|
|
|
@ -35,6 +35,13 @@ namespace NzbDrone.Core.ImportLists
|
||||||
return base.Active().Where(c => c.Enable).ToList();
|
return base.Active().Where(c => c.Enable).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SetProviderCharacteristics(IImportList provider, ImportListDefinition definition)
|
||||||
|
{
|
||||||
|
base.SetProviderCharacteristics(provider, definition);
|
||||||
|
|
||||||
|
definition.ListType = provider.ListType;
|
||||||
|
}
|
||||||
|
|
||||||
public List<IImportList> AutomaticAddEnabled(bool filterBlockedImportLists = true)
|
public List<IImportList> AutomaticAddEnabled(bool filterBlockedImportLists = true)
|
||||||
{
|
{
|
||||||
var enabledImportLists = GetAvailableProviders().Where(n => ((ImportListDefinition)n.Definition).EnableAutomaticAdd);
|
var enabledImportLists = GetAvailableProviders().Where(n => ((ImportListDefinition)n.Definition).EnableAutomaticAdd);
|
||||||
|
|
15
src/NzbDrone.Core/ImportLists/ImportListType.cs
Normal file
15
src/NzbDrone.Core/ImportLists/ImportListType.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.ImportLists
|
||||||
|
{
|
||||||
|
public enum ImportListType
|
||||||
|
{
|
||||||
|
Spotify,
|
||||||
|
LastFm,
|
||||||
|
Other
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,8 @@ namespace NzbDrone.Core.ImportLists.LastFm
|
||||||
{
|
{
|
||||||
public override string Name => "Last.fm Tag";
|
public override string Name => "Last.fm Tag";
|
||||||
|
|
||||||
|
public override ImportListType ListType => ImportListType.LastFm;
|
||||||
|
|
||||||
public override int PageSize => 1000;
|
public override int PageSize => 1000;
|
||||||
|
|
||||||
public LastFmTag(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
public LastFmTag(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace NzbDrone.Core.ImportLists.LastFm
|
||||||
{
|
{
|
||||||
public override string Name => "Last.fm User";
|
public override string Name => "Last.fm User";
|
||||||
|
|
||||||
|
public override ImportListType ListType => ImportListType.LastFm;
|
||||||
|
|
||||||
public override int PageSize => 1000;
|
public override int PageSize => 1000;
|
||||||
|
|
||||||
public LastFmUser(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
public LastFmUser(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace NzbDrone.Core.ImportLists.LidarrLists
|
||||||
{
|
{
|
||||||
public override string Name => "Lidarr Lists";
|
public override string Name => "Lidarr Lists";
|
||||||
|
|
||||||
|
public override ImportListType ListType => ImportListType.Other;
|
||||||
|
|
||||||
public override int PageSize => 10;
|
public override int PageSize => 10;
|
||||||
|
|
||||||
private readonly IMetadataRequestBuilder _requestBuilder;
|
private readonly IMetadataRequestBuilder _requestBuilder;
|
||||||
|
|
|
@ -32,6 +32,8 @@ namespace NzbDrone.Core.ImportLists.Spotify
|
||||||
_importListRepository = importListRepository;
|
_importListRepository = importListRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ImportListType ListType => ImportListType.Spotify;
|
||||||
|
|
||||||
private void RefreshToken()
|
private void RefreshToken()
|
||||||
{
|
{
|
||||||
_logger.Trace("Refreshing Token");
|
_logger.Trace("Refreshing Token");
|
||||||
|
|
|
@ -552,6 +552,7 @@
|
||||||
<Compile Include="ImportLists\ImportListBase.cs" />
|
<Compile Include="ImportLists\ImportListBase.cs" />
|
||||||
<Compile Include="ImportLists\ImportListPageableRequestChain.cs" />
|
<Compile Include="ImportLists\ImportListPageableRequestChain.cs" />
|
||||||
<Compile Include="ImportLists\ImportListPageableRequest.cs" />
|
<Compile Include="ImportLists\ImportListPageableRequest.cs" />
|
||||||
|
<Compile Include="ImportLists\ImportListType.cs" />
|
||||||
<Compile Include="ImportLists\ImportListUpdatedHandler.cs" />
|
<Compile Include="ImportLists\ImportListUpdatedHandler.cs" />
|
||||||
<Compile Include="ImportLists\IProcessImportListResponse.cs" />
|
<Compile Include="ImportLists\IProcessImportListResponse.cs" />
|
||||||
<Compile Include="ImportLists\ImportListSyncService.cs" />
|
<Compile Include="ImportLists\ImportListSyncService.cs" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue