diff options
| author | Arslaan Pathan <[email protected]> | 2026-10-06 11:07:23 +1300 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-10-06 11:07:23 +1300 |
| commit | 8f5e37d6d8c64bcc7d1d8a78bffb18be1e56a47c (patch) | |
| tree | 1649ad94799845d90f66fb3a4c50b00068d7b95a /backend.py | |
| parent | 31516d80bd1ca384074fd61b3c73879b5be2f0ac (diff) | |
| download | remote-automation-8f5e37d6d8c64bcc7d1d8a78bffb18be1e56a47c.tar.xz remote-automation-8f5e37d6d8c64bcc7d1d8a78bffb18be1e56a47c.zip | |
fav song
Diffstat (limited to 'backend.py')
| -rw-r--r-- | backend.py | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -10,6 +10,8 @@ import os app = Flask(__name__) print_lock = threading.Lock() +FAVOURITE = "/srv/shares/public/Media/Music/Oxlo - Money Mouth | Hyperpop | NCS - Copyright Free Music [BElFoAIsIOk].mp3" + music_process = None load_dotenv("/srv/automation/remote-automation/.env") @@ -133,11 +135,28 @@ def music_stop(): @app.get("/automate/volup") def volup(): os.system("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+") - + return "ok" @app.get("/automate/voldown") def voldown(): os.system("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-") + return "ok" + [email protected]("/automate/music/fav") +def fav_song(): + subprocess.Popen([ + "mpv", + "--no-video", + "--audio-device=pipewire", + "--", + FAVOURITE_SONG, + ]) + + return { + "status": "playing", + "title": "Money Mouth", + "artist": "Oxlo" + } if __name__ == "__main__": app.run(host="0.0.0.0", port=6732) |
