示例#1
0
 private Artist CreateArtist(ArtistModel[] artists, ArtistModel defaultArtist)
 {
     return(new Artist
     {
         Id = defaultArtist.Id.ToString(),
         Name = EnglishArtistNameJoiner.JoinArtistNames((from artist in artists
                                                         where artist.Type == EnglishArtistNameJoiner.ArtistMain
                                                         select artist.Name).ToArray())
     });
 }
示例#2
0
        private Track CreateTrack(TrackModel tidalTrack)
        {
            const string albumVersion = "Album Version";
            // Always put main artists in the artist field
            var t = new Track
            {
                DiscNumber     = tidalTrack.VolumeNumber,
                TrackNumber    = tidalTrack.TrackNumber,
                Title          = tidalTrack.Title,
                Id             = tidalTrack.Id.ToString(),
                IsDownloadable = tidalTrack.AllowStreaming
            };

            // Only use first artist name and picture for now
            t.Artist = CreateArtist(tidalTrack.Artists, tidalTrack.Artist);
            if (!String.IsNullOrEmpty(tidalTrack.Version))
            {
                if (settings.AppendVersionToTrackTitle)
                {
                    if (settings.DontAppendAlbumVersion)
                    {
                        if (!tidalTrack.Version.Contains(albumVersion))
                        {
                            t.Title += " (" + tidalTrack.Version + ")";
                        }
                    }
                    else
                    {
                        t.Title += " (" + tidalTrack.Version + ")";
                    }
                }
            }
            // If the featured artists aren't already in the title, append them there
            if (!EnglishArtistNameJoiner.DoesTitleContainArtistString(tidalTrack))
            {
                var nonMainArtists = (from artist in tidalTrack.Artists
                                      where artist.Type != EnglishArtistNameJoiner.ArtistMain
                                      select artist.Name).ToArray();
                if (nonMainArtists.Length > 0)
                {
                    t.Title += " " + EnglishArtistNameJoiner.JoinFeaturingArtists(nonMainArtists);
                }
            }
            t.Album = CreateAlbum(tidalTrack.Album);
            return(t);
        }