From: Banana Date: Wed, 31 Aug 2011 11:12:07 +0000 (+0200) Subject: read id3 tags from mp3 file X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=cc44695483a5b2221c4e6b32339d7414b73db284;p=dolphin.git read id3 tags from mp3 file --- 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