-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetseasons.php
More file actions
40 lines (28 loc) · 944 Bytes
/
getseasons.php
File metadata and controls
40 lines (28 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include "topline.php";
include "config.php";
$tvshowid = $_GET['tvshowid'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $xbmcjsonservice);
//prepare the field values being posted to the service
$request = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetSeasons", "params": { "tvshowid": ' . $tvshowid . ', "fields": ["season"]}, "id": 1}';
//echo $request;
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$array = json_decode(curl_exec($ch),true);
//results seasons
$results = $array['result']['seasons'];
echo "<div id=\"utility\"><ul>";
//loop seasons
foreach ($results as $value)
{
//show sources
$label = $value['label'];
$season = urlencode($value['season']);
//change location to video id
echo "<li><a href=getepisodes.php?tvshowid=$tvshowid&season=$season>$label</a><li>";
}
echo "</ul></div>";
include "downline.php";
?>