ch1ller0 / fridgefm-radio-core

Simple lightweight package for creating your own radio station via NodeJS heavily inspired by Shoutcast and Icecast.
https://fridgefm.com
MIT License
44 stars 8 forks source link

Suggestion: loop playlist with shuffle #331

Open feyli opened 1 year ago

feyli commented 1 year ago

It would just be great to have a way to do this: The radio starts, immediately shuffles the playlist, and plays it. When the playlist ends, the radio shuffles it again and plays it over. It would do this over and over, every time looping another shuffle of the same playlist.

ch1ller0 commented 1 year ago

Hey! Thanks for the suggestion. Does this code cover your case?

const { SHUFFLE_METHODS } = require('@fridgefm/radio-core')

station.on(PUBLIC_EVENTS.START, () => {
  station.reorderPlaylist(SHUFFLE_METHODS.randomShuffle());
});

station.on(PUBLIC_EVENTS.RESTART, () => {
  station.reorderPlaylist(SHUFFLE_METHODS.randomShuffle());
});