JavaScript based MPRIS service
// TODO: If we come back to resume this, we had started PlayerInterface
(haven't touched TrackList
nor Playlists
yet). Methods are set up, properties are not. We need to add tests for methods. We can base everything off of work in RootInterface
// TODO: Add back array handling
// TODO: Handle and document Set
actions (from our API, not a client) for the interfaces (e.g. updating Fullscreen
status)
// mrpisService.Root.Set('Fullscreen', true);
// Updates value, notifies DBus...Properties
// TODO: Take care of all TODOs
Missing/broken features:
GetAll
not supported forRoot
- TODO: Link to upstream issue
- Using
Set
on properties not supported- As a result, changes to
Fullscreen
etc will not be supported - TODO: Link to upstream issue
- As a result, changes to
Install the module with: npm install mpris-service.js
var mprisService = require('mpris-service.js');
mprisService(); // 'awesome'
We export a MprisService
constructor as our module.exports
Constructor a new MprisService
. It creates a DBus connection and sets up its interfaces. However, we don't request a name from DBus.
- params
Object
- Container for parameters- Root
Object
- Container for methods/properties for our the rootMediaPlayer2
interface- See RootInterface for documentation
- TODO: Document
TrackList
,Playlists
- Root
Interface implementation for MediaPlayer2
http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html
- params
Object
- Same parameters asnew MprisService(params)
- Root
Object
- Container for parameters specific toRootInterface
- Raise
Function
- Optional method to invoke to raise our media player- If this is provided, we will set
CanRaise
totrue
- Otherwise,
CanRaise
will befalse
- If this is provided, we will set
- Quit
Function
- Optional method to invoke to quit our media player- If this is provided, we will set
CanQuit
totrue
- Otherwise,
CanQuit
will befalse
- If this is provided, we will set
- Fullscreen
Boolean
- Optional boolean indicating fullscreen status- If this is provided, then
CanSetFullscreen
must be set as well - Due to upstream issues, we cannot handle write actions
- If this is provided, then
- CanSetFullscreen
Boolean
- Optional boolean indicating that fullscreen status can remotely be set- If this is provided, then
Fullscreen
must be set as well
- If this is provided, then
- Identity
String
- Human friendly name to identify media player by- For example, "google-music-electron"
- If this is not provided, we will use
params.name
- http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:Identity
- DesktopEntry
String
- Optional basename of corresponding desktop entry- For example,
/usr/share/applications/vlc.desktop
should havevlc
as itsDesktopEntry
- http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry
- For example,
- SupportedUriSchemes
Array<String>
- Array of strings indicating URI schemes supported by the media player- For example,
['file', 'http']
indicates thatfile://
andhttp://
URI schemes are supported - If this is not provided, then we will use an empty array (i.e.
[]
) - http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:SupportedUriSchemes
- For example,
- SupportedMimeTypes
Array<String>
- Array of strings indicating mime-types supported by the media player- For example,
['audio/mpeg', 'application/ogg']
indicates MPEG and OGG files are supported - If this is not provided, then we will use an empty array (i.e.
[]
) - http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:SupportedUriSchemes
- For example,
- Raise
- TrackList
Object
- Container for parameters specific toTrackListInterface
- If this is provided, then we will set
HasTrackList
totrue
- Otherwise,
HasTrackList
will befalse
- If this is provided, then we will set
- Root
(Coming soon)
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via npm run lint
and test via npm test
.
Support this project and others by twolfson via gratipay.
As of Jan 06 2016, Todd Wolfson has released this repository and its contents to the public domain.
It has been released under the UNLICENSE.