public async Task <IEnumerable <Track> > GetTracksAsync(string token) { var cloud = new Ewk.SoundCloud.ApiLibrary.SoundCloud(ClientId, token); var test = cloud.Me.Get(); return(await cloud.Me.Tracks.GetAsync()); }
public void DeleteTrack(string title, string token = null) { if (token == null) token = GetAccessToken(); var cloud = new Ewk.SoundCloud.ApiLibrary.SoundCloud(ClientId, token); var tracks = cloud.Me.Tracks.Get(); tracks.Where(t => t.title == title).ToList().ForEach(t => t.Delete()); }
public void DeleteTrack(string title, string token = null) { if (token == null) { token = GetAccessToken(); } var cloud = new Ewk.SoundCloud.ApiLibrary.SoundCloud(ClientId, token); var tracks = cloud.Me.Tracks.Get(); tracks.Where(t => t.title == title).ToList().ForEach(t => t.Delete()); }
public List <Track> GetTracks(string token = null, string title = null) { if (token == null) { token = GetAccessToken(); } var cloud = new Ewk.SoundCloud.ApiLibrary.SoundCloud(ClientId, token); if (title != null) { return(cloud.Me.Tracks.Get().Where(t => t.title == title).ToList()); } return(cloud.Me.Tracks.Get().ToList()); }
public IEnumerable <AudioTrack> GetItems(string setName, OAuthAccessToken accessToken) { var soundCloud = new Api.SoundCloud(_apiKey, accessToken.Token); if (string.IsNullOrEmpty(setName)) { return(soundCloud.Me.Tracks.Get() .Select(Map)); } return(soundCloud.Me.Playlists.Get() .Single(p => p.title == setName) .tracks .Select(Map)); }
public IEnumerable<AudioTrack> GetItems(string setName, OAuthAccessToken accessToken) { var soundCloud = new Api.SoundCloud(_apiKey, accessToken.Token); if (string.IsNullOrEmpty(setName)) { return soundCloud.Me.Tracks.Get() .Select(Map); } return soundCloud.Me.Playlists.Get() .Single(p => p.title == setName) .tracks .Select(Map); }
public OAuthAccessToken GetOAuthAccessToken(Uri currentUri) { var apiSecret = ConfigurationManager.AppSettings["AudioApiSecret"] ?? "141710b5a9167c693c3e67ad60377fc1"; var soundCloud = new Api.SoundCloud(_apiKey); var token = soundCloud.RequestOAuthToken(currentUri, apiSecret); var me = soundCloud.Me.Get(); return new OAuthAccessToken { Token = token.access_token, FullName = me.full_name, UserId = me.id.ToString(CultureInfo.InvariantCulture), Username = me.username, }; }
public OAuthAccessToken GetOAuthAccessToken(Uri currentUri) { var apiSecret = ConfigurationManager.AppSettings["AudioApiSecret"] ?? "141710b5a9167c693c3e67ad60377fc1"; var soundCloud = new Api.SoundCloud(_apiKey); var token = soundCloud.RequestOAuthToken(currentUri, apiSecret); var me = soundCloud.Me.Get(); return(new OAuthAccessToken { Token = token.access_token, FullName = me.full_name, UserId = me.id.ToString(CultureInfo.InvariantCulture), Username = me.username, }); }
public string UploadItem(Stream data, string setName, string title, OAuthAccessToken accessToken) { var soundCloud = new Api.SoundCloud(_apiKey, accessToken.Token); byte[] buffer; using (var ms = new MemoryStream()) { data.CopyTo(ms); buffer = ms.ToArray(); } var track = new Track { asset_data = buffer, title = title }; return(soundCloud.Tracks.Post(track).stream_url); }
public int UploadAudioFiles(string path) { using (HttpClient client = new HttpClient()) { SCTrackRequest track = new SCTrackRequest() { title = "test xyz 3", asset_data = @"Z:\Developments\NCLUni\Speeching\Crowd.Service\Uploads\sc2ev1.mp3" }; Ewk.SoundCloud.ApiLibrary.SoundCloud d = new Ewk.SoundCloud.ApiLibrary.SoundCloud(SOUNDCLOUD_CLIENT_ID); var e = d.RequestOAuthToken(new Uri("http://api.opescode.com/api/PutExternalAccessKey"), SOUNDCLOUD_CLIENT_SECRET); //Uri baseAddress = new Uri(SOUNDCLOUD_BASE_URI + "tracks.json?client_id=" + SOUNDCLOUD_CLIENT_ID); //var response = client.GetAsync(baseAddress).Result; //var x = response.Content.ReadAsAsync<IEnumerable<SCTrackScheme>>().Result; //var content = track.CreateRequestCUrlData(); //var response2 = client.PostAsync(baseAddress, content); //var tracks = d.Tracks; //var tracks2 = d.Tracks.Get(); ////var res = d.RequestOAuthToken(new Uri("http://www.speeching.co.uk"), SOUNDCLOUD_CLIENT_SECRET); //Track track = new Track(); //track.title = "new test track 1"; //track.asset_data = File.ReadAllBytes(@"Z:\Developments\NCLUni\Speeching\Crowd.Service\Uploads\sc2ev1.mp3"); //var response = d.Tracks.Post(track); //string x = ""; //var reqContent = track.CreateRequestCUrlData(); //Uri baseAddress = new Uri(CROWDFLOWER_BASE_URI + "jobs.json?key=" + CROWDFLOWER_KEY); //var response = client.PostAsync(baseAddress, reqContent).Result; //if (response.IsSuccessStatusCode) //{ // var x = response.Content.ReadAsAsync<CFJobResponse>().Result; //} //else //{ // string msg = response.Content.ReadAsStringAsync().Result; // throw new Exception(msg); //} } return 0; }
public Uri GetOAuthCalculatedAuthorizationUri(Uri callbackUri) { var soundCloud = new Api.SoundCloud(_apiKey); return soundCloud.GetAuthorizeUri(callbackUri); }
public AudioTrack GetItem(int id, OAuthAccessToken accessToken) { var soundCloud = new Api.SoundCloud(_apiKey, accessToken.Token); return Map(soundCloud.Tracks[id].Get()); }
public string UploadItem(Stream data, string setName, string title, OAuthAccessToken accessToken) { var soundCloud = new Api.SoundCloud(_apiKey, accessToken.Token); byte[] buffer; using (var ms = new MemoryStream()) { data.CopyTo(ms); buffer = ms.ToArray(); } var track = new Track { asset_data = buffer, title = title }; return soundCloud.Tracks.Post(track).stream_url; }
public AudioTrack GetItem(int id, OAuthAccessToken accessToken) { var soundCloud = new Api.SoundCloud(_apiKey, accessToken.Token); return(Map(soundCloud.Tracks[id].Get())); }
public IEnumerable <Track> GetTracks(string token) { var cloud = new Ewk.SoundCloud.ApiLibrary.SoundCloud(ClientId, token); return(cloud.Me.Tracks.Get()); }
public Uri GetOAuthCalculatedAuthorizationUri(Uri callbackUri) { var soundCloud = new Api.SoundCloud(_apiKey); return(soundCloud.GetAuthorizeUri(callbackUri)); }
public IEnumerable<Track> GetTracks(string token) { var cloud = new Ewk.SoundCloud.ApiLibrary.SoundCloud(ClientId, token); return cloud.Me.Tracks.Get(); }
public List<Track> GetTracks(string token = null, string title = null) { if (token == null) token = GetAccessToken(); var cloud = new Ewk.SoundCloud.ApiLibrary.SoundCloud(ClientId, token); if (title != null) return cloud.Me.Tracks.Get().Where(t => t.title == title).ToList(); return cloud.Me.Tracks.Get().ToList(); }