Skip to content

Instantly share code, notes, and snippets.

@dbaines
Created April 23, 2012 02:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbaines/2468423 to your computer and use it in GitHub Desktop.
Save dbaines/2468423 to your computer and use it in GitHub Desktop.
Sickbeard API PHP - List season start dates
<?php
// Edit Settings
$username = "admin";
$password = "password";
$ip = "192.168.1.1:8081";
$api = "1234";
// End Settings
// Check if username is available, set URL
// This probably isn't necessary
if($username) {
$feed = "http://".$username.":".$password."@".$ip."/api/".$api."/?cmd=future&sort=date&type=later";
} else {
$feed = "http://".$ip."/api/".$api."/?cmd=future&sort=date&type=later";
}
$sbJSON = json_decode(file_get_contents($feed));
// What are you!?
echo "<h1>Season Start Dates</h1>";
// Run through each feed item
foreach($sbJSON->{data}->{later} as $show) {
// Only grab shows of episode 1
if($show->{episode} == "1") {
// Reformat date
$newDate = date("l, j F Y", strtotime($show->{airdate}));
// Show Details
echo $show->{show_name} . " Season " . $show->{season} . ": " .$newDate . "<br />";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment