From cc44695483a5b2221c4e6b32339d7414b73db284 Mon Sep 17 00:00:00 2001 From: Banana Date: Wed, 31 Aug 2011 13:12:07 +0200 Subject: [PATCH] read id3 tags from mp3 file --- classes/id3-tag-reader.php | 156 +++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 classes/id3-tag-reader.php diff --git a/classes/id3-tag-reader.php b/classes/id3-tag-reader.php new file mode 100644 index 0000000..21302a2 --- /dev/null +++ b/classes/id3-tag-reader.php @@ -0,0 +1,156 @@ +aTV23); $i++) { + if (strpos($sSrc, $this->aTV23[$i].chr(0)) != FALSE) { + + $s = ''; + $iPos = strpos($sSrc, $this->aTV23[$i].chr(0)); + $iLen = hexdec(bin2hex(substr($sSrc,($iPos + 5),3))); + + $data = substr($sSrc, $iPos, 9 + $iLen); + for ($a = 0; $a < strlen($data); $a++) { + $char = substr($data, $a, 1); + if ($char >= ' ' && $char <= '~') + $s .= $char; + } + if (substr($s, 0, 4) == $this->aTV23[$i]) { + $iSL = 4; + if ($this->aTV23[$i] == 'USLT') { + $iSL = 7; + } elseif ($this->aTV23[$i] == 'TALB') { + $iSL = 5; + } elseif ($this->aTV23[$i] == 'TENC') { + $iSL = 6; + } + $aInfo[$this->aTV23t[$i]] = substr($s, $iSL); + } + } + } + } + + // passing through possible tags of idv2 (v2) + if($aInfo['Version'] == '2.0') { + for ($i = 0; $i < count($this->aTV22); $i++) { + if (strpos($sSrc, $this->aTV22[$i].chr(0)) != FALSE) { + + $s = ''; + $iPos = strpos($sSrc, $this->aTV22[$i].chr(0)); + $iLen = hexdec(bin2hex(substr($sSrc,($iPos + 3),3))); + + $data = substr($sSrc, $iPos, 6 + $iLen); + for ($a = 0; $a < strlen($data); $a++) { + $char = substr($data, $a, 1); + if ($char >= ' ' && $char <= '~') + $s .= $char; + } + + if (substr($s, 0, 3) == $this->aTV22[$i]) { + $iSL = 3; + if ($this->aTV22[$i] == 'ULT') { + $iSL = 6; + } + $aInfo[$this->aTV22t[$i]] = substr($s, $iSL); + } + } + } + } + return $aInfo; + } +} + +?> \ No newline at end of file -- 2.39.5