summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTheTroll <trolldev@gmail.com>2010-03-18 01:07:28 +0100
committerTheTroll <trolldev@gmail.com>2010-03-18 01:07:28 +0100
commitef0bc7bd8c304fe13b941d62ff07da33f5f49315 (patch)
tree5c77fe376d8195e4ce0aae033121a98cd3004733 /bin
parent459abaa2386fd1935abf8b763aee046222b13a01 (diff)
downloadistreamdev-ef0bc7bd8c304fe13b941d62ff07da33f5f49315.tar.gz
istreamdev-ef0bc7bd8c304fe13b941d62ff07da33f5f49315.tar.bz2
Support audio streaming
Temporary video/audio sources
Diffstat (limited to 'bin')
-rwxr-xr-xbin/backend.php16
-rwxr-xr-xbin/files.php22
-rwxr-xr-xbin/jsonapi.php17
-rwxr-xr-xbin/session.php37
4 files changed, 61 insertions, 31 deletions
diff --git a/bin/backend.php b/bin/backend.php
index 9be4b28..971629e 100755
--- a/bin/backend.php
+++ b/bin/backend.php
@@ -111,19 +111,9 @@ switch ($action)
print $tree;
break;
- case ("browseRec"):
- $tree = file_get_contents("textfiles/browseRec.txt");
- print $tree;
- break;
-
- case ("browseAudio"):
- $tree = file_get_contents("textfiles/browseAudio.txt");
- print $tree;
- break;
-
case ("streamAudio"):
- $tree = file_get_contents("textfiles/streamAudio.txt");
- print $tree;
- break;
+ $tree = streamAudio($_REQUEST['path'], $_REQUEST['file']);
+ print $tree;
+ break;
}
?>
diff --git a/bin/files.php b/bin/files.php
index d87d332..30dbe49 100755
--- a/bin/files.php
+++ b/bin/files.php
@@ -80,15 +80,6 @@ function mediagentb($stream, $dest)
exec('cp ../logos/nologoMEDIA.png ' .$dest);
}
-function mediagetwidth($file)
-{
-
- $getid3 = new getID3;
- $fileinfo = $getid3->analyze($file);
-
- return $fileinfo['video']['resolution_x'];
-}
-
function filegettype($file)
{
global $videotypes, $audiotypes;
@@ -114,7 +105,7 @@ function filegettype($file)
return 'unknown';
}
-function mediagetmusicinfo($file ="")
+function mediagetmusicinfo($file)
{
// Get info
$getid3 = new getID3;
@@ -187,6 +178,8 @@ function filesgetlisting($dir)
// Alphabetical sorting
sort($medianame_array);
+ $number = 1;
+
foreach($medianame_array as $value)
{
$newentry = array();
@@ -199,18 +192,17 @@ function filesgetlisting($dir)
switch ($type)
{
case 'audio':
+ list($newentry['trackname'], $newentry['length']) = mediagetmusicinfo($dir ."/" .$value);
+ $newentry['number'] = $number;
+ $number++;
case 'video':
case 'rec':
case 'folder':
$newentry['type'] = $type;
+ $listing[] = $newentry;
break;
default:
- continue;
-
}
-
- // Add new entry
- $listing[] = $newentry;
}
return $listing;
diff --git a/bin/jsonapi.php b/bin/jsonapi.php
index d4f96ac..b0e53cb 100755
--- a/bin/jsonapi.php
+++ b/bin/jsonapi.php
@@ -2,13 +2,13 @@
function getGlobals()
{
- global $vdrstreamdev, $vdrrecpath, $mediasource;
+ global $vdrstreamdev, $vdrrecpath, $mediasource, $videosource, $audiosource;
$ret = array();
$ret['streamdev_server'] = $vdrstreamdev;
$ret['rec_path'] = $vdrrecpath;
- $ret['video_path'] = "/home/storage/Foot/";
- $ret['audio_path'] = "/home/www/mp3/";
+ $ret['video_path'] = $videosource;
+ $ret['audio_path'] = $audiosource;
return json_encode($ret);
}
@@ -167,4 +167,15 @@ function browseFolder($path)
return json_encode($ret);
}
+
+function streamAudio($path, $file)
+{
+ $ret = array();
+
+ $ret['track'] = streammusic($path, $file);
+
+ return json_encode($ret);
+
+}
+
?>
diff --git a/bin/session.php b/bin/session.php
index 09d793f..e17e166 100755
--- a/bin/session.php
+++ b/bin/session.php
@@ -262,4 +262,41 @@ function sessiongetlist()
return $sessions;
}
+function streammusic($path, $file)
+{
+ global $httppath;
+
+ $files = array();
+
+ // Create all symlinks
+ exec('mkdir ../playlist');
+ exec('rm ../playlist/*');
+ exec('ln -s ' .addcslashes(quotemeta($path), " &'") .'/* ../playlist');
+
+ // Generate files
+
+ // Get listing
+ $filelisting = filesgetlisting($path);
+
+ $addfiles = 0;
+
+ foreach ($filelisting as $f)
+ {
+ if ($f['type'] != 'audio')
+ continue;
+
+ if ($f['name'] == $file)
+ $addfiles = 1;
+
+ if ($addfiles)
+ {
+ $newfile = array();
+ $newfile['file'] = $httppath ."playlist/" . $f['name'];
+ $files[] = $newfile;
+ }
+ }
+
+ return $files;
+}
+
?>