Massive refactor (Zed wouldn't stop complaining about formatting) and
beginning of proper GNOME implementation.
This commit is contained in:
+31
-20
@@ -1,29 +1,40 @@
|
||||
from .env_key import SunshineEnvKey as EnvKey
|
||||
from .enums import SunshineAudioConfig
|
||||
from .structs import SunshineAudioConfig, SunshineEnvironmentVariables, SunshineClientSpecs, SunshineClientInfo, SunshineClientOptions
|
||||
|
||||
from os import environ
|
||||
|
||||
from .enums import SunshineAudioConfig
|
||||
from .env_key import SunshineEnvKey as EnvKey
|
||||
from .structs import (
|
||||
SunshineAudioConfig,
|
||||
SunshineClientInfo,
|
||||
SunshineClientOptions,
|
||||
SunshineClientSpecs,
|
||||
SunshineEnvironmentVariables,
|
||||
)
|
||||
|
||||
|
||||
def load_env_variables() -> SunshineEnvironmentVariables:
|
||||
def ld_str(var: EnvKey): return environ.get(var.requested_key, var.default)
|
||||
def ld_int(var: EnvKey): return int(ld_str(var))
|
||||
def ld_bool(var: EnvKey): return ld_str(var).lower() == "true"
|
||||
|
||||
def ld_str(var: EnvKey):
|
||||
return environ.get(var.requested_key, var.default)
|
||||
|
||||
def ld_int(var: EnvKey):
|
||||
return int(ld_str(var))
|
||||
|
||||
def ld_bool(var: EnvKey):
|
||||
return ld_str(var).lower() == "true"
|
||||
|
||||
return SunshineEnvironmentVariables(
|
||||
SunshineClientInfo(
|
||||
app_id = ld_str(EnvKey.APP_ID),
|
||||
app_name = ld_str(EnvKey.APP_NAME)
|
||||
app_id=ld_str(EnvKey.APP_ID), app_name=ld_str(EnvKey.APP_NAME)
|
||||
),
|
||||
SunshineClientSpecs(
|
||||
width = ld_int(EnvKey.WIDTH),
|
||||
height = ld_int(EnvKey.HEIGHT),
|
||||
fps = ld_int(EnvKey.FPS),
|
||||
hdr = ld_bool(EnvKey.HDR),
|
||||
gcmap = ld_int(EnvKey.GCMAP)
|
||||
width=ld_int(EnvKey.WIDTH),
|
||||
height=ld_int(EnvKey.HEIGHT),
|
||||
fps=ld_int(EnvKey.FPS),
|
||||
hdr=ld_bool(EnvKey.HDR),
|
||||
gcmap=ld_int(EnvKey.GCMAP),
|
||||
),
|
||||
SunshineClientOptions(
|
||||
host_audio = ld_bool(EnvKey.HOST_AUDIO),
|
||||
enable_sops = ld_bool(EnvKey.ENABLE_SOPS),
|
||||
audio_config = SunshineAudioConfig(ld_str(EnvKey.AUDIO_CONFIG))
|
||||
)
|
||||
)
|
||||
host_audio=ld_bool(EnvKey.HOST_AUDIO),
|
||||
enable_sops=ld_bool(EnvKey.ENABLE_SOPS),
|
||||
audio_config=SunshineAudioConfig(ld_str(EnvKey.AUDIO_CONFIG)),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user