@jellybrick/mpris-service
Version:
Node.js implementation for the MPRIS D-Bus Interface Specification to create a mediaplayer service
100 lines (82 loc) • 2.18 kB
JavaScript
const MprisInterface = require('./mpris-interface');
const dbus = require('@jellybrick/dbus-next');
const {
property,
method,
ACCESS_READ
} = dbus.interface;
class RootInterface extends MprisInterface {
constructor(player, opts={}) {
super('org.mpris.MediaPlayer2', player);
if (opts.hasOwnProperty('identity')) {
this._Identity = opts.identity;
}
if (opts.hasOwnProperty('supportedUriSchemes')) {
this._SupportedUriSchemes = opts.supportedUriSchemes;
}
if (opts.hasOwnProperty('supportedMimeTypes')) {
this._SupportedMimeTypes = opts.supportedMimeTypes;
}
if (opts.hasOwnProperty('desktopEntry')) {
this._DesktopEntry = opts.desktopEntry;
}
}
_CanQuit = true;
_Fullscreen = false;
_CanSetFullscreen = false;
_CanRaise = true;
_HasTrackList = false;
_Identity = '';
// TODO optional properties
_DesktopEntry = '';
_SupportedUriSchemes = [];
_SupportedMimeTypes = [];
get CanQuit() {
return this._CanQuit;
}
get Fullscreen() {
return this._Fullscreen;
}
set Fullscreen(value) {
this._setPropertyInternal('Fullscreen', value);
}
get CanSetFullscreen() {
return this._CanSetFullscreen;
}
get CanRaise() {
return this._CanRaise;
}
get HasTrackList() {
return this._HasTrackList;
}
get Identity() {
return this._Identity;
}
get DesktopEntry() {
return this._DesktopEntry;
}
get SupportedUriSchemes() {
return this._SupportedUriSchemes;
}
get SupportedMimeTypes() {
return this._SupportedMimeTypes;
}
Raise() {
this.player.emit('raise');
}
Quit() {
this.player.emit('quit');
}
}
module.exports = RootInterface;