queue instructions - nthitz/mashupfm GitHub Wiki

no djs

currentDJ = null, default songs playing


step up
  if currentDJ
    set intent to stay up
  else if in queue
    bail
  push to queue

next song
  if currentDJ is null and queue is empty
    keep current DJ null, pick default song
  if currentDJ is null and queue is not empty
    currentDJ = queue.shift()
  if currentDJ
    if not intent to step down
      queue.push currentDJ
    if queue has items
      currentDj = queue.shift()
    else
      currentDJ = null and default song playing

step down
  if user is currentDJ
    set intent to stepdown
  else if user is in queue
    remove from queue