-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetmusicsources.php
More file actions
33 lines (24 loc) · 823 Bytes
/
getmusicsources.php
File metadata and controls
33 lines (24 loc) · 823 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
<?php
include "topline.php";
include "config.php";
$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": "Files.GetSources", "params" : { "media" : "music" }, "id": 1}';
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$array = json_decode(curl_exec($ch),true);
$results = $array['result']['shares'];
echo "<div id=\"utility\"><ul>";
//loop music sources
foreach ($results as $value)
{
//show music sources
$sourcename = $value['label'];
$sourcelocation = urlencode($value['file']);
echo "<li><a href=getmusicfiles.php?source=$sourcelocation>$sourcename</a></li>";
}
echo "</ul></div>";
include "downline.php";
?>