private Song GetRandomSong() { var artists = Subsonic.GetArtistIndexes(); var artistKey = artists.Values.OrderBy(r => randomLazy.Next()).FirstOrDefault(); var albumKey = Subsonic.GetAlbumIds(artistKey); var songs = GetSongIds(albumKey.OrderBy(rd => randomLazy.Next()).FirstOrDefault()); return(songs.OrderBy(r => randomLazy.Next()).FirstOrDefault(sng => sng != null)); }
public override void Execute(IPlayer player, params string[] parameters) { if (parameters.Length == 1) { ConsoleUtils.UOut(ConsoleColor.Red, "You didn't enter an artist/band name. use like this : (/listalbums rammstein) (/listalbums the cure)"); return; } string artistName = String.Join(" ", parameters.ToList().Skip(1)).ToLowerInvariant(); foreach (KeyValuePair <string, string> artist in Subsonic.GetArtistIndexes()) { if (artist.Key.ToLowerInvariant().Contains(artistName)) { foreach (var album in Subsonic.ListAlbums(artist.Value)) { ConsoleUtils.UOut(ConsoleColor.Yellow, "({0}) {1} - {2}", artist.Key, album.Key, album.Value); } } } }