sync
This commit is contained in:
@@ -3,7 +3,7 @@ import argparse
|
||||
import sys
|
||||
from core.config import load_config
|
||||
from core.connection import BuzzerConnection, BuzzerError
|
||||
from core.commands import info, ls, put, mkdir, rm, confirm, reboot
|
||||
from core.commands import info, ls, put, mkdir, rm, confirm, reboot, play
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Edis Buzzer Host Tool")
|
||||
@@ -38,10 +38,16 @@ def main():
|
||||
rm_parser.add_argument("path", type=str, help="Pfad der zu löschenden Datei/Ordner")
|
||||
rm_parser.add_argument("-r", "--recursive", action="store_true", help="Ordnerinhalte rekursiv löschen")
|
||||
|
||||
# Befehl: play
|
||||
play_parser = subparsers.add_parser("play", help="Spielt eine Datei auf dem Controller ab")
|
||||
play_parser.add_argument("path", type=str, help="Pfad der abzuspielenden Datei (z.B. /lfs/a/neu)")
|
||||
|
||||
# Befehl: confirm
|
||||
confirm_parser = subparsers.add_parser("confirm", help="Bestätigt die aktuell laufende Firmware")
|
||||
|
||||
# Befehl: reboot
|
||||
reboot_parser = subparsers.add_parser("reboot", help="Startet den Buzzer neu")
|
||||
|
||||
# Argumente parsen
|
||||
args = parser.parse_args()
|
||||
config = load_config(args)
|
||||
@@ -87,6 +93,8 @@ def main():
|
||||
confirm.execute(conn)
|
||||
elif args.command == "reboot":
|
||||
reboot.execute(conn)
|
||||
elif args.command == "play":
|
||||
play.execute(conn, path=args.path)
|
||||
elif args.command == "info" or args.command is None:
|
||||
# Wurde kein Befehl oder explizit 'info' angegeben, sind wir hier schon fertig
|
||||
pass
|
||||
|
||||
10
buzzer_tool/core/commands/play.py
Normal file
10
buzzer_tool/core/commands/play.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# core/commands/mkdir.py
|
||||
from core.connection import BuzzerError
|
||||
|
||||
def execute(conn, path: str):
|
||||
"""Spielt eine Datei auf dem Controller ab."""
|
||||
try:
|
||||
conn.send_command(f"play {path}")
|
||||
print(f"▶️ Datei '{path}' wird abgespielt.")
|
||||
except BuzzerError as e:
|
||||
print(f"❌ Fehler beim Abspielen von '{path}': {e}")
|
||||
Reference in New Issue
Block a user