Changeset 46112 for trunk/src/wp-includes/ID3/module.tag.apetag.php
- Timestamp:
- 09/14/2019 07:06:09 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/module.tag.apetag.php
r41196 r46112 1 1 <?php 2 2 3 ///////////////////////////////////////////////////////////////// 3 4 /// getID3() by James Heinrich <info@getid3.org> // 4 // available at http://getid3.sourceforge.net // 5 // or http://www.getid3.org // 6 // also https://github.com/JamesHeinrich/getID3 // 7 ///////////////////////////////////////////////////////////////// 8 // See readme.txt for more details // 5 // available at https://github.com/JamesHeinrich/getID3 // 6 // or https://www.getid3.org // 7 // or http://getid3.sourceforge.net // 8 // see readme.txt for more details // 9 9 ///////////////////////////////////////////////////////////////// 10 10 // // … … 17 17 class getid3_apetag extends getid3_handler 18 18 { 19 public $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory 19 /** 20 * true: return full data for all attachments; 21 * false: return no data for all attachments; 22 * integer: return data for attachments <= than this; 23 * string: save as file to this directory. 24 * 25 * @var int|bool|string 26 */ 27 public $inline_attachments = true; 28 20 29 public $overrideendoffset = 0; 21 30 31 /** 32 * @return bool 33 */ 22 34 public function Analyze() { 23 35 $info = &$this->getid3->info; … … 151 163 // http://wiki.hydrogenaud.io/index.php?title=ReplayGain#MP3Gain 152 164 case 'replaygain_track_gain': 153 if (preg_match('#^ [\\-\\+][0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) {154 $thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $ thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!165 if (preg_match('#^([\\-\\+][0-9\\.,]{8})( dB)?$#', $thisfile_ape_items_current['data'][0], $matches)) { 166 $thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $matches[1]); // float casting will see "0,95" as zero! 155 167 $thisfile_replaygain['track']['originator'] = 'unspecified'; 156 168 } else { … … 160 172 161 173 case 'replaygain_track_peak': 162 if (preg_match('#^ [0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) {163 $thisfile_replaygain['track']['peak'] = (float) str_replace(',', '.', $ thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!174 if (preg_match('#^([0-9\\.,]{8})$#', $thisfile_ape_items_current['data'][0], $matches)) { 175 $thisfile_replaygain['track']['peak'] = (float) str_replace(',', '.', $matches[1]); // float casting will see "0,95" as zero! 164 176 $thisfile_replaygain['track']['originator'] = 'unspecified'; 165 177 if ($thisfile_replaygain['track']['peak'] <= 0) { … … 172 184 173 185 case 'replaygain_album_gain': 174 if (preg_match('#^ [\\-\\+][0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) {175 $thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $ thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!186 if (preg_match('#^([\\-\\+][0-9\\.,]{8})( dB)?$#', $thisfile_ape_items_current['data'][0], $matches)) { 187 $thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $matches[1]); // float casting will see "0,95" as zero! 176 188 $thisfile_replaygain['album']['originator'] = 'unspecified'; 177 189 } else { … … 181 193 182 194 case 'replaygain_album_peak': 183 if (preg_match('#^ [0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) {184 $thisfile_replaygain['album']['peak'] = (float) str_replace(',', '.', $ thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!195 if (preg_match('#^([0-9\\.,]{8})$#', $thisfile_ape_items_current['data'][0], $matches)) { 196 $thisfile_replaygain['album']['peak'] = (float) str_replace(',', '.', $matches[1]); // float casting will see "0,95" as zero! 185 197 $thisfile_replaygain['album']['originator'] = 'unspecified'; 186 198 if ($thisfile_replaygain['album']['peak'] <= 0) { … … 226 238 if (is_array($thisfile_ape_items_current['data'])) { 227 239 foreach ($thisfile_ape_items_current['data'] as $comment) { 228 $thisfile_ape['comments']['track '][] = $comment;240 $thisfile_ape['comments']['track_number'][] = $comment; 229 241 } 230 242 } … … 336 348 } 337 349 350 /** 351 * @param string $APEheaderFooterData 352 * 353 * @return array|false 354 */ 338 355 public function parseAPEheaderFooter($APEheaderFooterData) { 339 356 // http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html … … 360 377 } 361 378 379 /** 380 * @param int $rawflagint 381 * 382 * @return array 383 */ 362 384 public function parseAPEtagFlags($rawflagint) { 363 385 // "Note: APE Tags 1.0 do not use any of the APE Tag flags. … … 375 397 } 376 398 399 /** 400 * @param int $contenttypeid 401 * 402 * @return string 403 */ 377 404 public function APEcontentTypeFlagLookup($contenttypeid) { 378 405 static $APEcontentTypeFlagLookup = array( … … 385 412 } 386 413 414 /** 415 * @param string $itemkey 416 * 417 * @return bool 418 */ 387 419 public function APEtagItemIsUTF8Lookup($itemkey) { 388 420 static $APEtagItemIsUTF8Lookup = array(
Note: See TracChangeset
for help on using the changeset viewer.