@jellybrick/mpris-service 2.1.4 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["constants","PLAYBACK_STATUS_PLAYING","PLAYBACK_STATUS_PAUSED","PLAYBACK_STATUS_STOPPED","LOOP_STATUS_NONE","LOOP_STATUS_TRACK","LOOP_STATUS_PLAYLIST","playbackStatuses","loopStatuses","isLoopStatusValid","value","includes","isPlaybackStatusValid","module","exports"],"sourceRoot":"../src/","sources":["constants.js"],"sourcesContent":["const constants = {\n PLAYBACK_STATUS_PLAYING: 'Playing',\n PLAYBACK_STATUS_PAUSED: 'Paused',\n PLAYBACK_STATUS_STOPPED: 'Stopped',\n\n LOOP_STATUS_NONE: 'None',\n LOOP_STATUS_TRACK: 'Track',\n LOOP_STATUS_PLAYLIST: 'Playlist'\n};\n\nconst playbackStatuses = [\n constants.PLAYBACK_STATUS_PLAYING,\n constants.PLAYBACK_STATUS_PAUSED,\n constants.PLAYBACK_STATUS_STOPPED\n];\n\nconst loopStatuses = [\n constants.LOOP_STATUS_NONE,\n constants.LOOP_STATUS_PLAYLIST,\n constants.LOOP_STATUS_TRACK\n];\n\nconstants.isLoopStatusValid = function(value) {\n return loopStatuses.includes(value);\n};\n\nconstants.isPlaybackStatusValid = function(value) {\n return playbackStatuses.includes(value);\n};\n\nmodule.exports = constants;\n"],"mappings":";;AAAA,MAAMA,SAAS,GAAG;EAChBC,uBAAuB,EAAE,SAAS;EAClCC,sBAAsB,EAAE,QAAQ;EAChCC,uBAAuB,EAAE,SAAS;EAElCC,gBAAgB,EAAE,MAAM;EACxBC,iBAAiB,EAAE,OAAO;EAC1BC,oBAAoB,EAAE;AACxB,CAAC;AAED,MAAMC,gBAAgB,GAAG,CACvBP,SAAS,CAACC,uBAAuB,EACjCD,SAAS,CAACE,sBAAsB,EAChCF,SAAS,CAACG,uBAAuB,CAClC;AAED,MAAMK,YAAY,GAAG,CACnBR,SAAS,CAACI,gBAAgB,EAC1BJ,SAAS,CAACM,oBAAoB,EAC9BN,SAAS,CAACK,iBAAiB,CAC5B;AAEDL,SAAS,CAACS,iBAAiB,GAAG,UAASC,KAAK,EAAE;EAC5C,OAAOF,YAAY,CAACG,QAAQ,CAACD,KAAK,CAAC;AACrC,CAAC;AAEDV,SAAS,CAACY,qBAAqB,GAAG,UAASF,KAAK,EAAE;EAChD,OAAOH,gBAAgB,CAACI,QAAQ,CAACD,KAAK,CAAC;AACzC,CAAC;AAEDG,MAAM,CAACC,OAAO,GAAGd,SAAS"}
1
+ {"version":3,"file":"constants.js","names":["constants","PLAYBACK_STATUS_PLAYING","PLAYBACK_STATUS_PAUSED","PLAYBACK_STATUS_STOPPED","LOOP_STATUS_NONE","LOOP_STATUS_TRACK","LOOP_STATUS_PLAYLIST","playbackStatuses","loopStatuses","isLoopStatusValid","value","includes","isPlaybackStatusValid","module","exports"],"sourceRoot":"../src/","sources":["constants.js"],"sourcesContent":["const constants = {\n PLAYBACK_STATUS_PLAYING: 'Playing',\n PLAYBACK_STATUS_PAUSED: 'Paused',\n PLAYBACK_STATUS_STOPPED: 'Stopped',\n\n LOOP_STATUS_NONE: 'None',\n LOOP_STATUS_TRACK: 'Track',\n LOOP_STATUS_PLAYLIST: 'Playlist'\n};\n\nconst playbackStatuses = [\n constants.PLAYBACK_STATUS_PLAYING,\n constants.PLAYBACK_STATUS_PAUSED,\n constants.PLAYBACK_STATUS_STOPPED\n];\n\nconst loopStatuses = [\n constants.LOOP_STATUS_NONE,\n constants.LOOP_STATUS_PLAYLIST,\n constants.LOOP_STATUS_TRACK\n];\n\nconstants.isLoopStatusValid = function(value) {\n return loopStatuses.includes(value);\n};\n\nconstants.isPlaybackStatusValid = function(value) {\n return playbackStatuses.includes(value);\n};\n\nmodule.exports = constants;\n"],"mappings":";;AAAA,MAAMA,SAAS,GAAG;EAChBC,uBAAuB,EAAE,SAAS;EAClCC,sBAAsB,EAAE,QAAQ;EAChCC,uBAAuB,EAAE,SAAS;EAElCC,gBAAgB,EAAE,MAAM;EACxBC,iBAAiB,EAAE,OAAO;EAC1BC,oBAAoB,EAAE;AACxB,CAAC;AAED,MAAMC,gBAAgB,GAAG,CACvBP,SAAS,CAACC,uBAAuB,EACjCD,SAAS,CAACE,sBAAsB,EAChCF,SAAS,CAACG,uBAAuB,CAClC;AAED,MAAMK,YAAY,GAAG,CACnBR,SAAS,CAACI,gBAAgB,EAC1BJ,SAAS,CAACM,oBAAoB,EAC9BN,SAAS,CAACK,iBAAiB,CAC5B;AAEDL,SAAS,CAACS,iBAAiB,GAAG,UAASC,KAAK,EAAE;EAC5C,OAAOF,YAAY,CAACG,QAAQ,CAACD,KAAK,CAAC;AACrC,CAAC;AAEDV,SAAS,CAACY,qBAAqB,GAAG,UAASF,KAAK,EAAE;EAChD,OAAOH,gBAAgB,CAACI,QAAQ,CAACD,KAAK,CAAC;AACzC,CAAC;AAEDG,MAAM,CAACC,OAAO,GAAGd,SAAS","ignoreList":[]}
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
 
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
7
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
8
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
7
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
8
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
9
9
  require('source-map-support').install();
10
10
  const {
11
11
  EventEmitter
12
12
  } = require('events');
13
- const dbus = require('dbus-next');
13
+ const dbus = require('@jellybrick/dbus-next');
14
14
  const PlayerInterface = require('./interfaces/player');
15
15
  const RootInterface = require('./interfaces/root');
16
16
  const PlaylistsInterface = require('./interfaces/playlists');
@@ -21,12 +21,7 @@ const MPRIS_PATH = '/org/mpris/MediaPlayer2';
21
21
  function lcfirst(str) {
22
22
  return str[0].toLowerCase() + str.substring(1);
23
23
  }
