Skip to content

Commit

Permalink
feat(playout): merge
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtimbo committed Aug 21, 2023
2 parents 44d305f + d7a9e42 commit 5cc1b2d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 16 deletions.
24 changes: 12 additions & 12 deletions legacy/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ log("output.{{ output.kind.value }} is not defined!")
%endif
%ifdef output.{{ output.kind.value }}
output.{{ output.kind.value }}(
id="{{ output.kind.value }}:{{ loop.index }}",
id="{{ output.kind.value }}:{{ loop.index }}",
device="{{ output.device }}",
s
)
Expand Down
40 changes: 37 additions & 3 deletions shared/libretime_shared/config/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,25 +245,59 @@ class ShoutcastOutput(BaseModel):
genre: Optional[str] = None


class SystemOutputKind(str, Enum):
class SystemOutput(str, Enum):
ALSA = "alsa"
AO = "ao"
OSS = "oss"
PORTAUDIO = "portaudio"
PULSEAUDIO = "pulseaudio"


class SystemOutput(BaseModel):
class BaseSystemOutput(BaseModel):
enabled: bool = False
kind: SystemOutputKind = SystemOutputKind.ALSA
device: Optional[str] = None


class ALSASystemOutput(BaseSystemOutput):
kind: Literal[SystemOutput.ALSA] = SystemOutput.ALSA
device: Optional[str] = None


class AOSystemOutput(BaseSystemOutput):
kind: Literal[SystemOutput.AO] = SystemOutput.AO


class OSSSystemOutput(BaseSystemOutput):
kind: Literal[SystemOutput.OSS] = SystemOutput.OSS


class PortAudioSystemOutput(BaseSystemOutput):
kind: Literal[SystemOutput.PORTAUDIO] = SystemOutput.PORTAUDIO


class PulseAudioSystemOutput(BaseSystemOutput):
kind: Literal[SystemOutput.PULSEAUDIO] = SystemOutput.PULSEAUDIO


AnySystemOutput = Annotated[
Union[
ALSASystemOutput,
AOSystemOutput,
OSSSystemOutput,
PortAudioSystemOutput,
PulseAudioSystemOutput,
],
Field(discriminator="kind"),
]
>>>>>>> d7a9e428641df61c732c773306af0fc68c58ee12


# pylint: disable=too-few-public-methods
class Outputs(BaseModel):
icecast: List[IcecastOutput] = Field([], max_items=3)
shoutcast: List[ShoutcastOutput] = Field([], max_items=1)
system: List[SystemOutput] = Field([], max_items=1)
system: List[AnySystemOutput] = Field([], max_items=1)

@property
def merged(self) -> List[Union[IcecastOutput, ShoutcastOutput]]:
Expand Down

0 comments on commit 5cc1b2d

Please sign in to comment.