From 438912c0c4a4075a5cd74cf9689451c9df4bbe34 Mon Sep 17 00:00:00 2001 From: Alib Date: Mon, 15 Mar 2010 17:56:22 +0100 Subject: New Jquery branch. Initial development version for istreamdev 1.0 --- includes/inc_audio.php | 128 ------------- includes/inc_auth.php | 36 ---- includes/inc_cat.php | 17 -- includes/inc_chan.php | 24 --- includes/inc_edittimer.php | 158 ---------------- includes/inc_epg.php | 15 -- includes/inc_files.php | 172 ----------------- includes/inc_home.php | 135 -------------- includes/inc_rec.php | 87 --------- includes/inc_session.php | 88 --------- includes/inc_stream.php | 139 -------------- includes/inc_streaminfo.php | 69 ------- includes/inc_streaming.php | 68 ------- includes/inc_svdrp.php | 446 -------------------------------------------- includes/inc_timers.php | 44 ----- includes/inc_utils.php | 95 ---------- includes/inc_vdr.php | 389 -------------------------------------- includes/inc_video.php | 117 ------------ includes/include.php | 137 -------------- 19 files changed, 2364 deletions(-) delete mode 100755 includes/inc_audio.php delete mode 100755 includes/inc_auth.php delete mode 100755 includes/inc_cat.php delete mode 100755 includes/inc_chan.php delete mode 100755 includes/inc_edittimer.php delete mode 100755 includes/inc_epg.php delete mode 100755 includes/inc_files.php delete mode 100755 includes/inc_home.php delete mode 100755 includes/inc_rec.php delete mode 100755 includes/inc_session.php delete mode 100755 includes/inc_stream.php delete mode 100755 includes/inc_streaminfo.php delete mode 100755 includes/inc_streaming.php delete mode 100755 includes/inc_svdrp.php delete mode 100755 includes/inc_timers.php delete mode 100755 includes/inc_utils.php delete mode 100755 includes/inc_vdr.php delete mode 100755 includes/inc_video.php delete mode 100755 includes/include.php (limited to 'includes') diff --git a/includes/inc_audio.php b/includes/inc_audio.php deleted file mode 100755 index 2960aa5..0000000 --- a/includes/inc_audio.php +++ /dev/null @@ -1,128 +0,0 @@ -\r\n"; -print "
\r\n"; - -print "
\r\n"; -if ($subdir == '/') - print " \"home\"
\r\n"; -else -{ - print " Back
\r\n"; - print "
\r\n"; - print " \"home\"
\r\n"; -} - -print "
iStreamdev
\r\n"; -print "\r\n"; -print "
\r\n"; -print "
\r\n"; - -$upsubdir = dirname($subdir); - -print "
\r\n"; -print " \r\n"; -print " \r\n"; -print " \r\n"; -print "
\r\n"; - -print "
\r\n"; - -print("
"); - -?> - diff --git a/includes/inc_auth.php b/includes/inc_auth.php deleted file mode 100755 index 1545b7c..0000000 --- a/includes/inc_auth.php +++ /dev/null @@ -1,36 +0,0 @@ - diff --git a/includes/inc_cat.php b/includes/inc_cat.php deleted file mode 100755 index 0b107d3..0000000 --- a/includes/inc_cat.php +++ /dev/null @@ -1,17 +0,0 @@ -\r\n"; -print "
\r\n"; -print "
\r\n"; -print "\"home\"
\r\n"; -print "
iStreamdev
\r\n"; -print "
\r\n"; -print "
\r\n"; -print " Category\r\n"; -print " "; -print "
\r\n"; -?> diff --git a/includes/inc_chan.php b/includes/inc_chan.php deleted file mode 100755 index ff73df6..0000000 --- a/includes/inc_chan.php +++ /dev/null @@ -1,24 +0,0 @@ -\r\n"; -print "
\r\n"; - -print "
\r\n"; -print "Back
\r\n"; -print "
\r\n"; -print "\"home\"
\r\n"; -print "
iStreamdev
\r\n"; -print "
\r\n"; -print "
\r\n"; -print " "; -print "
\r\n"; -print "
\r\n"; -?> diff --git a/includes/inc_edittimer.php b/includes/inc_edittimer.php deleted file mode 100755 index 8babf0c..0000000 --- a/includes/inc_edittimer.php +++ /dev/null @@ -1,158 +0,0 @@ -\r\n"; -print "
\r\n"; -print "
\r\n"; -print "Back
\r\n"; -print "
\r\n"; -print "\"home\"
\r\n"; -print "
iStream
\r\n"; -print "
\r\n"; -$timer = $_REQUEST['timer']; -if ($timer == -1) - print "
New Timer\r\n"; -else - print "
Edit Timer\r\n"; - -list($type, $channame, $date, $stime, $etime, $desc) = vdrgettimerinfo($timer); - -// Timer name -print "
\r\n"; -print "
    \r\n"; -if ($type & 0x1) - print "
  • Active
  • \r\n"; -else - print "
  • Active
  • \r\n"; -print "
\r\n"; -print "
    \r\n"; -print "
  • Recording name
  • \r\n"; -print "
  • \r\n"; - -if ($timer==-1) -{ -print " \r\n"; -} -else -{ -print " \r\n"; -} -print "
  • \r\n"; -print "
