@girs/playerctl-2.0 2.0.0-4.0.0-beta.3
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.
- package/README.md +86 -0
- package/package.json +54 -0
- package/playerctl-2.0-ambient.d.ts +12 -0
- package/playerctl-2.0-ambient.js +2 -0
- package/playerctl-2.0-import.d.ts +12 -0
- package/playerctl-2.0-import.js +3 -0
- package/playerctl-2.0.d.ts +496 -0
- package/playerctl-2.0.js +6 -0
- package/tsconfig.json +23 -0
- package/typedoc.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
# Playerctl-2.0
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
GJS TypeScript type definitions for Playerctl-2.0, generated from library version 2.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.3.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
To use this type definitions, install them with NPM:
|
|
14
|
+
```bash
|
|
15
|
+
npm install @girs/playerctl-2.0
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
You can import this package into your project like this:
|
|
21
|
+
```ts
|
|
22
|
+
import Playerctl from '@girs/playerctl-2.0';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Ambient Modules
|
|
26
|
+
|
|
27
|
+
You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
|
|
28
|
+
For this you need to include `@girs/playerctl-2.0` or `@girs/playerctl-2.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
29
|
+
|
|
30
|
+
`index.ts`:
|
|
31
|
+
```ts
|
|
32
|
+
import '@girs/playerctl-2.0'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`tsconfig.json`:
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"compilerOptions": {
|
|
39
|
+
...
|
|
40
|
+
},
|
|
41
|
+
"include": ["@girs/playerctl-2.0"],
|
|
42
|
+
...
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Now you can import the ambient module with TypeScript support:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import Playerctl from 'gi://Playerctl?version=2.0';
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Global import
|
|
53
|
+
|
|
54
|
+
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
55
|
+
For this you need to include `@girs/playerctl-2.0` or `@girs/playerctl-2.0/import` in your `tsconfig` or entry point Typescript file:
|
|
56
|
+
|
|
57
|
+
`index.ts`:
|
|
58
|
+
```ts
|
|
59
|
+
import '@girs/playerctl-2.0'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`tsconfig.json`:
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"compilerOptions": {
|
|
66
|
+
...
|
|
67
|
+
},
|
|
68
|
+
"include": ["@girs/playerctl-2.0"],
|
|
69
|
+
...
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Now you have also type support for this, too:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const Playerctl = imports.gi.Playerctl;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Bundle
|
|
80
|
+
|
|
81
|
+
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
82
|
+
|
|
83
|
+
## Other packages
|
|
84
|
+
|
|
85
|
+
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
86
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@girs/playerctl-2.0",
|
|
3
|
+
"version": "2.0.0-4.0.0-beta.3",
|
|
4
|
+
"description": "GJS TypeScript type definitions for Playerctl-2.0, generated from library version 2.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "playerctl-2.0.js",
|
|
7
|
+
"main": "playerctl-2.0.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./ambient": {
|
|
10
|
+
"types": "./playerctl-2.0-ambient.d.ts",
|
|
11
|
+
"import": "./playerctl-2.0-ambient.js",
|
|
12
|
+
"default": "./playerctl-2.0-ambient.js"
|
|
13
|
+
},
|
|
14
|
+
"./import": {
|
|
15
|
+
"types": "./playerctl-2.0-import.d.ts",
|
|
16
|
+
"import": "./playerctl-2.0-import.js",
|
|
17
|
+
"default": "./playerctl-2.0-import.js"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./playerctl-2.0.d.ts",
|
|
21
|
+
"import": "./playerctl-2.0.js",
|
|
22
|
+
"default": "./playerctl-2.0.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit playerctl-2.0.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@girs/gjs": "^4.0.0-beta.3",
|
|
30
|
+
"@girs/glib-2.0": "^2.80.0-4.0.0-beta.3",
|
|
31
|
+
"@girs/gobject-2.0": "^2.80.0-4.0.0-beta.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"typescript": "*"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"Gir",
|
|
38
|
+
"TypeScript",
|
|
39
|
+
"types",
|
|
40
|
+
"GObject-Introspection",
|
|
41
|
+
"GJS",
|
|
42
|
+
"Playerctl-2.0"
|
|
43
|
+
],
|
|
44
|
+
"author": "ts-for-gir",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/gjsify/ts-for-gir.git"
|
|
49
|
+
},
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/gjsify/types/tree/main/playerctl-2.0#readme"
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
declare module 'gi://Playerctl?version=2.0' {
|
|
3
|
+
import Playerctl from '@girs/playerctl-2.0';
|
|
4
|
+
export default Playerctl;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module 'gi://Playerctl' {
|
|
8
|
+
import Playerctl20 from 'gi://Playerctl?version=2.0';
|
|
9
|
+
export default Playerctl20;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Type Definitions for Gjs (https://gjs.guide/)
|
|
3
|
+
*
|
|
4
|
+
* These type definitions are automatically generated, do not edit them by hand.
|
|
5
|
+
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import './playerctl-2.0-ambient.d.ts';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Playerctl-2.0
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type GObject from '@girs/gobject-2.0';
|
|
15
|
+
import type GLib from '@girs/glib-2.0';
|
|
16
|
+
|
|
17
|
+
export namespace Playerctl {
|
|
18
|
+
/**
|
|
19
|
+
* Loop status enumeration for a #PlayerctlPlayer
|
|
20
|
+
*/
|
|
21
|
+
enum LoopStatus {
|
|
22
|
+
/**
|
|
23
|
+
* The playback will stop when there are no more tracks to play.
|
|
24
|
+
*/
|
|
25
|
+
NONE,
|
|
26
|
+
/**
|
|
27
|
+
* The current track will start again from the beginning once it has
|
|
28
|
+
* finished playing.
|
|
29
|
+
*/
|
|
30
|
+
TRACK,
|
|
31
|
+
/**
|
|
32
|
+
* The playback loops through a list of tracks.
|
|
33
|
+
*/
|
|
34
|
+
PLAYLIST,
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Playback status enumeration for a #PlayerctlPlayer
|
|
38
|
+
*/
|
|
39
|
+
enum PlaybackStatus {
|
|
40
|
+
/**
|
|
41
|
+
* A track is currently playing.
|
|
42
|
+
*/
|
|
43
|
+
PLAYING,
|
|
44
|
+
/**
|
|
45
|
+
* A track is currently paused.
|
|
46
|
+
*/
|
|
47
|
+
PAUSED,
|
|
48
|
+
/**
|
|
49
|
+
* There is no track currently playing.
|
|
50
|
+
*/
|
|
51
|
+
STOPPED,
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The source of the name used to control the player.
|
|
55
|
+
*/
|
|
56
|
+
enum Source {
|
|
57
|
+
/**
|
|
58
|
+
* Only for unitialized players. Source will be chosen automatically.
|
|
59
|
+
*/
|
|
60
|
+
NONE,
|
|
61
|
+
/**
|
|
62
|
+
* The player is on the DBus session bus.
|
|
63
|
+
*/
|
|
64
|
+
DBUS_SESSION,
|
|
65
|
+
/**
|
|
66
|
+
* The player is on the DBus system bus.
|
|
67
|
+
*/
|
|
68
|
+
DBUS_SYSTEM,
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Lists all the players that can be controlled by Playerctl.
|
|
72
|
+
* @returns A list of player names.
|
|
73
|
+
*/
|
|
74
|
+
function list_players(): PlayerName[];
|
|
75
|
+
module Player {
|
|
76
|
+
// Signal callback interfaces
|
|
77
|
+
|
|
78
|
+
interface Exit {
|
|
79
|
+
(): void;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface LoopStatus {
|
|
83
|
+
(loop_status: LoopStatus): void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface Metadata {
|
|
87
|
+
(metadata: GLib.Variant): void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface Pause {
|
|
91
|
+
(): void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface Play {
|
|
95
|
+
(): void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface PlaybackStatus {
|
|
99
|
+
(playback_status: PlaybackStatus): void;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface Seeked {
|
|
103
|
+
(position: number): void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface Shuffle {
|
|
107
|
+
(shuffle_status: boolean): void;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface Stop {
|
|
111
|
+
(): void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface Volume {
|
|
115
|
+
(volume: number): void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Constructor properties interface
|
|
119
|
+
|
|
120
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
121
|
+
can_control: boolean;
|
|
122
|
+
canControl: boolean;
|
|
123
|
+
can_go_next: boolean;
|
|
124
|
+
canGoNext: boolean;
|
|
125
|
+
can_go_previous: boolean;
|
|
126
|
+
canGoPrevious: boolean;
|
|
127
|
+
can_pause: boolean;
|
|
128
|
+
canPause: boolean;
|
|
129
|
+
can_play: boolean;
|
|
130
|
+
canPlay: boolean;
|
|
131
|
+
can_seek: boolean;
|
|
132
|
+
canSeek: boolean;
|
|
133
|
+
loop_status: LoopStatus;
|
|
134
|
+
loopStatus: LoopStatus;
|
|
135
|
+
metadata: GLib.Variant;
|
|
136
|
+
playback_status: PlaybackStatus;
|
|
137
|
+
playbackStatus: PlaybackStatus;
|
|
138
|
+
player_instance: string;
|
|
139
|
+
playerInstance: string;
|
|
140
|
+
player_name: string;
|
|
141
|
+
playerName: string;
|
|
142
|
+
position: number;
|
|
143
|
+
shuffle: boolean;
|
|
144
|
+
source: Source;
|
|
145
|
+
status: string;
|
|
146
|
+
volume: number;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
class Player extends GObject.Object {
|
|
151
|
+
static $gtype: GObject.GType<Player>;
|
|
152
|
+
|
|
153
|
+
// Own properties of Playerctl.Player
|
|
154
|
+
|
|
155
|
+
get can_control(): boolean;
|
|
156
|
+
get canControl(): boolean;
|
|
157
|
+
get can_go_next(): boolean;
|
|
158
|
+
get canGoNext(): boolean;
|
|
159
|
+
get can_go_previous(): boolean;
|
|
160
|
+
get canGoPrevious(): boolean;
|
|
161
|
+
get can_pause(): boolean;
|
|
162
|
+
get canPause(): boolean;
|
|
163
|
+
get can_play(): boolean;
|
|
164
|
+
get canPlay(): boolean;
|
|
165
|
+
get can_seek(): boolean;
|
|
166
|
+
get canSeek(): boolean;
|
|
167
|
+
get loop_status(): LoopStatus;
|
|
168
|
+
get loopStatus(): LoopStatus;
|
|
169
|
+
get metadata(): GLib.Variant;
|
|
170
|
+
get playback_status(): PlaybackStatus;
|
|
171
|
+
get playbackStatus(): PlaybackStatus;
|
|
172
|
+
get player_instance(): string;
|
|
173
|
+
get playerInstance(): string;
|
|
174
|
+
get player_name(): string;
|
|
175
|
+
get playerName(): string;
|
|
176
|
+
get position(): number;
|
|
177
|
+
get shuffle(): boolean;
|
|
178
|
+
get source(): Source;
|
|
179
|
+
/**
|
|
180
|
+
* The playback status of the player as a string
|
|
181
|
+
*/
|
|
182
|
+
get status(): string;
|
|
183
|
+
get volume(): number;
|
|
184
|
+
set volume(val: number);
|
|
185
|
+
|
|
186
|
+
// Constructors of Playerctl.Player
|
|
187
|
+
|
|
188
|
+
constructor(properties?: Partial<Player.ConstructorProps>, ...args: any[]);
|
|
189
|
+
|
|
190
|
+
_init(...args: any[]): void;
|
|
191
|
+
|
|
192
|
+
static ['new'](player_name?: string | null): Player;
|
|
193
|
+
|
|
194
|
+
static new_for_source(player_name: string | null, source: Source): Player;
|
|
195
|
+
|
|
196
|
+
static new_from_name(player_name: PlayerName): Player;
|
|
197
|
+
|
|
198
|
+
// Own signals of Playerctl.Player
|
|
199
|
+
|
|
200
|
+
connect(id: string, callback: (...args: any[]) => any): number;
|
|
201
|
+
connect_after(id: string, callback: (...args: any[]) => any): number;
|
|
202
|
+
emit(id: string, ...args: any[]): void;
|
|
203
|
+
connect(signal: 'exit', callback: (_source: this) => void): number;
|
|
204
|
+
connect_after(signal: 'exit', callback: (_source: this) => void): number;
|
|
205
|
+
emit(signal: 'exit'): void;
|
|
206
|
+
connect(signal: 'loop-status', callback: (_source: this, loop_status: LoopStatus) => void): number;
|
|
207
|
+
connect_after(signal: 'loop-status', callback: (_source: this, loop_status: LoopStatus) => void): number;
|
|
208
|
+
emit(signal: 'loop-status', loop_status: LoopStatus): void;
|
|
209
|
+
connect(signal: 'metadata', callback: (_source: this, metadata: GLib.Variant) => void): number;
|
|
210
|
+
connect_after(signal: 'metadata', callback: (_source: this, metadata: GLib.Variant) => void): number;
|
|
211
|
+
emit(signal: 'metadata', metadata: GLib.Variant): void;
|
|
212
|
+
connect(signal: 'pause', callback: (_source: this) => void): number;
|
|
213
|
+
connect_after(signal: 'pause', callback: (_source: this) => void): number;
|
|
214
|
+
emit(signal: 'pause'): void;
|
|
215
|
+
connect(signal: 'play', callback: (_source: this) => void): number;
|
|
216
|
+
connect_after(signal: 'play', callback: (_source: this) => void): number;
|
|
217
|
+
emit(signal: 'play'): void;
|
|
218
|
+
connect(signal: 'playback-status', callback: (_source: this, playback_status: PlaybackStatus) => void): number;
|
|
219
|
+
connect_after(
|
|
220
|
+
signal: 'playback-status',
|
|
221
|
+
callback: (_source: this, playback_status: PlaybackStatus) => void,
|
|
222
|
+
): number;
|
|
223
|
+
emit(signal: 'playback-status', playback_status: PlaybackStatus): void;
|
|
224
|
+
connect(signal: 'seeked', callback: (_source: this, position: number) => void): number;
|
|
225
|
+
connect_after(signal: 'seeked', callback: (_source: this, position: number) => void): number;
|
|
226
|
+
emit(signal: 'seeked', position: number): void;
|
|
227
|
+
connect(signal: 'shuffle', callback: (_source: this, shuffle_status: boolean) => void): number;
|
|
228
|
+
connect_after(signal: 'shuffle', callback: (_source: this, shuffle_status: boolean) => void): number;
|
|
229
|
+
emit(signal: 'shuffle', shuffle_status: boolean): void;
|
|
230
|
+
connect(signal: 'stop', callback: (_source: this) => void): number;
|
|
231
|
+
connect_after(signal: 'stop', callback: (_source: this) => void): number;
|
|
232
|
+
emit(signal: 'stop'): void;
|
|
233
|
+
connect(signal: 'volume', callback: (_source: this, volume: number) => void): number;
|
|
234
|
+
connect_after(signal: 'volume', callback: (_source: this, volume: number) => void): number;
|
|
235
|
+
emit(signal: 'volume', volume: number): void;
|
|
236
|
+
|
|
237
|
+
// Own methods of Playerctl.Player
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Gets the album from the metadata of the current track, or NULL if
|
|
241
|
+
* no track is playing.
|
|
242
|
+
* @returns The album from the metadata of the current track
|
|
243
|
+
*/
|
|
244
|
+
get_album(): string;
|
|
245
|
+
/**
|
|
246
|
+
* Gets the artist from the metadata of the current track, or NULL if no
|
|
247
|
+
* track is playing.
|
|
248
|
+
* @returns The artist from the metadata of the current track
|
|
249
|
+
*/
|
|
250
|
+
get_artist(): string;
|
|
251
|
+
/**
|
|
252
|
+
* Gets the position of the current track in microseconds ignoring the property
|
|
253
|
+
* cache.
|
|
254
|
+
*/
|
|
255
|
+
get_position(): number;
|
|
256
|
+
/**
|
|
257
|
+
* Gets the title from the metadata of the current track, or NULL if
|
|
258
|
+
* no track is playing.
|
|
259
|
+
* @returns The title from the metadata of the current track
|
|
260
|
+
*/
|
|
261
|
+
get_title(): string;
|
|
262
|
+
/**
|
|
263
|
+
* Command the player to go to the next track
|
|
264
|
+
*/
|
|
265
|
+
next(): void;
|
|
266
|
+
/**
|
|
267
|
+
* A convenience function for bindings to subscribe to an event with a callback
|
|
268
|
+
* @param event the event to subscribe to
|
|
269
|
+
* @param callback the callback to run on the event
|
|
270
|
+
*/
|
|
271
|
+
on(event: string, callback: GObject.Closure): void;
|
|
272
|
+
/**
|
|
273
|
+
* Command the player to open given URI
|
|
274
|
+
* @param uri the URI to open, either a file name or an external URL
|
|
275
|
+
*/
|
|
276
|
+
open(uri: string): void;
|
|
277
|
+
/**
|
|
278
|
+
* Command the player to pause
|
|
279
|
+
*/
|
|
280
|
+
pause(): void;
|
|
281
|
+
/**
|
|
282
|
+
* Command the player to play
|
|
283
|
+
*/
|
|
284
|
+
play(): void;
|
|
285
|
+
/**
|
|
286
|
+
* Command the player to play if it is paused or pause if it is playing
|
|
287
|
+
*/
|
|
288
|
+
play_pause(): void;
|
|
289
|
+
/**
|
|
290
|
+
* Command the player to go to the previous track
|
|
291
|
+
*/
|
|
292
|
+
previous(): void;
|
|
293
|
+
/**
|
|
294
|
+
* Gets the given property from the metadata of the current track. If property
|
|
295
|
+
* is null, prints all the metadata properties. Returns NULL if no track is
|
|
296
|
+
* playing.
|
|
297
|
+
* @param property the property from the metadata to print
|
|
298
|
+
* @returns The artist from the metadata of the current track
|
|
299
|
+
*/
|
|
300
|
+
print_metadata_prop(property?: string | null): string;
|
|
301
|
+
/**
|
|
302
|
+
* Command the player to seek forward by offset given in microseconds.
|
|
303
|
+
* @param offset the offset to seek forward to in microseconds
|
|
304
|
+
*/
|
|
305
|
+
seek(offset: number): void;
|
|
306
|
+
/**
|
|
307
|
+
* Set the loop status of the player. Can be set to either None, Track, or Playlist.
|
|
308
|
+
* @param status the requested #PlayerctlLoopStatus to set the player to
|
|
309
|
+
*/
|
|
310
|
+
set_loop_status(status: LoopStatus): void;
|
|
311
|
+
/**
|
|
312
|
+
* Sets the absolute position of the current track to the given position in microseconds.
|
|
313
|
+
* @param position The absolute position in the track to set as the position
|
|
314
|
+
*/
|
|
315
|
+
set_position(position: number): void;
|
|
316
|
+
/**
|
|
317
|
+
* Request to set the shuffle state of the player, either on or off.
|
|
318
|
+
* @param shuffle whether to enable shuffle
|
|
319
|
+
*/
|
|
320
|
+
set_shuffle(shuffle: boolean): void;
|
|
321
|
+
/**
|
|
322
|
+
* Sets the volume level for the player from 0.0 for no volume to 1.0 for
|
|
323
|
+
* maximum volume. Passing negative numbers should set the volume to 0.0.
|
|
324
|
+
* @param volume the volume level from 0.0 to 1.0
|
|
325
|
+
*/
|
|
326
|
+
set_volume(volume: number): void;
|
|
327
|
+
/**
|
|
328
|
+
* Command the player to stop
|
|
329
|
+
*/
|
|
330
|
+
stop(): void;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
module PlayerManager {
|
|
334
|
+
// Signal callback interfaces
|
|
335
|
+
|
|
336
|
+
interface NameAppeared {
|
|
337
|
+
(name: PlayerName): void;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
interface NameVanished {
|
|
341
|
+
(name: PlayerName): void;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
interface PlayerAppeared {
|
|
345
|
+
(player: Player): void;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
interface PlayerVanished {
|
|
349
|
+
(player: Player): void;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Constructor properties interface
|
|
353
|
+
|
|
354
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
355
|
+
player_names: PlayerName[];
|
|
356
|
+
playerNames: PlayerName[];
|
|
357
|
+
players: Player[];
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
class PlayerManager extends GObject.Object {
|
|
362
|
+
static $gtype: GObject.GType<PlayerManager>;
|
|
363
|
+
|
|
364
|
+
// Own properties of Playerctl.PlayerManager
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* A list of fully qualified player names that are currently available to control.
|
|
368
|
+
*/
|
|
369
|
+
get player_names(): PlayerName[];
|
|
370
|
+
/**
|
|
371
|
+
* A list of fully qualified player names that are currently available to control.
|
|
372
|
+
*/
|
|
373
|
+
get playerNames(): PlayerName[];
|
|
374
|
+
/**
|
|
375
|
+
* A list of players that are currently connected and managed by this class.
|
|
376
|
+
*/
|
|
377
|
+
get players(): Player[];
|
|
378
|
+
|
|
379
|
+
// Constructors of Playerctl.PlayerManager
|
|
380
|
+
|
|
381
|
+
constructor(properties?: Partial<PlayerManager.ConstructorProps>, ...args: any[]);
|
|
382
|
+
|
|
383
|
+
_init(...args: any[]): void;
|
|
384
|
+
|
|
385
|
+
static ['new'](): PlayerManager;
|
|
386
|
+
|
|
387
|
+
// Own signals of Playerctl.PlayerManager
|
|
388
|
+
|
|
389
|
+
connect(id: string, callback: (...args: any[]) => any): number;
|
|
390
|
+
connect_after(id: string, callback: (...args: any[]) => any): number;
|
|
391
|
+
emit(id: string, ...args: any[]): void;
|
|
392
|
+
connect(signal: 'name-appeared', callback: (_source: this, name: PlayerName) => void): number;
|
|
393
|
+
connect_after(signal: 'name-appeared', callback: (_source: this, name: PlayerName) => void): number;
|
|
394
|
+
emit(signal: 'name-appeared', name: PlayerName): void;
|
|
395
|
+
connect(signal: 'name-vanished', callback: (_source: this, name: PlayerName) => void): number;
|
|
396
|
+
connect_after(signal: 'name-vanished', callback: (_source: this, name: PlayerName) => void): number;
|
|
397
|
+
emit(signal: 'name-vanished', name: PlayerName): void;
|
|
398
|
+
connect(signal: 'player-appeared', callback: (_source: this, player: Player) => void): number;
|
|
399
|
+
connect_after(signal: 'player-appeared', callback: (_source: this, player: Player) => void): number;
|
|
400
|
+
emit(signal: 'player-appeared', player: Player): void;
|
|
401
|
+
connect(signal: 'player-vanished', callback: (_source: this, player: Player) => void): number;
|
|
402
|
+
connect_after(signal: 'player-vanished', callback: (_source: this, player: Player) => void): number;
|
|
403
|
+
emit(signal: 'player-vanished', player: Player): void;
|
|
404
|
+
|
|
405
|
+
// Own methods of Playerctl.PlayerManager
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Add the given player to the list of managed players. Takes a reference to
|
|
409
|
+
* the player (so you can unref it after you call this function). The player
|
|
410
|
+
* will automatically be unreffed and removed from the list of
|
|
411
|
+
* #PlayerctlPlayerManager:players when
|
|
412
|
+
* it disconnects and the #PlayerctlPlayerManager::player-vanished signal will
|
|
413
|
+
* be emitted on the manager.
|
|
414
|
+
* @param player A #PlayerctlPlayer to manage
|
|
415
|
+
*/
|
|
416
|
+
manage_player(player: Player): void;
|
|
417
|
+
/**
|
|
418
|
+
* Moves the player to the top of the list of #PlayerctlPlayerManager:players. If this manager has a
|
|
419
|
+
* sort function set with playerctl_player_manager_set_sort_func(), the list of
|
|
420
|
+
* players will be sorted afterward, but will be on top of equal players in the
|
|
421
|
+
* sorted order.
|
|
422
|
+
* @param player A #PlayerctlPlayer in the list of #PlayerctlPlayerManager:players
|
|
423
|
+
*/
|
|
424
|
+
move_player_to_top(player: Player): void;
|
|
425
|
+
/**
|
|
426
|
+
* Keeps the #PlayerctlPlayerManager:players list of this manager in sorted order which is useful
|
|
427
|
+
* for using this list as a priority queue.
|
|
428
|
+
* @param sort_func The compare function to be used to sort the #PlayerctlPlayerManager:players.
|
|
429
|
+
* @param notify A function to notify when the sort function will no longer be used.
|
|
430
|
+
*/
|
|
431
|
+
set_sort_func(sort_func: GLib.CompareDataFunc, notify?: GLib.DestroyNotify | null): void;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
type PlayerClass = typeof Player;
|
|
435
|
+
type PlayerManagerClass = typeof PlayerManager;
|
|
436
|
+
abstract class PlayerManagerPrivate {
|
|
437
|
+
static $gtype: GObject.GType<PlayerManagerPrivate>;
|
|
438
|
+
|
|
439
|
+
// Constructors of Playerctl.PlayerManagerPrivate
|
|
440
|
+
|
|
441
|
+
_init(...args: any[]): void;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Event container for when names of players appear or disapear as the
|
|
446
|
+
* controllable media player applications open and close.
|
|
447
|
+
*/
|
|
448
|
+
class PlayerName {
|
|
449
|
+
static $gtype: GObject.GType<PlayerName>;
|
|
450
|
+
|
|
451
|
+
// Own fields of Playerctl.PlayerName
|
|
452
|
+
|
|
453
|
+
name: string;
|
|
454
|
+
instance: string;
|
|
455
|
+
source: Source;
|
|
456
|
+
|
|
457
|
+
// Constructors of Playerctl.PlayerName
|
|
458
|
+
|
|
459
|
+
_init(...args: any[]): void;
|
|
460
|
+
|
|
461
|
+
// Own methods of Playerctl.PlayerName
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Creates a dynamically allocated name name container as a copy of
|
|
465
|
+
* `name`.
|
|
466
|
+
* @returns a newly-allocated copy of @name
|
|
467
|
+
*/
|
|
468
|
+
copy(): PlayerName;
|
|
469
|
+
/**
|
|
470
|
+
* Frees `name`. If `name` is %NULL, it simply returns.
|
|
471
|
+
*/
|
|
472
|
+
free(): void;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
abstract class PlayerPrivate {
|
|
476
|
+
static $gtype: GObject.GType<PlayerPrivate>;
|
|
477
|
+
|
|
478
|
+
// Constructors of Playerctl.PlayerPrivate
|
|
479
|
+
|
|
480
|
+
_init(...args: any[]): void;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Name of the imported GIR library
|
|
485
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
486
|
+
*/
|
|
487
|
+
const __name__: string;
|
|
488
|
+
/**
|
|
489
|
+
* Version of the imported GIR library
|
|
490
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
491
|
+
*/
|
|
492
|
+
const __version__: string;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export default Playerctl;
|
|
496
|
+
// END
|
package/playerctl-2.0.js
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// General settings for code interpretation
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ESNext"],
|
|
7
|
+
"types": [],
|
|
8
|
+
"experimentalDecorators": true,
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"noEmitOnError": false,
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"rootDir": ".",
|
|
14
|
+
// General settings for code generation
|
|
15
|
+
"removeComments": false,
|
|
16
|
+
"inlineSourceMap": false,
|
|
17
|
+
"inlineSources": false,
|
|
18
|
+
"newLine": "LF"
|
|
19
|
+
},
|
|
20
|
+
"include": ["./playerctl-2.0.d.ts"]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|