Skip to content

Instantly share code, notes, and snippets.

@sumpygump sumpygump/method
Created Jan 2, 2015

What would you like to do?
Method Radio Terminal Status
#!/usr/bin/env php
* Method Radio Terminal status
* This will show the currently playing song and a brief song history from the
* terminal
* Save this file in your path as 'method'
* Suggested usage:
* watch -n 60 method
$infoUrl = '';
$rawJson = file_get_contents($infoUrl);
$playInfo = json_decode($rawJson);
print("Method Radio\n");
printf("Now Playing: %s\n", $playInfo->title);
printf("Listeners: %s\n", $playInfo->listeners);
print "\nHistory:\n";
foreach ($playInfo->songHistory as $song) {
printf("%s %s\n", date('Y-m-d H:i:s', $song->time), $song->title);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.