mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
Fixed: author manual import (#32)
* Fix: apply fix from Lidarr to the Readarr manual import modal * Rename Album to Book in the identification override * Rename "audio" to "book" in the interactive import modal empty message
This commit is contained in:
@@ -60,16 +60,16 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Identification
|
||||
// tagCandidate = GetDbCandidatesByRelease(new List<AlbumRelease> { tagMbidRelease }, includeExisting);
|
||||
// }
|
||||
// }
|
||||
if (idOverrides?.Album != null)
|
||||
if (idOverrides?.Book != null)
|
||||
{
|
||||
// use the release from file tags if it exists and agrees with the specified book
|
||||
if (tagMbidRelease?.Id == idOverrides.Album.Id)
|
||||
if (tagMbidRelease?.Id == idOverrides.Book.Id)
|
||||
{
|
||||
candidateReleases = tagCandidate;
|
||||
}
|
||||
else
|
||||
{
|
||||
candidateReleases = GetDbCandidatesByAlbum(idOverrides.Album, includeExisting);
|
||||
candidateReleases = GetDbCandidatesByAlbum(idOverrides.Book, includeExisting);
|
||||
}
|
||||
}
|
||||
else if (idOverrides?.Author != null)
|
||||
|
||||
@@ -125,6 +125,14 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Identification
|
||||
|
||||
if (candidateReleases.Count == 0)
|
||||
{
|
||||
// can't find any candidates even after fingerprinting
|
||||
// populate the overrides and return
|
||||
foreach (var localTrack in localAlbumRelease.LocalBooks)
|
||||
{
|
||||
localTrack.Book = idOverrides.Book;
|
||||
localTrack.Author = idOverrides.Author;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport
|
||||
public class IdentificationOverrides
|
||||
{
|
||||
public Author Author { get; set; }
|
||||
public Book Album { get; set; }
|
||||
public Book Book { get; set; }
|
||||
}
|
||||
|
||||
public class ImportDecisionMakerInfo
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Manual
|
||||
{
|
||||
public interface IManualImportService
|
||||
{
|
||||
List<ManualImportItem> GetMediaFiles(string path, string downloadId, FilterFilesType filter, bool replaceExistingFiles);
|
||||
List<ManualImportItem> GetMediaFiles(string path, string downloadId, Author author, FilterFilesType filter, bool replaceExistingFiles);
|
||||
List<ManualImportItem> UpdateItems(List<ManualImportItem> item);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Manual
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public List<ManualImportItem> GetMediaFiles(string path, string downloadId, FilterFilesType filter, bool replaceExistingFiles)
|
||||
public List<ManualImportItem> GetMediaFiles(string path, string downloadId, Author author, FilterFilesType filter, bool replaceExistingFiles)
|
||||
{
|
||||
if (downloadId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
@@ -110,14 +110,14 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Manual
|
||||
return new List<ManualImportItem> { result };
|
||||
}
|
||||
|
||||
return ProcessFolder(path, downloadId, filter, replaceExistingFiles);
|
||||
return ProcessFolder(path, downloadId, author, filter, replaceExistingFiles);
|
||||
}
|
||||
|
||||
private List<ManualImportItem> ProcessFolder(string folder, string downloadId, FilterFilesType filter, bool replaceExistingFiles)
|
||||
private List<ManualImportItem> ProcessFolder(string folder, string downloadId, Author author, FilterFilesType filter, bool replaceExistingFiles)
|
||||
{
|
||||
DownloadClientItem downloadClientItem = null;
|
||||
var directoryInfo = new DirectoryInfo(folder);
|
||||
var author = _parsingService.GetArtist(directoryInfo.Name);
|
||||
author = author ?? _parsingService.GetArtist(directoryInfo.Name);
|
||||
|
||||
if (downloadId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
@@ -181,7 +181,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Manual
|
||||
var idOverride = new IdentificationOverrides
|
||||
{
|
||||
Author = group.First().Author,
|
||||
Album = group.First().Book,
|
||||
Book = group.First().Book,
|
||||
};
|
||||
var config = new ImportDecisionMakerConfig
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
@@ -41,10 +42,23 @@ namespace Readarr.Api.V1.ManualImport
|
||||
{
|
||||
var folder = (string)Request.Query.folder;
|
||||
var downloadId = (string)Request.Query.downloadId;
|
||||
NzbDrone.Core.Books.Author author = null;
|
||||
|
||||
var authorIdQuery = Request.Query.authorId;
|
||||
if (authorIdQuery.HasValue)
|
||||
{
|
||||
var authorId = Convert.ToInt32(authorIdQuery.Value);
|
||||
|
||||
if (authorId > 0)
|
||||
{
|
||||
author = _authorService.GetAuthor(authorId);
|
||||
}
|
||||
}
|
||||
|
||||
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, author, filter, replaceExistingFiles).ToResource().Select(AddQualityWeight).ToList();
|
||||
}
|
||||
|
||||
private ManualImportResource AddQualityWeight(ManualImportResource item)
|
||||
|
||||
Reference in New Issue
Block a user