Fixes #5967 -- Hide bitrate for lossless streams.
This commit is contained in:
parent
0408efb656
commit
a6641d5a4f
|
@ -33,9 +33,8 @@
|
|||
</template>
|
||||
<template #cell(enable_autodj)="row">
|
||||
<template v-if="row.item.enable_autodj">
|
||||
{{ $gettext('Enabled') }}
|
||||
-
|
||||
{{ row.item.autodj_bitrate }}kbps {{ upper(row.item.autodj_format) }}
|
||||
{{ $gettext('Enabled') }} -
|
||||
{{ showFormatAndBitrate(row.item.autodj_format, row.item.autodj_bitrate) }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $gettext('Disabled') }}
|
||||
|
@ -70,6 +69,7 @@ import {ref} from "vue";
|
|||
import {useSweetAlert} from "~/vendor/sweetalert";
|
||||
import {useNotify} from "~/vendor/bootstrapVue";
|
||||
import {useAxios} from "~/vendor/axios";
|
||||
import showFormatAndBitrate from "~/functions/showFormatAndBitrate";
|
||||
|
||||
const props = defineProps({
|
||||
...mayNeedRestartProps,
|
||||
|
@ -90,14 +90,6 @@ const fields = [
|
|||
{key: 'actions', label: $gettext('Actions'), sortable: false, class: 'shrink'}
|
||||
];
|
||||
|
||||
const upper = (data) => {
|
||||
let upper = [];
|
||||
data.split(' ').forEach((word) => {
|
||||
upper.push(word.toUpperCase());
|
||||
});
|
||||
return upper.join(' ');
|
||||
};
|
||||
|
||||
const datatable = ref(); // DataTable
|
||||
|
||||
const relist = () => {
|
||||
|
|
|
@ -27,9 +27,8 @@
|
|||
</template>
|
||||
<template #cell(enable_autodj)="row">
|
||||
<template v-if="row.item.enable_autodj">
|
||||
{{ $gettext('Enabled') }} - {{ row.item.autodj_bitrate }}kbps {{
|
||||
upper(row.item.autodj_format)
|
||||
}}
|
||||
{{ $gettext('Enabled') }} -
|
||||
{{ showFormatAndBitrate(row.item.autodj_format, row.item.autodj_bitrate) }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $gettext('Disabled') }}
|
||||
|
@ -64,6 +63,7 @@ import {ref} from "vue";
|
|||
import {useSweetAlert} from "~/vendor/sweetalert";
|
||||
import {useNotify} from "~/vendor/bootstrapVue";
|
||||
import {useAxios} from "~/vendor/axios";
|
||||
import showFormatAndBitrate from "~/functions/showFormatAndBitrate";
|
||||
|
||||
const props = defineProps({
|
||||
...mayNeedRestartProps,
|
||||
|
@ -78,18 +78,6 @@ const fields = [
|
|||
{key: 'actions', label: $gettext('Actions'), sortable: false, class: 'shrink'}
|
||||
];
|
||||
|
||||
const upper = (data) => {
|
||||
if (!data) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let upper = [];
|
||||
data.split(' ').forEach((word) => {
|
||||
upper.push(word.toUpperCase());
|
||||
});
|
||||
return upper.join(' ');
|
||||
};
|
||||
|
||||
const datatable = ref(); // DataTable
|
||||
|
||||
const relist = () => {
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import strtoupper from "~/functions/strtoupper";
|
||||
|
||||
export default function showFormatAndBitrate(format, bitrate) {
|
||||
if (format === 'flac') {
|
||||
return strtoupper(format);
|
||||
}
|
||||
|
||||
return bitrate + 'kbps ' + strtoupper(format);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
export default function strtoupper(data) {
|
||||
if (!data) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let upper = [];
|
||||
data.split(' ').forEach((word) => {
|
||||
upper.push(word.toUpperCase());
|
||||
});
|
||||
return upper.join(' ');
|
||||
};
|
|
@ -182,7 +182,11 @@ class StationMount implements
|
|||
}
|
||||
|
||||
if ($this->enable_autodj) {
|
||||
return $this->name . ' (' . $this->autodj_bitrate . 'kbps ' . strtoupper($this->autodj_format ?? '') . ')';
|
||||
$format = $this->getAutodjFormatEnum();
|
||||
|
||||
return (null !== $format)
|
||||
? $this->name . ' (' . $format->formatBitrate($this->autodj_bitrate) . ')'
|
||||
: $this->name;
|
||||
}
|
||||
|
||||
return $this->name;
|
||||
|
|
|
@ -426,7 +426,10 @@ class StationRemote implements
|
|||
}
|
||||
|
||||
if ($this->enable_autodj) {
|
||||
return $this->autodj_bitrate . 'kbps ' . strtoupper($this->autodj_format ?? '');
|
||||
$format = $this->getAutodjFormatEnum();
|
||||
if (null !== $format) {
|
||||
return $format->formatBitrate($this->autodj_bitrate);
|
||||
}
|
||||
}
|
||||
|
||||
return Utilities\Strings::truncateUrl($this->url);
|
||||
|
|
|
@ -23,6 +23,18 @@ enum StreamFormats: string
|
|||
};
|
||||
}
|
||||
|
||||
public function formatBitrate(?int $bitrate): string
|
||||
{
|
||||
if (null === $bitrate) {
|
||||
return strtoupper($this->value);
|
||||
}
|
||||
|
||||
return match ($this) {
|
||||
self::Flac => 'FLAC',
|
||||
default => $bitrate . 'kbps ' . strtoupper($this->value)
|
||||
};
|
||||
}
|
||||
|
||||
public function sendIcyMetadata(): bool
|
||||
{
|
||||
return match ($this) {
|
||||
|
|
Loading…
Reference in New Issue