mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-21 00:32:04 +00:00
fix for bitrate
This commit is contained in:
parent
39ddd236e6
commit
4203ad18be
1 changed files with 13 additions and 4 deletions
|
|
@ -119,10 +119,17 @@ export const buildExoAudioTrackName = (t: any, i: number): string => {
|
||||||
// Check both title and name fields for the |ch: encoding from Java
|
// Check both title and name fields for the |ch: encoding from Java
|
||||||
let rawTitle: string = t.title ?? t.name ?? '';
|
let rawTitle: string = t.title ?? t.name ?? '';
|
||||||
let channelCount: number | null = null;
|
let channelCount: number | null = null;
|
||||||
const chMatch = rawTitle.match(/\|ch:(\d+)$/);
|
let encodedBitrate: number | null = null;
|
||||||
|
|
||||||
|
const chMatch = rawTitle.match(/\|ch:(\d+)/);
|
||||||
if (chMatch) {
|
if (chMatch) {
|
||||||
channelCount = parseInt(chMatch[1], 10);
|
channelCount = parseInt(chMatch[1], 10);
|
||||||
rawTitle = rawTitle.replace(/\|ch:\d+$/, '').trim();
|
rawTitle = rawTitle.replace(/\|ch:\d+/, '').trim();
|
||||||
|
}
|
||||||
|
const brMatch = rawTitle.match(/\|br:(\d+)/);
|
||||||
|
if (brMatch) {
|
||||||
|
encodedBitrate = parseInt(brMatch[1], 10);
|
||||||
|
rawTitle = rawTitle.replace(/\|br:\d+/, '').trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawTitle) {
|
if (rawTitle) {
|
||||||
|
|
@ -162,8 +169,10 @@ export const buildExoAudioTrackName = (t: any, i: number): string => {
|
||||||
else parts.push(`${ch}ch`);
|
else parts.push(`${ch}ch`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t.bitrate != null && t.bitrate > 0) {
|
// Use encoded bitrate first, fall back to t.bitrate / t.bitRate field
|
||||||
parts.push(`${Math.round(t.bitrate / 1000)} kbps`);
|
const bitrate = encodedBitrate ?? t.bitrate ?? t.bitRate ?? null;
|
||||||
|
if (bitrate != null && bitrate > 0) {
|
||||||
|
parts.push(`${Math.round(bitrate / 1000)} kbps`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parts.length > 0 ? parts.join(' ') : `Track ${i + 1}`;
|
return parts.length > 0 ? parts.join(' ') : `Track ${i + 1}`;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue