summaryrefslogtreecommitdiff
path: root/includes/inc_files.php
diff options
context:
space:
mode:
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);
+}