1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 09:49:30 +02:00

Merge pull request #1412 from SenorSmartyPants/DuplicateArtists

Handle ID3v2.3 and v2.4 better regarding multivalued lists
This commit is contained in:
Afterster 2016-11-15 07:31:51 +01:00 committed by GitHub
commit d65d200384
2 changed files with 19 additions and 7 deletions

View file

@ -1908,8 +1908,18 @@ abstract class Catalog extends database_object
public static function trim_slashed_list($string) public static function trim_slashed_list($string)
{ {
if ($string) { if ($string) {
$items = explode('/', $string); $items = explode("\x00", $string);
$first = trim($items[0]); $first = trim($items[0]);
//if first is the same as string, nothing was exploded, try other delimiters
if ($first === $string) {
//try splitting with ; and then /
$items = explode(";", $string);
$first = trim($items[0]);
if ($first === $string) {
$items = explode("/", $string);
$first = trim($items[0]);
}
}
} }
if ($first == '') { if ($first == '') {
$first = null; $first = null;

View file

@ -885,25 +885,27 @@ class vainfo
if (!empty($id3v2['TXXX'])) { if (!empty($id3v2['TXXX'])) {
// Find the MBIDs for the album and artist // Find the MBIDs for the album and artist
// Use trimAscii to remove noise (see #225 and #438 issues). Is this a GetID3 bug? // Use trimAscii to remove noise (see #225 and #438 issues). Is this a GetID3 bug?
// not a bug those strings are UTF-16 encoded
// getID3 has copies of text properly converted to utf-8 encoding in comments/text
foreach ($id3v2['TXXX'] as $txxx) { foreach ($id3v2['TXXX'] as $txxx) {
switch (strtolower($this->trimAscii($txxx['description']))) { switch (strtolower($this->trimAscii($txxx['description']))) {
case 'musicbrainz album id': case 'musicbrainz album id':
$parsed['mb_albumid'] = $this->trimAscii($txxx['data']); $parsed['mb_albumid'] = $id3v2['comments']['text'][$txxx['description']];
break; break;
case 'musicbrainz release group id': case 'musicbrainz release group id':
$parsed['mb_albumid_group'] = $this->trimAscii($txxx['data']); $parsed['mb_albumid_group'] = $id3v2['comments']['text'][$txxx['description']];
break; break;
case 'musicbrainz artist id': case 'musicbrainz artist id':
$parsed['mb_artistid'] = $this->trimAscii($txxx['data']); $parsed['mb_artistid'] = $id3v2['comments']['text'][$txxx['description']];
break; break;
case 'musicbrainz album artist id': case 'musicbrainz album artist id':
$parsed['mb_albumartistid'] = $this->trimAscii($txxx['data']); $parsed['mb_albumartistid'] = $id3v2['comments']['text'][$txxx['description']];
break; break;
case 'musicbrainz album type': case 'musicbrainz album type':
$parsed['release_type'] = $this->trimAscii($txxx['data']); $parsed['release_type'] = $id3v2['comments']['text'][$txxx['description']];
break; break;
case 'catalognumber': case 'catalognumber':
$parsed['catalog_number'] = $this->trimAscii($txxx['data']); $parsed['catalog_number'] = $id3v2['comments']['text'][$txxx['description']];
break; break;
case 'replaygain_track_gain': case 'replaygain_track_gain':
$parsed['replaygain_track_gain'] = floatval($txxx['data']); $parsed['replaygain_track_gain'] = floatval($txxx['data']);