audio_manager.py hinzugefügt
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import subprocess
|
||||
import logging
|
||||
|
||||
log = logging.getLogger("AudioManager")
|
||||
|
||||
|
||||
class AudioManager:
|
||||
def __init__(self):
|
||||
self.current_sink = None
|
||||
|
||||
# -------------------
|
||||
# SPOTIFY CONTROL
|
||||
# -------------------
|
||||
def spotify_play(self):
|
||||
subprocess.run(["playerctl", "-p", "spotify", "play"])
|
||||
|
||||
def spotify_pause(self):
|
||||
subprocess.run(["playerctl", "-p", "spotify", "pause"])
|
||||
|
||||
def spotify_next(self):
|
||||
subprocess.run(["playerctl", "-p", "spotify", "next"])
|
||||
|
||||
# -------------------
|
||||
# VOLUME CONTROL
|
||||
# -------------------
|
||||
def set_volume(self, vol: int):
|
||||
subprocess.run(["pactl", "set-sink-volume", "@DEFAULT_SINK@", f"{vol}%"])
|
||||
|
||||
# -------------------
|
||||
# BLUETOOTH ROUTING
|
||||
# -------------------
|
||||
def set_sink(self, sink_name: str):
|
||||
subprocess.run(["pactl", "set-default-sink", sink_name])
|
||||
|
||||
# -------------------
|
||||
# STATUS
|
||||
# -------------------
|
||||
def status(self):
|
||||
return subprocess.getoutput("playerctl status")
|
||||
Reference in New Issue
Block a user