mpd :: ServerStatus
mpd :: ServerStatus :: defaultinit
mpd :: ServerStatus :: elapsed=
Time elapsed within the current song.mpd :: ServerStatus :: time_ratio
Get the cursor position on the song duration.mpd :: ServerStatus :: time_total=
Total time of the current song.mpd $ ServerStatus :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
mpd :: ServerStatus :: defaultinit
core :: Object :: defaultinit
mpd :: ServerStatus :: elapsed=
Time elapsed within the current song.core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).mpd :: ServerStatus :: time_ratio
Get the cursor position on the song duration.mpd :: ServerStatus :: time_total=
Total time of the current song.
# MPD server status
class ServerStatus
# MPD server volume.
var volume: nullable Int
# Playback state (play/stop/pause).
var state: String
# Is MPD server playing?
fun playing: Bool do return state == "play"
# Is MPD server stopped?
fun stopped: Bool do return state == "stop"
# Time elapsed within the current song.
var elapsed: nullable Int
# TODO comment
var time_at: nullable Int
# Total time of the current song.
var time_total: nullable Int
# Get the cursor position on the song duration.
fun time_ratio: nullable Float do
if time_at == null or time_total == null then return null
return time_at.to_f / time_total.to_f
end
redef fun to_s do
var vol = "unknown"
if volume != null then vol = volume.to_s
var time_at = time_at
var time_total = time_total
var elapsed = elapsed
if time_at != null and time_total != null and elapsed != null then
return "volume: {vol}\nstate: {state}\nelapsed: {elapsed}\ntime_[at|total]: {time_at}:{time_total}\ntime_ratio: {time_ratio.as(not null)}"
else
return "volume: {vol}\nstate: {state}"
end
end
end
lib/mpd/mpd.nit:214,1--257,3