public override string ToString() { StringBuilder builder = new StringBuilder(DiscordString.Bold("Current playlist\n").Underline().ToString()); for (int i = 0; i < Songs.Count; i++) { PlaylistSong song = Songs[i]; builder.Append($"{DiscordString.Bold($"{i + 1}:")} {song.Song.Title}"); if (i == Index - 1) { builder.Append($" - {DiscordString.Bold("Currently playing!")}"); } builder.Append("\n"); } return(builder.ToString()); }
public Song Next() { if (Index < 0 || Index >= Songs.Count) { return(null); } if (Index > 0) { PlaylistSong previous = Songs[Index - 1]; if (!previous.Keep) { Songs.Remove(previous); Index--; } } PlaylistSong target = Songs[Index]; // Increase the index Index++; return(target.Song); }
public void Add(PlaylistSong song) { Songs.Add(song); }
/// <summary> /// Create a json object from a PlaylistSong /// </summary> /// <param name="song"></param> /// <returns>The created json object</returns> public static JObject SongToJson(PlaylistSong song) { return(new JObject { { "title", song.Song.Title }, { "keep", song.Keep }, { "id", song.Song.Id } }); }