--- Needed modules local component = require("component") local shell = require("shell") local fm = component.openfm_radio local args, options = shell.parse(...) if #args == 1 then if args[1] == "-h" then io.write("Usage: iRadio [station id]\n") io.write("Copyright (c) 2016 Dwight Spencer (@denzuko) <0XFC13F74B>, All Rights Reserved.\n") io.write("Distributed under the Simplified BSD Licence.\n\n") end end --- Station database local stations = { { ["url"]="http://streams.echoesofbluemars.org:8000/bluemars", ["title"]="Bluemars radio", ["desc"]="Thanks of all the fish, lone." }, { ["url"]="http://streams.echosofbluemars.org:8000/cryosleep", ["title"]="Cryosleep radio", ["desc"]="Rest well lone and dream of electric sheep" }, { ["url"]="http://listen.radionomy.com/DeepHouse", ["title"]="DeepHouse Radio", ["desc"]="Trans and deep house EDM music" }, { ["url"]="http://ice1.somafm.com/indiepop-128-mp3", ["title"]="Indie Pop Rocks", ["desc"]="New and classic favorite indie pop tracks" }, { ["url"]="http://ice1.somafm.com/metal-128-mp3", ["title"]="Metal Detector", ["desc"]="From black to doom, prog to sludge, thrash to post, stoner to crossover, punk to industrial. The metal will be detected" }, { ["url"]="http://ice1.somafm.com/brfm-128-mp3", ["title"]="Black Rock FM", ["desc"]="From the Playa to the world" } } --- Station selection local stationId = tonumber(args[1]) if not stationId then stationId = math.random(#stations) elseif stationId > #stations then stationId = math.fmod(stationId,#stations) end local station = stations[stationId] --- Radio player fm = component.openfm_radio fm.stop() fm.setURL(station.url) fm.setScreenText(station.title) io.write("Playing " .. station.title) fm.start()