mirror of
https://github.com/Readarr/Readarr
synced 2026-01-13 02:53:19 +01:00
Fixed: Trying to get book details from filename when already obtained from tags
This commit is contained in:
parent
446a0591db
commit
791bba471f
4 changed files with 13 additions and 24 deletions
|
|
@ -31,7 +31,7 @@ private LocalEdition GivenTracks(List<string> files, string root)
|
|||
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 @@ private void VerifyDataAuto(List<LocalBook> tracks, string[] tokens, string whit
|
|||
|
||||
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 @@ public AggregateFilenameInfo(Logger logger)
|
|||
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 @@ private void ApplyMatches(Dictionary<LocalBook, Match> matches, Regex pattern)
|
|||
// 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 @@ public static Distance BookDistance(List<LocalBook> localTracks, Edition edition
|
|||
{
|
||||
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 @@ public void Scan(List<string> folders = null, FilterFilesType filter = FilterFil
|
|||
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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue