summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheTroll <trolldev@gmail.com>2010-03-17 19:27:09 +0100
committerTheTroll <trolldev@gmail.com>2010-03-17 19:27:09 +0100
commitbdfebadb0d8f241dea056417cb14ce314c0c4ae9 (patch)
tree5cea72f3abe8fc31b28762fa6abc602e6fecbae2
parent0288e7e23ea7aea31727780b6cfebb0baab87abc (diff)
downloadistreamdev-bdfebadb0d8f241dea056417cb14ce314c0c4ae9.tar.gz
istreamdev-bdfebadb0d8f241dea056417cb14ce314c0c4ae9.tar.bz2
Generate video logo and print info
-rwxr-xr-xbin/backend.php7
-rwxr-xr-xbin/files.php27
-rwxr-xr-xbin/jsonapi.php12
-rwxr-xr-xbin/session.php7
4 files changed, 36 insertions, 17 deletions
diff --git a/bin/backend.php b/bin/backend.php
index 3ed2dcb..87a5f7b 100755
--- a/bin/backend.php
+++ b/bin/backend.php
@@ -6,6 +6,7 @@ if (file_exists('../config.php'))
include ('../config.php');
else
include ('../config_default.php');
+include ('../getid3/getid3.php');
include ('./utils.php');
include ('./files.php');
include ('./streaminfo.php');
@@ -50,9 +51,9 @@ switch ($action)
break;
case ("getVidInfo"):
- $tree = file_get_contents("textfiles/getVidInfo.txt");
- print $tree;
- break;
+ $tree = getVidInfo($_REQUEST['file']);
+ print $tree;
+ break;
case ("getStreamInfo"):
$tree = getStreamInfo($_REQUEST['session']);
diff --git a/bin/files.php b/bin/files.php
index f39ee98..ba82d21 100755
--- a/bin/files.php
+++ b/bin/files.php
@@ -2,22 +2,21 @@
function mediagetinfostream($stream)
{
+ $info = array();
+
// Get info
$getid3 = new getID3;
$fileinfo = $getid3->analyze($stream);
- $title = "Media:";
- $info = "Duration: <i>" .sec2hms($fileinfo['playtime_seconds']) ."</i><br>";
- if ($fileinfo['fileformat'])
- $info .= "Format: <i>" .$fileinfo['fileformat'] ."</i><br>";
- if ($fileinfo['video']['codec'])
- $info .= "Video: <i>" .$fileinfo['video']['codec'] ."</i><br>";
- if ($fileinfo['audio']['codec'])
- $info .= "Audio: <i>" .$fileinfo['audio']['codec'] ."</i><br>";
- if ($fileinfo['video']['resolution_x'])
- $info .= "Resolution: <i>" .$fileinfo['video']['resolution_x'] ."x" .$fileinfo['video']['resolution_y'] ."</i><br>";
-
- return array($title, $info);
+ $info['name'] = basename($stream);
+ $info['desc'] = "";
+ $info['duration'] = sec2hms($fileinfo['playtime_seconds']);
+ $info['format'] = $fileinfo['fileformat'];
+ $info['video'] = $fileinfo['video']['codec'];
+ $info['audio'] = $fileinfo['audio']['codec'];
+ $info['resolution'] = $fileinfo['video']['resolution_x'] ."x" .$fileinfo['video']['resolution_y'];
+
+ return $info;
}
function mediagentb($stream, $dest)
@@ -64,12 +63,12 @@ function mediagentb($stream, $dest)
}
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");
+ 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);
+ exec('cp ../logos/nologoMEDIA.png ' .$dest);
}
function mediagetwidth($file)
diff --git a/bin/jsonapi.php b/bin/jsonapi.php
index 0c3b350..0f922c2 100755
--- a/bin/jsonapi.php
+++ b/bin/jsonapi.php
@@ -75,6 +75,18 @@ function getRecInfo($rec)
return json_encode($ret);
}
+function getVidInfo($file)
+{
+ $ret = array();
+
+ // Generate logo
+ generatelogo('vid', $file, '../ram/temp-logo.png');
+
+ $ret['program'] = mediagetinfostream($file);
+
+ return json_encode($ret);
+}
+
function startBroadcast($type, $url, $mode)
{
$ret = array();
diff --git a/bin/session.php b/bin/session.php
index 8e3e727..ccf12fe 100755
--- a/bin/session.php
+++ b/bin/session.php
@@ -140,6 +140,13 @@ function sessiongetinfo($session)
list($channame, $info['name'], $info['desc'], $info['recorded']) = vdrgetrecinfo($url);
break;
case 'vid':
+ $infovid = mediagetinfostream($url);
+ $info['desc'] = $infovid['desc'];
+ $info['duration'] = $infovid['duration'];
+ $info['format'] = $infovid['format'];
+ $info['video'] = $infovid['video'];
+ $info['audio'] = $infovid['audio'];
+ $info['resiolution'] = $infovid['resiolution'];
break;
}