Skip to content
Snippets Groups Projects
Commit 0b9f9269 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

feat: use radio settings for tank line-in inputs

refs aura#242
refs #282
refs #283
parent 4b63d8c3
No related branches found
No related tags found
No related merge requests found
Pipeline #8116 passed
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
<AEditDialog <AEditDialog
ref="dialog" ref="dialog"
:title="t('playlist.editor.addInputDialog.title')" :title="t('playlist.editor.addInputDialog.title')"
:can-save="canSave"
:save-label="t('playlist.editor.addInputDialog.saveLabel')" :save-label="t('playlist.editor.addInputDialog.saveLabel')"
:save="() => emit('save', selectedInput)" :save="() => emit('save', selectedInput as string)"
class="tw-w-min" class="tw-w-min"
> >
<div class="tw-flex tw-flex-col tw-gap-2 tw-w-96"> <div class="tw-flex tw-flex-col tw-gap-2 tw-w-96">
...@@ -33,7 +34,7 @@ ...@@ -33,7 +34,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue' import { computed, onMounted, ref, watchEffect } from 'vue'
import { useI18n } from '@/i18n' import { useI18n } from '@/i18n'
import { usePlayoutStore } from '@/stores' import { usePlayoutStore } from '@/stores'
...@@ -46,8 +47,15 @@ const emit = defineEmits<{ ...@@ -46,8 +47,15 @@ const emit = defineEmits<{
const { t } = useI18n() const { t } = useI18n()
const playout = usePlayoutStore() const playout = usePlayoutStore()
const selectedInput = ref(playout.inputs[0].uri) const selectedInput = ref<string>()
const canSave = computed(() => playout.inputs.some((i) => i.uri === selectedInput.value))
const dialog = ref() const dialog = ref()
onMounted(() => dialog.value.open()) onMounted(() => dialog.value.open())
watchEffect(() => {
if (!selectedInput.value && playout.inputs.length > 0) {
selectedInput.value = playout.inputs[0].uri
}
})
</script> </script>
...@@ -22,6 +22,7 @@ export { usePlayoutStore } from '@/stores/playout' ...@@ -22,6 +22,7 @@ export { usePlayoutStore } from '@/stores/playout'
export { useScheduleStore } from '@/stores/schedules' export { useScheduleStore } from '@/stores/schedules'
export { useShowStore } from '@/stores/shows' export { useShowStore } from '@/stores/shows'
export { useTimeSlotStore } from '@/stores/timeslots' export { useTimeSlotStore } from '@/stores/timeslots'
export { useRadioSettingsStore } from '@/stores/radio-settings'
export { useRRuleStore } from '@/stores/rrules' export { useRRuleStore } from '@/stores/rrules'
export const useFundingCategoryStore = createUnpaginatedAPIStore<FundingCategory>( export const useFundingCategoryStore = createUnpaginatedAPIStore<FundingCategory>(
......
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { computed, MaybeRefOrGetter, toValue } from 'vue' import { computed, MaybeRefOrGetter, toValue } from 'vue'
import { useCurrentRadioSettings } from '@/stores/radio-settings'
type Input = { type Input = {
uri: string uri: string
...@@ -13,14 +14,12 @@ export function useInput(uri: MaybeRefOrGetter<string>) { ...@@ -13,14 +14,12 @@ export function useInput(uri: MaybeRefOrGetter<string>) {
} }
export const usePlayoutStore = defineStore('playout', () => { export const usePlayoutStore = defineStore('playout', () => {
// These are hard-coded in engine-core as well const radioSettings = useCurrentRadioSettings()
// See playout config: https://gitlab.servus.at/aura/engine-core/-/blob/40e7c86373a0029e4db9fd98295997017a92a9e3/config/sample.engine-core.ini#L73
// see playout source: https://gitlab.servus.at/aura/engine-core/-/blob/40e7c86373a0029e4db9fd98295997017a92a9e3/src/in_soundcard.liq#L83-105 const inputs = computed<Input[]>(() => {
const inputs: Input[] = [ const inputs = Object.entries(radioSettings.value?.playout?.lineInChannels ?? {})
{ uri: 'line://0', label: 'Studio' }, return inputs.map(([id, label]) => ({ uri: `line://${id}`, label }))
{ uri: 'line://1', label: 'Pre-Production' }, })
{ uri: 'line://2', label: 'Line 2' },
]
return { return {
inputs, inputs,
......
import { createUnpaginatedAPIStore } from '@/stores/util'
import { RadioSettings } from '@/types'
import { createSteeringURL } from '@/api'
import { steeringAuthInit } from '@/stores/auth'
import { computed } from 'vue'
export const useRadioSettingsStore = createUnpaginatedAPIStore<RadioSettings>(
'radio-settings',
createSteeringURL.prefix('settings'),
steeringAuthInit,
{ syncOnAuth: true },
)
export function useCurrentRadioSettings() {
const radioStore = useRadioSettingsStore()
return computed<RadioSettings | null>(() => radioStore.items?.[0] ?? null)
}
...@@ -57,6 +57,7 @@ export type Topic = Required<steeringComponents['schemas']['Topic']> ...@@ -57,6 +57,7 @@ export type Topic = Required<steeringComponents['schemas']['Topic']>
export type License = Required<steeringComponents['schemas']['License']> export type License = Required<steeringComponents['schemas']['License']>
export type LinkType = Required<steeringComponents['schemas']['LinkType']> export type LinkType = Required<steeringComponents['schemas']['LinkType']>
export type Link = { typeId: LinkType['id'] | null; url: string } export type Link = { typeId: LinkType['id'] | null; url: string }
export type RadioSettings = Required<steeringComponents['schemas']['RadioSettings']>
export type RRule = Required< export type RRule = Required<
Omit<steeringComponents['schemas']['RRule'], 'byWeekdays'> & { Omit<steeringComponents['schemas']['RRule'], 'byWeekdays'> & {
// this is an extension to ease testing // this is an extension to ease testing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment