diff --git a/.local/bin/cron/openfm-update-stations b/.local/bin/cron/openfm-update-stations new file mode 100755 index 0000000..321dcba --- /dev/null +++ b/.local/bin/cron/openfm-update-stations @@ -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)) diff --git a/.local/bin/scripts/sync-radio b/.local/bin/scripts/sync-radio new file mode 100755 index 0000000..2dd8730 --- /dev/null +++ b/.local/bin/scripts/sync-radio @@ -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