dotfiles/local/bin/radio
2025-07-21 12:57:44 +03:30

30 lines
864 B
Python
Executable file

#!/usr/bin/env python3
import subprocess
import time
# 128kbps Opus
URL="https://radio.animebits.moe/stream/stream128.ogg"
# 256kbps Opus
#URL="https://radio.animebits.moe/stream/stream256.ogg"
# ~148kbps VBR AAC
#URL="https://radio.animebits.moe/stream/stream128.aac"
# ~192kbps VBR MP3
#URL="https://radio.animebits.moe/stream/stream192.mp3"
# Lossless FLAC
#URL="https://radio.animebits.moe/stream/stream.flac"
#volume
VOL=20
while True:
try:
print("Playing now...")
subprocess.run(["notify-send", "Playing now..."])
subprocess.run(["mpv", "--no-video", f"--volume={VOL}", URL])
except KeyboardInterrupt:
subprocess.run(["notify-send", "Stopping now..."])
print("\nStopping now...")
break
except Exception as e:
print(f"Something broke... trying again... Error: {e}")
time.sleep(2)