Changeset 61289 for branches/6.9/src/wp-includes/ID3/module.tag.lyrics3.php
- Timestamp:
- 11/24/2025 06:36:59 PM (3 months ago)
- Location:
- branches/6.9
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/wp-includes/ID3/module.tag.lyrics3.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/6.9
-
branches/6.9/src/wp-includes/ID3/module.tag.lyrics3.php
r52254 r61289 111 111 if (isset($info['lyrics3']['tag_offset_start'])) { 112 112 $GETID3_ERRORARRAY = &$info['warning']; 113 getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true); 114 $getid3_temp = new getID3(); 115 $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); 116 $getid3_apetag = new getid3_apetag($getid3_temp); 117 $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start']; 118 $getid3_apetag->Analyze(); 119 if (!empty($getid3_temp->info['ape'])) { 120 $info['ape'] = $getid3_temp->info['ape']; 121 } 122 if (!empty($getid3_temp->info['replay_gain'])) { 123 $info['replay_gain'] = $getid3_temp->info['replay_gain']; 124 } 125 unset($getid3_temp, $getid3_apetag); 113 if ($this->getid3->option_tag_apetag) { 114 getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true); 115 $getid3_temp = new getID3(); 116 $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); 117 $getid3_apetag = new getid3_apetag($getid3_temp); 118 $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start']; 119 $getid3_apetag->Analyze(); 120 if (!empty($getid3_temp->info['ape'])) { 121 $info['ape'] = $getid3_temp->info['ape']; 122 } 123 if (!empty($getid3_temp->info['replay_gain'])) { 124 $info['replay_gain'] = $getid3_temp->info['replay_gain']; 125 } 126 unset($getid3_temp, $getid3_apetag); 127 } else { 128 $this->warning('Unable to check for Lyrics3 and APE tags interaction since option_tag_apetag=FALSE'); 129 } 126 130 } else { 127 131 $this->warning('Lyrics3 and APE tags appear to have become entangled (most likely due to updating the APE tags with a non-Lyrics3-aware tagger)'); … … 228 232 if (strpos($imagestring, '||') !== false) { 229 233 $imagearray = explode('||', $imagestring); 230 $ParsedLyrics3['images'][$key]['filename'] = (isset($imagearray[0]) ? $imagearray[0] : '');234 $ParsedLyrics3['images'][$key]['filename'] = $imagearray[0]; 231 235 $ParsedLyrics3['images'][$key]['description'] = (isset($imagearray[1]) ? $imagearray[1] : ''); 232 236 $ParsedLyrics3['images'][$key]['timestamp'] = $this->Lyrics3Timestamp2Seconds(isset($imagearray[2]) ? $imagearray[2] : ''); … … 273 277 public function Lyrics3Timestamp2Seconds($rawtimestamp) { 274 278 if (preg_match('#^\\[([0-9]{2}):([0-9]{2})\\]$#', $rawtimestamp, $regs)) { 275 return (int) (( $regs[1] * 60) +$regs[2]);279 return (int) (((int) $regs[1] * 60) + (int) $regs[2]); 276 280 } 277 281 return false; … … 288 292 foreach ($lyricsarray as $key => $lyricline) { 289 293 $regs = array(); 290 unset($thislinetimestamps);294 $thislinetimestamps = array(); 291 295 while (preg_match('#^(\\[[0-9]{2}:[0-9]{2}\\])#', $lyricline, $regs)) { 292 296 $thislinetimestamps[] = $this->Lyrics3Timestamp2Seconds($regs[0]); … … 294 298 } 295 299 $notimestamplyricsarray[$key] = $lyricline; 296 if ( isset($thislinetimestamps) && is_array($thislinetimestamps)) {300 if (count($thislinetimestamps) > 0) { 297 301 sort($thislinetimestamps); 298 302 foreach ($thislinetimestamps as $timestampkey => $timestamp) { 299 if (isset($Lyrics3data[' synchedlyrics'][$timestamp])) {303 if (isset($Lyrics3data['comments']['synchedlyrics'][$timestamp])) { 300 304 // timestamps only have a 1-second resolution, it's possible that multiple lines 301 305 // could have the same timestamp, if so, append 302 $Lyrics3data[' synchedlyrics'][$timestamp] .= "\r\n".$lyricline;306 $Lyrics3data['comments']['synchedlyrics'][$timestamp] .= "\r\n".$lyricline; 303 307 } else { 304 $Lyrics3data[' synchedlyrics'][$timestamp] = $lyricline;305 } 306 } 307 } 308 } 309 $Lyrics3data[' unsynchedlyrics'] = implode("\r\n", $notimestamplyricsarray);310 if (isset($Lyrics3data[' synchedlyrics']) && is_array($Lyrics3data['synchedlyrics'])) {311 ksort($Lyrics3data[' synchedlyrics']);308 $Lyrics3data['comments']['synchedlyrics'][$timestamp] = $lyricline; 309 } 310 } 311 } 312 } 313 $Lyrics3data['comments']['unsynchedlyrics'][0] = implode("\r\n", $notimestamplyricsarray); 314 if (isset($Lyrics3data['comments']['synchedlyrics']) && is_array($Lyrics3data['comments']['synchedlyrics'])) { 315 ksort($Lyrics3data['comments']['synchedlyrics']); 312 316 } 313 317 return true;
Note: See TracChangeset
for help on using the changeset viewer.