mirror of https://github.com/lidarr/Lidarr
Fixed: Manual import from artist page forces correct artist
This commit is contained in:
parent
fb88017821
commit
8771e715ae
|
@ -657,6 +657,7 @@ class ArtistDetails extends Component {
|
|||
|
||||
<InteractiveImportModal
|
||||
isOpen={isInteractiveImportModalOpen}
|
||||
artistId={id}
|
||||
folder={path}
|
||||
allowArtistChange={false}
|
||||
showFilterExistingFiles={true}
|
||||
|
|
|
@ -52,6 +52,7 @@ class InteractiveImportModalContentConnector extends Component {
|
|||
|
||||
componentDidMount() {
|
||||
const {
|
||||
artistId,
|
||||
downloadId,
|
||||
folder
|
||||
} = this.props;
|
||||
|
@ -62,6 +63,7 @@ class InteractiveImportModalContentConnector extends Component {
|
|||
} = this.state;
|
||||
|
||||
this.props.fetchInteractiveImportItems({
|
||||
artistId,
|
||||
downloadId,
|
||||
folder,
|
||||
filterExistingFiles,
|
||||
|
@ -78,11 +80,13 @@ class InteractiveImportModalContentConnector extends Component {
|
|||
if (prevState.filterExistingFiles !== filterExistingFiles ||
|
||||
prevState.replaceExistingFiles !== replaceExistingFiles) {
|
||||
const {
|
||||
artistId,
|
||||
downloadId,
|
||||
folder
|
||||
} = this.props;
|
||||
|
||||
this.props.fetchInteractiveImportItems({
|
||||
artistId,
|
||||
downloadId,
|
||||
folder,
|
||||
filterExistingFiles,
|
||||
|
@ -204,6 +208,7 @@ class InteractiveImportModalContentConnector extends Component {
|
|||
}
|
||||
|
||||
InteractiveImportModalContentConnector.propTypes = {
|
||||
artistId: PropTypes.number.isRequired,
|
||||
downloadId: PropTypes.string,
|
||||
folder: PropTypes.string,
|
||||
filterExistingFiles: PropTypes.bool.isRequired,
|
||||
|
@ -219,6 +224,7 @@ InteractiveImportModalContentConnector.propTypes = {
|
|||
};
|
||||
|
||||
InteractiveImportModalContentConnector.defaultProps = {
|
||||
artistId: 0,
|
||||
filterExistingFiles: true,
|
||||
replaceExistingFiles: false
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http;
|
||||
|
@ -44,10 +45,22 @@ namespace Lidarr.Api.V1.ManualImport
|
|||
{
|
||||
var folder = (string)Request.Query.folder;
|
||||
var downloadId = (string)Request.Query.downloadId;
|
||||
NzbDrone.Core.Music.Artist artist = null;
|
||||
|
||||
var artistIdQuery = Request.Query.artistId;
|
||||
if (artistIdQuery.HasValue)
|
||||
{
|
||||
var artistId = Convert.ToInt32(artistIdQuery.Value);
|
||||
if (artistId > 0)
|
||||
{
|
||||
artist = _artistService.GetArtist(Convert.ToInt32(artistIdQuery.Value));
|
||||
}
|
||||
}
|
||||
|
||||
var filter = Request.GetBooleanQueryParameter("filterExistingFiles", true) ? FilterFilesType.Matched : FilterFilesType.None;
|
||||
var replaceExistingFiles = Request.GetBooleanQueryParameter("replaceExistingFiles", true);
|
||||
|
||||
return _manualImportService.GetMediaFiles(folder, downloadId, filter, replaceExistingFiles).ToResource().Select(AddQualityWeight).ToList();
|
||||
return _manualImportService.GetMediaFiles(folder, downloadId, artist, filter, replaceExistingFiles).ToResource().Select(AddQualityWeight).ToList();
|
||||
}
|
||||
|
||||
private ManualImportResource AddQualityWeight(ManualImportResource item)
|
||||
|
|
|
@ -220,6 +220,14 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Identification
|
|||
if (candidateReleases.Count == 0)
|
||||
{
|
||||
// can't find any candidates even after fingerprinting
|
||||
// populate the overrides and return
|
||||
foreach (var localTrack in localAlbumRelease.LocalTracks)
|
||||
{
|
||||
localTrack.Release = idOverrides.AlbumRelease;
|
||||
localTrack.Album = idOverrides.Album;
|
||||
localTrack.Artist = idOverrides.Artist;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Manual
|
|||
{
|
||||
public interface IManualImportService
|
||||
{
|
||||
List<ManualImportItem> GetMediaFiles(string path, string downloadId, FilterFilesType filter, bool replaceExistingFiles);
|
||||
List<ManualImportItem> GetMediaFiles(string path, string downloadId, Artist artist, FilterFilesType filter, bool replaceExistingFiles);
|
||||
List<ManualImportItem> UpdateItems(List<ManualImportItem> item);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Manual
|
|||
_logger = logger;
|
||||
}
|
||||
|
||||
public List<ManualImportItem> GetMediaFiles(string path, string downloadId, FilterFilesType filter, bool replaceExistingFiles)
|
||||
public List<ManualImportItem> GetMediaFiles(string path, string downloadId, Artist artist, FilterFilesType filter, bool replaceExistingFiles)
|
||||
{
|
||||
if (downloadId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
|
@ -116,14 +116,14 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Manual
|
|||
return new List<ManualImportItem> { result };
|
||||
}
|
||||
|
||||
return ProcessFolder(path, downloadId, filter, replaceExistingFiles);
|
||||
return ProcessFolder(path, downloadId, artist, filter, replaceExistingFiles);
|
||||
}
|
||||
|
||||
private List<ManualImportItem> ProcessFolder(string folder, string downloadId, FilterFilesType filter, bool replaceExistingFiles)
|
||||
private List<ManualImportItem> ProcessFolder(string folder, string downloadId, Artist artist, FilterFilesType filter, bool replaceExistingFiles)
|
||||
{
|
||||
DownloadClientItem downloadClientItem = null;
|
||||
var directoryInfo = new DirectoryInfo(folder);
|
||||
var artist = _parsingService.GetArtist(directoryInfo.Name);
|
||||
artist = artist ?? _parsingService.GetArtist(directoryInfo.Name);
|
||||
|
||||
if (downloadId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue