Improve radio setup
This commit is contained in:
parent
7460ce68f9
commit
9c6142edd0
17
.local/bin/cron/openfm-update-stations
Executable file
17
.local/bin/cron/openfm-update-stations
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
||||
response = json.loads(
|
||||
requests.get("https://open.fm/radio/api/v2/ofm/stations_slug.json").text
|
||||
)
|
||||
|
||||
dict_ = {}
|
||||
for channel in response["channels"]:
|
||||
id_ = channel["instance_id"]
|
||||
name = channel["name"]
|
||||
dict_[name] = id_
|
||||
|
||||
with open("/home/samedamci/.config/radio/openfm_channels.json", "w") as f:
|
||||
f.write(json.dumps(dict_, indent=2, ensure_ascii=False))
|
9
.local/bin/scripts/sync-radio
Executable file
9
.local/bin/scripts/sync-radio
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
stream="$(mpc status -f "%file%" | awk 'NR==1')"
|
||||
|
||||
mpc stop >/dev/null
|
||||
mpc clear >/dev/null
|
||||
|
||||
mpc add "$stream" >/dev/null
|
||||
mpc play >/dev/null
|
Loading…
x
Reference in New Issue
Block a user