1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-12-21 20:56:58 +00:00

If multiple languages found, look for default

Fix for Google rolling out AI dubbed translations and cloudtube picking
the first audio stream, not the default.

Chooses the best audio format by filtering for default.

If none of the audio streams are marked as default, then use old
codepath.

Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
Martyn Ranyard 2024-12-13 12:28:40 +00:00 committed by Cadence Ember
parent 4823f8ec73
commit be33a66e8c

View File

@ -19,11 +19,19 @@ for (const f of [].concat(
function getBestAudioFormat() {
let best = null
let aidub = false
for (const f of audioFormats.values()) {
if (f.resolution.includes("default")) {
aidub = true
}
}
for (const f of audioFormats.values()) {
if (!aidub || f.resolution.includes("default")) {
if (best === null || f.bitrate > best.bitrate) {
best = f
}
}
}
return best
}