//{"deleteId":"c790204e-1ee2-4160-9e25-7801d67d0a16"} public void DeletePlaylist(String id) { String jsonString = "{\"id\":\"" + id + "\"}"; Dictionary<String, String> fields = new Dictionary<String, String> { {"json", jsonString} }; FormBuilder form = new FormBuilder(); form.AddFields(fields); form.Close(); client.UploadDataAsync(new Uri("https://play.google.com/music/services/deleteplaylist"), form, PlaylistDeleted); }
/// <summary> /// Creates a playlist with given name /// </summary> /// <param name="playlistName">Name of playlist</param> public void AddPlaylist(String playlistName) { String jsonString = "{\"title\":\"" + playlistName + "\"}"; Dictionary<String, String> fields = new Dictionary<String, String> { {"json", jsonString} }; FormBuilder form = new FormBuilder(); form.AddFields(fields); form.Close(); client.UploadDataAsync(new Uri("https://play.google.com/music/services/addplaylist"), form, PlaylistCreated); }
/// <summary> /// Gets all the songs /// </summary> /// <param name="continuationToken"></param> public void GetAllSongs(String continuationToken = "") { List<GoogleMusicSong> library = new List<GoogleMusicSong>(); String jsonString = "{\"continuationToken\":\"" + continuationToken + "\"}"; Dictionary<String, String> fields = new Dictionary<String, String> { {"json", jsonString} }; FormBuilder form = new FormBuilder(); form.AddFields(fields); form.Close(); client.UploadDataAsync(new Uri("https://play.google.com/music/services/loadalltracks"), form, TrackListChunkRecv); }
public void Login(String email, String password) { Dictionary<String, String> fields = new Dictionary<String, String> { {"service", "sj"}, {"Email", email}, {"Passwd", password}, }; FormBuilder form = new FormBuilder(); form.AddFields(fields); form.Close(); client.UploadDataAsync(new Uri("https://www.google.com/accounts/ClientLogin"), form.ContentType, form.GetBytes(), GetAuthTokenComplete); }
/// <summary> /// Returns all user and instant playlists /// </summary> public void GetPlaylist(String plID = "all") { String jsonString = (plID.Equals("all")) ? "{}" : "{\"id\":\"" + plID + "\"}"; Dictionary<String, String> fields = new Dictionary<String, String>() { }; fields.Add("json", jsonString); FormBuilder builder = new FormBuilder(); builder.AddFields(fields); builder.Close(); if (plID.Equals("all")) client.UploadDataAsync(new Uri("https://play.google.com/music/services/loadplaylist"), builder, PlaylistRecv); else client.UploadDataAsync(new Uri("https://play.google.com/music/services/loadplaylist"), builder, PlaylistRecvSingle); }
public HttpWebRequest UploadDataAsync(Uri address, FormBuilder form, RequestCompletedEventHandler complete) { return UploadDataAsync(address, form.ContentType, form.GetBytes(), complete); }