diff options
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/inc_media.php | 55 | ||||
-rwxr-xr-x | includes/inc_rec.php | 18 | ||||
-rwxr-xr-x | includes/inc_stream.php | 39 | ||||
-rwxr-xr-x | includes/inc_vdr.php | 3 | ||||
-rwxr-xr-x | includes/include.php | 3 |
5 files changed, 76 insertions, 42 deletions
diff --git a/includes/inc_media.php b/includes/inc_media.php index 3d1f820..53788c2 100755 --- a/includes/inc_media.php +++ b/includes/inc_media.php @@ -1,11 +1,18 @@ <?php -global $mediapath; +global $mediapath, $videotypes, $audiotypes; $dir = $_REQUEST['dir']; if ($dir == "") $dir = $mediapath; +/* Add last slash to dirs */ +if ($mediapath[strlen($mediapath)-1] != '/') + $mediapath = $mediapath .'/'; + +if ($dir[strlen($dir)-1] != '/') + $dir = $dir .'/'; + // Get current subdir $subdir = preg_replace("'" .quotemeta($mediapath) ."'", '', $dir); @@ -16,8 +23,11 @@ if ($dir == $mediapath) print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; else print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; +if ($dir != $mediapath) +{ print "<div id=\"rightnav\">\r\n"; print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; +} print "<div id=\"title\">iStreamdev</div>\r\n"; print "</div>\r\n"; print "<div id=\"content\">\r\n"; @@ -26,38 +36,53 @@ print "<br>"; print " <span class=\"graytitle\">{$subdir}</span>\r\n"; print " <ul class=\"pageitem\">"; -$dir_handle = @opendir($dir) or die("Unable to open $dir"); - -while ($medianame = readdir($dir_handle)) +$dir_handle = @opendir($dir); +if (!$dir_handle) +{ + print "Unable to open $dir"; +} +else while ($medianame = readdir($dir_handle)) { if($medianame == "." || $medianame == ".." || $medianame == 'lost+found') continue; - + $medianame2=addslashes($medianame); - if (strstr($medianame, ".avi") == ".avi") + // Directories + if (is_dir($dir ."/" .$medianame)) { print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\"><span class=\"name\">$medianame</span><span class=\"arrow\"></span></a></li>\r\n"; print "<form name=\"$medianame\" id=\"$medianame\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\"/>"; - print " <input name=\"type\" type=\"hidden\" id=\"type\" value=3 />"; - print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$dir}/{$medianame}\" />"; + print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\"/>"; + print " <input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$dir}{$medianame}/\" />"; print "</form>\r\n"; } else { - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\"><span class=\"name\">$medianame</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"$medianame\" id=\"$medianame\" method=\"post\" action=\"index.php\">"; - print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\"/>"; - print " <input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$dir}/{$medianame}\" />"; - print "</form>\r\n"; + // Get file extension + $fileext = end(explode(".", $medianame)); + + // Check if it is supported + if ( preg_match("'" .$fileext ." '", $videotypes) + || preg_match("'" .$fileext ." $'", $videotypes) + ) + { + print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\"><img src=\"images/pictos/media.png\" /><span class=\"name\">$medianame</span><span class=\"arrow\"></span></a></li>\r\n"; + print "<form name=\"$medianame\" id=\"$medianame\" method=\"post\" action=\"index.php\">"; + print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\"/>"; + print " <input name=\"type\" type=\"hidden\" id=\"type\" value=3 />"; + print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$dir}{$medianame}\" />"; + print "</form>\r\n"; + } } } $updir = dirname($dir); print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\"/><input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$updir}/\" /></form>\r\n"; -closedir($dir_handle); + +if ($dir_handle) + closedir($dir_handle); print "</ul></div>\r\n"; ?> diff --git a/includes/inc_rec.php b/includes/inc_rec.php index 8459a07..b01a64c 100755 --- a/includes/inc_rec.php +++ b/includes/inc_rec.php @@ -16,10 +16,11 @@ if ($dir == $vdrrecpath) print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; else print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n"; - +if ($dir != $vdrrecpath) +{ print "<div id=\"rightnav\">\r\n"; print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n"; - +} print "<div id=\"title\">iStreamdev</div>\r\n"; print "</div>\r\n"; print "<div id=\"content\">\r\n"; @@ -28,9 +29,12 @@ print "<br>"; print " <span class=\"graytitle\">{$subdir}</span>\r\n"; print " <ul class=\"pageitem\">"; -$dir_handle = @opendir($dir) or die("Unable to open $dir"); - -while ($recname = readdir($dir_handle)) +$dir_handle = @opendir($dir); +if (!$dir_handle) +{ + print "Unable to open $dir"; +} +else while ($recname = readdir($dir_handle)) { if($recname == "." || $recname == ".." || $recname == "epg.data" || $recname == 'lost+found') continue; @@ -59,7 +63,9 @@ while ($recname = readdir($dir_handle)) $updir = dirname($dir); print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\"><input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\"/><input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$updir}/\" /></form>\r\n"; -closedir($dir_handle); + +if ($dir_handle) + closedir($dir_handle); print "</ul></div>\r\n"; ?> diff --git a/includes/inc_stream.php b/includes/inc_stream.php index b5df588..da191fa 100755 --- a/includes/inc_stream.php +++ b/includes/inc_stream.php @@ -21,15 +21,17 @@ if (infostreamexist()) // Print the right logo print " <ul class=\"pageitem\">\r\n"; - if ($type <= 2) - { - if (!file_exists('logos/'.$realname.'.png')) - print " <center><video id=\"videofeed\" poster=\"logos/nologo2.png\" width='80' height='80' /></center>\r\n"; - else - print " <center><video id=\"videofeed\" poster=\"logos/{$realname}.png\" width='80' height='80' /></center>\r\n"; - } + + if ($type == 3) + $logopath = "ram/stream-tb.png"; else + $logopath = "logos/" .$realname .".png"; + + if (!file_exists($logopath)) print " <center><video id=\"videofeed\" poster=\"logos/nologo2.png\" width='80' height='80' /></center>\r\n"; + else + print " <center><video id=\"videofeed\" poster=\"{$logopath}\" width='80' height='80' /></center>\r\n"; + print " </ul>\r\n"; print " <ul class=\"pageitem\">\r\n"; @@ -52,7 +54,7 @@ if (infostreamexist()) print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$realname}\" />"; break; case 2: - case 3: + case 3: print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$url}\" />"; break; @@ -79,9 +81,8 @@ else break; // Media case 3: - $realname = $name; - $title = ""; - $desc = ""; + list($title, $desc) = mediagetinfostream($name); + $realname = basename($name); break; default: $realname = ""; @@ -106,18 +107,18 @@ else print " <span class=\"graytitle\">Select stream mode</span>\r\n"; + // Print the right logo print " <ul class=\"pageitem\">\r\n"; - // Print the right logo - if ($type <= 2) - { - if (!file_exists('logos/'.$realname.'.png')) - print " <center><img src=\"logos/nologo2.png\"></img></center>\r\n"; - else - print " <center><img src=\"logos/{$realname}.png\"></img></center>\r\n"; - } + if ($type == 3) + $logopath = "ram/stream-tb.png"; else + $logopath = "logos/" .$realname .".png"; + + if (!file_exists($logopath)) print " <center><img src=\"logos/nologo2.png\"></img></center>\r\n"; + else + print " <center><img src=\"{$logopath}\"></img></center>\r\n"; print " </ul>\r\n"; diff --git a/includes/inc_vdr.php b/includes/inc_vdr.php index a90d80f..07880e7 100755 --- a/includes/inc_vdr.php +++ b/includes/inc_vdr.php @@ -52,6 +52,7 @@ function vdrgetinfostream($stream = "NULL", $ischan = 1) // Find the right chan (take the first one) if ($chanfound == 0) { + $streamArray = explode(",",$stream); if (strstr($allepg[$i], $stream) == $stream) $chanfound = 1; } @@ -73,7 +74,7 @@ function vdrgetinfostream($stream = "NULL", $ischan = 1) { $channame = substr($allepg[$i], 2); $channames = explode(" ", $channame); - $channame = substr($channame, strlen($channames[0])); + $channame = substr($channame, strlen($channames[0])+1); } } else if(ereg("^T", $allepg[$i])) diff --git a/includes/include.php b/includes/include.php index acffb58..05aa4b5 100755 --- a/includes/include.php +++ b/includes/include.php @@ -3,6 +3,7 @@ include ('config.php'); include ('includes/inc_auth.php'); include ('includes/inc_vdr.php'); +include ('includes/inc_files.php'); include ('includes/inc_streaminfo.php'); function selectpage() @@ -99,7 +100,7 @@ function start_stream($type, $name, $title, $desc, $qname, $qparams, $category, $cmd = "export SHELL=\"/bin/sh\";printf \"cat \\\"" .$url ."\\\"/0* | ./istream.sh - " .$qparams ." " .$httppath ." 1260 " .$ffmpegpath ." \" | at now"; break; case 3: - $cmd = "export SHELL=\"/bin/sh\";printf \"./istream.sh '" .$url ."' " .$qparams ." " .$httppath ." 1260 " .$ffmpegpath ." \" | at now"; + $cmd = "export SHELL=\"/bin/sh\";printf \"./istream.sh \"" .$url ."\" " .$qparams ." " .$httppath ." 1260 " .$ffmpegpath ." \" | at now"; break; default: $cmd = ""; |