24
- var _addRootInterface = /*#__PURE__*/new WeakSet();
25
- var _addPlayerInterface = /*#__PURE__*/new WeakSet();
26
- var _addTracklistInterface = /*#__PURE__*/new WeakSet();
27
- var _addPlaylistsInterface = /*#__PURE__*/new WeakSet();
28
- var _addEventedProperty = /*#__PURE__*/new WeakSet();
29
- var _addEventedPropertiesList = /*#__PURE__*/new WeakSet();
24
+ var _Player_brand = /*#__PURE__*/new WeakSet();
30
25
  class Player extends EventEmitter {
31
26
  /**
32
27
  * Construct a new Player and export it on the DBus session bus.
@@ -180,12 +175,7 @@ class Player extends EventEmitter {
180
175
  */
181
176
  constructor(options) {
182
177
  super();
183
- _classPrivateMethodInitSpec(this, _addEventedPropertiesList);
184
- _classPrivateMethodInitSpec(this, _addEventedProperty);
185
- _classPrivateMethodInitSpec(this, _addPlaylistsInterface);
186
- _classPrivateMethodInitSpec(this, _addTracklistInterface);
187
- _classPrivateMethodInitSpec(this, _addPlayerInterface);
188
- _classPrivateMethodInitSpec(this, _addRootInterface);
178
+ _classPrivateMethodInitSpec(this, _Player_brand);
189
179
  this.name = options.name;
190
180
  this.supportedInterfaces = options.supportedInterfaces || ['player'];
191
181
  this._tracks = [];
@@ -199,15 +189,15 @@ class Player extends EventEmitter {
199
189
  this.emit('error', err);
200
190
  });
201
191
  this.interfaces = {};
202
- _classPrivateMethodGet(this, _addRootInterface, _addRootInterface2).call(this, this._bus, opts);
192
+ _assertClassBrand(_Player_brand, this, _addRootInterface).call(this, this._bus, opts);
203
193
  if (this.supportedInterfaces.indexOf('player') >= 0) {
204
- _classPrivateMethodGet(this, _addPlayerInterface, _addPlayerInterface2).call(this, this._bus);
194
+ _assertClassBrand(_Player_brand, this, _addPlayerInterface).call(this, this._bus);
205
195
  }
206
196
  if (this.supportedInterfaces.indexOf('trackList') >= 0) {
207
- _classPrivateMethodGet(this, _addTracklistInterface, _addTracklistInterface2).call(this, this._bus);
197
+ _assertClassBrand(_Player_brand, this, _addTracklistInterface).call(this, this._bus);
208
198
  }
209
199
  if (this.supportedInterfaces.indexOf('playlists') >= 0) {
210
- _classPrivateMethodGet(this, _addPlaylistsInterface, _addPlaylistsInterface2).call(this, this._bus);
200
+ _assertClassBrand(_Player_brand, this, _addPlaylistsInterface).call(this, this._bus);
211
201
  }
212
202
  for (let k of Object.keys(this.interfaces)) {
213
203
  let iface = this.interfaces[k];
@@ -349,18 +339,18 @@ class Player extends EventEmitter {
349
339
  * @constant
350
340
  */
351
341
  }
352
- function _addRootInterface2(bus, opts) {
342
+ function _addRootInterface(bus, opts) {
353
343
  this.interfaces.root = new RootInterface(this, opts);
354
- _classPrivateMethodGet(this, _addEventedPropertiesList, _addEventedPropertiesList2).call(this, this.interfaces.root, ['Identity', 'Fullscreen', 'SupportedUriSchemes', 'SupportedMimeTypes', 'CanQuit', 'CanRaise', 'CanSetFullscreen', 'HasTrackList', 'DesktopEntry']);
344
+ _assertClassBrand(_Player_brand, this, _addEventedPropertiesList).call(this, this.interfaces.root, ['Identity', 'Fullscreen', 'SupportedUriSchemes', 'SupportedMimeTypes', 'CanQuit', 'CanRaise', 'CanSetFullscreen', 'HasTrackList', 'DesktopEntry']);
355
345
  }
356
- function _addPlayerInterface2(bus) {
346
+ function _addPlayerInterface(bus) {
357
347
  this.interfaces.player = new PlayerInterface(this);
358
348
  let eventedProps = ['PlaybackStatus', 'LoopStatus', 'Rate', 'Shuffle', 'Metadata', 'Volume', 'CanControl', 'CanPause', 'CanPlay', 'CanSeek', 'CanGoNext', 'CanGoPrevious', 'MinimumRate', 'MaximumRate'];
359
- _classPrivateMethodGet(this, _addEventedPropertiesList, _addEventedPropertiesList2).call(this, this.interfaces.player, eventedProps);
349
+ _assertClassBrand(_Player_brand, this, _addEventedPropertiesList).call(this, this.interfaces.player, eventedProps);
360
350
  }
361
- function _addTracklistInterface2(bus) {
351
+ function _addTracklistInterface(bus) {
362
352
  this.interfaces.tracklist = new TracklistInterface(this);
363
- _classPrivateMethodGet(this, _addEventedPropertiesList, _addEventedPropertiesList2).call(this, this.interfaces.tracklist, ['CanEditTracks']);
353
+ _assertClassBrand(_Player_brand, this, _addEventedPropertiesList).call(this, this.interfaces.tracklist, ['CanEditTracks']);
364
354
  Object.defineProperty(this, 'tracks', {
365
355
  get: function () {
366
356
  return this._tracks;
@@ -373,11 +363,11 @@ function _addTracklistInterface2(bus) {
373
363
  configurable: true
374
364
  });
375
365
  }
376
- function _addPlaylistsInterface2(bus) {
366
+ function _addPlaylistsInterface(bus) {
377
367
  this.interfaces.playlists = new PlaylistsInterface(this);
378
- _classPrivateMethodGet(this, _addEventedPropertiesList, _addEventedPropertiesList2).call(this, this.interfaces.playlists, ['PlaylistCount', 'ActivePlaylist']);
368
+ _assertClassBrand(_Player_brand, this, _addEventedPropertiesList).call(this, this.interfaces.playlists, ['PlaylistCount', 'ActivePlaylist']);
379
369
  }
380
- function _addEventedProperty2(iface, name) {
370
+ function _addEventedProperty(iface, name) {
381
371
  let localName = lcfirst(name);
382
372
  Object.defineProperty(this, localName, {
383
373
  get: function () {
@@ -396,9 +386,9 @@ function _addEventedProperty2(iface, name) {
396
386
  configurable: true
397
387
  });
398
388
  }
399
- function _addEventedPropertiesList2(iface, props) {
389
+ function _addEventedPropertiesList(iface, props) {
400
390
  for (let i = 0; i < props.length; i++) {
401
- _classPrivateMethodGet(this, _addEventedProperty, _addEventedProperty2).call(this, iface, props[i]);
391
+ _assertClassBrand(_Player_brand, this, _addEventedProperty).call(this, iface, props[i]);
402
392
  }
403
393
  }
404
394
  _defineProperty(Player, "PLAYBACK_STATUS_PLAYING", constants.PLAYBACK_STATUS_PLAYING);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["require","install","EventEmitter","dbus","PlayerInterface","RootInterface","PlaylistsInterface","TracklistInterface","types","constants","MPRIS_PATH","lcfirst","str","toLowerCase","substring","_addRootInterface","WeakSet","_addPlayerInterface","_addTracklistInterface","_addPlaylistsInterface","_addEventedProperty","_addEventedPropertiesList","Player","constructor","options","_classPrivateMethodInitSpec","name","supportedInterfaces","_tracks","init","opts","serviceName","validators","assertBusNameValid","_bus","sessionBus","on","err","emit","interfaces","_classPrivateMethodGet","_addRootInterface2","call","indexOf","_addPlayerInterface2","_addTracklistInterface2","_addPlaylistsInterface2","k","Object","keys","iface","export","requestName","NameFlag","DO_NOT_QUEUE","then","reply","RequestNameReply","EXISTS","process","pid","catch","objectPath","subpath","path","getPosition","seeked","position","seekTo","Math","floor","isNaN","Error","player","Seeked","getTrackIndex","trackId","i","tracks","length","track","getTrack","addTrack","push","tracklist","setTracks","afterTrack","TrackAdded","removeTrack","splice","TrackRemoved","getPlaylistIndex","playlistId","playlists","playlist","Id","setPlaylists","playlistCount","forEach","PlaylistChanged","setActivePlaylist","setActivePlaylistId","bus","root","_addEventedPropertiesList2","eventedProps","defineProperty","get","set","value","TrackListReplaced","enumerable","configurable","_addEventedProperty2","localName","playlistToPlain","metadataToPlain","setProperty","props","_defineProperty","PLAYBACK_STATUS_PLAYING","PLAYBACK_STATUS_PAUSED","PLAYBACK_STATUS_STOPPED","LOOP_STATUS_NONE","LOOP_STATUS_TRACK","LOOP_STATUS_PLAYLIST","module","exports"],"sourceRoot":"../src/","sources":["index.js"],"sourcesContent":["require('source-map-support').install();\n\nconst { EventEmitter } = require('events');\n\nconst dbus = require('dbus-next');\nconst PlayerInterface = require('./interfaces/player');\nconst RootInterface = require('./interfaces/root');\nconst PlaylistsInterface = require('./interfaces/playlists');\nconst TracklistInterface = require('./interfaces/tracklist');\nconst types = require('./interfaces/types');\nconst constants = require('./constants');\n\nconst MPRIS_PATH = '/org/mpris/MediaPlayer2';\n\nfunction lcfirst(str) {\n return str[0].toLowerCase() + str.substring(1);\n}\n\nclass Player extends EventEmitter {\n /**\n * Construct a new Player and export it on the DBus session bus.\n *\n * For more information about the properties of this class, see [the MPRIS DBus Interface Specification](https://specifications.freedesktop.org/mpris-spec/latest/).\n *\n * Method Call Events\n * ------------------\n *\n * The Player is an `EventEmitter` that emits events when the corresponding\n * methods are called on the DBus interface over the wire.\n *\n * The Player emits events whenever the corresponding methods on the DBus\n * interface are called.\n *\n * * `raise` - Brings the media player's user interface to the front using any appropriate mechanism available.\n * * `quit` - Causes the media player to stop running.\n * * `next` - Skips to the next track in the tracklist.\n * * `previous` - Skips to the previous track in the tracklist.\n * * `pause` - Pauses playback.\n * * `playPause` - Pauses playback. If playback is already paused, resumes playback. If playback is stopped, starts playback.\n * * `stop` - Stops playback.\n * * `play` - Starts or resumes playback.\n * * `seek` - Seeks forward in the current track by the specified number of microseconds. With event data `offset`.\n * * `position` - Sets the current track position in microseconds. With event data `{ trackId, position }`.\n * * `open` - Opens the Uri given as an argument. With event data `{ uri }`.\n * * `volume` - Sets the volume of the player. With event data `volume` (between 0.0 and 1.0).\n * * `shuffle` - Sets whether shuffle is enabled on the player. With event data `shuffleStatus` (boolean).\n * * `rate` - Sets the playback rate of the player. A value of 1.0 is the normal rate. With event data `rate`.\n * * `loopStatus` - Sets the loop status of the player to either 'None', 'Track', or 'Playlist'. With event data `loopStatus`.\n * * `activatePlaylist` - Starts playing the given playlist. With event data `playlistId`.\n *\n * The Player may also emit an `error` event with the underlying Node `Error`\n * as the event data. After receiving this event, the Player may be\n * disconnected.\n *\n * ```\n * player.on('play', () => {\n * realPlayer.play();\n * });\n *\n * player.on('shuffle', (enableShuffle) => {\n * realPlayer.setShuffle(enableShuffle);\n * player.shuffle = enableShuffle;\n * });\n * ```\n *\n * Player Properties\n * -----------------\n *\n * Player properties (documented below) should be kept up to date to reflect\n * the state of your real player. These properties can be gotten by the client\n * through the `org.freedesktop.DBus.Properties` interface which will return\n * the value currently set on the player. Setting these properties on the\n * player to a different value will emit the `PropertiesChanged` signal on the\n * properties interface to notify clients that properties of the player have\n * changed.\n *\n * ```\n * realPlayer.on('shuffle:changed', (shuffleEnabled) => {\n * player.shuffle = shuffleEnabled;\n * });\n *\n * realPlayer.on('play', () => {\n * player.playbackStatus = 'Playing';\n * });\n * ```\n *\n * Player Position\n * ---------------\n *\n * Clients can get the position of your player by getting the `Position`\n * property of the `org.mpris.MediaPlayer2.Player` interface. Since position\n * updates continuously, {@link Player#getPosition} is implemented as a getter\n * you can override on your Player. This getter will be called when a client\n * requests the position and should return the position of your player for the\n * client in microseconds.\n *\n * ```\n * player.getPosition() {\n * return realPlayer.getPositionInMicroseconds();\n * }\n * ```\n *\n * When your real player seeks to a new location, such as when someone clicks\n * on the time bar, you can notify clients of the new position by calling the\n * {@link Player#seeked} method. This will raise the `Seeked` signal on the\n * `org.mpris.MediaPlayer2.Player` interface with the given current time of the\n * player in microseconds.\n *\n * ```\n * realPlayer.on('seeked', (positionInMicroseconds) => {\n * player.seeked(positionInMicroseconds);\n * });\n * ```\n *\n * Clients can request to set position using the `Seek` and `SetPosition`\n * methods of the `org.mpris.MediaPlayer2.Player` interface. These requests are\n * implemented as events on the Player similar to the other requests.\n *\n * ```\n * player.on('seek', (offset) => {\n * // note that offset may be negative\n * let currentPosition = realPlayer.getPositionInMicroseconds();\n * let newPosition = currentPosition + offset;\n * realPlayer.setPosition(newPosition);\n * });\n *\n * player.on('position', (event) => {\n * // check that event.trackId is the current track before continuing.\n * realPlayer.setPosition(event.position);\n * });\n * ```\n *\n * @class Player\n * @param {\n * name: String,\n * identity: String,\n * supportedMimeTypes: string[],\n * supportedInterfaces: string[]\n * } options - Options for the player.\n * @param {String} options.name - Name on the bus to export to as `org.mpris.MediaPlayer2.{name}`.\n * @param {String} options.identity - Identity for the player to display on the root media player interface.\n * @param {Array} options.supportedMimeTypes - Mime types this player can open with the `org.mpris.MediaPlayer2.Open` method.\n * @param {Array} options.supportedInterfaces - The interfaces this player supports. Can include `'player'`, `'playlists'`, and `'trackList'`.\n * @property {String} identity - A friendly name to identify the media player to users.\n * @property {Boolean} fullscreen - Whether the media player is occupying the fullscreen.\n * @property {Array} supportedUriSchemes - The URI schemes supported by the media player.\n * @property {Array} supportedMimeTypes - The mime-types supported by the media player.\n * @property {Boolean} canQuit - Whether the player can quit.\n * @property {Boolean} canRaise - Whether the player can raise.\n * @property {Boolean} canSetFullscreen - Whether the player can be set to fullscreen.\n * @property {Boolean} hasTrackList - Indicates whether the /org/mpris/MediaPlayer2 object implements the org.mpris.MediaPlayer2.TrackList interface.\n * @property {String} desktopEntry - The basename of an installed .desktop file which complies with the Desktop entry specification, with the \".desktop\" extension stripped.\n * @property {String} playbackStatus - The current playback status. May be \"Playing\", \"Paused\" or \"Stopped\".\n * @property {String} loopStatus - The current loop/repeat status. May be \"None\", \"Track\", or \"Playlist\".\n * @property {Boolean} shuffle - Whether the player is shuffling.\n * @property {Object} metadata - The metadata of the current element. If there is a current track, this must have a \"mpris:trackid\" entry (of D-Bus type \"o\") at the very least, which contains a D-Bus path that uniquely identifies this track.\n * @property {Number} volume - The volume level. (Double)\n * @property {Boolean} canControl - Whether the media player may be controlled over this interface.\n * @property {Boolean} canPause - Whether playback can be paused using Pause or PlayPause.\n * @property {Boolean} canPlay - Whether playback can be started using Play or PlayPause.\n * @property {Boolean} canSeek - Whether the client can control the playback position using Seek and SetPosition.\n * @property {Boolean} canGoNext - Whether the client can call the Next method on this interface and expect the current track to change.\n * @property {Boolean} canGoPrevious - Whether the client can call the Previous method on this interface and expect the current track to change.\n * @property {Number} rate - The current playback rate. (Double)\n * @property {Number} minimumRate - The minimum value which the Rate property can take. (Double)\n * @property {Number} maximumRate - The maximum value which the Rate property can take. (Double)\n * @property {Array} playlists - The current playlists set by {@link Player#setPlaylists}. (Not a DBus property).\n * @property {String} activePlaylist - The id of the currently-active playlist.\n */\n constructor(options) {\n super();\n\n this.name = options.name;\n this.supportedInterfaces = options.supportedInterfaces || ['player'];\n this._tracks = [];\n this.init(options);\n }\n\n init(opts) {\n this.serviceName = `org.mpris.MediaPlayer2.${this.name}`;\n dbus.validators.assertBusNameValid(this.serviceName);\n\n this._bus = dbus.sessionBus();\n\n this._bus.on('error', (err) => {\n this.emit('error', err);\n });\n\n this.interfaces = {};\n\n this.#addRootInterface(this._bus, opts);\n\n if (this.supportedInterfaces.indexOf('player') >= 0) {\n this.#addPlayerInterface(this._bus);\n }\n if (this.supportedInterfaces.indexOf('trackList') >= 0) {\n this.#addTracklistInterface(this._bus);\n }\n if (this.supportedInterfaces.indexOf('playlists') >= 0) {\n this.#addPlaylistsInterface(this._bus);\n }\n\n for (let k of Object.keys(this.interfaces)) {\n let iface = this.interfaces[k];\n this._bus.export(MPRIS_PATH, iface);\n }\n\n this._bus.requestName(this.serviceName, dbus.NameFlag.DO_NOT_QUEUE)\n .then((reply) => {\n if (reply === dbus.RequestNameReply.EXISTS) {\n this.serviceName = `${this.serviceName}.instance${process.pid}`;\n return this._bus.requestName(this.serviceName);\n }\n })\n .catch((err) => {\n this.emit('error', err);\n });\n }\n\n #addRootInterface(bus, opts) {\n this.interfaces.root = new RootInterface(this, opts);\n this.#addEventedPropertiesList(this.interfaces.root,\n ['Identity', 'Fullscreen', 'SupportedUriSchemes', 'SupportedMimeTypes',\n 'CanQuit', 'CanRaise', 'CanSetFullscreen', 'HasTrackList',\n 'DesktopEntry']);\n }\n\n #addPlayerInterface(bus) {\n this.interfaces.player = new PlayerInterface(this);\n let eventedProps = ['PlaybackStatus', 'LoopStatus', 'Rate', 'Shuffle',\n 'Metadata', 'Volume', 'CanControl', 'CanPause', 'CanPlay', 'CanSeek',\n 'CanGoNext', 'CanGoPrevious', 'MinimumRate', 'MaximumRate'];\n this.#addEventedPropertiesList(this.interfaces.player, eventedProps);\n }\n\n #addTracklistInterface(bus) {\n this.interfaces.tracklist = new TracklistInterface(this);\n this.#addEventedPropertiesList(this.interfaces.tracklist, ['CanEditTracks']);\n\n Object.defineProperty(this, 'tracks', {\n get: function() {\n return this._tracks;\n },\n set: function(value) {\n this._tracks = value;\n this.interfaces.tracklist.TrackListReplaced(value);\n },\n enumerable: true,\n configurable: true\n });\n }\n\n #addPlaylistsInterface(bus) {\n this.interfaces.playlists = new PlaylistsInterface(this);\n this.#addEventedPropertiesList(this.interfaces.playlists,\n ['PlaylistCount', 'ActivePlaylist']);\n }\n\n /**\n * Get a valid object path with the `subpath` as the basename which is suitable\n * for use as an id.\n *\n * @name Player#objectPath\n * @function\n * @param {String} subpath - The basename of this path\n * @returns {String} - A valid object path that can be used as an id.\n */\n objectPath(subpath) {\n let path = `/org/node/mediaplayer/${this.name}`;\n if (subpath) {\n path += `/${subpath}`;\n }\n return path;\n }\n\n #addEventedProperty(iface, name) {\n let localName = lcfirst(name);\n\n Object.defineProperty(this, localName, {\n get: function() {\n let value = iface[name];\n if (name === 'ActivePlaylist') {\n return types.playlistToPlain(value);\n } else if (name === 'Metadata') {\n return types.metadataToPlain(value);\n }\n return value;\n },\n set: function(value) {\n iface.setProperty(name, value);\n },\n enumerable: true,\n configurable: true\n });\n }\n\n #addEventedPropertiesList(iface, props) {\n for (let i = 0; i < props.length; i++) {\n this.#addEventedProperty(iface, props[i]);\n }\n }\n\n /**\n * Gets the position of this player. This method is intended to be overridden\n * by the user to return the position of the player in microseconds.\n *\n * @name Player#getPosition\n * @function\n * @returns {Number} - The current position of the player in microseconds. (Integer)\n */\n getPosition() {\n return 0;\n }\n\n /**\n * Emits the `Seeked` DBus signal to listening clients with the given position.\n *\n * @name Player#seeked\n * @function\n * @param {Number} position - The position in microseconds. (Integer)\n */\n seeked(position) {\n let seekTo = Math.floor(position || 0);\n if (isNaN(seekTo)) {\n throw new Error(`seeked expected a number (got ${position})`);\n }\n this.interfaces.player.Seeked(seekTo);\n }\n\n getTrackIndex(trackId) {\n for (let i = 0; i < this.tracks.length; i++) {\n let track = this.tracks[i];\n\n if (track['mpris:trackid'] === trackId) {\n return i;\n }\n }\n\n return -1;\n }\n\n getTrack(trackId) {\n return this.tracks[this.getTrackIndex(trackId)];\n }\n\n addTrack(track) {\n this.tracks.push(track);\n this.interfaces.tracklist.setTracks(this.tracks);\n\n let afterTrack = '/org/mpris/MediaPlayer2/TrackList/NoTrack';\n if (this.tracks.length > 2) {\n afterTrack = this.tracks[this.tracks.length - 2]['mpris:trackid'];\n }\n this.interfaces.tracklist.TrackAdded(afterTrack);\n }\n\n removeTrack(trackId) {\n let i = this.getTrackIndex(trackId);\n this.tracks.splice(i, 1);\n this.interfaces.tracklist.setTracks(this.tracks);\n\n this.interfaces.tracklist.TrackRemoved(trackId);\n }\n\n /**\n * Get the index of a playlist entry in the `playlists` list property of the\n * player from the given id.\n *\n * @name Player#getPlaylistIndex\n * @function\n * @param {String} playlistId - The id for the playlist entry.\n */\n getPlaylistIndex(playlistId) {\n for (let i = 0; i < this.playlists.length; i++) {\n let playlist = this.playlists[i];\n\n if (playlist.Id === playlistId) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Set the list of playlists advertised to listeners on the bus. Each playlist\n * must have string members `Id`, `Name`, and `Icon`.\n *\n * @name Player#setPlaylists\n * @function\n * @param {Array} playlists - A list of playlists.\n */\n setPlaylists(playlists) {\n this.playlists = playlists;\n this.playlistCount = playlists.length;\n\n this.playlists.forEach((playlist) => {\n if (playlist) {\n this.interfaces.playlists.PlaylistChanged(playlist);\n }\n });\n }\n\n /**\n * Set the playlist identified by `playlistId` to be the currently active\n * playlist.\n *\n * @name Player#setActivePlaylist\n * @function\n * @param {String} playlistId - The id of the playlist to activate.\n */\n setActivePlaylist(playlistId) {\n this.interfaces.playlists.setActivePlaylistId(playlistId);\n }\n\n /**\n * Enumerated value for the `playbackStatus` property of the player to indicate\n * a track is currently playing.\n *\n * @name Player#PLAYBACK_STATUS_PLAYING\n * @static\n * @constant\n */\n static PLAYBACK_STATUS_PLAYING = constants.PLAYBACK_STATUS_PLAYING;\n /**\n * Enumerated value for the `playbackStatus` property of the player to indicate\n * a track is currently paused.\n *\n * @name Player#PLAYBACK_STATUS_PAUSED\n * @static\n * @constant\n */\n static PLAYBACK_STATUS_PAUSED = constants.PLAYBACK_STATUS_PAUSED;\n\n /**\n * Enumerated value for the `playbackStatus` property of the player to indicate\n * there is no track currently playing.\n *\n * @name Player#PLAYBACK_STATUS_STOPPED\n * @static\n * @constant\n */\n static PLAYBACK_STATUS_STOPPED = constants.PLAYBACK_STATUS_STOPPED;\n\n /**\n * Enumerated value for the `loopStatus` property of the player to indicate\n * playback will stop when there are no more tracks to play.\n *\n * @name Player#LOOP_STATUS_NONE\n * @static\n * @constant\n */\n static LOOP_STATUS_NONE = constants.LOOP_STATUS_NONE;\n\n /**\n * Enumerated value for the `loopStatus` property of the player to indicate the\n * current track will start again from the beginning once it has finished\n * playing.\n *\n * @name Player#LOOP_STATUS_TRACK\n * @static\n * @constant\n */\n static LOOP_STATUS_TRACK = constants.LOOP_STATUS_TRACK;\n\n /**\n * Enumerated value for the `loopStatus` property of the player to indicate the\n * playback loops through a list of tracks.\n *\n * @name Player#LOOP_STATUS_PLAYLIST\n * @static\n * @constant\n */\n static LOOP_STATUS_PLAYLIST = constants.LOOP_STATUS_PLAYLIST;\n}\n\nmodule.exports = Player;"],"mappings":";;;;;;;;AAAAA,OAAO,CAAC,oBAAoB,CAAC,CAACC,OAAO,CAAC,CAAC;AAEvC,MAAM;EAAEC;AAAa,CAAC,GAAGF,OAAO,CAAC,QAAQ,CAAC;AAE1C,MAAMG,IAAI,GAAGH,OAAO,CAAC,WAAW,CAAC;AACjC,MAAMI,eAAe,GAAGJ,OAAO,CAAC,qBAAqB,CAAC;AACtD,MAAMK,aAAa,GAAGL,OAAO,CAAC,mBAAmB,CAAC;AAClD,MAAMM,kBAAkB,GAAGN,OAAO,CAAC,wBAAwB,CAAC;AAC5D,MAAMO,kBAAkB,GAAGP,OAAO,CAAC,wBAAwB,CAAC;AAC5D,MAAMQ,KAAK,GAAGR,OAAO,CAAC,oBAAoB,CAAC;AAC3C,MAAMS,SAAS,GAAGT,OAAO,CAAC,aAAa,CAAC;AAExC,MAAMU,UAAU,GAAG,yBAAyB;AAE5C,SAASC,OAAOA,CAACC,GAAG,EAAE;EACpB,OAAOA,GAAG,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGD,GAAG,CAACE,SAAS,CAAC,CAAC,CAAC;AAChD;AAAC,IAAAC,iBAAA,oBAAAC,OAAA;AAAA,IAAAC,mBAAA,oBAAAD,OAAA;AAAA,IAAAE,sBAAA,oBAAAF,OAAA;AAAA,IAAAG,sBAAA,oBAAAH,OAAA;AAAA,IAAAI,mBAAA,oBAAAJ,OAAA;AAAA,IAAAK,yBAAA,oBAAAL,OAAA;AAED,MAAMM,MAAM,SAASpB,YAAY,CAAC;EAChC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEqB,WAAWA,CAACC,OAAO,EAAE;IACnB,KAAK,CAAC,CAAC;IAACC,2BAAA,OAAAJ,yBAAA;IAAAI,2BAAA,OAAAL,mBAAA;IAAAK,2BAAA,OAAAN,sBAAA;IAAAM,2BAAA,OAAAP,sBAAA;IAAAO,2BAAA,OAAAR,mBAAA;IAAAQ,2BAAA,OAAAV,iBAAA;IAER,IAAI,CAACW,IAAI,GAAGF,OAAO,CAACE,IAAI;IACxB,IAAI,CAACC,mBAAmB,GAAGH,OAAO,CAACG,mBAAmB,IAAI,CAAC,QAAQ,CAAC;IACpE,IAAI,CAACC,OAAO,GAAG,EAAE;IACjB,IAAI,CAACC,IAAI,CAACL,OAAO,CAAC;EACpB;EAEAK,IAAIA,CAACC,IAAI,EAAE;IACT,IAAI,CAACC,WAAW,GAAI,0BAAyB,IAAI,CAACL,IAAK,EAAC;I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APED,eAAA,CAtZIjG,MAAM,4BA8ZsBb,SAAS,CAACgH,sBAAsB;AAEhE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPEF,eAAA,CAhaIjG,MAAM,6BAwauBb,SAAS,CAACiH,uBAAuB;AAElE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPEH,eAAA,CA1aIjG,MAAM,sBAkbgBb,SAAS,CAACkH,gBAAgB;AAEpD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAREJ,eAAA,CApbIjG,MAAM,uBA6biBb,SAAS,CAACmH,iBAAiB;AAEtD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPEL,eAAA,CA/bIjG,MAAM,0BAucoBb,SAAS,CAACoH,oBAAoB;AAG9DC,MAAM,CAACC,OAAO,GAAGzG,MAAM"}
1
+ {"version":3,"file":"index.js","names":["require","install","EventEmitter","dbus","PlayerInterface","RootInterface","PlaylistsInterface","TracklistInterface","types","constants","MPRIS_PATH","lcfirst","str","toLowerCase","substring","_Player_brand","WeakSet","Player","constructor","options","_classPrivateMethodInitSpec","name","supportedInterfaces","_tracks","init","opts","serviceName","validators","assertBusNameValid","_bus","sessionBus","on","err","emit","interfaces","_assertClassBrand","_addRootInterface","call","indexOf","_addPlayerInterface","_addTracklistInterface","_addPlaylistsInterface","k","Object","keys","iface","export","requestName","NameFlag","DO_NOT_QUEUE","then","reply","RequestNameReply","EXISTS","process","pid","catch","objectPath","subpath","path","getPosition","seeked","position","seekTo","Math","floor","isNaN","Error","player","Seeked","getTrackIndex","trackId","i","tracks","length","track","getTrack","addTrack","push","tracklist","setTracks","afterTrack","TrackAdded","removeTrack","splice","TrackRemoved","getPlaylistIndex","playlistId","playlists","playlist","Id","setPlaylists","playlistCount","forEach","PlaylistChanged","setActivePlaylist","setActivePlaylistId","bus","root","_addEventedPropertiesList","eventedProps","defineProperty","get","set","value","TrackListReplaced","enumerable","configurable","_addEventedProperty","localName","playlistToPlain","metadataToPlain","setProperty","props","_defineProperty","PLAYBACK_STATUS_PLAYING","PLAYBACK_STATUS_PAUSED","PLAYBACK_STATUS_STOPPED","LOOP_STATUS_NONE","LOOP_STATUS_TRACK","LOOP_STATUS_PLAYLIST","module","exports"],"sourceRoot":"../src/","sources":["index.js"],"sourcesContent":["require('source-map-support').install();\n\nconst { EventEmitter } = require('events');\n\nconst dbus = require('@jellybrick/dbus-next');\nconst PlayerInterface = require('./interfaces/player');\nconst RootInterface = require('./interfaces/root');\nconst PlaylistsInterface = require('./interfaces/playlists');\nconst TracklistInterface = require('./interfaces/tracklist');\nconst types = require('./interfaces/types');\nconst constants = require('./constants');\n\nconst MPRIS_PATH = '/org/mpris/MediaPlayer2';\n\nfunction lcfirst(str) {\n return str[0].toLowerCase() + str.substring(1);\n}\n\nclass Player extends EventEmitter {\n /**\n * Construct a new Player and export it on the DBus session bus.\n *\n * For more information about the properties of this class, see [the MPRIS DBus Interface Specification](https://specifications.freedesktop.org/mpris-spec/latest/).\n *\n * Method Call Events\n * ------------------\n *\n * The Player is an `EventEmitter` that emits events when the corresponding\n * methods are called on the DBus interface over the wire.\n *\n * The Player emits events whenever the corresponding methods on the DBus\n * interface are called.\n *\n * * `raise` - Brings the media player's user interface to the front using any appropriate mechanism available.\n * * `quit` - Causes the media player to stop running.\n * * `next` - Skips to the next track in the tracklist.\n * * `previous` - Skips to the previous track in the tracklist.\n * * `pause` - Pauses playback.\n * * `playPause` - Pauses playback. If playback is already paused, resumes playback. If playback is stopped, starts playback.\n * * `stop` - Stops playback.\n * * `play` - Starts or resumes playback.\n * * `seek` - Seeks forward in the current track by the specified number of microseconds. With event data `offset`.\n * * `position` - Sets the current track position in microseconds. With event data `{ trackId, position }`.\n * * `open` - Opens the Uri given as an argument. With event data `{ uri }`.\n * * `volume` - Sets the volume of the player. With event data `volume` (between 0.0 and 1.0).\n * * `shuffle` - Sets whether shuffle is enabled on the player. With event data `shuffleStatus` (boolean).\n * * `rate` - Sets the playback rate of the player. A value of 1.0 is the normal rate. With event data `rate`.\n * * `loopStatus` - Sets the loop status of the player to either 'None', 'Track', or 'Playlist'. With event data `loopStatus`.\n * * `activatePlaylist` - Starts playing the given playlist. With event data `playlistId`.\n *\n * The Player may also emit an `error` event with the underlying Node `Error`\n * as the event data. After receiving this event, the Player may be\n * disconnected.\n *\n * ```\n * player.on('play', () => {\n * realPlayer.play();\n * });\n *\n * player.on('shuffle', (enableShuffle) => {\n * realPlayer.setShuffle(enableShuffle);\n * player.shuffle = enableShuffle;\n * });\n * ```\n *\n * Player Properties\n * -----------------\n *\n * Player properties (documented below) should be kept up to date to reflect\n * the state of your real player. These properties can be gotten by the client\n * through the `org.freedesktop.DBus.Properties` interface which will return\n * the value currently set on the player. Setting these properties on the\n * player to a different value will emit the `PropertiesChanged` signal on the\n * properties interface to notify clients that properties of the player have\n * changed.\n *\n * ```\n * realPlayer.on('shuffle:changed', (shuffleEnabled) => {\n * player.shuffle = shuffleEnabled;\n * });\n *\n * realPlayer.on('play', () => {\n * player.playbackStatus = 'Playing';\n * });\n * ```\n *\n * Player Position\n * ---------------\n *\n * Clients can get the position of your player by getting the `Position`\n * property of the `org.mpris.MediaPlayer2.Player` interface. Since position\n * updates continuously, {@link Player#getPosition} is implemented as a getter\n * you can override on your Player. This getter will be called when a client\n * requests the position and should return the position of your player for the\n * client in microseconds.\n *\n * ```\n * player.getPosition() {\n * return realPlayer.getPositionInMicroseconds();\n * }\n * ```\n *\n * When your real player seeks to a new location, such as when someone clicks\n * on the time bar, you can notify clients of the new position by calling the\n * {@link Player#seeked} method. This will raise the `Seeked` signal on the\n * `org.mpris.MediaPlayer2.Player` interface with the given current time of the\n * player in microseconds.\n *\n * ```\n * realPlayer.on('seeked', (positionInMicroseconds) => {\n * player.seeked(positionInMicroseconds);\n * });\n * ```\n *\n * Clients can request to set position using the `Seek` and `SetPosition`\n * methods of the `org.mpris.MediaPlayer2.Player` interface. These requests are\n * implemented as events on the Player similar to the other requests.\n *\n * ```\n * player.on('seek', (offset) => {\n * // note that offset may be negative\n * let currentPosition = realPlayer.getPositionInMicroseconds();\n * let newPosition = currentPosition + offset;\n * realPlayer.setPosition(newPosition);\n * });\n *\n * player.on('position', (event) => {\n * // check that event.trackId is the current track before continuing.\n * realPlayer.setPosition(event.position);\n * });\n * ```\n *\n * @class Player\n * @param {\n * name: String,\n * identity: String,\n * supportedMimeTypes: string[],\n * supportedInterfaces: string[]\n * } options - Options for the player.\n * @param {String} options.name - Name on the bus to export to as `org.mpris.MediaPlayer2.{name}`.\n * @param {String} options.identity - Identity for the player to display on the root media player interface.\n * @param {Array} options.supportedMimeTypes - Mime types this player can open with the `org.mpris.MediaPlayer2.Open` method.\n * @param {Array} options.supportedInterfaces - The interfaces this player supports. Can include `'player'`, `'playlists'`, and `'trackList'`.\n * @property {String} identity - A friendly name to identify the media player to users.\n * @property {Boolean} fullscreen - Whether the media player is occupying the fullscreen.\n * @property {Array} supportedUriSchemes - The URI schemes supported by the media player.\n * @property {Array} supportedMimeTypes - The mime-types supported by the media player.\n * @property {Boolean} canQuit - Whether the player can quit.\n * @property {Boolean} canRaise - Whether the player can raise.\n * @property {Boolean} canSetFullscreen - Whether the player can be set to fullscreen.\n * @property {Boolean} hasTrackList - Indicates whether the /org/mpris/MediaPlayer2 object implements the org.mpris.MediaPlayer2.TrackList interface.\n * @property {String} desktopEntry - The basename of an installed .desktop file which complies with the Desktop entry specification, with the \".desktop\" extension stripped.\n * @property {String} playbackStatus - The current playback status. May be \"Playing\", \"Paused\" or \"Stopped\".\n * @property {String} loopStatus - The current loop/repeat status. May be \"None\", \"Track\", or \"Playlist\".\n * @property {Boolean} shuffle - Whether the player is shuffling.\n * @property {Object} metadata - The metadata of the current element. If there is a current track, this must have a \"mpris:trackid\" entry (of D-Bus type \"o\") at the very least, which contains a D-Bus path that uniquely identifies this track.\n * @property {Number} volume - The volume level. (Double)\n * @property {Boolean} canControl - Whether the media player may be controlled over this interface.\n * @property {Boolean} canPause - Whether playback can be paused using Pause or PlayPause.\n * @property {Boolean} canPlay - Whether playback can be started using Play or PlayPause.\n * @property {Boolean} canSeek - Whether the client can control the playback position using Seek and SetPosition.\n * @property {Boolean} canGoNext - Whether the client can call the Next method on this interface and expect the current track to change.\n * @property {Boolean} canGoPrevious - Whether the client can call the Previous method on this interface and expect the current track to change.\n * @property {Number} rate - The current playback rate. (Double)\n * @property {Number} minimumRate - The minimum value which the Rate property can take. (Double)\n * @property {Number} maximumRate - The maximum value which the Rate property can take. (Double)\n * @property {Array} playlists - The current playlists set by {@link Player#setPlaylists}. (Not a DBus property).\n * @property {String} activePlaylist - The id of the currently-active playlist.\n */\n constructor(options) {\n super();\n\n this.name = options.name;\n this.supportedInterfaces = options.supportedInterfaces || ['player'];\n this._tracks = [];\n this.init(options);\n }\n\n init(opts) {\n this.serviceName = `org.mpris.MediaPlayer2.${this.name}`;\n dbus.validators.assertBusNameValid(this.serviceName);\n\n this._bus = dbus.sessionBus();\n\n this._bus.on('error', (err) => {\n this.emit('error', err);\n });\n\n this.interfaces = {};\n\n this.#addRootInterface(this._bus, opts);\n\n if (this.supportedInterfaces.indexOf('player') >= 0) {\n this.#addPlayerInterface(this._bus);\n }\n if (this.supportedInterfaces.indexOf('trackList') >= 0) {\n this.#addTracklistInterface(this._bus);\n }\n if (this.supportedInterfaces.indexOf('playlists') >= 0) {\n this.#addPlaylistsInterface(this._bus);\n }\n\n for (let k of Object.keys(this.interfaces)) {\n let iface = this.interfaces[k];\n this._bus.export(MPRIS_PATH, iface);\n }\n\n this._bus.requestName(this.serviceName, dbus.NameFlag.DO_NOT_QUEUE)\n .then((reply) => {\n if (reply === dbus.RequestNameReply.EXISTS) {\n this.serviceName = `${this.serviceName}.instance${process.pid}`;\n return this._bus.requestName(this.serviceName);\n }\n })\n .catch((err) => {\n this.emit('error', err);\n });\n }\n\n #addRootInterface(bus, opts) {\n this.interfaces.root = new RootInterface(this, opts);\n this.#addEventedPropertiesList(this.interfaces.root,\n ['Identity', 'Fullscreen', 'SupportedUriSchemes', 'SupportedMimeTypes',\n 'CanQuit', 'CanRaise', 'CanSetFullscreen', 'HasTrackList',\n 'DesktopEntry']);\n }\n\n #addPlayerInterface(bus) {\n this.interfaces.player = new PlayerInterface(this);\n let eventedProps = ['PlaybackStatus', 'LoopStatus', 'Rate', 'Shuffle',\n 'Metadata', 'Volume', 'CanControl', 'CanPause', 'CanPlay', 'CanSeek',\n 'CanGoNext', 'CanGoPrevious', 'MinimumRate', 'MaximumRate'];\n this.#addEventedPropertiesList(this.interfaces.player, eventedProps);\n }\n\n #addTracklistInterface(bus) {\n this.interfaces.tracklist = new TracklistInterface(this);\n this.#addEventedPropertiesList(this.interfaces.tracklist, ['CanEditTracks']);\n\n Object.defineProperty(this, 'tracks', {\n get: function() {\n return this._tracks;\n },\n set: function(value) {\n this._tracks = value;\n this.interfaces.tracklist.TrackListReplaced(value);\n },\n enumerable: true,\n configurable: true\n });\n }\n\n #addPlaylistsInterface(bus) {\n this.interfaces.playlists = new PlaylistsInterface(this);\n this.#addEventedPropertiesList(this.interfaces.playlists,\n ['PlaylistCount', 'ActivePlaylist']);\n }\n\n /**\n * Get a valid object path with the `subpath` as the basename which is suitable\n * for use as an id.\n *\n * @name Player#objectPath\n * @function\n * @param {String} subpath - The basename of this path\n * @returns {String} - A valid object path that can be used as an id.\n */\n objectPath(subpath) {\n let path = `/org/node/mediaplayer/${this.name}`;\n if (subpath) {\n path += `/${subpath}`;\n }\n return path;\n }\n\n #addEventedProperty(iface, name) {\n let localName = lcfirst(name);\n\n Object.defineProperty(this, localName, {\n get: function() {\n let value = iface[name];\n if (name === 'ActivePlaylist') {\n return types.playlistToPlain(value);\n } else if (name === 'Metadata') {\n return types.metadataToPlain(value);\n }\n return value;\n },\n set: function(value) {\n iface.setProperty(name, value);\n },\n enumerable: true,\n configurable: true\n });\n }\n\n #addEventedPropertiesList(iface, props) {\n for (let i = 0; i < props.length; i++) {\n this.#addEventedProperty(iface, props[i]);\n }\n }\n\n /**\n * Gets the position of this player. This method is intended to be overridden\n * by the user to return the position of the player in microseconds.\n *\n * @name Player#getPosition\n * @function\n * @returns {Number} - The current position of the player in microseconds. (Integer)\n */\n getPosition() {\n return 0;\n }\n\n /**\n * Emits the `Seeked` DBus signal to listening clients with the given position.\n *\n * @name Player#seeked\n * @function\n * @param {Number} position - The position in microseconds. (Integer)\n */\n seeked(position) {\n let seekTo = Math.floor(position || 0);\n if (isNaN(seekTo)) {\n throw new Error(`seeked expected a number (got ${position})`);\n }\n this.interfaces.player.Seeked(seekTo);\n }\n\n getTrackIndex(trackId) {\n for (let i = 0; i < this.tracks.length; i++) {\n let track = this.tracks[i];\n\n if (track['mpris:trackid'] === trackId) {\n return i;\n }\n }\n\n return -1;\n }\n\n getTrack(trackId) {\n return this.tracks[this.getTrackIndex(trackId)];\n }\n\n addTrack(track) {\n this.tracks.push(track);\n this.interfaces.tracklist.setTracks(this.tracks);\n\n let afterTrack = '/org/mpris/MediaPlayer2/TrackList/NoTrack';\n if (this.tracks.length > 2) {\n afterTrack = this.tracks[this.tracks.length - 2]['mpris:trackid'];\n }\n this.interfaces.tracklist.TrackAdded(afterTrack);\n }\n\n removeTrack(trackId) {\n let i = this.getTrackIndex(trackId);\n this.tracks.splice(i, 1);\n this.interfaces.tracklist.setTracks(this.tracks);\n\n this.interfaces.tracklist.TrackRemoved(trackId);\n }\n\n /**\n * Get the index of a playlist entry in the `playlists` list property of the\n * player from the given id.\n *\n * @name Player#getPlaylistIndex\n * @function\n * @param {String} playlistId - The id for the playlist entry.\n */\n getPlaylistIndex(playlistId) {\n for (let i = 0; i < this.playlists.length; i++) {\n let playlist = this.playlists[i];\n\n if (playlist.Id === playlistId) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Set the list of playlists advertised to listeners on the bus. Each playlist\n * must have string members `Id`, `Name`, and `Icon`.\n *\n * @name Player#setPlaylists\n * @function\n * @param {Array} playlists - A list of playlists.\n */\n setPlaylists(playlists) {\n this.playlists = playlists;\n this.playlistCount = playlists.length;\n\n this.playlists.forEach((playlist) => {\n if (playlist) {\n this.interfaces.playlists.PlaylistChanged(playlist);\n }\n });\n }\n\n /**\n * Set the playlist identified by `playlistId` to be the currently active\n * playlist.\n *\n * @name Player#setActivePlaylist\n * @function\n * @param {String} playlistId - The id of the playlist to activate.\n */\n setActivePlaylist(playlistId) {\n this.interfaces.playlists.setActivePlaylistId(playlistId);\n }\n\n /**\n * Enumerated value for the `playbackStatus` property of the player to indicate\n * a track is currently playing.\n *\n * @name Player#PLAYBACK_STATUS_PLAYING\n * @static\n * @constant\n */\n static PLAYBACK_STATUS_PLAYING = constants.PLAYBACK_STATUS_PLAYING;\n /**\n * Enumerated value for the `playbackStatus` property of the player to indicate\n * a track is currently paused.\n *\n * @name Player#PLAYBACK_STATUS_PAUSED\n * @static\n * @constant\n */\n static PLAYBACK_STATUS_PAUSED = constants.PLAYBACK_STATUS_PAUSED;\n\n /**\n * Enumerated value for the `playbackStatus` property of the player to indicate\n * there is no track currently playing.\n *\n * @name Player#PLAYBACK_STATUS_STOPPED\n * @static\n * @constant\n */\n static PLAYBACK_STATUS_STOPPED = constants.PLAYBACK_STATUS_STOPPED;\n\n /**\n * Enumerated value for the `loopStatus` property of the player to indicate\n * playback will stop when there are no more tracks to play.\n *\n * @name Player#LOOP_STATUS_NONE\n * @static\n * @constant\n */\n static LOOP_STATUS_NONE = constants.LOOP_STATUS_NONE;\n\n /**\n * Enumerated value for the `loopStatus` property of the player to indicate the\n * current track will start again from the beginning once it has finished\n * playing.\n *\n * @name Player#LOOP_STATUS_TRACK\n * @static\n * @constant\n */\n static LOOP_STATUS_TRACK = constants.LOOP_STATUS_TRACK;\n\n /**\n * Enumerated value for the `loopStatus` property of the player to indicate the\n * playback loops through a list of tracks.\n *\n * @name Player#LOOP_STATUS_PLAYLIST\n * @static\n * @constant\n */\n static LOOP_STATUS_PLAYLIST = constants.LOOP_STATUS_PLAYLIST;\n}\n\nmodule.exports = Player;"],"mappings":";;;;;;;;AAAAA,OAAO,CAAC,oBAAoB,CAAC,CAACC,OAAO,CAAC,CAAC;AAEvC,MAAM;EAAEC;AAAa,CAAC,GAAGF,OAAO,CAAC,QAAQ,CAAC;AAE1C,MAAMG,IAAI,GAAGH,OAAO,CAAC,uBAAuB,CAAC;AAC7C,MAAMI,eAAe,GAAGJ,OAAO,CAAC,qBAAqB,CAAC;AACtD,MAAMK,aAAa,GAAGL,OAAO,CAAC,mBAAmB,CAAC;AAClD,MAAMM,kBAAkB,GAAGN,OAAO,CAAC,wBAAwB,CAAC;AAC5D,MAAMO,kBAAkB,GAAGP,OAAO,CAAC,wBAAwB,CAAC;AAC5D,MAAMQ,KAAK,GAAGR,OAAO,CAAC,oBAAoB,CAAC;AAC3C,MAAMS,SAAS,GAAGT,OAAO,CAAC,aAAa,CAAC;AAExC,MAAMU,UAAU,GAAG,yBAAyB;AAE5C,SAASC,OAAOA,CAACC,GAAG,EAAE;EACpB,OAAOA,GAAG,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGD,GAAG,CAACE,SAAS,CAAC,CAAC,CAAC;AAChD;AAAC,IAAAC,aAAA,oBAAAC,OAAA;AAED,MAAMC,MAAM,SAASf,YAAY,CAAC;EAChC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AK,CAAC;MACrC;MACA,OAAOA,KAAK;IACd,CAAC;IACDD,GAAG,EAAE,SAAAA,CAASC,KAAK,EAAE;MACnB3D,KAAK,CAACmE,WAAW,CAAC3F,IAAI,EAAEmF,KAAK,CAAC;IAChC,CAAC;IACDE,UAAU,EAAE,IAAI;IAChBC,YAAY,EAAE;EAChB,CAAC,CAAC;AACJ;AAAC,SAAAR,0BAEyBtD,KAAK,EAAEoE,KAAK,EAAE;EACtC,KAAK,IAAIzC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGyC,KAAK,CAACvC,MAAM,EAAEF,CAAC,EAAE,EAAE;IACrCrC,iBAAA,CAAApB,aAAA,MAAI,EAAC6F,mBAAkB,CAAC,CAAAvE,IAAA,CAAxB,IAAI,EAAqBQ,KAAK,EAAEoE,KAAK,CAACzC,CAAC,CAAC;EAC1C;AACF;AAAC0C,eAAA,CA1RGjG,MAAM,6BAqZuBR,SAAS,CAAC0G,uBAAuB;AAClE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPED,eAAA,CAtZIjG,MAAM,4BA8ZsBR,SAAS,CAAC2G,sBAAsB;AAEhE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPEF,eAAA,CAhaIjG,MAAM,6BAwauBR,SAAS,CAAC4G,uBAAuB;AAElE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPEH,eAAA,CA1aIjG,MAAM,sBAkbgBR,SAAS,CAAC6G,gBAAgB;AAEpD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAREJ,eAAA,CApbIjG,MAAM,uBA6biBR,SAAS,CAAC8G,iBAAiB;AAEtD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPEL,eAAA,CA/bIjG,MAAM,0BAucoBR,SAAS,CAAC+G,oBAAoB;AAG9DC,MAAM,CAACC,OAAO,GAAGzG,MAAM","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- const dbus = require('dbus-next');
3
+ const dbus = require('@jellybrick/dbus-next');
4
4
  const types = require('./types');
5
5
  const deepEqual = require('deep-equal');
6
6
  const constants = require('../constants');
@@ -1 +1 @@
1
- {"version":3,"file":"mpris-interface.js","names":["dbus","require","types","deepEqual","constants","logging","Interface","interface","MprisInterface","constructor","name","player","_setPropertyInternal","property","valueDbus","emit","toLowerCase","substring","setProperty","valuePlain","metadataToDbus","playlistToDbus","emptyPlaylist","filter","t","map","isLoopStatusValid","warn","isPlaybackStatusValid","changedProperties","emitPropertiesChanged","module","exports"],"sourceRoot":"../../src/","sources":["interfaces/mpris-interface.js"],"sourcesContent":["const dbus = require('dbus-next');\nconst types = require('./types');\nconst deepEqual = require('deep-equal');\nconst constants = require('../constants');\nconst logging = require('../logging');\n\nconst { Interface } = dbus.interface;\n\nclass MprisInterface extends Interface {\n constructor(name, player) {\n super(name);\n this.player = player;\n }\n\n _setPropertyInternal(property, valueDbus) {\n // nothing is currently settable internally that needs conversion to plain\n this.player.emit(property[0].toLowerCase() + property.substring(1), valueDbus);\n }\n\n setProperty(property, valuePlain) {\n // convert the plain value to a dbus value (default to the plain value)\n let valueDbus = valuePlain;\n\n if (property === 'Metadata') {\n valueDbus = types.metadataToDbus(valuePlain);\n } else if (property === 'ActivePlaylist') {\n if (valuePlain) {\n valueDbus = [ true, types.playlistToDbus(valuePlain) ];\n } else {\n valueDbus = [ false, types.emptyPlaylist ];\n }\n } else if (property === 'Tracks') {\n valueDbus =\n valuePlain.filter((t) => t['mpris:trackid']).map((t) => t['mpris:trackid']);\n }\n\n if (!deepEqual(this[`_${property}`], valueDbus)) {\n this[`_${property}`] = valueDbus;\n\n if (property === 'LoopStatus' && !constants.isLoopStatusValid(valuePlain)) {\n logging.warn(`setting player loop status to an invalid value: ${valuePlain}`);\n } else if (property === 'PlaybackStatus' && !constants.isPlaybackStatusValid(valuePlain)) {\n logging.warn(`setting player playback status to an invalid value: ${valuePlain}`);\n } else {\n let changedProperties = {};\n changedProperties[property] = valueDbus;\n Interface.emitPropert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MAChCC,SAAS,GACPK,UAAU,CAACI,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAAC,eAAe,CAAC,CAAC,CAACC,GAAG,CAAED,CAAC,IAAKA,CAAC,CAAC,eAAe,CAAC,CAAC;IAC/E;IAEA,IAAI,CAACrB,SAAS,CAAC,IAAI,CAAE,IAAGU,QAAS,EAAC,CAAC,EAAEC,SAAS,CAAC,EAAE;MAC/C,IAAI,CAAE,IAAGD,QAAS,EAAC,CAAC,GAAGC,SAAS;MAEhC,IAAID,QAAQ,KAAK,YAAY,IAAI,CAACT,SAAS,CAACsB,iBAAiB,CAACP,UAAU,CAAC,EAAE;QACzEd,OAAO,CAACsB,IAAI,CAAE,mDAAkDR,UAAW,EAAC,CAAC;MAC/E,CAAC,MAAM,IAAIN,QAAQ,KAAK,gBAAgB,IAAI,CAACT,SAAS,CAACwB,qBAAqB,CAACT,UAAU,CAAC,EAAE;QACxFd,OAAO,CAACsB,IAAI,CAAE,uDAAsDR,UAAW,EAAC,CAAC;MACnF,CAAC,MAAM;QACL,IAAIU,iBAAiB,GAAG,CAAC,CAAC;QAC1BA,iBAAiB,CAAChB,QAAQ,CAAC,GAAGC,SAAS;QACvCR,SAAS,CAACwB,qBAAqB,CAAC,IAAI,EAAED,iBAAiB,CAAC;MAC1D;IACF;EACF;AACF;AAEAE,MAAM,CAACC,OAAO,GAAGxB,cAAc"}
1
+ {"version":3,"file":"mpris-interface.js","names":["dbus","require","types","deepEqual","constants","logging","Interface","interface","MprisInterface","constructor","name","player","_setPropertyInternal","property","valueDbus","emit","toLowerCase","substring","setProperty","valuePlain","metadataToDbus","playlistToDbus","emptyPlaylist","filter","t","map","isLoopStatusValid","warn","isPlaybackStatusValid","changedProperties","emitPropertiesChanged","module","exports"],"sourceRoot":"../../src/","sources":["interfaces/mpris-interface.js"],"sourcesContent":["const dbus = require('@jellybrick/dbus-next');\nconst types = require('./types');\nconst deepEqual = require('deep-equal');\nconst constants = require('../constants');\nconst logging = require('../logging');\n\nconst { Interface } = dbus.interface;\n\nclass MprisInterface extends Interface {\n constructor(name, player) {\n super(name);\n this.player = player;\n }\n\n _setPropertyInternal(property, valueDbus) {\n // nothing is currently settable internally that needs conversion to plain\n this.player.emit(property[0].toLowerCase() + property.substring(1), valueDbus);\n }\n\n setProperty(property, valuePlain) {\n // convert the plain value to a dbus value (default to the plain value)\n let valueDbus = valuePlain;\n\n if (property === 'Metadata') {\n valueDbus = types.metadataToDbus(valuePlain);\n } else if (property === 'ActivePlaylist') {\n if (valuePlain) {\n valueDbus = [ true, types.playlistToDbus(valuePlain) ];\n } else {\n valueDbus = [ false, types.emptyPlaylist ];\n }\n } else if (property === 'Tracks') {\n valueDbus =\n valuePlain.filter((t) => t['mpris:trackid']).map((t) => t['mpris:trackid']);\n }\n\n if (!deepEqual(this[`_${property}`], valueDbus)) {\n this[`_${property}`] = valueDbus;\n\n if (property === 'LoopStatus' && !constants.isLoopStatusValid(valuePlain)) {\n logging.warn(`setting player loop status to an invalid value: ${valuePlain}`);\n } else if (property === 'PlaybackStatus' && !constants.isPlaybackStatusValid(valuePlain)) {\n logging.warn(`setting player playback status to an invalid value: ${valuePlain}`);\n } else {\n let changedProperties = {};\n changedProperties[property] = valueDbus;\n Interface.emitPropertiesChanged(this, changedProperties);\n }\n }\n }\n}\n\nmodule.exports = MprisInterface;\n"],"mappings":";;AAAA,MAAMA,IAAI,GAAGC,OAAO,CAAC,uBAAuB,CAAC;AAC7C,MAAMC,KAAK,GAAGD,OAAO,CAAC,SAAS,CAAC;AAChC,MAAME,SAAS,GAAGF,OAAO,CAAC,YAAY,CAAC;AACvC,MAAMG,SAAS,GAAGH,OAAO,CAAC,cAAc,CAAC;AACzC,MAAMI,OAAO,GAAGJ,OAAO,CAAC,YAAY,CAAC;AAErC,MAAM;EAAEK;AAAU,CAAC,GAAGN,IAAI,CAACO,SAAS;AAEpC,MAAMC,cAAc,SAASF,SAAS,CAAC;EACrCG,WAAWA,CAACC,IAAI,EAAEC,MAAM,EAAE;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MAC/E,CAAC,MAAM,IAAIN,QAAQ,KAAK,gBAAgB,IAAI,CAACT,SAAS,CAACwB,qBAAqB,CAACT,UAAU,CAAC,EAAE;QACxFd,OAAO,CAACsB,IAAI,CAAC,uDAAuDR,UAAU,EAAE,CAAC;MACnF,CAAC,MAAM;QACL,IAAIU,iBAAiB,GAAG,CAAC,CAAC;QAC1BA,iBAAiB,CAAChB,QAAQ,CAAC,GAAGC,SAAS;QACvCR,SAAS,CAACwB,qBAAqB,CAAC,IAAI,EAAED,iBAAiB,CAAC;MAC1D;IACF;EACF;AACF;AAEAE,MAAM,CAACC,OAAO,GAAGxB,cAAc","ignoreList":[]}
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
 
3
- function _decorate(decorators, factory, superClass, mixins) { var api = _getDecoratorsApi(); if (mixins) { for (var i = 0; i < mixins.length; i++) { api = mixins[i](api); } } var r = factory(function initialize(O) { api.initializeInstanceElements(O, decorated.elements); }, superClass); var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); api.initializeClassElements(r.F, decorated.elements); return api.runClassFinishers(r.F, decorated.finishers); }
4
- function _getDecoratorsApi() { _getDecoratorsApi = function () { return api; }; var api = { elementsDefinitionOrder: [["method"], ["field"]], initializeInstanceElements: function (O, elements) { ["method", "field"].forEach(function (kind) { elements.forEach(function (element) { if (element.kind === kind && element.placement === "own") { this.defineClassElement(O, element); } }, this); }, this); }, initializeClassElements: function (F, elements) { var proto = F.prototype; ["method", "field"].forEach(function (kind) { elements.forEach(function (element) { var placement = element.placement; if (element.kind === kind && (placement === "static" || placement === "prototype")) { var receiver = placement === "static" ? F : proto; this.defineClassElement(receiver, element); } }, this); }, this); }, defineClassElement: function (receiver, element) { var descriptor = element.descriptor; if (element.kind === "field") { var initializer = element.initializer; descriptor = { enumerable: descriptor.enumerable, writable: descriptor.writable, configurable: descriptor.configurable, value: initializer === void 0 ? void 0 : initializer.call(receiver) }; } Object.defineProperty(receiver, element.key, descriptor); }, decorateClass: function (elements, decorators) { var newElements = []; var finishers = []; var placements = { static: [], prototype: [], own: [] }; elements.forEach(function (element) { this.addElementPlacement(element, placements); }, this); elements.forEach(function (element) { if (!_hasDecorators(element)) return newElements.push(element); var elementFinishersExtras = this.decorateElement(element, placements); newElements.push(elementFinishersExtras.element); newElements.push.apply(newElements, elementFinishersExtras.extras); finishers.push.apply(finishers, elementFinishersExtras.finishers); }, this); if (!decorators) { return { elements: newElements, finishers: finishers }; } var result = this.decorateConstructor(newElements, decorators); finishers.push.apply(finishers, result.finishers); result.finishers = finishers; return result; }, addElementPlacement: function (element, placements, silent) { var keys = placements[element.placement]; if (!silent && keys.indexOf(element.key) !== -1) { throw new TypeError("Duplicated element (" + element.key + ")"); } keys.push(element.key); }, decorateElement: function (element, placements) { var extras = []; var finishers = []; for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { var keys = placements[element.placement]; keys.splice(keys.indexOf(element.key), 1); var elementObject = this.fromElementDescriptor(element); var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); element = elementFinisherExtras.element; this.addElementPlacement(element, placements); if (elementFinisherExtras.finisher) { finishers.push(elementFinisherExtras.finisher); } var newExtras = elementFinisherExtras.extras; if (newExtras) { for (var j = 0; j < newExtras.length; j++) { this.addElementPlacement(newExtras[j], placements); } extras.push.apply(extras, newExtras); } } return { element: element, finishers: finishers, extras: extras }; }, decorateConstructor: function (elements, decorators) { var finishers = []; for (var i = decorators.length - 1; i >= 0; i--) { var obj = this.fromClassDescriptor(elements); var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); if (elementsAndFinisher.finisher !== undefined) { finishers.push(elementsAndFinisher.finisher); } if (elementsAndFinisher.elements !== undefined) { elements = elementsAndFinisher.elements; for (var j = 0; j < elements.length - 1; j++) { for (var k = j + 1; k < elements.length; k++) { if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { throw new TypeError("Duplicated element (" + elements[j].key + ")"); } } } } } return { elements: elements, finishers: finishers }; }, fromElementDescriptor: function (element) { var obj = { kind: element.kind, key: element.key, placement: element.placement, descriptor: element.descriptor }; var desc = { value: "Descriptor", configurable: true }; Object.defineProperty(obj, Symbol.toStringTag, desc); if (element.kind === "field") obj.initializer = element.initializer; return obj; }, toElementDescriptors: function (elementObjects) { if (elementObjects === undefined) return; return _toArray(elementObjects).map(function (elementObject) { var element = this.toElementDescriptor(elementObject); this.disallowProperty(elementObject, "finisher", "An element descriptor"); this.disallowProperty(elementObject, "extras", "An element descriptor"); return element; }, this); }, toElementDescriptor: function (elementObject) { var kind = String(elementObject.kind); if (kind !== "method" && kind !== "field") { throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); } var key = _toPropertyKey(elementObject.key); var placement = String(elementObject.placement); if (placement !== "static" && placement !== "prototype" && placement !== "own") { throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); } var descriptor = elementObject.descriptor; this.disallowProperty(elementObject, "elements", "An element descriptor"); var element = { kind: kind, key: key, placement: placement, descriptor: Object.assign({}, descriptor) }; if (kind !== "field") { this.disallowProperty(elementObject, "initializer", "A method descriptor"); } else { this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); element.initializer = elementObject.initializer; } return element; }, toElementFinisherExtras: function (elementObject) { var element = this.toElementDescriptor(elementObject); var finisher = _optionalCallableProperty(elementObject, "finisher"); var extras = this.toElementDescriptors(elementObject.extras); return { element: element, finisher: finisher, extras: extras }; }, fromClassDescriptor: function (elements) { var obj = { kind: "class", elements: elements.map(this.fromElementDescriptor, this) }; var desc = { value: "Descriptor", configurable: true }; Object.defineProperty(obj, Symbol.toStringTag, desc); return obj; }, toClassDescriptor: function (obj) { var kind = String(obj.kind); if (kind !== "class") { throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); } this.disallowProperty(obj, "key", "A class descriptor"); this.disallowProperty(obj, "placement", "A class descriptor"); this.disallowProperty(obj, "descriptor", "A class descriptor"); this.disallowProperty(obj, "initializer", "A class descriptor"); this.disallowProperty(obj, "extras", "A class descriptor"); var finisher = _optionalCallableProperty(obj, "finisher"); var elements = this.toElementDescriptors(obj.elements); return { elements: elements, finisher: finisher }; }, runClassFinishers: function (constructor, finishers) { for (var i = 0; i < finishers.length; i++) { var newConstructor = (0, finishers[i])(constructor); if (newConstructor !== undefined) { if (typeof newConstructor !== "function") { throw new TypeError("Finishers must return a constructor."); } constructor = newConstructor; } } return constructor; }, disallowProperty: function (obj, name, objectType) { if (obj[name] !== undefined) { throw new TypeError(objectType + " can't have a ." + name + " property."); } } }; return api; }
5
- function _createElementDescriptor(def) { var key = _toPropertyKey(def.key); var descriptor; if (def.kind === "method") { descriptor = { value: def.value, writable: true, configurable: true, enumerable: false }; } else if (def.kind === "get") { descriptor = { get: def.value, configurable: true, enumerable: false }; } else if (def.kind === "set") { descriptor = { set: def.value, configurable: true, enumerable: false }; } else if (def.kind === "field") { descriptor = { configurable: true, writable: true, enumerable: true }; } var element = { kind: def.kind === "field" ? "field" : "method", key: key, placement: def.static ? "static" : def.kind === "field" ? "own" : "prototype", descriptor: descriptor }; if (def.decorators) element.decorators = def.decorators; if (def.kind === "field") element.initializer = def.value; return element; }
6
- function _coalesceGetterSetter(element, other) { if (element.descriptor.get !== undefined) { other.descriptor.get = element.descriptor.get; } else { other.descriptor.set = element.descriptor.set; } }
7
- function _coalesceClassElements(elements) { var newElements = []; var isSameElement = function (other) { return other.kind === "method" && other.key === element.key && other.placement === element.placement; }; for (var i = 0; i < elements.length; i++) { var element = elements[i]; var other; if (element.kind === "method" && (other = newElements.find(isSameElement))) { if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { if (_hasDecorators(element) || _hasDecorators(other)) { throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); } other.descriptor = element.descriptor; } else { if (_hasDecorators(element)) { if (_hasDecorators(other)) { throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); } other.decorators = element.decorators; } _coalesceGetterSetter(element, other); } } else { newElements.push(element); } } return newElements; }
8
- function _hasDecorators(element) { return element.decorators && element.decorators.length; }
9
- function _isDataDescriptor(desc) { return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); }
10
- function _optionalCallableProperty(obj, name) { var value = obj[name]; if (value !== undefined && typeof value !== "function") { throw new TypeError("Expected '" + name + "' to be a function"); } return value; }
11
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
- function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
3
+ function _decorate(e, r, t, i) { var o = _getDecoratorsApi(); if (i) for (var n = 0; n < i.length; n++) o = i[n](o); var s = r(function (e) { o.initializeInstanceElements(e, a.elements); }, t), a = o.decorateClass(_coalesceClassElements(s.d.map(_createElementDescriptor)), e); return o.initializeClassElements(s.F, a.elements), o.runClassFinishers(s.F, a.finishers); }
4
+ function _getDecoratorsApi() { _getDecoratorsApi = function () { return e; }; var e = { elementsDefinitionOrder: [["method"], ["field"]], initializeInstanceElements: function (e, r) { ["method", "field"].forEach(function (t) { r.forEach(function (r) { r.kind === t && "own" === r.placement && this.defineClassElement(e, r); }, this); }, this); }, initializeClassElements: function (e, r) { var t = e.prototype; ["method", "field"].forEach(function (i) { r.forEach(function (r) { var o = r.placement; if (r.kind === i && ("static" === o || "prototype" === o)) { var n = "static" === o ? e : t; this.defineClassElement(n, r); } }, this); }, this); }, defineClassElement: function (e, r) { var t = r.descriptor; if ("field" === r.kind) { var i = r.initializer; t = { enumerable: t.enumerable, writable: t.writable, configurable: t.configurable, value: void 0 === i ? void 0 : i.call(e) }; } Object.defineProperty(e, r.key, t); }, decorateClass: function (e, r) { var t = [], i = [], o = { static: [], prototype: [], own: [] }; if (e.forEach(function (e) { this.addElementPlacement(e, o); }, this), e.forEach(function (e) { if (!_hasDecorators(e)) return t.push(e); var r = this.decorateElement(e, o); t.push(r.element), t.push.apply(t, r.extras), i.push.apply(i, r.finishers); }, this), !r) return { elements: t, finishers: i }; var n = this.decorateConstructor(t, r); return i.push.apply(i, n.finishers), n.finishers = i, n; }, addElementPlacement: function (e, r, t) { var i = r[e.placement]; if (!t && -1 !== i.indexOf(e.key)) throw new TypeError("Duplicated element (" + e.key + ")"); i.push(e.key); }, decorateElement: function (e, r) { for (var t = [], i = [], o = e.decorators, n = o.length - 1; n >= 0; n--) { var s = r[e.placement]; s.splice(s.indexOf(e.key), 1); var a = this.fromElementDescriptor(e), l = this.toElementFinisherExtras((0, o[n])(a) || a); e = l.element, this.addElementPlacement(e, r), l.finisher && i.push(l.finisher); var c = l.extras; if (c) { for (var p = 0; p < c.length; p++) this.addElementPlacement(c[p], r); t.push.apply(t, c); } } return { element: e, finishers: i, extras: t }; }, decorateConstructor: function (e, r) { for (var t = [], i = r.length - 1; i >= 0; i--) { var o = this.fromClassDescriptor(e), n = this.toClassDescriptor((0, r[i])(o) || o); if (void 0 !== n.finisher && t.push(n.finisher), void 0 !== n.elements) { e = n.elements; for (var s = 0; s < e.length - 1; s++) for (var a = s + 1; a < e.length; a++) if (e[s].key === e[a].key && e[s].placement === e[a].placement) throw new TypeError("Duplicated element (" + e[s].key + ")"); } } return { elements: e, finishers: t }; }, fromElementDescriptor: function (e) { var r = { kind: e.kind, key: e.key, placement: e.placement, descriptor: e.descriptor }; return Object.defineProperty(r, Symbol.toStringTag, { value: "Descriptor", configurable: !0 }), "field" === e.kind && (r.initializer = e.initializer), r; }, toElementDescriptors: function (e) { if (void 0 !== e) return _toArray(e).map(function (e) { var r = this.toElementDescriptor(e); return this.disallowProperty(e, "finisher", "An element descriptor"), this.disallowProperty(e, "extras", "An element descriptor"), r; }, this); }, toElementDescriptor: function (e) { var r = e.kind + ""; if ("method" !== r && "field" !== r) throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "' + r + '"'); var t = _toPropertyKey(e.key), i = e.placement + ""; if ("static" !== i && "prototype" !== i && "own" !== i) throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "' + i + '"'); var o = e.descriptor; this.disallowProperty(e, "elements", "An element descriptor"); var n = { kind: r, key: t, placement: i, descriptor: Object.assign({}, o) }; return "field" !== r ? this.disallowProperty(e, "initializer", "A method descriptor") : (this.disallowProperty(o, "get", "The property descriptor of a field descriptor"), this.disallowProperty(o, "set", "The property descriptor of a field descriptor"), this.disallowProperty(o, "value", "The property descriptor of a field descriptor"), n.initializer = e.initializer), n; }, toElementFinisherExtras: function (e) { return { element: this.toElementDescriptor(e), finisher: _optionalCallableProperty(e, "finisher"), extras: this.toElementDescriptors(e.extras) }; }, fromClassDescriptor: function (e) { var r = { kind: "class", elements: e.map(this.fromElementDescriptor, this) }; return Object.defineProperty(r, Symbol.toStringTag, { value: "Descriptor", configurable: !0 }), r; }, toClassDescriptor: function (e) { var r = e.kind + ""; if ("class" !== r) throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "' + r + '"'); this.disallowProperty(e, "key", "A class descriptor"), this.disallowProperty(e, "placement", "A class descriptor"), this.disallowProperty(e, "descriptor", "A class descriptor"), this.disallowProperty(e, "initializer", "A class descriptor"), this.disallowProperty(e, "extras", "A class descriptor"); var t = _optionalCallableProperty(e, "finisher"); return { elements: this.toElementDescriptors(e.elements), finisher: t }; }, runClassFinishers: function (e, r) { for (var t = 0; t < r.length; t++) { var i = (0, r[t])(e); if (void 0 !== i) { if ("function" != typeof i) throw new TypeError("Finishers must return a constructor."); e = i; } } return e; }, disallowProperty: function (e, r, t) { if (void 0 !== e[r]) throw new TypeError(t + " can't have a ." + r + " property."); } }; return e; }
5
+ function _createElementDescriptor(e) { var r, t = _toPropertyKey(e.key); "method" === e.kind ? r = { value: e.value, writable: !0, configurable: !0, enumerable: !1 } : "get" === e.kind ? r = { get: e.value, configurable: !0, enumerable: !1 } : "set" === e.kind ? r = { set: e.value, configurable: !0, enumerable: !1 } : "field" === e.kind && (r = { configurable: !0, writable: !0, enumerable: !0 }); var i = { kind: "field" === e.kind ? "field" : "method", key: t, placement: e.static ? "static" : "field" === e.kind ? "own" : "prototype", descriptor: r }; return e.decorators && (i.decorators = e.decorators), "field" === e.kind && (i.initializer = e.value), i; }
6
+ function _coalesceGetterSetter(e, r) { void 0 !== e.descriptor.get ? r.descriptor.get = e.descriptor.get : r.descriptor.set = e.descriptor.set; }
7
+ function _coalesceClassElements(e) { for (var r = [], isSameElement = function (e) { return "method" === e.kind && e.key === o.key && e.placement === o.placement; }, t = 0; t < e.length; t++) { var i, o = e[t]; if ("method" === o.kind && (i = r.find(isSameElement))) { if (_isDataDescriptor(o.descriptor) || _isDataDescriptor(i.descriptor)) { if (_hasDecorators(o) || _hasDecorators(i)) throw new ReferenceError("Duplicated methods (" + o.key + ") can't be decorated."); i.descriptor = o.descriptor; } else { if (_hasDecorators(o)) { if (_hasDecorators(i)) throw new ReferenceError("Decorators can't be placed on different accessors with for the same property (" + o.key + ")."); i.decorators = o.decorators; } _coalesceGetterSetter(o, i); } } else r.push(o); } return r; }
8
+ function _hasDecorators(e) { return e.decorators && e.decorators.length; }
9
+ function _isDataDescriptor(e) { return void 0 !== e && !(void 0 === e.value && void 0 === e.writable); }
10
+ function _optionalCallableProperty(e, r) { var t = e[r]; if (void 0 !== t && "function" != typeof t) throw new TypeError("Expected '" + r + "' to be a function"); return t; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
12
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
+ function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
14
14
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
17
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
18
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
- const dbus = require('dbus-next');
15
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
16
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
17
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
18
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
19
+ const dbus = require('@jellybrick/dbus-next');
20
20
  const MprisInterface = require('./mpris-interface');
21
21
  const constants = require('../constants');
22
22
  const {
@@ -126,7 +126,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
126
126
  access: ACCESS_READ
127
127
  })],
128
128
  key: "CanControl",
129
- value: function CanControl() {
129
+ value: function () {
130
130
  return this._CanControl;
131
131
  }
132
132
  }, {
@@ -136,7 +136,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
136
136
  access: ACCESS_READ
137
137
  })],
138
138
  key: "CanPause",
139
- value: function CanPause() {
139
+ value: function () {
140
140
  return this._CanPause;
141
141
  }
142
142
  }, {
@@ -146,7 +146,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
146
146
  access: ACCESS_READ
147
147
  })],
