aboutsummaryrefslogtreecommitdiff
path: root/web/poc_jsonrpc/tvshowseasons.html
blob: ec80721ef3412853de10ea3cb0bb140b61f11cd2 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<html>
<head>
<link type="text/css" rel="stylesheet" href="basic.css">
<script type="text/javascript" src="json.js"></script>
<script type="text/javascript" src="help.js"></script>
</head>
<body>
<table class="Navigation">
<tr class="primary">
  <td class="unselected"><a href="nowplaying.html">Now playing</a></td>
  <td class="selected">Videos</td>
  <td class="unselected"><a href="artists.html">Music</a></td>
  <td class="unselected"><a href="development.html">Development</a></td>
</tr>
<tr>
  <td></td><td>
  <table>
  <tr class="secondary">
    <td><a href="videofiles.html">Video files</a></td>
    <td><a href="movies.html">Movies</a></td>
    <td>TV Shows</td>
  </tr>
  </table></td>
</tr>
</table>
<br>

<script type="text/javascript">
var tvshowid = gup("tvshowid");

var http_request = new XMLHttpRequest();
http_request.open( "POST", "jsonrpc", false );
http_request.send('{"jsonrpc": "2.0", "method": "VideoLibrary.GetSeasons", "params": { "tvshowid": ' + tvshowid + ', "fields": [ "season" ] }, "id": 1}');

var the_object = JSON.parse(http_request.responseText);
var result = the_object["result"];
if (result) {
  var array = result["seasons"];

  document.write('<table class="Episodes"><thead><tr><th>Thumbnail</th><th>Info</th></tr></thead><tbody>');
  for (var i in array) {
    var item = array[i];

    document.write('<tr class="' + (i % 2 == 0 ? 'even' : 'odd') + '"><td class="cover">');
    document.write('<a href="tvshowepisodes.html?tvshowid=' + tvshowid + '&season=' + item["season"] + '">');
    var imgSrc = item["thumbnail"] ? ('vfs/' + escape(item["thumbnail"])) : "images/nocover.jpg";
    document.write('<img src="' + imgSrc + '" class="cover" alt="' + item["label"] + '"></img>');
    document.write('</a>');
    document.write('</td><td class="info">');
    document.write('<h1>' + item["label"] + '</h1>');
    if (item["plot"])
      document.write(item["plot"]);

    document.write('</td></tr>');
  }
  document('</tbody></table>');
} else {
  document.write("Error");
}
</script>
</body>
</html>