\r\n"; -print "
    \r\n"; -print "
  • Channel
  • \r\n"; -print "
  • \r\n"; - -// Channel selection -print " \r\n"; -print " "; -print "
  • \r\n"; -print "
\r\n"; - -// Date selection -print " \r\n"; - -// Start/End time selection -print " \r\n"; -print " \r\n"; -print "\r\n"; - -if ($timer == -1) -{ -print "\r\n"; -print "\r\n"; -print "\r\n"; -} -else -{ -print "\r\n"; -print "\r\n"; -print "\r\n"; -} - -print "\r\n"; - -print "
    \r\n"; -print "
  • \r\n"; -if ($timer == -1){ - print "
  • \r\n"; -} -else -{ - print " \r\n"; -} -print "
\r\n"; -print "
\r\n"; - -if ($timer != -1) -{ - print "
\r\n"; - print " \r\n"; - print " \r\n"; - print "
    \r\n"; - print "
  • \r\n"; - print "
  • \r\n"; - print "
\r\n"; - print "
\r\n"; -} - -print "
\r\n"; -print "
\r\n"; - -?> diff --git a/includes/inc_epg.php b/includes/inc_epg.php deleted file mode 100755 index 721cc9f..0000000 --- a/includes/inc_epg.php +++ /dev/null @@ -1,15 +0,0 @@ -\r\n"; -print "
\r\n"; -print "
\r\n"; -print "\"home\"
\r\n"; -print "
iStreamdev
\r\n"; -print "
\r\n"; -print "
\r\n"; -print " Program Guide\r\n"; -print "
    "; -print "
  • Incoming featureTo do...

  • "; -print "