148
148
  key: "CanPlay",
149
- value: function CanPlay() {
149
+ value: function () {
150
150
  return this._CanPlay;
151
151
  }
152
152
  }, {
@@ -156,7 +156,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
156
156
  access: ACCESS_READ
157
157
  })],
158
158
  key: "CanSeek",
159
- value: function CanSeek() {
159
+ value: function () {
160
160
  return this._CanSeek;
161
161
  }
162
162
  }, {
@@ -166,7 +166,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
166
166
  access: ACCESS_READ
167
167
  })],
168
168
  key: "CanGoNext",
169
- value: function CanGoNext() {
169
+ value: function () {
170
170
  return this._CanGoNext;
171
171
  }
172
172
  }, {
@@ -176,7 +176,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
176
176
  access: ACCESS_READ
177
177
  })],
178
178
  key: "CanGoPrevious",
179
- value: function CanGoPrevious() {
179
+ value: function () {
180
180
  return this._CanGoPrevious;
181
181
  }
182
182
  }, {
@@ -186,7 +186,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
186
186
  access: ACCESS_READ
187
187
  })],
188
188
  key: "Metadata",
189
- value: function Metadata() {
189
+ value: function () {
190
190
  return this._Metadata;
191
191
  }
192
192
  }, {
@@ -196,7 +196,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
196
196
  access: ACCESS_READ
197
197
  })],
