mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
fix(feed): harden audio detection — audio/mp4 (.f4a/.m4b) podcasts
Follow-up to the audio-only feed guard. Real case: a Nodesignal-Talk podcast published with `imeta m audio/mp4` + a `.f4a` URL. It was already filtered via its imeta hint (audio/mp4 → hasAudio), but unlike the .ogg/.mp3 ones it actually PLAYS in a <video> element (AAC-in-MP4 = audio + poster), which is why it looked like it "worked." It's still a podcast, so it stays out of the video grid. Closes the fallback gap for audio/mp4 notes that lack an imeta audio hint: added .f4a/.m4b/.mka to AUDIO_ONLY_URL_PATTERN (AAC-in-MP4 audio / audiobooks / Matroska audio). .mp4/.m4v remain video and are explicitly asserted not to match. Tests: video-schema-and-conversion (+2, 13/13). Lint + build clean. TODO #60. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
efdf497c59
commit
0c09f2854c
2 files changed
+41
-4
No files matched your search
+7
-4
@@ -1492,10 +1492,13 @@ function detectImetaMediaKinds(tags = []) {
|
||||
return { hasVideo, hasAudio };
|
||||
}
|
||||
|
||||
// Unambiguous audio-only file extensions. `.ogg` is deliberately excluded — it
|
||||
// can be video (Theora) and bitvid maps it to video/ogg — so `.ogg` is only
|
||||
// treated as audio when an `imeta m audio/*` tag says so.
|
||||
const AUDIO_ONLY_URL_PATTERN = /\.(mp3|m4a|aac|wav|flac|opus|oga|weba)(?:[?#]|$)/i;
|
||||
// Unambiguous audio-only file extensions (the fallback when an event carries no
|
||||
// `imeta m audio/*` hint). `.ogg` is deliberately excluded — it can be video
|
||||
// (Theora) and bitvid maps it to video/ogg — so `.ogg` is only treated as audio
|
||||
// when an `imeta m audio/*` tag says so. `.f4a`/`.m4b` are AAC-in-MP4 audio
|
||||
// (podcasts/audiobooks) — NOT `.mp4`/`.m4v`, which are video.
|
||||
const AUDIO_ONLY_URL_PATTERN =
|
||||
/\.(mp3|m4a|m4b|f4a|aac|wav|flac|opus|oga|weba|mka)(?:[?#]|$)/i;
|
||||
|
||||
// Whether a (converted) video object is an audio-only note — a podcast/music
|
||||
// note published as a native kind-30078. bitvid has no <audio> player, so these
|
||||
|
||||
Reference in new issue
Block a user