public async Task GetStreamUrl() { var account = CommonTests.GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); RadioFeed tracks; Assert.IsNotNull(tracks = await mc.GetStationFeed(ExplicitType.Explicit, new StationFeedStation { LibraryContentOnly = false, NumberOfEntries = 25, RecentlyPlayed = new Track[0], Seed = new StationSeed { SeedType = 6 } } )); var track = tracks.Data.Stations.First().Tracks.First(); Assert.IsNotNull(await mc.GetStreamUrlAsync(track)); }
public async Task LikeDislikeTrack() { var account = CommonTests.GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); RadioFeed tracks; Assert.IsNotNull(tracks = await mc.GetStationFeed(ExplicitType.Explicit, new StationFeedStation { LibraryContentOnly = false, NumberOfEntries = 25, RecentlyPlayed = new Track[0], Seed = new StationSeed { SeedType = 6 } } )); var track = tracks.Data.Stations.First().Tracks.First(); RecordRealTimeResponse data; Assert.IsNotNull(data = await mc.SetTrackRating(Rating.FiveStars, track)); Assert.IsTrue(data.EventResults.All(x => x.Code != ResponseCode.Invalid)); Assert.IsNotNull(data = await mc.SetTrackRating(Rating.OneStar, track)); Assert.IsTrue(data.EventResults.All(x => x.Code != ResponseCode.Invalid)); Assert.IsNotNull(data = await mc.SetTrackRating(Rating.NoRating, track)); Assert.IsTrue(data.EventResults.All(x => x.Code != ResponseCode.Invalid)); }
public async Task Login() { var account = GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); }
public async Task GetConfig() { var account = GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Assert.IsNotNull(await mc.GetConfigAsync()); }
public async Task GetAlbum() { var account = GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Assert.IsNotNull(await mc.GetAlbumAsync("Bdyocq5dfo3a72heswzl7nhni64")); // Lunch Money - EP, By: SoySauce }
public async Task ExploreTabs() { var account = GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Assert.IsNotNull(await mc.ExploreTabsAsync()); }
public async Task ListPlaylists() { var account = GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Assert.IsNotNull(await mc.ListPlaylistsAsync()); }
public async Task ListStationCategories() { var account = CommonTests.GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Assert.IsNotNull(await mc.ListStationCategoriesAsync()); }
public async Task ListPromotedTracksAsync() { var account = CommonTests.GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Assert.IsNotNull(await mc.ListPromotedTracksAsync()); }
public async Task GetTrack() { var account = GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Assert.IsNotNull(await mc.GetTrackAsync("Tkou6ps7lrj2wz3c2ejrgar337m")); // Essence, By: Skrux }
public async Task ListPlaylistItems() { var account = CommonTests.GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); ResultList <Playlist> playlist; Assert.IsNotNull(playlist = await mc.ListPlaylistsAsync()); Assert.IsNotNull(await mc.ListTracksFromPlaylist(playlist.Data.Items.First())); }
public async Task CreateDeletePlaylist() { var account = CommonTests.GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Playlist item; Assert.IsNotNull(item = await mc.CreatePlaylist(Guid.NewGuid().ToString(), "")); Assert.IsNotNull(await mc.DetelePlaylist(item)); }
public override async Task <AuthenticationResponse> LoginAsync(string username, string password) { await client.LoginAsync(username, password); return(new AuthenticationResponse { Token = client.Session.MasterToken, UserIdentity = username, UserName = client.Session.FirstName + " " + client.Session.LastName + " (" + username + ")" }); }
private async void InitializeGoogleMusicClient() { _mobileClient = new MobileClient(); _isLoggedIn = await _mobileClient.LoginAsync(LoginData.Login, LoginData.Password); if (_isLoggedIn) { await InitPlayLists(); _mainWindow.SearchOnGooglePlayBtn.IsEnabled = true; } }
public async Task ChangePlaylistShareState() { var account = CommonTests.GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Playlist item; Assert.IsNotNull(item = await mc.CreatePlaylist(Guid.NewGuid().ToString(), "", ShareState.Public)); Assert.IsTrue(await mc.IsPlaylistSharedAsync(item)); item.ShareState = ShareState.Private; Assert.IsNotNull(item = await mc.UpdatePlaylistAsync(item)); Debug.WriteLine(item); Assert.IsFalse(await mc.IsPlaylistSharedAsync(item)); Assert.IsNotNull(await mc.DetelePlaylist(item)); }
public async Task <bool> AuthenticateAsync(string username, string password, bool rememberUser) { if (!await client.LoginAsync(username, password)) { return(false); } Account = new AccountInfo { DisplayId = username, DisplayName = client.Session.FirstName + " " + client.Session.LastName }; // ReSharper disable once InvertIf if (rememberUser) { settings.SessionToken = client.Session.MasterToken; settings.Email = username; settings.DisplayName = Account.DisplayName; } return(true); }
public async Task AdRemoveSongsFromPlaylist() { var account = CommonTests.GetAccount(); var mc = new MobileClient(); Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2)); Playlist item; Assert.IsNotNull(item = await mc.CreatePlaylist(Guid.NewGuid().ToString(), "")); RadioFeed tracks; Assert.IsNotNull(tracks = await mc.GetStationFeed(ExplicitType.Explicit, new StationFeedStation { LibraryContentOnly = false, NumberOfEntries = 25, RecentlyPlayed = new Track[0], Seed = new StationSeed { SeedType = 6 } } )); var track = tracks.Data.Stations.First().Tracks.First(); Assert.IsNotNull(await mc.AddSongToPlaylist(item, track)); var result = await mc.ListTracksFromPlaylist(item); Assert.IsTrue(result.Any(x => x.StoreId == track.StoreId)); Assert.IsNotNull(await mc.RemoveSongsFromPlaylist(mc.GetTrackPlaylistEntry(item, track))); Assert.IsNotNull(await mc.DetelePlaylist(item)); }
private async Task MusicCommand(Channel channel, string query) { await channel.SendIsTyping(); await this.InitVoice(); if (this.readingMessages) { await channel.SendMessage("I'm busy reading shit."); return; } if (this.playingMusic) { await channel.SendMessage("No, I like this song."); return; } this.playingMusic = true; var mc = new MobileClient(); if (await mc.LoginAsync(this.config.GoogleUsername, this.config.GooglePassword)) { var result = await mc.SearchAsync(query); var entry = result.Entries.Where(x => x.Track != null).FirstOrDefault(); if (entry != null) { try { var track = entry.Track; var uri = await mc.GetStreamUrlAsync(track); var request = WebRequest.CreateHttp(uri); using (var rsp = request.GetResponse()) using (var web = rsp.GetResponseStream()) using (var mem = new MemoryStream()) { int count; await channel.SendMessage("Buffering song..."); var channels = this.discord.GetService <AudioService>().Config.Channels; var format = new WaveFormat(48000, 16, channels); var buffer = new byte[format.AverageBytesPerSecond / 50]; while (this.playingMusic && (count = web.Read(buffer, 0, buffer.Length)) > 0) { mem.Write(buffer, 0, count); } mem.Seek(0, SeekOrigin.Begin); await channel.SendMessage($"\r\n{track.Artist}\r\n*{track.Album}*\r\n**{track.Title}**"); using (var mp3 = new Mp3FileReader(mem)) using (var resampler = new MediaFoundationResampler(mp3, format)) { resampler.ResamplerQuality = 60; buffer = new byte[format.AverageBytesPerSecond / 50]; while (this.playingMusic && (count = resampler.Read(buffer, 0, buffer.Length)) > 0) { this.audio.Send(buffer, 0, count); } } } } catch (Exception) { await channel.SendMessage($"Guess THIS is the day that the music died."); } this.playingMusic = false; } else { this.playingMusic = false; await channel.SendMessage("Sorry, never heard of that song."); } } else { this.playingMusic = false; await channel.SendMessage("Uhm, maybe config me better? kthx"); } }