Class: Squeezer::Models::Playlist

Inherits:
Model
  • Object
show all
Defined in:
lib/squeezer/models/playlist.rb

Overview

initial playlist support

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

extract_records

Methods included from Connection

close_connection, exec, #exit, open_connection, retrieve_connection

Constructor Details

#initialize(id, options = {}) ⇒ Playlist

Returns a new instance of Playlist.



9
10
11
12
# File 'lib/squeezer/models/playlist.rb', line 9

def initialize(id, options={})
  super options
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/squeezer/models/playlist.rb', line 7

def id
  @id
end

Instance Method Details

#add(entity) ⇒ Object



14
15
16
17
# File 'lib/squeezer/models/playlist.rb', line 14

def add(entity)
  playlistcontrol(:cmd => :add, :entity => entity_name(entity), :id => entity.id)
  true
end

#clearObject



25
26
27
# File 'lib/squeezer/models/playlist.rb', line 25

def clear
  cmd "#{id} playlist clear"
end

#load(entity) ⇒ Object

starts playing directly



20
21
22
23
# File 'lib/squeezer/models/playlist.rb', line 20

def load(entity)
  playlistcontrol(:cmd => :load, :entity => entity_name(entity), :id => entity.id)
  true
end