Method: Muzak::Player::MPV#list_queue

Defined in:
lib/muzak/player/mpv.rb

#list_queueArray<Song>

Note:

This includes songs already played.

Get mpv's internal queue.

Returns:

  • (Array<Song>)

    all songs in mpv's queue



139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/muzak/player/mpv.rb', line 139

def list_queue
  entries = @mpv.get_property "playlist/count"

  playlist = []

  entries.times do |i|
    # TODO: this is slow and should be avoided at all costs,
    # since we have access to these Song instances earlier
    # in the object's lifecycle.
    playlist << Song.new(@mpv.get_property("playlist/#{i}/filename"))
  end

  playlist
end