aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-06-08 22:02:41 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-06-08 22:02:41 +0200
commitc2404189eb4800764de13f28abc0bca2b3b5d848 (patch)
tree4e05ab1f352a18db2dd8352a3a4384d99bb270de
parente9eea96d7132fe7811b3c7b5f826cc99860ef1e3 (diff)
downloadrefcat-c2404189eb4800764de13f28abc0bca2b3b5d848.tar.gz
refcat-c2404189eb4800764de13f28abc0bca2b3b5d848.zip
map: tweak isbn
-rw-r--r--skate/map.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/skate/map.go b/skate/map.go
index 17d9ed2..a6dc5f3 100644
--- a/skate/map.go
+++ b/skate/map.go
@@ -289,22 +289,13 @@ func MapperOpenLibraryReleaseNormalizedISBN(p []byte) (fields [][]byte, err erro
}
// There can be 10 and 13 variants in the data, we always want 13.
for _, isbn := range doc.ExtIDs.ISBN {
- if len(isbn) == 13 {
- isbn13 = isbn
+ parsed := ParseIsbn(isbn)
+ if len(parsed) > 0 {
+ isbn13 = parsed[0]
break
}
}
if isbn13 == "" {
- // This is rarer, more expensive.
- for _, isbn := range doc.ExtIDs.ISBN {
- parsed := ParseIsbn(isbn)
- if len(parsed) > 0 {
- isbn13 = parsed[0]
- break
- }
- }
- }
- if isbn13 == "" {
return nil, nil
} else {
key = []byte(isbn13)