Module: VLC::Client::PlaylistControls

Included in:
VLC::Client
Defined in:
lib/vlc-client/client/playlist_controls.rb

Instance Method Summary collapse

Instance Method Details

#add_to_playlist(media) ⇒ Object

Adds media to the playlist

Parameters:

  • media (String, File, URI)

    the media to be played


19
20
21
# File 'lib/vlc-client/client/playlist_controls.rb', line 19

def add_to_playlist(media)
  connection.write("enqueue #{media(media)}")
end

#clearObject

Clears the playlist


46
47
48
# File 'lib/vlc-client/client/playlist_controls.rb', line 46

def clear
  connection.write("clear")
end

#nextObject

Plays the next element on the playlist


36
37
38
# File 'lib/vlc-client/client/playlist_controls.rb', line 36

def next
  connection.write("next")
end

#playlistObject

Lists tracks on the playlist


24
25
26
27
28
29
30
31
32
33
# File 'lib/vlc-client/client/playlist_controls.rb', line 24

def playlist
  connection.write("playlist")

  list = []
  begin
    list << connection.read
  end while list.last != PLAYLIST_TERMINATOR

  parse_playlist(list)
end

#previousObject

Plays the previous element on the playlist


41
42
43
# File 'lib/vlc-client/client/playlist_controls.rb', line 41

def previous
  connection.write("prev")
end