2024-12-30 06:01:41 +01:00
|
|
|
#!/usr/bin/env hy
|
|
|
|
(import json)
|
|
|
|
(import requests)
|
|
|
|
(import subprocess)
|
2024-12-31 04:34:48 +01:00
|
|
|
(import argparse)
|
|
|
|
|
|
|
|
(defn live-play [live-id]
|
|
|
|
(while True
|
|
|
|
(for [item (.json (requests.get f"https://stream.chillhop.com/live/{live-id}"))]
|
2025-01-02 06:01:35 +01:00
|
|
|
(print f"Now playing: {(:title item)} - {(:artists item)} - {(:fileId item)}")
|
|
|
|
(subprocess.run f"mpv --no-video https://stream.chillhop.com/mp3/{(:fileId item)}"
|
|
|
|
:shell True
|
|
|
|
:capture_output True))))
|
2024-12-31 04:34:48 +01:00
|
|
|
|
|
|
|
(setv parser (argparse.ArgumentParser))
|
|
|
|
(parser.add_argument "-s" :action "store" :dest "station" :metavar "station" :required False)
|
|
|
|
(setv args (parser.parse_args))
|
|
|
|
(when args.station (live-play args.station))
|
2024-12-30 06:01:41 +01:00
|
|
|
|
2024-12-31 04:34:48 +01:00
|
|
|
(let [presets (:presets (.json (requests.get "https://stream.chillhop.com/presets")))]
|
|
|
|
(print "Now streaming...")
|
|
|
|
(for [item presets]
|
2025-01-02 06:01:35 +01:00
|
|
|
(print f"Name: {(:name item)} station Id: {(:stationId item)}"))
|
2024-12-31 04:34:48 +01:00
|
|
|
(live-play (input "Input station ID: ")))
|