discstation 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/discstation.py +13 -2
- package/src/discstation_host.py +5 -0
package/package.json
CHANGED
package/src/discstation.py
CHANGED
|
@@ -571,6 +571,13 @@ def _record_web_status(msg):
|
|
|
571
571
|
elif msg.startswith("CANCELLED:"):
|
|
572
572
|
_web_status = msg[10:].strip() or "CANCELLED"
|
|
573
573
|
_web_progress_active = False
|
|
574
|
+
elif msg.startswith(("STANDBY:", "HOME:")):
|
|
575
|
+
# idle again (tray open, insert disc, back to the menu) — clear any
|
|
576
|
+
# lingering "Ejecting..." / progress state on the web UI.
|
|
577
|
+
text = msg.split(":", 1)[1].strip()
|
|
578
|
+
_web_status = "READY" if text in ("", "DiscStation", "Select mode", "Starting...") else text
|
|
579
|
+
_web_progress = -1
|
|
580
|
+
_web_progress_active = False
|
|
574
581
|
else:
|
|
575
582
|
return
|
|
576
583
|
_sse_publish(_status_snapshot())
|
|
@@ -3829,9 +3836,13 @@ def station_loop(ser, url, artist_hint=None, album_hint=None):
|
|
|
3829
3836
|
apply_disc_line("Disc: reading...")
|
|
3830
3837
|
elif st == "disc":
|
|
3831
3838
|
_tray_open = False
|
|
3839
|
+
transient_words = ["none", "checking", "reading", "tray open"]
|
|
3840
|
+
if discstation_host.system_name() == "darwin":
|
|
3841
|
+
# macOS slot drives take a few seconds to mount; "unknown"
|
|
3842
|
+
# is a not-ready read, not a settled answer — keep re-polling.
|
|
3843
|
+
transient_words.append("unknown")
|
|
3832
3844
|
have_line = last_disc_line and not any(
|
|
3833
|
-
w in last_disc_line.lower()
|
|
3834
|
-
for w in ("none", "checking", "reading", "tray open"))
|
|
3845
|
+
w in last_disc_line.lower() for w in transient_words)
|
|
3835
3846
|
if not have_line and _disc_poll_future is None:
|
|
3836
3847
|
_disc_poll_start = now
|
|
3837
3848
|
last_disc_poll = now
|
package/src/discstation_host.py
CHANGED
|
@@ -424,6 +424,7 @@ def eject_device(device, close=False):
|
|
|
424
424
|
command.append("-t")
|
|
425
425
|
command.append(device)
|
|
426
426
|
elif system == "darwin":
|
|
427
|
+
global _last_disc_device
|
|
427
428
|
# `drutil tray open` is a no-op on slot-load drives; `drutil eject`
|
|
428
429
|
# works on both. `diskutil eject` is the fallback for a mounted disc.
|
|
429
430
|
if close:
|
|
@@ -435,6 +436,10 @@ def eject_device(device, close=False):
|
|
|
435
436
|
for command in commands:
|
|
436
437
|
try:
|
|
437
438
|
if subprocess.run(command, capture_output=True, text=True, timeout=10).returncode == 0:
|
|
439
|
+
if not close:
|
|
440
|
+
# the /dev/diskN node is gone now — don't let disc_device()
|
|
441
|
+
# hand back this stale node when the next disc goes in.
|
|
442
|
+
_last_disc_device = None
|
|
438
443
|
return True
|
|
439
444
|
except (OSError, subprocess.TimeoutExpired):
|
|
440
445
|
pass
|