Repository: xbmc/xbmc
File: xbmc/music/Song.cpp (C++)

Code before:
  iEndOffset = static_cast<int>(item.GetEndOffset());
  idSong = -1;
  iTimesPlayed = 0;
  idAlbum = -1;
  iBPM = tag.GetBPM();
  iSampleRate = tag.GetSampleRate();
  iBitRate = tag.GetBitRate();
  iChannels = tag.GetNoOfChannels();
  songVideoURL = tag.GetSongVideoURL();
}

CSong::CSong()
{
  Clear();
}

void CSong::SetArtistCredits(const std::vector<std::string>& names, const std::vector<std::string>& hints,
  const std::vector<std::string>& mbids)
{
  artistCredits.clear();
  std::vector<std::string> artistHints = hints;
  //Split the artist sort string to try and get sort names for individual artists
  std::vector<std::string> artistSort = StringUtils::Split(strArtistSort, CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_musicItemSeparator);

    // Vector of possible separators in the order least likely to be part of artist name
  const std::vector<std::string> separators{" feat. ", " ft. ", " Feat. ", " Ft. ",  ";", ":",
                                            "|",       "#",     "/",       " with ", "&"};

  if (!mbids.empty())
  { // Have musicbrainz artist info, so use it

    // Establish tag consistency - do the number of musicbrainz ids and number of names in hints or artist match
    if (mbids.size() != artistHints.size() && mbids.size() != names.size())
    {
      // Tags mismatch - report it and then try to fix
      CLog::Log(LOGDEBUG, "Mismatch in song file tags: {} mbid {} names {} {}", (int)mbids.size(),
                (int)names.size(), strTitle, strArtistDesc);
      /*
        Most likely we have no hints and a single artist name like "Artist1 feat. Artist2"
        or "Composer; Conductor, Orchestra, Soloist" or "Artist1/Artist2" where the
        expected single item separator (default = space-slash-space) as not been used.
        Ampersand (&), comma and slash (no spaces) are poor delimiters as could be in name
        e.g. "AC/DC", "Earth, Wind & Fire", but here treat them as such in attempt to find artist names.
        When there are hints but count not match mbid they could be poorly formatted using unexpected
        separators so attempt to split them. Or we could have more hints or artist names than
        musicbrainz id so ignore them but raise warning.
      */
      // Do hints exist yet mismatch
      if (artistHints.size() > 0 &&
        artistHints.size() != mbids.size())
      {

Review comment (suggestion):
Make it static maybe?
```suggestion
  static const std::vector<std::string> separators{" feat. ", " ft. ", " Feat. ", " Ft. ",  ";", ":",
```

Code after:
  iEndOffset = static_cast<int>(item.GetEndOffset());
  idSong = -1;
  iTimesPlayed = 0;
  idAlbum = -1;
  iBPM = tag.GetBPM();
  iSampleRate = tag.GetSampleRate();
  iBitRate = tag.GetBitRate();
  iChannels = tag.GetNoOfChannels();
  songVideoURL = tag.GetSongVideoURL();
}

CSong::CSong()
{
  Clear();
}

void CSong::SetArtistCredits(const std::vector<std::string>& names, const std::vector<std::string>& hints,
  const std::vector<std::string>& mbids)
{
  artistCredits.clear();
  std::vector<std::string> artistHints = hints;
  //Split the artist sort string to try and get sort names for individual artists
  std::vector<std::string> artistSort = StringUtils::Split(
      strArtistSort,
      CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_musicItemSeparator);

  // Vector of possible separators in the order least likely to be part of artist name
  static const std::vector<std::string> separators{
      " feat. ", " ft. ", " Feat. ", " Ft. ", ";", ":", "|", "#", "/", " with ", "&"};

  if (!mbids.empty())
  { // Have musicbrainz artist info, so use it

    // Establish tag consistency - do the number of musicbrainz ids and number of names in hints or artist match
    if (mbids.size() != artistHints.size() && mbids.size() != names.size())
    {
      // Tags mismatch - report it and then try to fix
      CLog::Log(LOGDEBUG, "Mismatch in song file tags: {} mbid {} names {} {}", (int)mbids.size(),
                (int)names.size(), strTitle, strArtistDesc);
      /*
        Most likely we have no hints and a single artist name like "Artist1 feat. Artist2"
        or "Composer; Conductor, Orchestra, Soloist" or "Artist1/Artist2" where the
        expected single item separator (default = space-slash-space) as not been used.
        Ampersand (&), comma and slash (no spaces) are poor delimiters as could be in name
        e.g. "AC/DC", "Earth, Wind & Fire", but here treat them as such in attempt to find artist names.
        When there are hints but count not match mbid they could be poorly formatted using unexpected
        separators so attempt to split them. Or we could have more hints or artist names than
        musicbrainz id so ignore them but raise warning.
      */
      // Do hints exist yet mismatch
      if (artistHints.size() > 0 &&