198
198
  key: "MaximumRate",
199
- value: function MaximumRate() {
199
+ value: function () {
200
200
  return this._MaximumRate;
201
201
  }
202
202
  }, {
@@ -206,7 +206,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
206
206
  access: ACCESS_READ
207
207
  })],
208
208
  key: "MinimumRate",
209
- value: function MinimumRate() {
209
+ value: function () {
210
210
  return this._MinimumRate;
211
211
  }
212
212
  }, {
@@ -215,13 +215,13 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
215
215
  signature: 'd'
216
216
  })],
217
217
  key: "Rate",
218
- value: function Rate() {
218
+ value: function () {
219
219
  return this._Rate;
220
220
  }
221
221
  }, {
222
222
  kind: "set",
223
223
  key: "Rate",
224
- value: function Rate(value) {
224
+ value: function (value) {
225
225
  this._setPropertyInternal('Rate', value);
226
226
  }
227
227
  }, {
@@ -230,13 +230,13 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
230
230
  signature: 'b'
231
231
  })],
232
232
  key: "Shuffle",
233
- value: function Shuffle() {
233
+ value: function () {
234
234
  return this._Shuffle;
235
235
  }
236
236
  }, {
237
237
  kind: "set",
238
238
  key: "Shuffle",
239
- value: function Shuffle(value) {
239
+ value: function (value) {
240
240
  this._setPropertyInternal('Shuffle', value);
241
241
  }
242
242
  }, {
@@ -245,13 +245,13 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
245
245
  signature: 'd'
246
246
  })],
