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:

  1. the value of the property
  2. 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:

  1. a string of the type HH:MM:SS
  2. an empty string if the application is not available
MediaPlayer:info ()
Return useful information about the track. For full control over the metadata, use player.Metadata.

Returns:

  1. a table with the following keys (if available in the track's metadata):

    • album: name of the album
    • title: title of the song
    • year: song year
    • artists: comma-separated list of artists
    • length: total lenght of the track as HH:MM:SS
  2. 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)
generated by LDoc 1.4.6 Last updated 2020-01-06 08:29:59