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
        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));
        }
 private static void AssertArtwork(bool withArtwork, SCTrack uploadedTrack)
 {
     if (withArtwork)
     {
         Assert.IsNotNull(uploadedTrack.Artwork);
     }
     else
     {
         Assert.IsNull(uploadedTrack.Artwork);
     }
 }
예제 #4
0
 public SCPlaylist()
 {
     Tracks = new SCTrack[0];
 }
예제 #5
0
 public SCPlaylist()
 {
     Tracks = new SCTrack[0];
 }