diff options
author | TheTroll <trolldev@gmail.com> | 2010-02-26 14:47:14 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-02-26 14:47:14 +0100 |
commit | 13faaed4ec54b1611dcc1dd7aa796fe3649fdc6a (patch) | |
tree | bdd40801e6c2bb737044246bf16d4dce92e60ba6 /includes/inc_files.php | |
parent | 9cd6bbb758f3be5c2390a77770cc54b05dcf0b83 (diff) | |
download | istreamdev-13faaed4ec54b1611dcc1dd7aa796fe3649fdc6a.tar.gz istreamdev-13faaed4ec54b1611dcc1dd7aa796fe3649fdc6a.tar.bz2 |
Display ID3 tag if available for music
Diffstat (limited to 'includes/inc_files.php')
-rwxr-xr-x | includes/inc_files.php | 27 |
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); +} |