\r\n"; -?> - diff --git a/includes/inc_files.php b/includes/inc_files.php deleted file mode 100755 index 60bc4f2..0000000 --- a/includes/inc_files.php +++ /dev/null @@ -1,172 +0,0 @@ -analyze($stream); - - $title = "Media:"; - $info = "Duration: " .sec2hms($fileinfo['playtime_seconds']) ."
"; - if ($fileinfo['fileformat']) - $info .= "Format: " .$fileinfo['fileformat'] ."
"; - if ($fileinfo['video']['codec']) - $info .= "Video: " .$fileinfo['video']['codec'] ."
"; - if ($fileinfo['audio']['codec']) - $info .= "Audio: " .$fileinfo['audio']['codec'] ."
"; - if ($fileinfo['video']['resolution_x']) - $info .= "Resolution: " .$fileinfo['video']['resolution_x'] ."x" .$fileinfo['video']['resolution_y'] ."
"; - - return array($title, $info); -} - -function mediagentb($stream, $dest) -{ - global $ffmpegpath; - - // Get info - $getid3 = new getID3; - $fileinfo = $getid3->analyze($stream); - - exec("rm " .$dest); - $path = dirname($stream); - - if (file_exists(substr($stream, 0, -4) .".tbn")) - $file = substr($stream, 0, -4) .".tbn"; - else if (file_exists($path ."/poster.jpg")) - $file = $path ."/poster.jpg"; - else if (file_exists($path ."/folder.jpg")) - $file = $path ."/folder.jpg"; - else - $file = ""; - - $resx = 180; - $resy = 100; - - if ($file) - { - $getid3 = new getID3; - $fileinfo = $getid3->analyze($file); - } - - if ($fileinfo['video']['resolution_y'] && $fileinfo['video']['resolution_x']) - { - if ($fileinfo['video']['resolution_y'] < $fileinfo['video']['resolution_x']) - { - $resx = 180; - $resy = round(($fileinfo['video']['resolution_y'] * 180) / $fileinfo['video']['resolution_x']); - } - else - { - $resx = round (($fileinfo['video']['resolution_x'] * 100) / $fileinfo['video']['resolution_y']); - $resy = 100; - } - } - - if ($file) - exec("cp \"" .$file ."\" ram/stream-tb-tmp.jpg; " .$ffmpegpath ." -y -i ram/stream-tb-tmp.jpg -s " .$resx ."x" .$resy ." " .$dest ." ; rm ram/stream-tb-tmp.jpg"); - else - exec($ffmpegpath ." -y -i \"" .$stream ."\" -an -ss 00:00:05.00 -r 1 -vframes 1 -s " .$resx ."x" .$resy ." -f mjpeg " .$dest); - - if (!file_exists($dest)) - exec('cp logos/nologoMEDIA.png ' .$dest); -} - -function mediagetwidth($file) -{ - - $getid3 = new getID3; - $fileinfo = $getid3->analyze($file); - - return $fileinfo['video']['resolution_x']; -} - -function mediagettype($file) -{ - global $videotypes, $audiotypes; - - // Get file extension - $fileext = end(explode(".", $file)); - $file = str_replace("\\'", "'", $file); - - if (is_dir($file)) - return 3; - else if (preg_match("$/$", $fileext)) - return 0; - else if (preg_match("/" .$fileext ." /", $videotypes)) - return 1; - else if (preg_match("/" .$fileext ." /", $audiotypes)) - return 2; - else - return 0; -} - -function mediadirhasaudio($dir) -{ - global $audiotypes; - - $audioextarray = explode(' ', $audiotypes); - - foreach ($audioextarray as $num => $audioext) - { - if (glob($dir .'*.' .$audioext)) - return 1; - } - - return 0; -} - -function mediagetmusicinfo($file ="") -{ - // Get info - $getid3 = new getID3; - $fileinfo = $getid3->analyze($file); - - $name = $fileinfo['tags']['id3v2']['title'][0]; - if ($name == "") - { - $name = $fileinfo['tags']['id3v1']['title'][0]; - if ($name == "") - { - $name = $fileinfo['filename']; - if ($name == "") - $name = "unknown"; - } - } - - if (!is_utf8($name)) - $name = utf8_encode($name); - - $duration = $fileinfo['playtime_string']; - - return array ($name, $duration); -} - -function generatelogo($type, $name, $dest) -{ - switch ($type) - { - case 1: - $channoslash = preg_replace("$/$", " ", $name); - $logopath = "logos/" .$channoslash .".png"; - if (!file_exists($logopath)) - $logopath = "logos/nologoTV.png"; - exec("cp \"" .$logopath ."\" " .$dest); - break; - case 2: - $channoslash = preg_replace("$/$", " ", $name); - $logopath = "logos/" .$channoslash .".png"; - if (!file_exists($logopath)) - $logopath = "logos/nologoREC.png"; - exec("cp \"" .$logopath ."\" " .$dest); - break; - case 3: - // Generate TB - mediagentb($name, $dest); - break; - } -} - -?> diff --git a/includes/inc_home.php b/includes/inc_home.php deleted file mode 100755 index f38518c..0000000 --- a/includes/inc_home.php +++ /dev/null @@ -1,135 +0,0 @@ -\r\n"; -print "
\r\n"; -print "
iStreamdev
\r\n"; -print "
\r\n"; -print "
\r\n"; - -$sessioncnt = 0; - -print " SESSIONS\r\n"; -print "
    \r\n"; - -// Streaming in progress -$dir_handle = @opendir('ram/'); -if ($dir_handle) -{ - while ($session = readdir($dir_handle)) - { - if($session == "." || $session == ".." || $session == 'lost+found') - continue; - - if (!is_dir('ram/' .$session)) - continue; - - // Get info - list($type, $realname, $title, $desc, $mode, $category, $url, $mediapath, $subdir) = readinfostream($session); - - switch ($type) - { - case 1: - $sessionname = "Live: "; - $picto = "tv"; - break; - case 2: - $sessionname = "Rec: "; - $picto = "record"; - break; - case 3: - $sessionname = "Media: "; - $picto = "media"; - break; - default: - continue; - } - - // Check if encoding - if (file_exists('ram/' .$session .'/segmenter.pid')) - $sessionname = "*" .$sessionname; - - $sessioncnt++; - - $sessionname .= $realname; - - print "
  • "; - print " "; - print " "; - print " {$sessionname}"; - print " "; - print "
  • \r\n"; - print "
    "; - print " "; - print " "; - print "
    \r\n"; - } - - closedir($dir_handle); -} - -if (!$sessioncnt) -{ - print "
  • none

  • \r\n"; - print "
\r\n"; -} -else -{ - print "\r\n"; - print "
\r\n"; - print " \r\n"; - print "
    \r\n"; - print "
  • \r\n"; - print "
  • \r\n"; - print "
\r\n"; - print "
\r\n"; -} - -// VDR menus -if ($vdrenabled) -{ - print " VDR\r\n"; - print "
    \r\n"; - print "
  • Channels
  • \r\n"; - print "
    \r\n"; - print "
  • Recordings
  • \r\n"; - print "
    \r\n"; - print "
  • Program Guide
  • \r\n"; - print "
    \r\n"; - print "
  • Timers
  • \r\n"; - print "
    \r\n"; - print "
"; -} - -// Media menus -print " MEDIA\r\n"; -print " "; -print "
"; -?> diff --git a/includes/inc_rec.php b/includes/inc_rec.php deleted file mode 100755 index 63b757e..0000000 --- a/includes/inc_rec.php +++ /dev/null @@ -1,87 +0,0 @@ -\r\n"; -print "
\r\n"; -print "
\r\n"; -if ($dir == $vdrrecpath) - print "\"home\"
\r\n"; -else - print "Back
\r\n"; -if ($dir != $vdrrecpath) -{ -print "
\r\n"; -print "\"home\"
\r\n"; -} -print "
iStreamdev
\r\n"; -print "
\r\n"; -print "
\r\n"; -print " Recordings\r\n"; -print "
"; -print " " . stripslashes($subdir) . "\r\n"; -print "
\r\n"; -?> diff --git a/includes/inc_session.php b/includes/inc_session.php deleted file mode 100755 index 2e10155..0000000 --- a/includes/inc_session.php +++ /dev/null @@ -1,88 +0,0 @@ - diff --git a/includes/inc_stream.php b/includes/inc_stream.php deleted file mode 100755 index 5837e22..0000000 --- a/includes/inc_stream.php +++ /dev/null @@ -1,139 +0,0 @@ -\r\n"; - -print "
\r\n"; -print "
\r\n"; - -print "Back
\r\n"; -print "
\r\n"; -print "\"home\"
\r\n"; - -print "
iStreamdev
\r\n"; -print "
\r\n"; - -print "
\r\n"; - -print " Select stream mode\r\n"; - -// Print the right logo -print " \r\n"; - -print "
\r\n"; -print "
\r\n"; - -foreach ($quality as $qname => $qparams) - print "{$qname}"; -print "\r\n"; - -print "
\r\n"; - -print " \r\n"; - -print "
\r\n"; - -foreach ($quality as $qname => $qparams) -{ - print "
\r\n"; - print " \r\n"; - print " \r\n"; - print " \r\n"; - print " \r\n"; - print " \r\n"; - print " \r\n"; - print " \r\n"; - print " \r\n"; - switch ($type) - { - case 1: - print " \r\n"; - break; - case 3: - $mediapath = $_REQUEST['mediapath']; - $subdir = $_REQUEST['subdir']; - $subdir = stripslashes($subdir); - print " \r\n"; - print " \r\n"; - // NO BREAK - case 2: - print " \r\n"; - break; - } - print "
"; -} - -print "
"; -switch ($type) -{ - case 1: - if ($category==null) - { - print " "; - } - else - { - print " "; - print " "; - } - break; - case 2: - $dir = dirname($name); - print " "; - print " "; - break; - case 3: - $mediapath = $_REQUEST['mediapath']; - $subdir = $_REQUEST['subdir']; - $subdir = stripslashes($subdir); - - print " "; - print " \r\n"; - print " \r\n"; - break; -} -print "
\r\n"; - -?> diff --git a/includes/inc_streaminfo.php b/includes/inc_streaminfo.php deleted file mode 100755 index 4124396..0000000 --- a/includes/inc_streaminfo.php +++ /dev/null @@ -1,69 +0,0 @@ - diff --git a/includes/inc_streaming.php b/includes/inc_streaming.php deleted file mode 100755 index 913f28e..0000000 --- a/includes/inc_streaming.php +++ /dev/null @@ -1,68 +0,0 @@ -\r\n"; - -print "
\r\n"; -print "
\r\n"; -print "Stop Stream
\r\n"; - -print "
\r\n"; -print "\"home\"
\r\n"; - -print "
iStreamdev
\r\n"; -print "
\r\n"; - -print "
\r\n"; -print " Now streaming\r\n"; - -// Print the right logo -print " \r\n"; - -print " \r\n"; - -print " \r\n"; - -print "
\r\n"; - -print "
"; -print " "; -print " "; -print " "; -switch ($type) -{ - case 1: - print " "; - break; - case 3: - print " \r\n"; - print " \r\n"; - // NO BREAK - case 2: - print " "; - break; - -} - -print "
\r\n"; -?> diff --git a/includes/inc_svdrp.php b/includes/inc_svdrp.php deleted file mode 100755 index da83b49..0000000 --- a/includes/inc_svdrp.php +++ /dev/null @@ -1,446 +0,0 @@ -cfgServer = $server; - $this->cfgPort = $port; - $this->cfgTimeOut = $timeout; - $this->debug = $debug; - $this->handle = 0; - } - - function DebugMessage($msg) - { - if($this->debug) echo ($msg); - } - - function Connect() - { - if($this->handle) Disconnect(); - $errno = 0; - $errstr = ""; - $this->handle = fsockopen($this->cfgServer, $this->cfgPort, &$errno, &$errstr, $this->cfgTimeOut); - - if(!$this->handle) - { - $this->DebugMessage("error $errno: $errstr"); - return false; - } - - $this->DebugMessage("handle: $this->handle
\n"); - - - $input = fgets($this->handle,128); - - if(!preg_match("/^220 /", $input) || $input == "") - { - $this->DebugMessage("wrong welcome message: '$input'
\n"); - $this->Disconnect(); - return false; - } - - - $this->DebugMessage("Welcome message: $input

\n"); - - return true; - } - - function Command($cmd) - { - if(!$this->handle) return false; - - $ret = array(); - - $this->DebugMessage("Kommando $cmd
"); - fputs($this->handle, $cmd . "\n"); - $s = ""; - $nline = 0; - while($s .= fgets($this->handle,4096)) - { - $nline++; - - $this->DebugMessage($s); - if(!preg_match("/^(\\d{3})([ -])(.*)$/", $s, $data)) - { - continue; - } - - - - - $number = $data[1]; - // TODO: Fehlernummer bearbeiten - $ret[] = $data[3]; - if($data[2] != "-" && $nline == 1) $ret = $data[3] ; - if($data[2] != "-") break; - $s = ""; - - } - - $this->DebugMessage(""); - return $ret; - } - - function ListChannels($numberorname="") - { - if(!$this->handle) return false; - $channels = array(); - $lines = $this->Command("LSTC$numberorname"); - if(!$lines) return false; - foreach($lines as $a => $l) - { - $a = split(":", $l); - $name = $a[0]; - $freq = $a[1]; - $b = split(";", $name); - $name = $b[0]; - if(!isset($b[1])) $b[1] = $name; - $group = $b[1]; - - - $c["name"] = $name; - $c["group"] = $group; - $c["frequency"] = $freq; - - $channels[] = $c; - - - } - return $channels; - } - - function Help() - { - return $this->Command("HELP"); - } - function Disconnect() - { - if(!$this->handle) return; - $this->Command("QUIT"); - - fclose($this->handle); - $this->handle = 0; - $this->DebugMessage("disconnected"); - } - function ClearEpg() - { - if(!$this->handle) return false; - $this->Command("CLRE"); - return true; - } - function SwitchUp() - { - if(!$this->handle) return false; - $this->Command("CHAN +"); - return true; - } - function SwitchDown() - { - if(!$this->handle) return false; - $this->Command("CHAN -"); - return true; - } - function SwitchChannel($channel) - { - if(!$this->handle) return false; - $this->Command("CHAN $channel"); - return true; - } - function DeleteChannel($id) - { - if(!$this->handle) return false; - $this->Command("DELC $id"); - return true; - } - function DeleteRecord($id) - { - if(!$this->handle) return false; - $this->Command("DELR $id"); - return true; - } - - function GrabImage($filename, $type="jpeg", $quality="", $width="", $height) - { - if(!$this->handle) return false; - $this->Command("GRAB $filename $type $quality $width $height"); - return true; - } - function HitKey($key) - { - if(!$this->handle) return false; - $this->Command("HITK $key"); - return true; - } - function PowerOff() - { - if(!$this->handle) return false; - $this->Command("HITK Power"); - return true; - - } - function GetKeys() - { - if(!$this->handle) return false; - - $lines = $this->Command("HITK"); - $keys = array(); - foreach($lines as $l) - { - if(!preg_match("/^ {4}(.*)$/", $l, $m)) continue; - $keys[] = $m[1]; - } - - return $keys; - } - function ListEPG($pStrChannel="", $pStrTime="") - { - if(!$this->handle) return false; - $lines = $this->Command("LSTE"); - - $epg = array (); - $channel = array(); - $event = array(); - - $channelname = ""; - foreach($lines as $l) - { - preg_match("/^(.)\\s*(.*)$/", $l, $m); - $type = $m[1]; - $text = $m[2]; - switch($type) - { - case 'C': // Channel - list( $channeldata, $channelname ) = explode( ' ', $text, 2 ); - - break; - case 'E': // new Event - sscanf($text, "%u %ld %d %X", $event["EventID"], $event["StartTime"], $event["Duration"], $event["TableID"]); - - break; - case 'T': // Title - $event["Title"] = $text; - break; - case 'S': // Short text - $event["Shottext"] = $text; - break; - case 'D': // Description - $event["Desc"] = $text; - break; - case 'V': // VPS - $event["VPS"] = $text; - break; - case 'e': // Event end - if ((trim($pStrTime) != '') && (( $event['StartTime'] > $pStrTime ) || ($event['StartTime'] + $event["Duration"] < $pStrTime))) - continue; - - $channel[] = $event; - $event = array(); - - break; - case 'c': // Channel end - if ((trim($pStrChannel) != '') && ($channelname != $pStrChannel)) - continue; - - $epg[$channelname] = $channel; - $channel = array(); - - break; - } - - } - if ((trim($pStrTime) == '') || (( $event['StartTime'] < $pStrTime ) && ($event['StartTime'] + $event["Duration"] > $pStrTime))) - $channel[] = $event; - - if ((trim($pStrChannel) != '') || ($channelname == $pStrChannel)) - $epg[$channelname] = $channel; - - return $epg; - } - - function Message($msg) - { - if(!$this->handle) return false; - $this->Command("MESG $msg"); - return true; - } - - - // Volume commands - function ToggleMute() - { - if(!$this->handle) return false; - $this->Command("VOLU mute"); - return true; - } - function VolumeUp() - { - if(!$this->handle) return false; - $this->Command("VOLU +"); - return true; - } - function VolumeDown() - { - if(!$this->handle) return false; - $this->Command("VOLU -"); - return true; - } - function SetVolume($v) - { - if(!$this->handle) return false; - $this->Command("VOLU $v"); - return true; - } - function GetVolume() - { - if(!$this->handle) return false; - $v = $this->Command("VOLU"); - if($v == "Audio is mute") return 0; - if(!preg_match("/Audio volume is (.*)/", $v, $m)) return false; - - return $m[1]; - } - function GetDiskStat() - { - if(!$this->handle) return false; - $stat = $this->Command("STAT DISK"); - sscanf($stat, "%dMB %dMB %d%%", $FreeMUsedMB, $FreeMB, $Percent); - $ret["FreeMB + UsedMB"] = $FreeMUsedMB; - $ret["FreeMB"] = $FreeMB; - $ret["UsedMB"] = $FreeMUsedMB - $FreeMB; - $ret["Percent"] = $Percent; - return $ret; - } - function StartScan() - { - if(!$this->handle) return false; - $this->Command("SCAN"); - return true; - } - function MoveChannel($number, $to) - { - if(!$this->handle) return false; - $this->Command("MOVC $number $to"); - return true; - - } - - function DeleteTimer($id) - { - if(!$this->handle) return false; - $this->Command("DELT $id"); - return true; - } - - function MoveTimer($number, $to) - { - if(!$this->handle) return false; - $this->Command("MOVT $number $to"); - return true; - } - - function TimerOnOff($n, $state = "on") - { - if(!$this->handle) return false; - //if($state == "1") $state = "on"; - //if($state == "0") $state = "off"; - //if($state == false) $state = "off"; - // if($state == true) $state = "on"; - switch($state) - { - case false: - case "off": - case "0": - $state = "off"; - break; - default: - $state = "on"; - break; - } - - return $this->Command("MODT $n $state"); - } - - function ListTimers() - { - - } - - function ShowMessage($msg = "") - { - if(!$this->handle) return false; - return $this->Command("MESG $msg"); - } - - function ListRecords() - { - if(!$this->handle) return false; - - $lines = $this->Command("LSTR"); - $records = array(); - foreach($lines as $l) - { - - if(!preg_match("/^(\\d)\s(\\d*)\\.(\\d*)\\.(\\d*) (\\d*)\\:(\\d*).\s(.*)$/", $l, $m)) continue; - $id = $m[1]; - $m["id"] = $m[1]; - $m["day"] = $m[2]; - $m["month"] = $m[3]; - $m["year"] = $m[4]; - $m["hour"] = $m[5]; - $m["minute"] = $m[6]; - $m["desc"] = $m[7]; - - $records[$id] = $m; - } - - return $records; - - } - - // TODO: perhaps better implementation - function ListRecord($n) - { - if(!$this->handle) return false; - $m = $this->Command("LSTR $n"); - return $m[0]; - } - - - - //TODO: Implement following commands: - /* - - - LSTT MODT NEWT UPDT - MODC NEWC - NEXT - PUTE - - */ -} - -// Small Example -/* -echo ""; -$a = new SVDRP(); -$a->Connect(); -print_r($a->Help()); -print_r($a->ListChannels()); -$a->GetKeys(); -print_r($a->GetVolume()); -print_r($a->GetDiskStat()); -$a->Disconnect(); -*/ -?> - - diff --git a/includes/inc_timers.php b/includes/inc_timers.php deleted file mode 100755 index 5190494..0000000 --- a/includes/inc_timers.php +++ /dev/null @@ -1,44 +0,0 @@ -\r\n"; -print "
\r\n"; -print "
\r\n"; -print "\"home\"
\r\n"; -print "
iStreamdev
\r\n"; -print "
\r\n"; -print "
\r\n"; -print " Timers\r\n"; - -// Status display -if ($message != "") -{ - print "
    "; - print $message; - print "
"; -} - -print "
    "; -print "
  • "; -print " Current timers"; -print "
  • "; - -vdrlisttimers(); - -print "
"; - -print ""; - -print "
\r\n"; -a -?> - diff --git a/includes/inc_utils.php b/includes/inc_utils.php deleted file mode 100755 index e748c64..0000000 --- a/includes/inc_utils.php +++ /dev/null @@ -1,95 +0,0 @@ - 128) - { - if(($c >= 254)) return false; - elseif($c >= 252) $bits=6; - elseif($c >= 248) $bits=5; - elseif($c >= 240) $bits=4; - elseif($c >= 224) $bits=3; - elseif($c >= 192) $bits=2; - else return false; - if(($i+$bits) > $len) return false; - while($bits > 1) - { - $i++; - $b=ord($str[$i]); - if($b < 128 || $b > 191) return false; - $bits--; - } - } - } - return true; -} - -function php2js ($var) -{ - if (is_array($var)) - { - $array = array(); - - foreach ($var as $a_var) - $array[] = php2js($a_var); - - return str_replace("\"", "'", join(",", $array)); - - - } - - elseif (is_bool($var)) - return ($var ? "true" : "false"); - - elseif (is_int($var) || is_integer($var) || is_double($var) || is_float($var)) - return $var; - - elseif (is_string($var)) - return "\"" .$var . "\""; - - else - return false; -} - -function sec2hms ($sec, $padHours = false) -{ - - // holds formatted string - $hms = ""; - - // there are 3600 seconds in an hour, so if we - // divide total seconds by 3600 and throw away - // the remainder, we've got the number of hours - $hours = intval(intval($sec) / 3600); - - // add to $hms, with a leading 0 if asked for - $hms .= ($padHours) - ? str_pad($hours, 2, "0", STR_PAD_LEFT). ':' - : $hours. ':'; - - // dividing the total seconds by 60 will give us - // the number of minutes, but we're interested in - // minutes past the hour: to get that, we need to - // divide by 60 again and keep the remainder - $minutes = intval(($sec / 60) % 60); - - // then add to $hms (with a leading 0 if needed) - $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':'; - - // seconds are simple - just divide the total - // seconds by 60 and keep the remainder - $seconds = intval($sec % 60); - - // add to $hms, again with a leading 0 if needed - $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT); - - // done! - return $hms; - -} -?> diff --git a/includes/inc_vdr.php b/includes/inc_vdr.php deleted file mode 100755 index 6dee5dc..0000000 --- a/includes/inc_vdr.php +++ /dev/null @@ -1,389 +0,0 @@ -Connect(); - $ret = $svdrp->Command($cmd); - $svdrp->Disconnect(); - - return $ret; -} - -function vdrgetinfostream($stream = "NULL", $ischan = 1) -{ - global $allepg, $allepgfilled; - $stream=stripslashes($stream); - if ($ischan) - { - // Fill epg if not yet done - if ($allepgfilled == 0) - { - $allepg = vdrsendcommand("LSTE NOW"); - $allepgfilled = 1; - } - - $channame = $stream; - } - else - { - $infofile = $stream ."/info"; - if (file_exists($infofile)) - $info= file_get_contents($infofile); - else - { - $infofile = $stream ."/info.vdr"; - if (file_exists($infofile)) - $info= file_get_contents($infofile); - else - $info=""; - } - - $allepg = explode("\n", $info); - } - - if ($ischan) - $chanfound = 0; - else - $chanfound = 1; - $epgtitlefound = 0; - - $epgtitle=""; - $epgdesc=""; - - // For all epg - $count = count($allepg); - for ($i = 0; $i < $count; $i++) - { - // Find the right chan (take the first one) - if ($chanfound == 0) - { - $streamArray = explode(";",$stream); - if (strstr($allepg[$i], $streamArray[0]) == $streamArray[0]) - $chanfound = 1; - } - else - { - // Now find T or C - if(ereg("^C", $allepg[$i])) - { - // Check if it is our chan too, else search again - if ($ischan) - { - if(!ereg("$stream$", $allepg[$i])) - { - $chanfound = 0; - continue; - } - } - else - { - $channame = substr($allepg[$i], 2); - $channames = explode(" ", $channame); - $channame = substr($channame, strlen($channames[0])+1); - } - } - else if(ereg("^T", $allepg[$i])) - $epgtitle=substr($allepg[$i], 2); - else if(ereg("^D", $allepg[$i])) - $epgdesc=substr($allepg[$i], 2); - } - } - - // Convert if needed - if (!is_utf8($epgtitle)) - $epgtitle = utf8_encode($epgtitle); - if (!is_utf8($epgdesc)) - $epgdesc = utf8_encode($epgdesc); - - - return array($epgtitle, $epgdesc, $channame); -} - -function vdrgettimerinfo($timernum=-1) -{ - if ($timernum != -1) - { - $timer = vdrsendcommand("LSTT " .$timernum); - - $timerarray = explode(":", $timer); - - $typearray = explode(" ", $timerarray[0]); - $type = $typearray[1]; - $channel = $timerarray[1]; - $date = $timerarray[2]; - $stime = $timerarray[3]; - $etime = $timerarray[4]; - $desc = $timerarray[7]; - } - else - { - $type = 1; - $channel = 1; - $date = date('Y-m-d'); - $stime = date('Hi'); - $etime = date('Hi'); - $desc = "New timer"; - } - - $channame = vdrgetchanname($channel); - - return array($type, $channame, $date, $stime, $etime, $desc); -} - -function vdrgetchannum($chan = "NULL") -{ - $channels = vdrsendcommand("LSTC"); - - // Get channel number - $channels = preg_grep(quotemeta('"'.$chan.';|'.$chan.':"'), $channels); - reset($channels); - - $channels = explode(" ", $channels[key($channels)]); - $channum = $channels[0]; - - return $channum; -} - -function vdrgetchanname($channum = 0) -{ - $channel = vdrsendcommand("LSTC " .$channum); - - // Get channel name - $chanarray = explode(":", $channel); - $chanarray = explode(";", $chanarray[0]); - $channame = $chanarray[0]; - $channame = substr($channame, strlen($channum)+1); - - return $channame; -} - - -function vdrlistcategories() -{ - global $vdrchannels; - - // All chans - print "
  • All channels
  • \r\n"; - print "
    \r\n"; - - if (!file_exists($vdrchannels)) - { - print "Error: channels file not found"; - return; - } - - $fp = fopen ($vdrchannels,"r"); - if (!fp) - { - print "Unable to open channels file"; - return; - } - while ($line = fgets($fp, 1024)) - { - // Check if it is a categorie - if ($line[0] == ":") - { - // Remove : and @ - $cat = substr($line, 1, -1); - if($cat[0] == '@') - { - $cat_array = explode(' ', $cat); - $cat = substr($cat, strlen($cat_array[0])+1); - } - - $cat2 = addslashes($cat); - - print "
  • $cat
  • \r\n"; - print "
    \r\n"; - } - } - fclose($fp); -} - -function vdrlistchannels($category = "NULL") -{ - global $epgtitle; - global $vdrchannels; - - if ($category == "All") - $cat_found=1; - else - $cat_found=0; - - if (!file_exists($vdrchannels)) - { - print "Error: channels file not found"; - return; - } - - $fp = fopen ($vdrchannels,"r"); - if (!fp) - { - print "Unable to open channels file"; - return; - } - while ($line = fgets($fp, 1024)) - { - if ($cat_found) - { - if ($line[0] == ":") - { - if ($category == "All") - continue; - else - break; - } - - $channels = explode(":", $line); - $channels = explode(";", $channels[0]); - $chan = $channels[0]; - - // Get EPG title - $epgtitle = NULL; - list($epgtitle, $epgdesc, $channame) = vdrgetinfostream($chan, 1); - print "
  • "; - $chan2=addslashes($chan); - print " \r\n"; - $channoslash = preg_replace("$/$", " ", $chan); - if (!file_exists('logos/'.$channoslash.'.png')) - print " \r\n"; - else - print " \r\n"; - print " $chan\r\n"; - print " $epgtitle\r\n
  • \r\n"; - print "
    "; - print " "; - print " "; - print " "; - print "
    \r\n"; - } - else - { - if ($line[0] == ":") - { - // Remove : and @ - $cat = substr($line, 1, -1); - if($cat[0] == '@') - { - $cat_array = explode(' ', $cat); - $cat = substr($cat, strlen($cat_array[0])+1); - } - - // Check category - if ("$cat" == "$category") - $cat_found = 1; - } - } - } - fclose($fp); -} - -function vdrlistchannelsdrop($chansel = "") -{ - global $vdrchannels; - - $chanselected = 0; - - if (!file_exists($vdrchannels)) - { - print "Error: channels file not found"; - return; - } - - $fp = fopen ($vdrchannels,"r"); - if (!fp) - { - print "Unable to open channels file"; - return; - } - while ($line = fgets($fp, 1024)) - { - if ($line[0] == ":") - continue; - - $channels = explode(":", $line); - $channels = explode(";", $channels[0]); - $chan = $channels[0]; - if (($chan == $chansel) && !$chanselected) - { - print ""; - $chanselected = 1; - } - else - print ""; - } -} - -function vdrlisttimers() -{ - $timers = vdrsendcommand("LSTT"); - - if (gettype($timers) == "string") - { - if (!is_numeric(substr($timers,0,1))) - { - print "
  • none

  • \r\n"; - return; - } - else - $timersarray[] = $timers; - } - else - $timersarray = $timers; - - foreach($timersarray as $timer) - { - // Extract timer # - $timerarray = explode(" ", $timer); - $timernum = $timerarray[0]; - - list($type, $channame, $date, $starthour, $endhour, $desc) = vdrgettimerinfo($timernum); - - print "
  • "; - print " \r\n"; - - if ($type & 0x8) - print " \"list\"\r\n"; - else if ($type & 0x1) - print " \"list\"\r\n"; - else - print " \"list\"\r\n"; - - print " {$date}: {$desc}\r\n"; - - print " \r\n"; - print "
  • \r\n"; - - print "
    \r\n"; - print " \r\n"; - print " \r\n"; - print "
    \r\n"; - } -} - -function vdrdeltimer($timer=0) -{ - return vdrsendcommand("DELT " .$timer); -} - -function vdrsettimer($prevtimer, $channame, $date, $stime, $etime, $desc, $active) -{ - $channum = vdrgetchannum($channame); - if ($active) - $type = "1"; - else - $type = "0"; - - if ($prevtimer == -1) - $command = "NEWT " .$type .":" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc; - else - $command = "MODT " .$prevtimer ." " .$type .":" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc; - - return vdrsendcommand($command); -} - -?> diff --git a/includes/inc_video.php b/includes/inc_video.php deleted file mode 100755 index 8fc9208..0000000 --- a/includes/inc_video.php +++ /dev/null @@ -1,117 +0,0 @@ -\r\n"; -print "
    \r\n"; - -print "
    \r\n"; - -if ($subdir == '/') - print "\"home\"
    \r\n"; -else -{ - print "Back
    \r\n"; - print "
    \r\n"; - print "\"home\"
    \r\n"; -} - -print "
    iStreamdev
    \r\n"; -print "\r\n"; - -print "
    \r\n"; -print " Media\r\n"; -print "
    "; -print "
      "; -print "
    • Current path:

      " . stripslashes($subdir) . "

    • "; - -$noslashdir = stripslashes($mediapath.$subdir); -$dir_handle = @opendir($noslashdir); - -if (!$dir_handle) -{ - print "Unable to open $mediapath .$subdir"; -} -else while ($medianame = readdir($dir_handle)) -{ - if($medianame == "." || $medianame == ".." || $medianame == 'lost+found') - continue; - - $medianame_array[] = $medianame; -} - -if ($medianame_array[0]) -{ - // Alphabetical sorting - sort($medianame_array); - - $audiocnt=0; - - foreach($medianame_array as $value) - { - $medianame2=addslashes($value); - - switch (mediagettype($mediapath .$subdir .$value)) - { - // Dir - case 3: - { - print "
    • \r\n"; - print " \r\n"; - print " $value\r\n"; - print " \r\n"; - print "
    • \r\n"; - print "
      "; - print " "; - print " "; - print " \r\n"; - print "
      \r\n"; - break; - } - // Video - case 1: - { - print "
    • \r\n"; - print " \r\n"; - print " \r\n"; - print " $value\r\n"; - print " \r\n"; - print "
    • \r\n"; - print "
      "; - print " "; - print " "; - print " "; - print " \r\n"; - print " "; - print "
      \r\n"; - break; - } - // Rest of files - default: - continue; - } - } -} - -$upsubdir = dirname($subdir); - -print "
      \r\n"; -print " \r\n"; -print " \r\n"; -print " \r\n"; -print "
      \r\n"; - -if ($dir_handle) - closedir($dir_handle); - -print "
    \r\n"; -?> diff --git a/includes/include.php b/includes/include.php deleted file mode 100755 index de9cfa4..0000000 --- a/includes/include.php +++ /dev/null @@ -1,137 +0,0 @@ -

    Timer deleted successfully

    "; - -} - -function set_timer($active, $channame, $date, $stime, $etime, $desc, $prevtimer) -{ - $ret = vdrsettimer($prevtimer, $channame, $date, $stime, $etime, $desc, $active); - - if ($prevtimer == -1) - $settype = "creat"; - else - $settype = "edit"; - - $retarray = explode(":", $ret); - - if (!is_numeric(substr($retarray[0], 0, 1))) - $message = "
  • {$retarray[0]}

  • "; - else - $message = "
  • Timer {$settype}ed successfully

  • "; -} - -?> -- cgit v1.2.3