public E <LocalStr> Previous(InvokerData invoker) { PlaylistItem pli = null; for (int i = 0; i < 10; i++) { if ((pli = PlaylistManager.Previous()) == null) { break; } var result = Play(invoker, pli); if (result.Ok) { return(result); } Log.Warn("Skipping: {0} because {1}", pli.DisplayString, result.Error.Str); } if (pli == null) { return(new LocalStr(strings.info_playmgr_no_previous_song)); } else { return(new LocalStr(string.Format(strings.error_playmgr_many_songs_failed, "!previous"))); } }
public R Previous(InvokerData invoker) { PlaylistItem pli = null; for (int i = 0; i < 10; i++) { if ((pli = PlaylistManager.Previous()) == null) { break; } if (Play(invoker, pli)) { return(R.OkR); } // optional message here that playlist entry has been skipped } if (pli == null) { return("No previous song could be played"); } else { return("A few songs failed to start, use !previous to continue"); } }
public E <LocalStr> Previous(InvokerData invoker, bool manually = true) { bool skipPrev = CurrentPlayData?.MetaData.From != PlaySource.FromPlaylist; PlaylistItem pli = null; for (int i = 0; i < 10; i++) { if (skipPrev) { pli = PlaylistManager.Current; skipPrev = false; } else { pli = PlaylistManager.Previous(manually); } if (pli is null) { break; } var result = Play(invoker, pli); if (result.Ok) { return(result); } Log.Warn("Skipping: {0} because {1}", pli.DisplayString, result.Error.Str); } if (pli is null) { return(new LocalStr(strings.info_playmgr_no_previous_song)); } else { return(new LocalStr(string.Format(strings.error_playmgr_many_songs_failed, "!previous"))); } }