Voluimio にWEBラジオがあるが、よく聞くチャンネルを一発で選曲する方法
前提 として、Volumioが正常に稼働していること
Windowsショートカットやバッチファイルから
curl -X POST "http://192.168.1.100/api/v1/replaceAndPlay" -H "Content-Type: application/json" -d "{\"service\":\"webradio\",\"type\":\"webradio\",\"uri\":\"WEB_RADIO_URL\",\"title\":\"Station_Name\"}"
実際は、下記の部分を書き換える。
Voluimoのアドレス:192.168.1.100
uri:WEB_RADIO_URL
title:Station_Name
URLを調べるには、Volumioで一旦選局し、例えばコマンドプロンプトで下記のコマンドで使い、現在選局中のURLを取得できる
curl "http://192.168.1.100/api/v1/getstate”
例えばこの様な出力があるので、ここから、URLなどを取得する。
{"status":"play","position":0,"title":"Maxwell - This Woman's Work ","artist":"UrbanRadio Smooth Jazz","album":null,"albumart":"http://cdn-radiotime-logos.tunein.com/s159769q.png","uri":"http://hydra.cdnstream.com/1541_128","trackType":"webradio","seek":5255,"duration":0,"samplerate":"","bitdepth":"","channels":2,"bitrate":"128 Kbps","random":null,"repeat":null,"repeatSingle":false,"consume":true,"volume":78,"dbVolume":null,"mute":false,"disableVolumeControl":false,"stream":true,"updatedb":false,"volatile":false,"service":"webradio"}
具体的な例として、下記の方法で、UrbanRadio Smooth Jazzに選局ができる
curl -X POST "http://volumio/api/v1/replaceAndPlay" -H "Content-Type: application/json" -d "{\"service\":\"webradio\",\"type\":\"webradio\",\"uri\":\"http://hydra.cdnstream.com/1541_128\",\"title\":\"UrbanRadio Smooth Jazz\"}"
具体的な例として、下記の方法で、FMジャングルだと以下の通り
curl -X POST "http://volumio/api/v1/replaceAndPlay" -H "Content-Type: application/json" -d "{\"service\":\"webradio\",\"type\":\"webradio\",\"uri\":\"http://mtist.as.smartstream.ne.jp/30013/livestream/playlist.m3u8#?\",\"title\":\"FMジャングル\"}"
ついでに音量調節するには、以下の通り
curl "http://volumio/api/v1/commands/?cmd=volume&volume=50"
このコマンドでvolume=50の部分を変更することで、音量を0から100の範囲で指定できる(%設定)