Class: Moc::Controller::Status::Song

Inherits:
Object
  • Object
show all
Defined in:
lib/moc/controller/status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ Song

Returns a new instance of Song.



118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/moc/controller/status.rb', line 118

def initialize (controller)
  @controller = controller
  @internal   = Live::Song.new(controller)

  @channels        = @internal.channels
  @rate            = @internal.rate
  @bitrate         = @internal.bitrate
  @average_bitrate = @internal.average_bitrate
  @position        = @internal.position
  @file            = @internal.file
  @tags            = @internal.tags
end

Instance Attribute Details

#average_bitrateObject (readonly)

Returns the value of attribute average_bitrate.



116
117
118
# File 'lib/moc/controller/status.rb', line 116

def average_bitrate
  @average_bitrate
end

#bitrateObject (readonly)

Returns the value of attribute bitrate.



116
117
118
# File 'lib/moc/controller/status.rb', line 116

def bitrate
  @bitrate
end

#channelsObject (readonly)

Returns the value of attribute channels.



116
117
118
# File 'lib/moc/controller/status.rb', line 116

def channels
  @channels
end

#controllerObject (readonly)

Returns the value of attribute controller.



116
117
118
# File 'lib/moc/controller/status.rb', line 116

def controller
  @controller
end

#fileObject (readonly)

Returns the value of attribute file.



116
117
118
# File 'lib/moc/controller/status.rb', line 116

def file
  @file
end

#positionObject (readonly)

Returns the value of attribute position.



116
117
118
# File 'lib/moc/controller/status.rb', line 116

def position
  @position
end

#rateObject (readonly)

Returns the value of attribute rate.



116
117
118
# File 'lib/moc/controller/status.rb', line 116

def rate
  @rate
end

#tagsObject (readonly)

Returns the value of attribute tags.



116
117
118
# File 'lib/moc/controller/status.rb', line 116

def tags
  @tags
end

Instance Method Details

#durationObject



139
140
141
# File 'lib/moc/controller/status.rb', line 139

def duration
  tags.time if tags
end

#inspectObject



143
144
145
# File 'lib/moc/controller/status.rb', line 143

def inspect
  "#<#{self.class.name}: track=#{track} title=#{title.inspect} artist=#{artist.inspect} album=#{album.inspect} channels=#{channels} bitrate=#{bitrate}(#{average_bitrate}) position=#{position}/#{duration || ??}>"
end