@@ -4,10 +4,10 @@ declare module '@jellybrick/mpris-service' {
44 import { interface as dbusInterface } from 'dbus-next' ;
55
66 interface RootInterfaceOptions {
7- identity : string ;
8- supportedUriSchemes : string [ ] ;
9- supportedMimeTypes : string [ ] ;
10- desktopEntry : string ;
7+ identity ? : string ;
8+ supportedUriSchemes ? : string [ ] ;
9+ supportedMimeTypes ? : string [ ] ;
10+ desktopEntry ? : string ;
1111 }
1212
1313 export interface Track {
@@ -35,6 +35,32 @@ declare module '@jellybrick/mpris-service' {
3535 'xesam:userRating' ?: number ;
3636 }
3737
38+ export type PlayBackStatus = 'Playing' | 'Paused' | 'Stopped' ;
39+
40+ export type LoopStatus = 'None' | 'Track' | 'Playlist' ;
41+
42+ export const PLAYBACK_STATUS_PLAYING : 'Playing' ;
43+ export const PLAYBACK_STATUS_PAUSED : 'Paused' ;
44+ export const PLAYBACK_STATUS_STOPPED : 'Stopped' ;
45+
46+ export const LOOP_STATUS_NONE : 'None' ;
47+ export const LOOP_STATUS_TRACK : 'Track' ;
48+ export const LOOP_STATUS_PLAYLIST : 'Playlist' ;
49+
50+ export type Interfaces = 'player' | 'trackList' | 'playlists' ;
51+
52+ export interface AdditionalPlayerOptions {
53+ name : string ;
54+ supportedInterfaces : Interfaces [ ] ;
55+ }
56+
57+ export type PlayerOptions = RootInterfaceOptions & AdditionalPlayerOptions ;
58+
59+ export interface Position {
60+ trackId : string ;
61+ position : number ;
62+ }
63+
3864 declare class Player extends EventEmitter {
3965 constructor ( opts : {
4066 name : string ;
@@ -43,18 +69,44 @@ declare module '@jellybrick/mpris-service' {
4369 supportedInterfaces ?: string [ ] ;
4470 } ) ;
4571
72+ //RootInterface
73+ on ( event : 'quit' , listener : ( ) => void ) : this;
74+ on ( event : 'raise' , listener : ( ) => void ) : this;
75+ on (
76+ event : 'fullscreen' ,
77+ listener : ( fullscreenEnabled : boolean ) => void ,
78+ ) : this;
79+
80+ emit ( type : string , ...args : unknown [ ] ) : unknown ;
81+
4682 name : string ;
4783 identity : string ;
48- fullscreen : boolean ;
84+ fullscreen ? : boolean ;
4985 supportedUriSchemes : string [ ] ;
5086 supportedMimeTypes : string [ ] ;
5187 canQuit : boolean ;
5288 canRaise : boolean ;
53- canSetFullscreen : boolean ;
89+ canSetFullscreen ?: boolean ;
90+ desktopEntry ?: string ;
5491 hasTrackList : boolean ;
55- desktopEntry : string ;
56- playbackStatus : string ;
57- loopStatus : string ;
92+
93+ // PlayerInterface
94+ on ( event : 'next' , listener : ( ) => void ) : this;
95+ on ( event : 'previous' , listener : ( ) => void ) : this;
96+ on ( event : 'pause' , listener : ( ) => void ) : this;
97+ on ( event : 'playpause' , listener : ( ) => void ) : this;
98+ on ( event : 'stop' , listener : ( ) => void ) : this;
99+ on ( event : 'play' , listener : ( ) => void ) : this;
100+ on ( event : 'seek' , listener : ( offset : number ) => void ) : this;
101+ on ( event : 'open' , listener : ( { uri : string } ) => void ) : this;
102+ on ( event : 'loopStatus' , listener : ( status : LoopStatus ) => void ) : this;
103+ on ( event : 'rate' , listener : ( ) => void ) : this;
104+ on ( event : 'shuffle' , listener : ( enableShuffle : boolean ) => void ) : this;
105+ on ( event : 'volume' , listener : ( newVolume : number ) => void ) : this;
106+ on ( event : 'position' , listener : ( position : Position ) => void ) : this;
107+
108+ playbackStatus : PlayBackStatus ;
109+ loopStatus : LoopStatus ;
58110 shuffle : boolean ;
59111 metadata : Track ;
60112 volume : number ;
@@ -67,9 +119,40 @@ declare module '@jellybrick/mpris-service' {
67119 rate : number ;
68120 minimumRate : number ;
69121 maximumRate : number ;
70- playlists : unknown [ ] ;
122+
123+ abstract getPosition ( ) : number ;
124+
125+ seeked ( position : number ) : void ;
126+
127+ // TracklistInterface
128+ on ( event : 'addTrack' , listener : ( ) => void ) : this;
129+ on ( event : 'removeTrack' , listener : ( ) => void ) : this;
130+ on ( event : 'goTo' , listener : ( ) => void ) : this;
131+
132+ tracks : Track [ ] ;
133+ canEditTracks : boolean ;
134+
135+ on ( event : '*' , a : unknown [ ] ) : this;
136+
137+ addTrack ( track : string ) : void ;
138+
139+ removeTrack ( trackId : string ) : void ;
140+
141+ // PlaylistsInterface
142+ on ( event : 'activatePlaylist' , listener : ( ) => void ) : this;
143+
144+ playlists : Playlist [ ] ;
71145 activePlaylist : string ;
72146
147+ setPlaylists ( playlists : Playlist [ ] ) : void ;
148+
149+ setActivePlaylist ( playlistId : string ) : void ;
150+
151+ // Player methods
152+ constructor ( opts : PlayerOptions ) ;
153+
154+ on ( event : 'error' , listener : ( error : Error ) => void ) : this;
155+
73156 init ( opts : RootInterfaceOptions ) : void ;
74157
75158 objectPath ( subpath ?: string ) : string ;
@@ -91,13 +174,6 @@ declare module '@jellybrick/mpris-service' {
91174 setPlaylists ( playlists : Track [ ] ) : void ;
92175
93176 setActivePlaylist ( playlistId : string ) : void ;
94-
95- static PLAYBACK_STATUS_PLAYING : 'Playing' ;
96- static PLAYBACK_STATUS_PAUSED : 'Paused' ;
97- static PLAYBACK_STATUS_STOPPED : 'Stopped' ;
98- static LOOP_STATUS_NONE : 'None' ;
99- static LOOP_STATUS_TRACK : 'Track' ;
100- static LOOP_STATUS_PLAYLIST : 'Playlist' ;
101177 }
102178
103179 interface MprisInterface extends dbusInterface . Interface {
0 commit comments