summaryrefslogtreecommitdiff
path: root/includes/inc_files.php
diff options
context:
space:
mode:
authorTheTroll <trolldev@gmail.com>2010-02-26 14:47:14 +0100
committerTheTroll <trolldev@gmail.com>2010-02-26 14:47:14 +0100
commit13faaed4ec54b1611dcc1dd7aa796fe3649fdc6a (patch)
treebdd40801e6c2bb737044246bf16d4dce92e60ba6 /includes/inc_files.php
parent9cd6bbb758f3be5c2390a77770cc54b05dcf0b83 (diff)
downloadistreamdev-13faaed4ec54b1611dcc1dd7aa796fe3649fdc6a.tar.gz
istreamdev-13faaed4ec54b1611dcc1dd7aa796fe3649fdc6a.tar.bz2
Display ID3 tag if available for music
Diffstat (limited to 'includes/inc_files.php')
-rwxr-xr-xincludes/inc_files.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/includes/inc_files.php b/includes/inc_files.php
index 06a9cc0..3e9e90f 100755
--- a/includes/inc_files.php
+++ b/includes/inc_files.php
@@ -4,7 +4,6 @@ $audiotypes='mp3 aac wav ';
function mediagetinfostream($stream = "")
{
-
global $ffmpegpath;
// Get info
@@ -62,3 +61,29 @@ function mediadirhasaudio($dir)
return 0;
}
+
+function mediagetmusicinfo($file ="")
+{
+ // Get info
+ $getid3 = new getID3;
+ $fileinfo = $getid3->analyze($file);
+
+ $name = $fileinfo['tags']['id3v1']['title'][0];
+ if ($name == "")
+ {
+ $name = $fileinfo['tags']['id3v2']['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);
+}