Esempio n. 1
0
        internal Album CreateAthameAlbum(TidalServiceSettings settings)
        {
            var cmAlbum = new Album
            {
                Id             = Id.ToString(),
                Title          = Title,
                CoverPicture   = new TidalPicture(Cover),
                Type           = (AlbumType)TidalAlbumType,
                CustomMetadata = new[]
                {
                    MetadataHelpers.ExplicitMetadata(Explicit),
                    MetadataHelpers.MasterMetadata(AudioQuality)
                }
            };

            // On most calls the Album returned is a "lite" version, with only the properties above
            // available.
            if (Artist != null)
            {
                // Need only main artists
                cmAlbum.Artist = NameHelpers.CreateMainArtist(Artists, Artist);
            }
            if (TidalTracks != null)
            {
                cmAlbum.Tracks = (from track in TidalTracks select track.CreateAthameTrack(settings)).ToList();
            }
            return(cmAlbum);
        }
Esempio n. 2
0
        internal Track CreateAthameTrack(TidalServiceSettings settings)
        {
            // Always put main artists in the artist field
            var t = new Track
            {
                DiscNumber     = VolumeNumber,
                TrackNumber    = TrackNumber,
                Title          = NameHelpers.CreateTrackTitle(settings, this),
                Id             = Id.ToString(),
                IsDownloadable = AllowStreaming,
                // Only use first artist name and picture for now
                Artist         = NameHelpers.CreateMainArtist(Artists, Artist),
                CustomMetadata = new[]
                {
                    MetadataHelpers.ExplicitMetadata(Explicit),
                    MetadataHelpers.MasterMetadata(AudioQuality)
                }
            };



            // If the featured artists aren't already in the title, append them there
            if (!EnglishArtistNameJoiner.DoesTitleContainArtistString(this))
            {
                var nonMainArtists = (from artist in Artists
                                      where artist.Type != ArtistRole.Main
                                      select artist.Name).ToArray();
                if (nonMainArtists.Length > 0)
                {
                    t.Title += " " + EnglishArtistNameJoiner.JoinFeaturingArtists(nonMainArtists);
                }
            }
            t.Album = Album.CreateAthameAlbum(settings);
            return(t);
        }