summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheTroll <trolldev@gmail.com>2010-02-24 17:20:04 +0100
committerTheTroll <trolldev@gmail.com>2010-02-24 17:20:04 +0100
commitff270318f7859bb99de1dc679ad3093c31f304dd (patch)
treedbb0e553c6bc349a6f5ea8eb99db1be07cd0d6e7
parent840252e0287b055e699af194b7357eccab4fce8a (diff)
downloadistreamdev-ff270318f7859bb99de1dc679ad3093c31f304dd.tar.gz
istreamdev-ff270318f7859bb99de1dc679ad3093c31f304dd.tar.bz2
Now redirect single files to playlist frontend (still buggy, file is not played yert)
Remove audiotypes conf (we only support native safari ext)
-rwxr-xr-xconfig_default.php1
-rwxr-xr-xincludes/inc_media.php26
-rwxr-xr-xincludes/inc_mp3.php7
-rwxr-xr-xstreammusic.php18
4 files changed, 23 insertions, 29 deletions
diff --git a/config_default.php b/config_default.php
index f02d272..6491d02 100755
--- a/config_default.php
+++ b/config_default.php
@@ -16,7 +16,6 @@
// Media configuration
$mediainfopath='/usr/bin/mediainfo';
$videotypes='avi mkv ts mov mp4 wmv flv mpg mpeg mpeg2 mpv'; //video files extensions
- $audiotypes='mp3 wav aac flac'; //audio files extensions
// Source name Source path
$mediasources=array ( 'Video' => '/mnt/media/movies',
'Audio' => '/mnt/media/music');
diff --git a/includes/inc_media.php b/includes/inc_media.php
index 441ce3f..d0f94c1 100755
--- a/includes/inc_media.php
+++ b/includes/inc_media.php
@@ -1,6 +1,7 @@
<?php
-global $videotypes, $audiotypes;
+global $videotypes;
+$audiotypes='mp3 aac';
$subdir = $_REQUEST['subdir'];
$mediapath = $_REQUEST['mediapath'];
@@ -34,8 +35,15 @@ print " <ul class=\"pageitem\">";
print " <li class=\"textbox\"><span class=\"header\">Current path:</span><p>{$subdir}</p></li>";
// Option to play dir
+$audioextarray = explode(' ', $audiotypes);
+$playlist = 0;
+foreach ($audioextarray as $num => $audioext)
+{
+ if (glob($mediapath .$subdir .'*.' .$audioext))
+ $playlist = 1;
+}
-if (glob($mediapath .$subdir ."*.mp3"))
+if ($playlist)
{
print " <li class=\"menu\">\r\n";
print " <a href=\"index.php?action=playdir&mediapath={$mediapath}&subdir={$subdir}\">\r\n";
@@ -63,6 +71,8 @@ if ($medianame_array[0])
{
// Alphabetical sorting
sort($medianame_array);
+
+ $audiocnt=0;
foreach($medianame_array as $value)
{
@@ -88,9 +98,7 @@ if ($medianame_array[0])
$fileext = end(explode(".", $value));
// Check if it is supported
- if ( preg_match("/" .$fileext ." /", $videotypes)
- || preg_match("/" .$fileext ." $/", $videotypes)
- )
+ if ( preg_match("/" .$fileext ." /", $videotypes) || preg_match("/" .$fileext ." $/", $videotypes) )
{
print "<li class=\"menu\">\r\n";
print " <a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\">\r\n";
@@ -106,12 +114,12 @@ if ($medianame_array[0])
print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$mediapath}{$subdir}{$value}\" />";
print "</form>\r\n";
}
- else if ( preg_match("/" .$fileext ." /", $audiotypes)
- || preg_match("/" .$fileext ."$/", $audiotypes)
- )
+ else if ( preg_match("/" .$fileext ." /", $audiotypes) || preg_match("/" .$fileext ."$/", $audiotypes) )
{
+ $audiocnt++;
+
print "<li class=\"menu\">\r\n";
- print " <a href=\"streammusic.php?mediapath={$mediapath}&subdir={$subdir}&file={$value}\">\r\n";
+ print " <a href=\"index.php?action=playdir&mediapath={$mediapath}&subdir={$subdir}&play={$audiocnt}\">\r\n";
print " <img src=\"images/pictos/audio.png\" />\r\n";
print " <span class=\"name\">$value</span><span class=\"arrow\"></span>\r\n";
print " </a>\r\n";
diff --git a/includes/inc_mp3.php b/includes/inc_mp3.php
index 162ebcb..9e3cd62 100755
--- a/includes/inc_mp3.php
+++ b/includes/inc_mp3.php
@@ -1,6 +1,11 @@
<?php
-print "<body class=\"ipodlist\">\r\n";
+$play =$_REQUEST['play'];
+if ($play == "")
+ print "<body class=\"ipodlist\">\r\n";
+else
+ print "<body class=\"ipodlist\" onload=\"javascript:Document.s{$play}.Play()\">\r\n";
+
print "<div id=\"topbar\" class=\"transparent\">\r\n";
print "<div id=\"leftnav\">\r\n";
print " <a href=\"javascript:sendForm('getback')\">Back</a>\r\n";
diff --git a/streammusic.php b/streammusic.php
deleted file mode 100755
index 8dbcbfe..0000000
--- a/streammusic.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-//set headers to mp3
-
-$mediapath = $_GET['mediapath'];
-$subdir = $_GET['subdir'];
-$file = $_GET['file'];
-
-header("Content-Transfer-Encoding: binary");
-header("Content-Type: audio/mp3");
-header('Content-length: ' . filesize($mediapath .$subdir .$file));
-header('Content-Disposition: attachment; filename="streaming.mp3"');
-header('X-Pad: avoid browser bug');
-Header('Cache-Control: no-cache');
-
-readfile($mediapath .$subdir .$file);
-
-?>