From 8af2544b279b62cac287784840d26ff72568e9c5 Mon Sep 17 00:00:00 2001 From: Paul Arthur Date: Thu, 12 Apr 2012 21:56:27 -0400 Subject: Refactor getting MBIDs from ID3 tags Just grab the info from the TXXX bit, instead of relying on a correlation between the raw tags and the cooked ones. --- lib/class/vainfo.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php index 1aeaddcb..53ad2578 100644 --- a/lib/class/vainfo.class.php +++ b/lib/class/vainfo.class.php @@ -701,12 +701,14 @@ class vainfo { } // Find the MBIDs for the album and artist - for ($i = 0, $size = sizeof($id3v2['comments']['text']) ; $i < $size ; $i++) { - if ($id3v2['TXXX'][$i]['description'] == 'MusicBrainz Album Id') { - $array['mb_albumid'] = $this->_clean_tag($id3v2['comments']['text'][$i]); - } - elseif ($id3v2['TXXX'][$i]['description'] == 'MusicBrainz Artist Id') { - $array['mb_artistid'] = $this->_clean_tag($id3v2['comments']['text'][$i]); + foreach ($id3v2['TXXX'] as $txxx) { + switch ($txxx['description']) { + case 'MusicBrainz Album Id': + $array['mb_albumid'] = $this->_clean_tag($txxx['data']); + break; + case 'MusicBrainz Artist Id': + $array['mb_artistid'] = $this->_clean_tag($txxx['data']); + break; } } } -- cgit