commit a553d4eb41074cb96ecec82779db6939ba97f23b
parent d78c776a5283a1d106e1f091b2a08dab4ae8a51b
Author: Alex Balgavy <alex@balgavy.eu>
Date: Wed, 1 Jun 2022 12:28:59 +0200
Add WFMU radio
Diffstat:
M | radio | | | 25 | ++++++++++++++++++++++++- |
M | urls | | | 3 | +++ |
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/radio b/radio
@@ -57,6 +57,22 @@ class Radio
end
end
+class WFMU < Radio
+ HOSTNAME = 'wfmu.org'
+ def initialize(selected_channel)
+ super()
+ @channel = selected_channel[:link]
+ end
+
+ def play
+ if @player == 'mpc'
+ system 'mpc', 'clear', 1 => '/dev/null'
+ system 'mpc', 'load', @channel
+ end
+ super @channel
+ end
+end
+
# SomaFM radio subclass
class SomaFM < Radio
HOSTNAME = 'somafm.com'
@@ -234,7 +250,14 @@ def read_config_file(cfg)
parts = line.chomp.split(/(?<=")\s+(?=http)/)
channel = { name: parts.first.gsub('"', ''), link: parts.last }
- channel[:radio] = (URI.parse(channel[:link]).host == SomaFM::HOSTNAME ? SomaFM : OtherRadio)
+ case URI.parse(channel[:link]).host
+ when SomaFM::HOSTNAME
+ channel[:radio] = SomaFM
+ when WFMU::HOSTNAME
+ channel[:radio] = WFMU
+ else
+ channel[:radio] = OtherRadio
+ end
channels << channel
end
diff --git a/urls b/urls
@@ -23,3 +23,6 @@
"Bluemars (http://echoesofbluemars.org/)" http://streams.echoesofbluemars.org:8000/bluemars.m3u
"Cryosleep (http://echoesofbluemars.org/)" http://streams.echoesofbluemars.org:8000/cryosleep.m3u
"Voices From Within (http://echoesofbluemars.org/)" http://streams.echoesofbluemars.org:8000/voicesfromwithin.m3u
+
+# WFMU
+"WFMU (https://wfmu.org/)" https://wfmu.org/wfmu.pls