From 2de8c72131def1ebfa6eb019de5e53d9378d2503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20van=20Br=C3=BCgge?= Date: Mon, 6 Jun 2022 10:40:10 +0200 Subject: [PATCH] Allow `show` and `episode_id` tags for audiobook series FFmpeg only supports a very limited number of tags for m4b files (see https://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata) by default. `series` and `series-part` are only possible by enabling custom tags with `-movflags use_metadata_tags`. To work around that, `show` and `episode_id` are added as second option. --- server/utils/prober.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/server/utils/prober.js b/server/utils/prober.js index 4a8bd952..f9dc39b3 100644 --- a/server/utils/prober.js +++ b/server/utils/prober.js @@ -70,11 +70,6 @@ function tryGrabChannelLayout(stream) { return String(layout).split('(').shift() } -function tryGrabTag(stream, tag) { - if (!stream.tags) return null - return stream.tags[tag] || stream.tags[tag.toUpperCase()] || null -} - function tryGrabTags(stream, ...tags) { if (!stream.tags) return null for (let i = 0; i < tags.length; i++) { @@ -182,14 +177,14 @@ function parseTags(format, verbose) { file_tag_comment: tryGrabTags(format, 'comment', 'comm', 'com'), file_tag_description: tryGrabTags(format, 'description', 'desc'), file_tag_genre: tryGrabTags(format, 'genre', 'tcon', 'tco'), - file_tag_series: tryGrabTag(format, 'series'), - file_tag_seriespart: tryGrabTag(format, 'series-part'), - file_tag_isbn: tryGrabTag(format, 'isbn'), + file_tag_series: tryGrabTags(format, 'series', 'show'), + file_tag_seriespart: tryGrabTags(format, 'series-part', 'episode_id'), + file_tag_isbn: tryGrabTags(format, 'isbn'), file_tag_language: tryGrabTags(format, 'language', 'lang'), - file_tag_asin: tryGrabTag(format, 'asin'), + file_tag_asin: tryGrabTags(format, 'asin'), // Not sure if these are actually used yet or not - file_tag_creation_time: tryGrabTag(format, 'creation_time'), + file_tag_creation_time: tryGrabTags(format, 'creation_time'), file_tag_wwwaudiofile: tryGrabTags(format, 'wwwaudiofile', 'woaf', 'waf'), file_tag_contentgroup: tryGrabTags(format, 'contentgroup', 'tit1', 'tt1'), file_tag_releasetime: tryGrabTags(format, 'releasetime', 'tdrl'), @@ -299,4 +294,4 @@ function probe(filepath, verbose = false) { } }) } -module.exports.probe = probe \ No newline at end of file +module.exports.probe = probe