|
|
@ -19,6 +19,8 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Identification
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly RegexReplace StripSeriesRegex = new RegexReplace(@"\([^\)].+?\)$", string.Empty, RegexOptions.Compiled);
|
|
|
|
private static readonly RegexReplace StripSeriesRegex = new RegexReplace(@"\([^\)].+?\)$", string.Empty, RegexOptions.Compiled);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly RegexReplace CleanTitleCruft = new RegexReplace(@"\((?:unabridged)\)", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
|
|
|
|
|
|
|
|
|
|
|
public static Distance BookDistance(List<LocalBook> localTracks, Edition edition)
|
|
|
|
public static Distance BookDistance(List<LocalBook> localTracks, Edition edition)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var dist = new Distance();
|
|
|
|
var dist = new Distance();
|
|
|
@ -68,8 +70,10 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Identification
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dist.AddString("book", title, titleOptions);
|
|
|
|
var fileTitles = new[] { title, CleanTitleCruft.Replace(title) }.Distinct().ToList();
|
|
|
|
Logger.Trace("book: '{0}' vs '{1}'; {2}", title, titleOptions.ConcatToString("' or '"), dist.NormalizedDistance());
|
|
|
|
|
|
|
|
|
|
|
|
dist.AddString("book", fileTitles, titleOptions);
|
|
|
|
|
|
|
|
Logger.Trace("book: '{0}' vs '{1}'; {2}", fileTitles.ConcatToString("' or '"), titleOptions.ConcatToString("' or '"), dist.NormalizedDistance());
|
|
|
|
|
|
|
|
|
|
|
|
var isbn = localTracks.MostCommon(x => x.FileTrackInfo.Isbn);
|
|
|
|
var isbn = localTracks.MostCommon(x => x.FileTrackInfo.Isbn);
|
|
|
|
if (isbn.IsNotNullOrWhiteSpace() && edition.Isbn13.IsNotNullOrWhiteSpace())
|
|
|
|
if (isbn.IsNotNullOrWhiteSpace() && edition.Isbn13.IsNotNullOrWhiteSpace())
|
|
|
|