Created
July 31, 2012 05:57
-
-
Save dbaines/3214115 to your computer and use it in GitHub Desktop.
List CouchPotatoServer coming theatre and dvd release 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
<style> | |
body, table, td {font-family: Arial, sans-serif; font-size: 14px;} | |
.nodate {font-style: italic;} | |
td {padding: 5px 10px;} | |
tr:hover td {background: #eee;} | |
th {font-weight: bold; text-align: left; padding: 10px; border-bottom: 2px solid #ccc;} | |
</style> | |
<table border="0" cellspacing="0" class="tablesorter"> | |
<thead> | |
<tr> | |
<th>Title</th> | |
<th>Theatre Date</th> | |
<th>DVD Date</th> | |
</tr> | |
</thead> | |
<tbody> | |
<?php | |
// Configuring our API call | |
$host = "http://localhost:5050"; | |
$apikey = "123456"; | |
$movielist = json_decode(file_get_contents($host."/api/".$apikey."/movie.list/")); | |
// Run through each wanted movie from the API call | |
foreach($movielist->{movies} as $movie){ | |
// Get basic information about this movie | |
$title = $movie->{library}->{info}->{titles}[0]; | |
$year = $movie->{library}->{year}; | |
$getTheatre = $movie->{library}->{info}->{released}; | |
$getDVDDate = $movie->{library}->{info}->{release_date}->{dvd}; | |
$theatre = date("d/m/Y", strtotime($getTheatre)); | |
$dvd = date("d/m/Y", $getDVDDate); | |
// Convert Unknown Dates | |
if($getTheatre == ""){ | |
$theatre = "<em>-</em>"; | |
} | |
if($getDVDDate == "" or $getDVDDate == "0"){ | |
$dvd = "<em>-</em>"; | |
} | |
// Build our table row | |
echo "<tr>"; | |
/* | |
// Alternate formatting for titles without a date | |
if($date != ""){ | |
echo "<td class='title'>".$title."</td><td class='date'>".$newDate."</td>"; | |
} else { | |
echo "<td class='title nodate'>".$title."</td><td class='date nodate'>Unknown Date</td>"; | |
} | |
*/ | |
echo "<td class='title'>".$title."</td><td class='tdate'>".$theatre."</td><td class='ddate'>".$dvd."</td></tr>"; | |
echo "</tr>"; | |
} | |
?> | |
</tbody> | |
</table> | |
<script src="jquery.js"></script> | |
<script src="jquery.tablesorter.min.js"></script> | |
<script> | |
$(function(){ | |
$(".tablesorter").tablesorter({dateFormat: "uk"}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment