/// <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(); ConnectionClient.UploadDataAsync(new Uri("https://play.google.com/music/services/addplaylist"), form, PlaylistCreated); }
//{"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(); ConnectionClient.UploadDataAsync(new Uri("https://play.google.com/music/services/deleteplaylist"), form, PlaylistDeleted); }
/// <summary> /// Returns specified user/instant playlist /// </summary> public void GetPlaylist(String plID) { 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")) ConnectionClient.UploadDataAsync(new Uri("https://play.google.com/music/services/loadplaylist"), builder, PlaylistRecv); else ConnectionClient.UploadDataAsync(new Uri("https://play.google.com/music/services/loadplaylist"), builder, PlaylistRecvSingle); }
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(); ConnectionClient.UploadDataAsync(new Uri("https://www.google.com/accounts/ClientLogin"), form.ContentType, form.GetBytes(), GetAuthTokenComplete); }
/// <summary> /// Gets all the songs /// </summary> /// <param name="continuationToken"></param> public void GetAllSongs(String continuationToken = "") { List<Models.GoogleMusicSong> library = new List<Models.GoogleMusicSong>(); String jsonString = "{\"continuationToken\":\"" + continuationToken + "\"}"; Dictionary<String, String> fields = new Dictionary<String, String> { {"json", jsonString} }; FormBuilder form = new FormBuilder(); form.AddFields(fields); form.Close(); ConnectionClient.UploadDataAsync(new Uri("https://play.google.com/music/services/loadalltracks"), form, TrackListChunkRecv); }