Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2a636e95d1
commit
de654bcbb7
3 files changed
+23
-12
No files matched your search
@@ -1,5 +1,5 @@
|
||||
PROGRAM_NAME = "KaTrain"
|
||||
VERSION = "1.18.0"
|
||||
VERSION = "1.18.1"
|
||||
HOMEPAGE = "https://github.com/sanderland/katrain"
|
||||
CONFIG_MIN_VERSION = "1.17.0" # keep config files from this version
|
||||
ANALYSIS_FORMAT_VERSION = "1.0"
|
||||
|
||||
+17
-10
@@ -31,16 +31,23 @@ def preload_sounds(sound_dir):
|
||||
if not audio_files:
|
||||
return
|
||||
|
||||
# Test if audio subsystem works by loading one sound in a subprocess
|
||||
try:
|
||||
subprocess.run(
|
||||
[sys.executable, "-c",
|
||||
f"from kivy.core.audio import SoundLoader; SoundLoader.load({audio_files[0]!r})"],
|
||||
timeout=3, capture_output=True,
|
||||
)
|
||||
except subprocess.TimeoutExpired as e:
|
||||
print(f"Warning: Audio unavailable ({e}). Sounds disabled.", file=sys.stderr)
|
||||
return
|
||||
# SoundLoader.load() deadlocks when no audio output device is available, so
|
||||
# on macOS/Linux we first probe in a subprocess. We skip the probe when:
|
||||
# - on Windows, where the deadlock does not occur, and
|
||||
# - in frozen builds, where sys.executable is the katrain app (not python),
|
||||
# so "-c <snippet>" relaunches katrain instead of running the snippet;
|
||||
# Kivy then misparses it as a "section:key:value" config arg and crashes.
|
||||
# See https://github.com/sanderland/katrain/issues/824
|
||||
if platform != "win" and not getattr(sys, "frozen", False):
|
||||
try:
|
||||
subprocess.run(
|
||||
[sys.executable, "-c",
|
||||
f"from kivy.core.audio import SoundLoader; SoundLoader.load({audio_files[0]!r})"],
|
||||
timeout=3, capture_output=True,
|
||||
)
|
||||
except subprocess.TimeoutExpired as e:
|
||||
print(f"Warning: Audio unavailable ({e}). Sounds disabled.", file=sys.stderr)
|
||||
return
|
||||
|
||||
# Audio works, preload all sounds
|
||||
for path in audio_files:
|
||||
|
||||
Reference in new issue
Block a user