From 808f2a389fb96a3e86be616aaa3cb3b351933088 Mon Sep 17 00:00:00 2001 From: TheTroll Date: Thu, 25 Feb 2010 00:18:20 +0100 Subject: M3u generator --- genplaylist.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 genplaylist.php (limited to 'genplaylist.php') diff --git a/genplaylist.php b/genplaylist.php new file mode 100755 index 0000000..17c083b --- /dev/null +++ b/genplaylist.php @@ -0,0 +1,56 @@ +\n"; + echo "\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 "error"; + else + { + $found = 0; + while ($medianame = readdir($dir_handle)) + { + if (mediagettype($path .$name) == 2) + { + if ($medianame == $name) + $found = 1; + + if ($found) + $medianame_array[] = $medianame; + } + } + + if ($medianame_array[0]) + { + + // Alphabetical sorting + sort($medianame_array); + + $plfile = fopen("playlist/playlist.m3u", 'w'); + if (!$plfile) + echo "error"; + else + { + $count = count($medianame_array); + for ($cnt=0; $cnt < $count; $cnt++) + fwrite($plfile, "playlist/" .$medianame_array[$cnt] ."\n"); + + fclose($plfile); + + echo "ok\n"; + } + } + else + echo "error"; + } + + echo "\n"; + +?> -- cgit v1.2.3