public SCUser Convert(User user)
        {
            if (user == null)
            {
                return(null);
            }

            return(new SCUser
            {
                Id = user.Id,
                Permalink = user.Permalink,
                UserName = user.UserName,
                Uri = user.Uri,
                PermalinkUrl = user.PermalinkUrl,
                Avatar = SCScalableEntity <SCAvatarFormat> .Create(user.AvatarUrl),
                Country = user.Country,
                FullName = user.FullName,
                City = user.City,
                Description = user.Description,
                Discogs = user.Discogs,
                Myspace = user.Myspace,
                WebsiteUrl = user.Website,
                WebsiteTitle = user.WebsiteTitle,
                IsOnline = user.IsOnline,
                TrackCount = user.TrackCount,
                EmailConfirmed = user.EmailConfirmed,
                FavoriteCount = user.FavoriteCount,
                FollowerCount = user.FollowerCount,
                FollowingCount = user.FollowingCount,
                Plan = user.Plan,
                PlaylistCount = user.PlaylistCount,
                PrivatePlaylistCount = user.PrivatePlaylistCount,
                PrivateTrackCount = user.PrivateTrackCount
            });
        }
        public SCTrack Convert(Track track)
        {
            if (track == null)
            {
                return(null);
            }

            return(new SCTrack
            {
                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.GetValue <SCSharing>(),
                EmbeddableBy = track.EmbeddableBy.GetValue <SCEmbeddableBy>(),
                Artwork = SCScalableEntity <SCArtworkFormat> .Create(track.Artwork),
                Description = track.Description,
                Label = userConverter.Convert(track.Label),
                Duration = TimeSpan.FromMilliseconds(track.Duration),
                Genre = track.Genre,
                TagList = tagListConverter.Convert(track.TagList),
                LabelId = track.LabelId,
                LabelName = track.LabelName,
                ReleaseNumber = track.Release,
                ReleaseDate = dateTimeConverter.ConvertReleaseDate(track.ReleaseYear, track.ReleaseMonth, track.ReleaseDay),
                Streamable = track.Streamable,
                Downloadable = track.Downloadable,
                State = track.State.GetValue <SCState>(),
                License = track.License.GetValue <SCLicense>(),
                TrackType = track.TrackType.GetValue <SCTrackType>(),
                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
            });
        }
Пример #3
0
        public SCGroup Convert(Group @group)
        {
            if (@group == null)
            {
                return(null);
            }

            return(new SCGroup
            {
                Id = @group.Id,
                Artwork = SCScalableEntity <SCArtworkFormat> .Create(@group.ArtworkUrl),
                CreatedAt = dateTimeConverter.Convert(@group.CreatedAt),
                Uri = @group.Uri,
                Description = @group.Description,
                Permalink = @group.Permalink,
                PermalinkUrl = @group.PermalinkUrl,
                Creator = userConverter.Convert(@group.Creator),
                Name = @group.Name,
                ShortDescription = @group.Description
            });
        }
Пример #4
0
        public SCPlaylist Convert(Playlist playlist)
        {
            if (playlist == null)
            {
                return(null);
            }

            return(new SCPlaylist
            {
                Id = playlist.Id,
                CreatedAt = dateTimeConverter.Convert(playlist.CreatedAt),
                UserId = playlist.UserId,
                User = userConverter.Convert(playlist.User),
                Title = playlist.Title,
                Permalink = playlist.Permalink,
                PermalinkUrl = playlist.PermalinkUrl,
                Uri = playlist.Uri,
                Sharing = playlist.Sharing.GetValue <SCSharing>(),
                EmbeddableBy = playlist.EmbeddableBy.GetValue <SCEmbeddableBy>(),
                PurchaseUrl = playlist.PurchaseUrl,
                Artwork = SCScalableEntity <SCArtworkFormat> .Create(playlist.ArtworkUrl),
                Description = playlist.Description,
                Label = userConverter.Convert(playlist.Label),
                LabelId = playlist.LabelId,
                LabelName = playlist.LabelName,
                Duration = TimeSpan.FromMilliseconds(playlist.Duration),
                Genre = playlist.Genre,
                TagList = tagListConverter.Convert(playlist.TagList),
                Release = playlist.Release,
                ReleaseDate = dateTimeConverter.ConvertReleaseDate(playlist.ReleaseYear, playlist.ReleaseMonth, playlist.ReleaseDay),
                Streamabale = playlist.Streamabale,
                Downloadable = playlist.Downloadable,
                Ean = playlist.Ean,
                PlaylistType = playlist.PlaylistType.GetValue <SCPlaylistType>(),
                License = playlist.License.GetValue <SCLicense>(),
                Tracks = playlist.Tracks.Select(trackConverter.Convert).ToArray(),
                Type = playlist.Type.GetValue <SCTrackType>()
            });
        }