Added isbn fetching for metadata

If file metadata has isbn tag it will be fetched and used for book
This commit is contained in:
ISO-B 2022-01-03 21:40:03 +02:00
parent 55e253ac60
commit 021d3cfa1a
3 changed files with 11 additions and 2 deletions

View File

@ -16,6 +16,7 @@ class AudioFileMetadata {
this.tagDescription = null this.tagDescription = null
this.tagEncoder = null this.tagEncoder = null
this.tagEncodedBy = null this.tagEncodedBy = null
this.tagIsbn = null
if (metadata) { if (metadata) {
this.construct(metadata) this.construct(metadata)
@ -50,6 +51,7 @@ class AudioFileMetadata {
this.tagDescription = metadata.tagDescription || null this.tagDescription = metadata.tagDescription || null
this.tagEncoder = metadata.tagEncoder || null this.tagEncoder = metadata.tagEncoder || null
this.tagEncodedBy = metadata.tagEncodedBy || null this.tagEncodedBy = metadata.tagEncodedBy || null
this.tagIsbn = metadata.tagIsbn || null
} }
// Data parsed in prober.js // Data parsed in prober.js
@ -70,6 +72,7 @@ class AudioFileMetadata {
this.tagDescription = payload.file_tag_description || null this.tagDescription = payload.file_tag_description || null
this.tagEncoder = payload.file_tag_encoder || null this.tagEncoder = payload.file_tag_encoder || null
this.tagEncodedBy = payload.file_tag_encodedby || null this.tagEncodedBy = payload.file_tag_encodedby || null
this.tagIsbn = payload.file_tag_isbn || null
} }
updateData(payload) { updateData(payload) {
@ -89,7 +92,8 @@ class AudioFileMetadata {
tagComment: payload.file_tag_comment || null, tagComment: payload.file_tag_comment || null,
tagDescription: payload.file_tag_description || null, tagDescription: payload.file_tag_description || null,
tagEncoder: payload.file_tag_encoder || null, tagEncoder: payload.file_tag_encoder || null,
tagEncodedBy: payload.file_tag_encodedby || null tagEncodedBy: payload.file_tag_encodedby || null,
tagIsbn: payload.file_tag_isbn || nulll
} }
var hasUpdates = false var hasUpdates = false

View File

@ -343,6 +343,10 @@ class Book {
{ {
tag: 'tagSeriesPart', tag: 'tagSeriesPart',
key: 'volumeNumber' key: 'volumeNumber'
},
{
tag: 'tagIsbn',
key: 'isbn'
} }
] ]

View File

@ -163,6 +163,7 @@ function parseTags(format, verbose) {
file_tag_genre: tryGrabTags(format, 'genre', 'tcon', 'tco'), file_tag_genre: tryGrabTags(format, 'genre', 'tcon', 'tco'),
file_tag_series: tryGrabTag(format, 'series'), file_tag_series: tryGrabTag(format, 'series'),
file_tag_seriespart: tryGrabTag(format, 'series-part'), file_tag_seriespart: tryGrabTag(format, 'series-part'),
file_tag_isbn: tryGrabTag(format, 'isbn'),
// Not sure if these are actually used yet or not // Not sure if these are actually used yet or not
file_tag_creation_time: tryGrabTag(format, 'creation_time'), file_tag_creation_time: tryGrabTag(format, 'creation_time'),
@ -180,7 +181,7 @@ function parseTags(format, verbose) {
} }
} }
var keysToLookOutFor = ['file_tag_genre1', 'file_tag_genre2', 'file_tag_series', 'file_tag_seriespart', 'file_tag_movement', 'file_tag_movementname', 'file_tag_wwwaudiofile', 'file_tag_contentgroup', 'file_tag_releasetime'] var keysToLookOutFor = ['file_tag_genre1', 'file_tag_genre2', 'file_tag_series', 'file_tag_seriespart', 'file_tag_movement', 'file_tag_movementname', 'file_tag_wwwaudiofile', 'file_tag_contentgroup', 'file_tag_releasetime', 'file_tag_isbn']
keysToLookOutFor.forEach((key) => { keysToLookOutFor.forEach((key) => {
if (tags[key]) { if (tags[key]) {
Logger.debug(`Notable! ${key} => ${tags[key]}`) Logger.debug(`Notable! ${key} => ${tags[key]}`)