/
/
/
1"""Constants for the MSX Bridge Provider."""
2
3from __future__ import annotations
4
5import re
6
7CONF_HTTP_PORT = "http_port"
8CONF_OUTPUT_FORMAT = "output_format"
9CONF_PLAYER_IDLE_TIMEOUT = "player_idle_timeout"
10CONF_SHOW_STOP_NOTIFICATION = "show_stop_notification"
11CONF_ENABLE_GROUPING = "enable_player_grouping"
12CONF_GROUP_STREAM_MODE = "group_stream_mode"
13CONF_ENABLE_SENDSPIN_BRIDGE = "enable_sendspin_bridge"
14
15DEFAULT_HTTP_PORT = 8099
16DEFAULT_OUTPUT_FORMAT = "mp3"
17DEFAULT_PLAYER_IDLE_TIMEOUT = 30 # minutes
18DEFAULT_SHOW_STOP_NOTIFICATION = False
19DEFAULT_ENABLE_GROUPING = False
20DEFAULT_ENABLE_SENDSPIN_BRIDGE = True
21
22# Group stream modes
23GROUP_STREAM_MODE_INDEPENDENT = "independent" # Each player gets its own stream
24GROUP_STREAM_MODE_SHARED = "shared" # Shared buffer: one ffmpeg, multiple readers
25GROUP_STREAM_MODE_REDIRECT = "redirect" # Redirect TVs to the MA Streamserver directly (default)
26DEFAULT_GROUP_STREAM_MODE = GROUP_STREAM_MODE_REDIRECT
27
28# Player ID prefix for dynamically registered players
29MSX_PLAYER_ID_PREFIX = "msx_"
30
31# Sanitize device_id or IP for use in player_id (alphanumeric + underscore only)
32PLAYER_ID_SANITIZE_RE = re.compile(r"[^a-zA-Z0-9_]+")
33
34# Pre-buffer size: accumulate this many bytes before sending HTTP headers to prevent
35# MSX stutter/restart when ffmpeg hasn't produced data yet.
36PRE_BUFFER_BYTES = 64 * 1024
37
38# Sendspin bridge: client id prefix follows the Sendspin ecosystem "spb_" convention
39SENDSPIN_BRIDGE_CLIENT_PREFIX = "spb_msx_"
40# Seconds the bridge waits for the TV's JS client to connect after a stream
41# start before transferring playback back to the regular HTTP player.
42SENDSPIN_CONNECT_TIMEOUT = 15.0
43