Created
March 27, 2015 11:49
-
-
Save sobi3ch/fe4af2bcf8d34c3178c1 to your computer and use it in GitHub Desktop.
Polish radiostations from linux CLI / Polskie radiostacje z linii poleceń
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define('INDENT', ' '); | |
| // Radio list | |
| $radiostations = [ | |
| 'trojka' => 'mms://stream.polskieradio.pl/program3_wma10', | |
| 'dwojka' => 'mms://stream.polskieradio.pl/program2_wma10', | |
| 'jedynka' => 'mms://stream.polskieradio.pl/program1_wma10', | |
| 'luz' => 'http://radioluz.pwr.wroc.pl/listen.pls', | |
| 'pin' => 'http://www.radiopin.pl/shoutcast/radiopin128.m3u', | |
| 'tokfm' => 'http://www.radio.pionier.net.pl/stream.pls?radio=radiotok', | |
| ]; | |
| if (!isset($argv[1]) || empty($argv[1])) { | |
| echo 'Usage: polon <radioname>'. PHP_EOL; | |
| foreach (array_keys($radiostations) as $radioname) { | |
| echo INDENT . $radioname . PHP_EOL; | |
| } | |
| } else { | |
| $name = $argv[1]; | |
| if (array_key_exists($name, $radiostations)) { | |
| echo INDENT . 'Playing: ' . $name . PHP_EOL; | |
| $command = 'mplayer -quiet '. $radiostations[$name]; | |
| echo $command . PHP_EOL; | |
| $output = shell_exec($command); | |
| echo $output; | |
| } else { | |
| echo INDENT . "Sorry, couldn't find this radio station"; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
php polon.phplist all stationsphp polon.php <radiostation>runs radio