MPD server status

Introduced properties

init defaultinit(volume: nullable Int, state: String, elapsed: nullable Int, time_at: nullable Int, time_total: nullable Int)

mpd :: ServerStatus :: defaultinit

fun elapsed: nullable Int

mpd :: ServerStatus :: elapsed

Time elapsed within the current song.
protected fun elapsed=(elapsed: nullable Int)

mpd :: ServerStatus :: elapsed=

Time elapsed within the current song.
fun playing: Bool

mpd :: ServerStatus :: playing

Is MPD server playing?
fun state: String

mpd :: ServerStatus :: state

Playback state (play/stop/pause).
protected fun state=(state: String)

mpd :: ServerStatus :: state=

Playback state (play/stop/pause).
fun stopped: Bool

mpd :: ServerStatus :: stopped

Is MPD server stopped?
fun time_at: nullable Int

mpd :: ServerStatus :: time_at

TODO comment
protected fun time_at=(time_at: nullable Int)

mpd :: ServerStatus :: time_at=

TODO comment
fun time_ratio: nullable Float

mpd :: ServerStatus :: time_ratio

Get the cursor position on the song duration.
fun time_total: nullable Int

mpd :: ServerStatus :: time_total

Total time of the current song.
protected fun time_total=(time_total: nullable Int)

mpd :: ServerStatus :: time_total=

Total time of the current song.
fun volume: nullable Int

mpd :: ServerStatus :: volume

MPD server volume.
protected fun volume=(volume: nullable Int)

mpd :: ServerStatus :: volume=

MPD server volume.

Redefined properties

redef type SELF: ServerStatus

mpd $ ServerStatus :: SELF

Type of this instance, automatically specialized in every class
redef fun to_s: String

mpd $ ServerStatus :: to_s

User readable representation of self.

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
init defaultinit(volume: nullable Int, state: String, elapsed: nullable Int, time_at: nullable Int, time_total: nullable Int)

mpd :: ServerStatus :: defaultinit

fun elapsed: nullable Int

mpd :: ServerStatus :: elapsed

Time elapsed within the current song.
protected fun elapsed=(elapsed: nullable Int)

mpd :: ServerStatus :: elapsed=

Time elapsed within the current song.
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun playing: Bool

mpd :: ServerStatus :: playing

Is MPD server playing?
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun state: String

mpd :: ServerStatus :: state

Playback state (play/stop/pause).
protected fun state=(state: String)

mpd :: ServerStatus :: state=

Playback state (play/stop/pause).
fun stopped: Bool

mpd :: ServerStatus :: stopped

Is MPD server stopped?
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun time_at: nullable Int

mpd :: ServerStatus :: time_at

TODO comment
protected fun time_at=(time_at: nullable Int)

mpd :: ServerStatus :: time_at=

TODO comment
fun time_ratio: nullable Float

mpd :: ServerStatus :: time_ratio

Get the cursor position on the song duration.
fun time_total: nullable Int

mpd :: ServerStatus :: time_total

Total time of the current song.
protected fun time_total=(time_total: nullable Int)

mpd :: ServerStatus :: time_total=

Total time of the current song.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun volume: nullable Int

mpd :: ServerStatus :: volume

MPD server volume.
protected fun volume=(volume: nullable Int)

mpd :: ServerStatus :: volume=

MPD server volume.
package_diagram mpd::ServerStatus ServerStatus core::Object Object mpd::ServerStatus->core::Object

Parents

interface Object

core :: Object

The root of the class hierarchy.

Class definitions

mpd $ ServerStatus
# 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