Exemplo n.º 1
0
        public Track(RequiredInformation requiredInfo, JToken trackData)
        {
            RequiredInfo = requiredInfo;

            AlbumArtUrl   = trackData.Value <string>("albumArtUrl") ?? string.Empty;
            AlbumIdentity = trackData.Value <string>("albumIdentity") ?? string.Empty;
            AlbumName     = trackData.Value <string>("albumName") ?? string.Empty;
            AllowFeedback = trackData.Value <bool?>("allowFeedback") ?? false;
            ArtistName    = trackData.Value <string>("artistName") ?? string.Empty;

            var audioUrlMap = trackData["audioUrlMap"];

            if (audioUrlMap != null)
            {
                AudioUrlMap = TrackFactory.CreateAudioMap(audioUrlMap);
            }

            CategoryDescriptor = trackData.Value <string>("categoryDescriptor") ?? string.Empty;

            var dateCreated = trackData["dateCreated"];

            if (dateCreated != null)
            {
                DateCreated = Time.FromJavaTimeStamp(dateCreated.Value <double?>("time") ?? 0);
            }

            FeedbackId        = trackData.Value <string>("feedbackId") ?? string.Empty;
            IsFeatured        = trackData.Value <bool?>("isFeatured") ?? false;
            IsPositive        = trackData.Value <bool?>("isPositive") ?? false;
            MusicId           = trackData.Value <string>("musicId") ?? string.Empty;
            MusicToken        = trackData.Value <string>("musicToken") ?? string.Empty;
            PandoraId         = trackData.Value <string>("pandoraId") ?? string.Empty;
            PandoraType       = trackData.Value <string>("pandoraType") ?? string.Empty;
            ProgramDescriptor = trackData.Value <string>("programDescriptor") ?? string.Empty;
            SongIdentity      = trackData.Value <string>("songIdentity") ?? string.Empty;
            SongName          = trackData.Value <string>("songName") ?? string.Empty;
            SongRating        = trackData.Value <int?>("songRating") ?? 0;
            StationId         = trackData.Value <string>("stationId") ?? string.Empty;
            TrackGain         = double.Parse(trackData.Value <string>("trackGain") ?? "0", CultureInfo.InvariantCulture);
            TrackToken        = trackData.Value <string>("trackToken") ?? string.Empty;
            TrackType         = trackData.Value <string>("trackType") ?? string.Empty;
        }