blob: 2df62702115c07f47841c8b64614908fffca6dd0 (
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
|
<?php
if (file_exists('config.php'))
include ('config.php');
else
include ('config_default.php');
include ('includes/inc_files.php');
header('Content-Type: text/xml');
echo "<?xml version=\"1.0\"?>\n";
echo "<status>\n";
$path = $_REQUEST['path'];
$name = $_REQUEST['name'];
exec('rm playlist/*');
exec('ln -s ' .addcslashes(quotemeta($path), " &") .'* playlist');
$dir_handle = @opendir($path);
if (!$dir_handle)
echo "<m3u>error</m3u>";
else
{
while ($medianame = readdir($dir_handle))
if (mediagettype($path .$medianame) == 2)
$medianame_array[] = $medianame;
if ($medianame_array[0])
{
// Alphabetical sorting
sort($medianame_array);
$plfile = fopen("playlist/playlist.m3u", 'w');
if (!$plfile)
echo "<m3u>error</m3u>";
else
{
$count = count($medianame_array);
$found = 0;
for ($cnt=0; $cnt < $count; $cnt++)
{
if ($medianame_array[$cnt] == $name)
$found=1;
if ($found)
fwrite($plfile, "playlist/" .$medianame_array[$cnt] ."\n");
}
fclose($plfile);
echo "<m3u>ok</m3u>\n";
}
}
else
echo "<m3u>error</m3u>";
}
echo "</status>\n";
?>
|