Class: MPD::Controller::Status
- Inherits:
-
Object
- Object
- MPD::Controller::Status
- Defined in:
- lib/mpd/controller/status.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#bitrate ⇒ Object
readonly
Returns the value of attribute bitrate.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#crossfade ⇒ Object
readonly
Returns the value of attribute crossfade.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#mixer ⇒ Object
readonly
Returns the value of attribute mixer.
-
#playlist ⇒ Object
readonly
Returns the value of attribute playlist.
-
#song ⇒ Object
readonly
Returns the value of attribute song.
-
#volume ⇒ Object
readonly
Returns the value of attribute volume.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #consume? ⇒ Boolean
-
#initialize(controller) ⇒ Status
constructor
A new instance of Status.
- #random? ⇒ Boolean
- #repeat? ⇒ Boolean
- #single? ⇒ Boolean
- #to_sym ⇒ Object
Constructor Details
#initialize(controller) ⇒ Status
Returns a new instance of Status.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/mpd/controller/status.rb', line 20 def initialize (controller) @controller = controller @mixer = Mixer.new @playlist = Playlist.new controller.do_and_raise_if_needed(:status).each {|name, value| case name when :state then @status = value when :repeat then @repeat = value when :random then @random = value when :single then @single = value when :consume then @consume = value when :volume then @volume = value when :xfade then @crossfade = value when :mixrampdb then @mixer.decibels = value when :mixrampdelay then @mixer.delay = value when :bitrate then @bitrate = value when :error then @error = value when :playlist then @playlist.version = value when :playlistlength then @playlist.length = value when :song then (@playlist.current ||= Playlist::Song.new).position = value when :songid then (@playlist.current ||= Playlist::Song.new).id = value when :time then (@playlist.current ||= Playlist::Song.new).elapsed = value when :elapsed then (@playlist.current ||= Playlist::Song.new).elapsed = value when :nextsong then (@playlist.next ||= Playlist::Song.new).position = value when :nextsongid then (@playlist.next ||= Playlist::Song.new).id = value end } @song = Database::Song.from_data(controller.do_and_raise_if_needed(:currentsong)) end |
Instance Attribute Details
#bitrate ⇒ Object (readonly)
Returns the value of attribute bitrate.
18 19 20 |
# File 'lib/mpd/controller/status.rb', line 18 def bitrate @bitrate end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
18 19 20 |
# File 'lib/mpd/controller/status.rb', line 18 def controller @controller end |
#crossfade ⇒ Object (readonly)
Returns the value of attribute crossfade.
18 19 20 |
# File 'lib/mpd/controller/status.rb', line 18 def crossfade @crossfade end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
18 19 20 |
# File 'lib/mpd/controller/status.rb', line 18 def error @error end |
#mixer ⇒ Object (readonly)
Returns the value of attribute mixer.
18 19 20 |
# File 'lib/mpd/controller/status.rb', line 18 def mixer @mixer end |
#playlist ⇒ Object (readonly)
Returns the value of attribute playlist.
18 19 20 |
# File 'lib/mpd/controller/status.rb', line 18 def playlist @playlist end |
#song ⇒ Object (readonly)
Returns the value of attribute song.
18 19 20 |
# File 'lib/mpd/controller/status.rb', line 18 def song @song end |
#volume ⇒ Object (readonly)
Returns the value of attribute volume.
18 19 20 |
# File 'lib/mpd/controller/status.rb', line 18 def volume @volume end |
Instance Method Details
#==(other) ⇒ Object
60 61 62 |
# File 'lib/mpd/controller/status.rb', line 60 def == (other) super || to_sym.downcase == other.to_sym.downcase end |
#consume? ⇒ Boolean
58 |
# File 'lib/mpd/controller/status.rb', line 58 def consume?; @consume; end |
#random? ⇒ Boolean
56 |
# File 'lib/mpd/controller/status.rb', line 56 def random?; @random; end |
#repeat? ⇒ Boolean
55 |
# File 'lib/mpd/controller/status.rb', line 55 def repeat?; @repeat; end |
#single? ⇒ Boolean
57 |
# File 'lib/mpd/controller/status.rb', line 57 def single?; @single; end |
#to_sym ⇒ Object
64 65 66 |
# File 'lib/mpd/controller/status.rb', line 64 def to_sym @status end |