Created
April 23, 2012 02:35
-
-
Save dbaines/2468423 to your computer and use it in GitHub Desktop.
Sickbeard API PHP - List season start dates
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 | |
// 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