本文整理匯總了PHP中getid3_lib::flipped_array_merge_noclobber方法的典型用法代碼示例。如果您正苦於以下問題:PHP getid3_lib::flipped_array_merge_noclobber方法的具體用法?PHP getid3_lib::flipped_array_merge_noclobber怎麽用?PHP getid3_lib::flipped_array_merge_noclobber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類getid3_lib
的用法示例。
在下文中一共展示了getid3_lib::flipped_array_merge_noclobber方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Analyze
//.........這裏部分代碼省略.........
} else {
// next frame is invalid too, abort processing
//unset($framedata);
$framedata = null;
$info['warning'][] = 'Invalid ID3v2 frame size, aborting.';
}
if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) {
switch ($frame_name) {
case "" . 'MP':
case "" . 'MP3':
case ' MP3':
case 'MP3e':
case "" . 'MP':
case ' MP':
case 'MP3':
$info['warning'][] = 'error parsing "' . $frame_name . '" (' . $framedataoffset . ' bytes into the ID3v2.' . $id3v2_majorversion . ' tag). (ERROR: !IsValidID3v2FrameName("' . str_replace("", ' ', $frame_name) . '", ' . $id3v2_majorversion . '))). [Note: this particular error has been known to happen with tags edited by "MP3ext (www.mutschler.de/mp3ext/)"]';
break;
default:
$info['warning'][] = 'error parsing "' . $frame_name . '" (' . $framedataoffset . ' bytes into the ID3v2.' . $id3v2_majorversion . ' tag). (ERROR: !IsValidID3v2FrameName("' . str_replace("", ' ', $frame_name) . '", ' . $id3v2_majorversion . '))).';
break;
}
} elseif (!isset($framedata) || $frame_size > strlen($framedata)) {
$info['error'][] = 'error parsing "' . $frame_name . '" (' . $framedataoffset . ' bytes into the ID3v2.' . $id3v2_majorversion . ' tag). (ERROR: $frame_size (' . $frame_size . ') > strlen($framedata) (' . (isset($framedata) ? strlen($framedata) : 'null') . ')).';
} else {
$info['error'][] = 'error parsing "' . $frame_name . '" (' . $framedataoffset . ' bytes into the ID3v2.' . $id3v2_majorversion . ' tag).';
}
}
$framedataoffset += $frame_size + $this->ID3v2HeaderLength($id3v2_majorversion);
}
}
// Footer
// The footer is a copy of the header, but with a different identifier.
// ID3v2 identifier "3DI"
// ID3v2 version $04 00
// ID3v2 flags %abcd0000
// ID3v2 size 4 * %0xxxxxxx
if (isset($thisfile_id3v2_flags['isfooter']) && $thisfile_id3v2_flags['isfooter']) {
$footer = $this->fread(10);
if (substr($footer, 0, 3) == '3DI') {
$thisfile_id3v2['footer'] = true;
$thisfile_id3v2['majorversion_footer'] = ord($footer[3]);
$thisfile_id3v2['minorversion_footer'] = ord($footer[4]);
}
if ($thisfile_id3v2['majorversion_footer'] <= 4) {
$id3_flags = ord(substr($footer[5]));
$thisfile_id3v2_flags['unsynch_footer'] = (bool) ($id3_flags & 0x80);
$thisfile_id3v2_flags['extfoot_footer'] = (bool) ($id3_flags & 0x40);
$thisfile_id3v2_flags['experim_footer'] = (bool) ($id3_flags & 0x20);
$thisfile_id3v2_flags['isfooter_footer'] = (bool) ($id3_flags & 0x10);
$thisfile_id3v2['footerlength'] = getid3_lib::BigEndian2Int(substr($footer, 6, 4), 1);
}
}
// end footer
if (isset($thisfile_id3v2['comments']['genre'])) {
$genre = array();
foreach ($thisfile_id3v2['comments']['genre'] as $key => $value) {
unset($thisfile_id3v2['comments']['genre'][$key]);
$genre = getid3_lib::flipped_array_merge_noclobber($genre, $this->ParseID3v2GenreString($value));
}
$thisfile_id3v2['comments']['genre'] = getid3_lib::flipped_array_merge_noclobber($thisfile_id3v2['comments']['genre'], $genre);
}
if (isset($thisfile_id3v2['comments']['track'])) {
foreach ($thisfile_id3v2['comments']['track'] as $key => $value) {
if (strstr($value, '/')) {
list($thisfile_id3v2['comments']['tracknum'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track'][$key]);
}
}
}
if (!isset($thisfile_id3v2['comments']['year']) && !empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) {
$thisfile_id3v2['comments']['year'] = array($matches[1]);
}
if (!empty($thisfile_id3v2['TXXX'])) {
// MediaMonkey does this, maybe others: write a blank RGAD frame, but put replay-gain adjustment values in TXXX frames
foreach ($thisfile_id3v2['TXXX'] as $txxx_array) {
switch ($txxx_array['description']) {
case 'replaygain_track_gain':
if (empty($info['replay_gain']['track']['adjustment']) && !empty($txxx_array['data'])) {
$info['replay_gain']['track']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
}
break;
case 'replaygain_track_peak':
if (empty($info['replay_gain']['track']['peak']) && !empty($txxx_array['data'])) {
$info['replay_gain']['track']['peak'] = floatval($txxx_array['data']);
}
break;
case 'replaygain_album_gain':
if (empty($info['replay_gain']['album']['adjustment']) && !empty($txxx_array['data'])) {
$info['replay_gain']['album']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
}
break;
}
}
}
// Set avdataoffset
$info['avdataoffset'] = $thisfile_id3v2['headerlength'];
if (isset($thisfile_id3v2['footer'])) {
$info['avdataoffset'] += 10;
}
return true;
}