247
247
  key: "Volume",
248
- value: function Volume() {
248
+ value: function () {
249
249
  return this._Volume;
250
250
  }
251
251
  }, {
252
252
  kind: "set",
253
253
  key: "Volume",
254
- value: function Volume(value) {
254
+ value: function (value) {
255
255
  this._setPropertyInternal('Volume', value);
256
256
  }
257
257
  }, {
@@ -261,7 +261,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
261
261
  access: ACCESS_READ
262
262
  })],
263
263
  key: "Position",
264
- value: function Position() {
264
+ value: function () {
265
265
  let playerPosition = this.player.getPosition();
266
266
  let position = Math.floor(playerPosition || 0);
267
267
  if (isNaN(position)) {
@@ -277,7 +277,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
277
277
  signature: 's'
278
278
  })],
279
279
  key: "LoopStatus",
280
- value: function LoopStatus() {
280
+ value: function () {
281
281
  if (!constants.isLoopStatusValid(this._LoopStatus)) {
282
282
  const err = 'github.mpris_service.InvalidLoopStatusError';
283
283
  const message = `The player has set an invalid loop status: ${this._LoopStatus}`;
@@ -288,7 +288,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
288
288
  }, {
289
289
  kind: "set",
290
290
  key: "LoopStatus",
291
- value: function LoopStatus(value) {
291
+ value: function (value) {
292
292
  if (!constants.isLoopStatusValid(value)) {
293
293
  const err = 'github.mpris_service.InvalidLoopStatusError';
294
294
  const message = `Tried to set loop status to an invalid value: ${value}`;
@@ -303,7 +303,7 @@ let PlayerInterface = _decorate(null, function (_initialize, _MprisInterface) {
303
303
  access: ACCESS_READ
304
304
  })],
305
305
  key: "PlaybackStatus",
306
- value: function PlaybackStatus() {
306
+ value: function () {
307
307
  if (!constants.isPlaybackStatusValid(this._PlaybackStatus)) {
308
308
  const err = 'github.mpris_service.InvalidPlaybackStatusError';
309
309
  const message = `The player has set an invalid playback status: ${this._PlaybackStatus}`;