Beispiel #1
0
 public SoundCloudSongViewModel(SoundCloudSong model)
     : base(model)
 {
     this.hasThumbnail = this.WhenAnyValue(x => x.Thumbnail)
                         .Select(x => x != null)
                         .ToProperty(this, x => x.HasThumbnail);
 }
            public void PrioritizesDownloadStream()
            {
                var song = new SoundCloudSong
                {
                    IsStreamable = true,
                    StreamUrl = new Uri("http://streamable.com"),
                    IsDownloadable = true,
                    DownloadUrl = new Uri("http://downloadable.com")
                };

                Assert.Equal(song.PlaybackPath, song.DownloadUrl.ToString());
            }
Beispiel #3
0
            public void PrioritizesDownloadStream()
            {
                var song = new SoundCloudSong
                {
                    IsStreamable   = true,
                    StreamUrl      = new Uri("http://streamable.com"),
                    IsDownloadable = true,
                    DownloadUrl    = new Uri("http://downloadable.com")
                };

                Assert.Equal(song.PlaybackPath, song.DownloadUrl.ToString());
            }
Beispiel #4
0
        public MatchSong(SoundCloudSong soundCloudSong)
        {
            Id         = soundCloudSong.Id.ToString();
            Title      = soundCloudSong.Title;
            AudioUrl   = $"{soundCloudSong.StreamUrl}?client_id={ApiKeys.SoundCloudId}";
            Duration   = TimeSpan.FromMilliseconds(soundCloudSong.Duration);
            ByteSize   = soundCloudSong.OriginalContentSize;
            FileAuthor = soundCloudSong.User.Username;

            if (!string.IsNullOrEmpty(soundCloudSong.ArtworkUrl))
            {
                ArtworkImage = new Uri(soundCloudSong.ArtworkUrl);
            }
        }
Beispiel #5
0
        public WebSong(SoundCloudSong soundCloudSong)
        {
            Id         = soundCloudSong.id.ToString();
            Name       = soundCloudSong.title;
            AudioUrl   = soundCloudSong.stream_url;
            Provider   = Mp3Provider.SoundCloud;
            Duration   = TimeSpan.FromMilliseconds(soundCloudSong.duration);
            ByteSize   = soundCloudSong.original_content_size;
            FileAuthor = soundCloudSong.user.username;

            if (!string.IsNullOrEmpty(soundCloudSong.artwork_url))
            {
                ArtworkImage = new Uri(soundCloudSong.artwork_url);
            }
        }
Beispiel #6
0
        public WebSong(SoundCloudSong soundCloudSong)
        {
            Id       = soundCloudSong.Id.ToString();
            _Id      = soundCloudSong.Id;
            Name     = soundCloudSong.Title;
            AudioUrl = soundCloudSong.StreamUrl;
            Provider = Mp3Provider.SoundCloud;
            Duration = TimeSpan.FromMilliseconds(soundCloudSong.Duration);
            ByteSize = soundCloudSong.OriginalContentSize;
            Artist   = FileAuthor = soundCloudSong.User.Username;

            ProviderNumber = 8;
            if (!string.IsNullOrEmpty(soundCloudSong.ArtworkUrl))
            {
                ArtworkImage = new Uri(soundCloudSong.ArtworkUrl);
            }
        }
            public void PrioritizesDeserialization()
            {
                var song = new SoundCloudSong("http://soundcloud.com", "http://streamable.com");

                Assert.Equal("http://streamable.com", song.PlaybackPath);
            }
Beispiel #8
0
            public void PrioritizesDeserialization()
            {
                var song = new SoundCloudSong("http://soundcloud.com", "http://streamable.com");

                Assert.Equal("http://streamable.com", song.PlaybackPath);
            }
Beispiel #9
0
        public void TestSoundCloudFinder2()
        {
            var ApiKey = "2f6a35993001bc3c0ba251207025a75c";
            var Uri = "https://soundcloud.com/aurevoirsimone/fade-into-you-feat-nikolai-fraiture";
            var uriResolve = string.Format("https://api.soundcloud.com/resolve.json?url={0}&client_id={1}", Uri, ApiKey);
            var webclient = new WebClient();
            var results = webclient.DownloadString(new Uri(uriResolve));
            var soundcloudSongs = JObject.Parse(results); //JsonO.Parse(results);

            var reg = new Regex(@"([a-zA-Z0-9]+)_");
            var res = reg.Match(soundcloudSongs["waveform_url"].Value<String>());
            var path = String.Format("http://media.soundcloud.com/stream/{0}", res.Value);

                var song = new SoundCloudSong()
                {
                    Artist = soundcloudSongs["title"].Value<String>(),
                    Title = soundcloudSongs["title"].Value<String>(),
                    OriginalPath = path
                };
        }