mirror of
https://github.com/fergalmoran/Readarr.git
synced 2026-02-10 18:07:38 +00:00
Fixed: Trying to get book details from filename when already obtained from tags
This commit is contained in:
@@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Aggregation.Aggregators
|
||||
private void VerifyData(LocalBook track, string author, string title, int trackNum, int disc)
|
||||
{
|
||||
track.FileTrackInfo.AuthorTitle.Should().Be(author);
|
||||
track.FileTrackInfo.Title.Should().Be(title);
|
||||
track.FileTrackInfo.BookTitle.Should().Be(title);
|
||||
track.FileTrackInfo.TrackNumbers[0].Should().Be(trackNum);
|
||||
track.FileTrackInfo.DiscNumber.Should().Be(disc);
|
||||
}
|
||||
@@ -172,21 +172,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Aggregation.Aggregators
|
||||
|
||||
if (tokens.Contains("title"))
|
||||
{
|
||||
info.Title.Should().Be($"{(char)(96 + i)} track title {i}".Replace(" ", whitespace));
|
||||
}
|
||||
|
||||
if (tokens.Contains("trackNum2") || tokens.Contains("trackNum3"))
|
||||
{
|
||||
info.TrackNumbers[0].Should().Be(i);
|
||||
}
|
||||
|
||||
if (tokens.Contains("trackNum3"))
|
||||
{
|
||||
info.DiscNumber.Should().Be(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
info.DiscNumber.Should().Be(0);
|
||||
info.BookTitle.Should().Be($"{(char)(96 + i)} track title {i}".Replace(" ", whitespace));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,9 +58,8 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Aggregation.Aggregators
|
||||
public LocalEdition Aggregate(LocalEdition release, bool others)
|
||||
{
|
||||
var tracks = release.LocalBooks;
|
||||
if (tracks.Count(x => x.FileTrackInfo.Title.IsNullOrWhiteSpace()) > 0
|
||||
|| tracks.Count(x => x.FileTrackInfo.TrackNumbers.First() == 0) > 0
|
||||
|| tracks.Count(x => x.FileTrackInfo.DiscNumber == 0) > 0)
|
||||
if (tracks.Any(x => x.FileTrackInfo.BookTitle.IsNullOrWhiteSpace())
|
||||
|| tracks.Any(x => x.FileTrackInfo.AuthorTitle.IsNullOrWhiteSpace()))
|
||||
{
|
||||
_logger.Debug("Missing data in tags, trying filename augmentation");
|
||||
foreach (var charSep in CharsAndSeps)
|
||||
@@ -163,11 +162,11 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Aggregation.Aggregators
|
||||
// Apply the title and track
|
||||
foreach (var track in matches.Keys)
|
||||
{
|
||||
if (track.FileTrackInfo.Title.IsNullOrWhiteSpace())
|
||||
if (track.FileTrackInfo.BookTitle.IsNullOrWhiteSpace())
|
||||
{
|
||||
var title = matches[track].Groups[titleField].Value.Trim();
|
||||
_logger.Debug("Got title from filename: {0}", title);
|
||||
track.FileTrackInfo.Title = title;
|
||||
track.FileTrackInfo.BookTitle = title;
|
||||
}
|
||||
|
||||
var trackNums = track.FileTrackInfo.TrackNumbers;
|
||||
|
||||
@@ -53,8 +53,11 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Identification
|
||||
{
|
||||
foreach (var l in edition.Book.Value.SeriesLinks.Value)
|
||||
{
|
||||
titleOptions.Add($"{l.Series.Value.Title} {l.Position} {edition.Title}");
|
||||
titleOptions.Add($"{edition.Title} {l.Series.Value.Title} {l.Position}");
|
||||
if (l.Series?.Value?.Title?.IsNotNullOrWhiteSpace() ?? false)
|
||||
{
|
||||
titleOptions.Add($"{l.Series.Value.Title} {l.Position} {edition.Title}");
|
||||
titleOptions.Add($"{edition.Title} {l.Series.Value.Title} {l.Position}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,8 @@ namespace NzbDrone.Core.MediaFiles
|
||||
Modified = decision.Item.Modified,
|
||||
DateAdded = DateTime.UtcNow,
|
||||
Quality = decision.Item.Quality,
|
||||
MediaInfo = decision.Item.FileTrackInfo.MediaInfo
|
||||
MediaInfo = decision.Item.FileTrackInfo.MediaInfo,
|
||||
Edition = decision.Item.Edition
|
||||
})
|
||||
.ToList();
|
||||
_mediaFileService.AddMany(newFiles);
|
||||
|
||||
Reference in New Issue
Block a user