Module media_player
Create proxy objects that implement the
org.mpris.MediaPlayer2
DBus interface.
The proxy object exposes all the methods an properties of the interface in addition to the methods documented here. Note that some applications may not implement the full MPRIS specification.
This library is implemented on top of the dbus_proxy
module.
Usage:
MediaPlayer = require("media_player") vlc = MediaPlayer:new("vlc") vlc:PlayPause() for k, v in pairs(vlc:info()) do print(k, v) end vlc:Stop()
Info:
- Copyright: 2017 Stefano Mazzucco
- License: Apache License, version 2.0
- Author: Stefano Mazzucco
Class MediaPlayer
MediaPlayer:Get (property_name) | Get the value of a property. |
MediaPlayer:position_as_str () | Return the position of the track as a string of the type
HH:MM:SS . |
MediaPlayer:info () | Return useful information about the track. |
MediaPlayer:new (name) | Create a new MediaPlayer proxy object |
Class MediaPlayer
- MediaPlayer:Get (property_name)
-
Get the value of a property. You should not need to use this
method directly. Instead, you should access the property with the dot
notation: e.g.
player.PropertyName
.Parameters:
- property_name string the name of a property
Returns:
- the value of the property
- nil if the property is not present or the application is not available
- MediaPlayer:position_as_str ()
-
Return the position of the track as a string of the type
HH:MM:SS
.Returns:
-
a string of the type
HH:MM:SS
- an empty string if the application is not available
-
a string of the type
- MediaPlayer:info ()
-
Return useful information about the track.
For full control over the metadata, use
player.Metadata
.Returns:
-
a table with the following keys (if available in the track's metadata):
album
: name of the albumtitle
: title of the songyear
: song yearartists
: comma-separated list of artistslength
: total lenght of the track asHH:MM:SS
- an empty table if the application is not available
-
- MediaPlayer:new (name)
-
Create a new MediaPlayer proxy object
Parameters:
- name
string
name of the application as found in the unique bus name:
org.mpris.MediaPlayer2.<name>
. E.g.org.mpris.MediaPlayer2.vlc
. The resulting DBus name will also be exposed as a field of the object (i.e.player.name
)
- name
string
name of the application as found in the unique bus name: