mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 01:39:28 +02:00
Merge pull request #1409 from SenorSmartyPants/MultipleArtists
Only create entry for first artist in Artists MB data. Doesn't create…
This commit is contained in:
commit
297572d692
3 changed files with 22 additions and 11 deletions
|
@ -671,9 +671,8 @@ class Artist extends database_object implements library_item
|
|||
$trimmed = Catalog::trim_featuring($name);
|
||||
$name = $trimmed[0];
|
||||
|
||||
if ($mbid == '') {
|
||||
$mbid = null;
|
||||
}
|
||||
// If Ampache support multiple artists per song one day, we should also handle other artists here
|
||||
$mbid = Catalog::trim_slashed_list($mbid);
|
||||
|
||||
if (!$name) {
|
||||
$name = T_('Unknown (Orphaned)');
|
||||
|
|
|
@ -1899,6 +1899,24 @@ abstract class Catalog extends database_object
|
|||
return $year;
|
||||
}
|
||||
|
||||
/**
|
||||
* trim_slashed_list
|
||||
* Return only the first item from / separated list
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function trim_slashed_list($string)
|
||||
{
|
||||
if ($string) {
|
||||
$items = explode('/', $string);
|
||||
$first = trim($items[0]);
|
||||
}
|
||||
if ($first == '') {
|
||||
$first = null;
|
||||
}
|
||||
return $first;
|
||||
} // trim_slashed_list
|
||||
|
||||
/**
|
||||
* trim_featuring
|
||||
* Splits artists featuring from the string
|
||||
|
|
|
@ -384,10 +384,7 @@ class Song extends database_object implements media, library_item
|
|||
if (!isset($results['albumartist_id'])) {
|
||||
if ($albumartist) {
|
||||
// Multiple artist per songs not supported for now
|
||||
if ($albumartist_mbid) {
|
||||
$mbids = explode('/', $albumartist_mbid);
|
||||
$albumartist_mbid = trim($mbids[0]);
|
||||
}
|
||||
$albumartist_mbid = Catalog::trim_slashed_list($albumartist_mbid);
|
||||
$albumartist_id = Artist::check($albumartist, $albumartist_mbid);
|
||||
}
|
||||
} else {
|
||||
|
@ -396,10 +393,7 @@ class Song extends database_object implements media, library_item
|
|||
$artist_id = null;
|
||||
if (!isset($results['artist_id'])) {
|
||||
// Multiple artist per songs not supported for now
|
||||
if ($artist_mbid) {
|
||||
$mbids = explode('/', $artist_mbid);
|
||||
$artist_mbid = trim($mbids[0]);
|
||||
}
|
||||
$artist_mbid = Catalog::trim_slashed_list($artist_mbid);
|
||||
$artist_id = Artist::check($artist, $artist_mbid);
|
||||
} else {
|
||||
$artist_id = intval($results['artist_id']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue