public Track Convert(SCTrack track)
        {
            if (track == null)
            {
                return(null);
            }

            return(new Track
            {
                Id = track.Id,
                CreatedAt = dateTimeConverter.Convert(track.CreatedAt),
                UserId = track.UserId,
                User = userConverter.Convert(track.User),
                Title = track.Title,
                Permalink = track.Permalink,
                PermalinkUrl = track.PermalinkUrl,
                Uri = track.Uri,
                Sharing = track.Sharing.GetParameterName(),
                EmbeddableBy = track.EmbeddableBy.GetParameterName(),
                Artwork = track.Artwork == null ? null : track.Artwork.Url(),
                Description = track.Description,
                Label = userConverter.Convert(track.Label),
                Duration = (int)track.Duration.TotalMilliseconds,
                Genre = track.Genre,
                TagList = tagListConverter.Convert(track.TagList),
                LabelId = track.LabelId,
                LabelName = track.LabelName,
                Release = track.ReleaseNumber,
                ReleaseYear = track.ReleaseDate.SafeGet <DateTimeOffset, int>(x => x.Year),
                ReleaseMonth = track.ReleaseDate.SafeGet <DateTimeOffset, int>(x => x.Month),
                ReleaseDay = track.ReleaseDate.SafeGet <DateTimeOffset, int>(x => x.Day),
                Streamable = track.Streamable,
                Downloadable = track.Downloadable,
                State = track.State.GetParameterName(),
                License = track.License.GetParameterName(),
                TrackType = track.TrackType.GetParameterName(),
                WaveformUrl = track.WaveformUrl,
                DownloadUrl = track.DownloadUrl,
                StreamUrl = track.StreamUrl,
                VideoUrl = track.VideoUrl,
                Bpm = track.Bpm,
                Commentable = track.Commentable,
                Isrc = track.Isrc,
                KeySignature = track.KeySignature,
                CommentsCount = track.CommentsCount,
                DownloadCount = track.DownloadCount,
                PlaybackCount = track.PlaybackCount,
                FavoritingsCount = track.FavoritingsCount,
                OriginalFormat = track.OriginalFormat,
                OriginalContentSize = track.OriginalContentSize,
                CreatedWith = applicationConverter.Convert(track.CreatedWith),
                UserFavorite = track.UserFavorite,
                AttachmentUri = track.AttachmentUri,
                DownloadsRemaining = track.DownloadsRemaining,
                PurchaseUrl = track.PurchaseUrl,
                SecretToken = track.SecretToken,
                SecretUri = track.SecretUri,
                UserPlaybackCount = track.UserPlaybackCount
            });
        }
Пример #2
0
 private static void AssertArtwork(bool withArtwork, SCTrack uploadedTrack)
 {
     if (withArtwork)
     {
         Assert.IsNotNull(uploadedTrack.Artwork);
     }
     else
     {
         Assert.IsNull(uploadedTrack.Artwork);
     }
 }
Пример #3
0
    private void PlayTrackDataCallback(SCTrack track)
    {
        currentTrack = track;

        Text artist    = GameObject.Find("TrackInfo/Artist/Text").GetComponent <Text>();
        Text trackname = GameObject.Find("TrackInfo/Track/Text").GetComponent <Text>();

        artist.text    = track.user.username;
        trackname.text = track.title;

        SCManager.GetImage(track.artwork_url, GetAlbumArtCallback);
        SCManager.GetImage(track.waveform_url, GetWaveFormCallback);
    }
Пример #4
0
        public void UpdateTrack(SCTrack track)
        {
            if (track.Id != trackId)
            {
                throw new SoundCloudApiException(string.Format("Context set for trackId = {0}. Create new context for update another track.", trackId));
            }

            var currentTrack = GetInternalTrack();

            var diff = currentTrack.GetDiff(trackConverter.Convert(track));

            soundCloudRawClient.Request(prefix, string.Empty, HttpMethod.Put, diff.ToDictionary(x => string.Format("track[{0}]", x.Key), x => x.Value));
        }
Пример #5
0
 private void GetTrackCallback(SCTrack track)
 {
     console.text = track.ToString();
 }
Пример #6
0
    private void PlayTrackDataCallback(SCTrack track)
    {
        currentTrack = track;

        Text artist = GameObject.Find("TrackInfo/Artist/Text").GetComponent<Text>();
        Text trackname = GameObject.Find("TrackInfo/Track/Text").GetComponent<Text>();

        artist.text = track.user.username;
        trackname.text = track.title;

        SCManager.GetImage(track.artwork_url, GetAlbumArtCallback);
        SCManager.GetImage(track.waveform_url, GetWaveFormCallback);
    }
Пример #7
0
 private void GetTrackCallback(SCTrack track)
 {
     console.text = track.ToString();
 }