musicbeeipc 2.0.0.1
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.
- checksums.yaml +7 -0
- data/.yardopts +5 -0
- data/LICENSE_MusicBeeIPCSDK.txt +23 -0
- data/README.md +16 -0
- data/README.txt +16 -0
- data/enums.html +318 -0
- data/lib/constants.rb +12 -0
- data/lib/enums.rb +316 -0
- data/lib/musicbeeipc.rb +1477 -0
- data/lib/pack.rb +282 -0
- data/lib/structs.rb +40 -0
- data/lib/unpack.rb +204 -0
- data/lib/winapi.rb +39 -0
- data/musicbeeipc.gemspec +14 -0
- metadata +71 -0
data/lib/musicbeeipc.rb
ADDED
@@ -0,0 +1,1477 @@
|
|
1
|
+
#----------------------------------------------------------#
|
2
|
+
#- MusicBeeIPCSDK Rb v2.0.0 -#
|
3
|
+
#- Copyright © Kerli Low 2014 -#
|
4
|
+
#- This file is licensed under the -#
|
5
|
+
#- BSD 2-Clause License -#
|
6
|
+
#- See LICENSE_MusicBeeIPCSDK for more information. -#
|
7
|
+
#----------------------------------------------------------#
|
8
|
+
|
9
|
+
require_relative "enums.rb"
|
10
|
+
require_relative "constants.rb"
|
11
|
+
require_relative "pack.rb"
|
12
|
+
require_relative "unpack.rb"
|
13
|
+
require_relative "winapi.rb"
|
14
|
+
|
15
|
+
|
16
|
+
class MusicBeeIPC
|
17
|
+
# @!group General
|
18
|
+
|
19
|
+
# @return [bool]
|
20
|
+
def probe()
|
21
|
+
send_message(find_hwnd(), WM_USER, MBC_Probe, 0) != MBE_Error
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [MBError]
|
25
|
+
def play_pause()
|
26
|
+
send_message(find_hwnd(), WM_USER, MBC_PlayPause, 0)
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [MBError]
|
30
|
+
def play()
|
31
|
+
send_message(find_hwnd(), WM_USER, MBC_Play, 0)
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [MBError]
|
35
|
+
def pause()
|
36
|
+
send_message(find_hwnd(), WM_USER, MBC_Pause, 0)
|
37
|
+
end
|
38
|
+
|
39
|
+
# @return [MBError]
|
40
|
+
def stop()
|
41
|
+
send_message(find_hwnd(), WM_USER, MBC_Stop, 0)
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [MBError]
|
45
|
+
def stop_after_current()
|
46
|
+
send_message(find_hwnd(), WM_USER, MBC_StopAfterCurrent, 0)
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return [MBError]
|
50
|
+
def previous_track()
|
51
|
+
send_message(find_hwnd(), WM_USER, MBC_PreviousTrack, 0)
|
52
|
+
end
|
53
|
+
|
54
|
+
# @return [MBError]
|
55
|
+
def next_track()
|
56
|
+
send_message(find_hwnd(), WM_USER, MBC_NextTrack, 0)
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [MBError]
|
60
|
+
def start_auto_dj()
|
61
|
+
send_message(find_hwnd(), WM_USER, MBC_StartAutoDj, 0)
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [MBError]
|
65
|
+
def end_auto_dj()
|
66
|
+
send_message(find_hwnd(), WM_USER, MBC_EndAutoDj, 0)
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [MBPlayState]
|
70
|
+
def get_play_state()
|
71
|
+
send_message(find_hwnd(), WM_USER, MBC_GetPlayState, 0)
|
72
|
+
end
|
73
|
+
|
74
|
+
# @return [String]
|
75
|
+
def get_play_state_str()
|
76
|
+
case send_message(find_hwnd(), WM_USER, MBC_GetPlayState, 0)
|
77
|
+
when MBPS_Loading
|
78
|
+
"Loading"
|
79
|
+
when MBPS_Playing
|
80
|
+
"Playing"
|
81
|
+
when MBPS_Paused
|
82
|
+
"Paused"
|
83
|
+
when MBPS_Stopped
|
84
|
+
"Stopped"
|
85
|
+
else
|
86
|
+
"Undefined"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# @return [String]
|
91
|
+
def get_play_state_sym()
|
92
|
+
case send_message(find_hwnd(), WM_USER, MBC_GetPlayState, 0)
|
93
|
+
when MBPS_Loading
|
94
|
+
:Loading
|
95
|
+
when MBPS_Playing
|
96
|
+
:Playing
|
97
|
+
when MBPS_Paused
|
98
|
+
:Paused
|
99
|
+
when MBPS_Stopped
|
100
|
+
:Stopped
|
101
|
+
else
|
102
|
+
:Undefined
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# @return [int]
|
107
|
+
def get_position()
|
108
|
+
send_message(find_hwnd(), WM_USER, MBC_GetPosition, 0)
|
109
|
+
end
|
110
|
+
|
111
|
+
# @param position [int]
|
112
|
+
# @return [MBError]
|
113
|
+
def set_position(position)
|
114
|
+
send_message(find_hwnd(), WM_USER, MBC_SetPosition, position)
|
115
|
+
end
|
116
|
+
|
117
|
+
# @return [int]
|
118
|
+
def position
|
119
|
+
send_message(find_hwnd(), WM_USER, MBC_GetPosition, 0)
|
120
|
+
end
|
121
|
+
|
122
|
+
# @param position [int]
|
123
|
+
def position=(position)
|
124
|
+
send_message(find_hwnd(), WM_USER, MBC_SetPosition, position)
|
125
|
+
end
|
126
|
+
|
127
|
+
# Volume - Value between 0 - 100
|
128
|
+
# @return [int]
|
129
|
+
def get_volume()
|
130
|
+
send_message(find_hwnd(), WM_USER, MBC_GetVolume, 0)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Volume - Value between 0 - 100
|
134
|
+
# @param volume [int]
|
135
|
+
# @return [MBError]
|
136
|
+
def set_volume(volume)
|
137
|
+
send_message(find_hwnd(), WM_USER, MBC_SetVolume, volume)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Volume - Value between 0 - 100
|
141
|
+
# @return [int]
|
142
|
+
def volume
|
143
|
+
send_message(find_hwnd(), WM_USER, MBC_GetVolume, 0)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Volume - Value between 0 - 100
|
147
|
+
# @param volume [int]
|
148
|
+
def volume=(volume)
|
149
|
+
send_message(find_hwnd(), WM_USER, MBC_SetVolume, volume)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Precise volume - Value between 0 - 10000
|
153
|
+
# @return [int]
|
154
|
+
def get_volumep()
|
155
|
+
send_message(find_hwnd(), WM_USER, MBC_GetVolumep, 0)
|
156
|
+
end
|
157
|
+
|
158
|
+
# Precise volume - Value between 0 - 10000
|
159
|
+
# @param volume [int]
|
160
|
+
# @return [MBError]
|
161
|
+
def set_volumep(volume)
|
162
|
+
send_message(find_hwnd(), WM_USER, MBC_SetVolumep, volume)
|
163
|
+
end
|
164
|
+
|
165
|
+
# Precise volume - Value between 0 - 10000
|
166
|
+
# @return [int]
|
167
|
+
def volumep
|
168
|
+
send_message(find_hwnd(), WM_USER, MBC_GetVolumep, 0)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Precise volume - Value between 0 - 10000
|
172
|
+
# @param volume [int]
|
173
|
+
def volumep=(volume)
|
174
|
+
send_message(find_hwnd(), WM_USER, MBC_SetVolumep, volume)
|
175
|
+
end
|
176
|
+
|
177
|
+
# Floating point volume - Value between 0.0 - 1.0
|
178
|
+
# @return [float]
|
179
|
+
def get_volumef()
|
180
|
+
FloatInt.new(i:send_message(find_hwnd(), WM_USER, MBC_GetVolumef, 0))[:f]
|
181
|
+
end
|
182
|
+
|
183
|
+
# Floating point volume - Value between 0.0 - 1.0
|
184
|
+
# @param volume [float]
|
185
|
+
# @return [MBError]
|
186
|
+
def set_volumef(volume)
|
187
|
+
send_message(find_hwnd(), WM_USER, MBC_SetVolumef,
|
188
|
+
FloatInt.new(f:volume)[:i])
|
189
|
+
end
|
190
|
+
|
191
|
+
# Floating point volume - Value between 0.0 - 1.0
|
192
|
+
# @return [float]
|
193
|
+
def volumef
|
194
|
+
FloatInt.new(i:send_message(find_hwnd(), WM_USER, MBC_GetVolumef, 0))[:f]
|
195
|
+
end
|
196
|
+
|
197
|
+
# Floating point volume - Value between 0.0 - 1.0
|
198
|
+
# @param volume [float]
|
199
|
+
def volumef=(volume)
|
200
|
+
send_message(find_hwnd(), WM_USER, MBC_SetVolumef,
|
201
|
+
FloatInt.new(f:volume)[:i])
|
202
|
+
end
|
203
|
+
|
204
|
+
# @return [bool]
|
205
|
+
def get_mute()
|
206
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetMute, 0))
|
207
|
+
end
|
208
|
+
|
209
|
+
# @param mute [bool]
|
210
|
+
# @return [MBError]
|
211
|
+
def set_mute(mute)
|
212
|
+
send_message(find_hwnd(), WM_USER, MBC_SetMute, to_i(mute))
|
213
|
+
end
|
214
|
+
|
215
|
+
# @return [bool]
|
216
|
+
def get_shuffle()
|
217
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetShuffle, 0))
|
218
|
+
end
|
219
|
+
|
220
|
+
# @param shuffle [bool]
|
221
|
+
# @return [MBError]
|
222
|
+
def set_shuffle(shuffle)
|
223
|
+
send_message(find_hwnd(), WM_USER, MBC_SetShuffle, to_i(shuffle))
|
224
|
+
end
|
225
|
+
|
226
|
+
# @return [MBRepeatMode]
|
227
|
+
def get_repeat()
|
228
|
+
send_message(find_hwnd(), WM_USER, MBC_GetRepeat, 0)
|
229
|
+
end
|
230
|
+
|
231
|
+
# @param repeat [MBRepeatMode]
|
232
|
+
# @return [MBError]
|
233
|
+
def set_repeat(repeat)
|
234
|
+
send_message(find_hwnd(), WM_USER, MBC_SetRepeat, repeat)
|
235
|
+
end
|
236
|
+
|
237
|
+
# @return [bool]
|
238
|
+
def get_equalizer_enabled()
|
239
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetEqualizerEnabled, 0))
|
240
|
+
end
|
241
|
+
|
242
|
+
# @param enabled [bool]
|
243
|
+
# @return [MBError]
|
244
|
+
def set_equalizer_enabled(enabled)
|
245
|
+
send_message(find_hwnd(), WM_USER, MBC_SetEqualizerEnabled, to_i(enabled))
|
246
|
+
end
|
247
|
+
|
248
|
+
# @return [bool]
|
249
|
+
def get_dsp_enabled()
|
250
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetDspEnabled, 0))
|
251
|
+
end
|
252
|
+
|
253
|
+
# @param enabled [bool]
|
254
|
+
# @return [MBError]
|
255
|
+
def set_dsp_enabled(enabled)
|
256
|
+
send_message(find_hwnd(), WM_USER, MBC_SetDspEnabled, to_i(enabled))
|
257
|
+
end
|
258
|
+
|
259
|
+
# @return [bool]
|
260
|
+
def get_scrobble_enabled()
|
261
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetScrobbleEnabled, 0))
|
262
|
+
end
|
263
|
+
|
264
|
+
# @param enabled [bool]
|
265
|
+
# @return [MBError]
|
266
|
+
def set_scrobble_enabled(enabled)
|
267
|
+
send_message(find_hwnd(), WM_USER, MBC_SetScrobbleEnabled, to_i(enabled))
|
268
|
+
end
|
269
|
+
|
270
|
+
# @return [MBError]
|
271
|
+
def show_equalizer()
|
272
|
+
send_message(find_hwnd(), WM_USER, MBC_ShowEqualiser, 0)
|
273
|
+
end
|
274
|
+
|
275
|
+
# @return [bool]
|
276
|
+
def get_auto_dj_enabled()
|
277
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetAutoDjEnabled, 0))
|
278
|
+
end
|
279
|
+
|
280
|
+
# @return [bool]
|
281
|
+
def get_stop_after_current_enabled()
|
282
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetStopAfterCurrentEnabled, 0))
|
283
|
+
end
|
284
|
+
|
285
|
+
# @param enabled [bool]
|
286
|
+
# @return [bool]
|
287
|
+
def set_stop_after_current_enabled(enabled)
|
288
|
+
send_message(find_hwnd(), WM_USER, MBC_SetStopAfterCurrentEnabled,
|
289
|
+
to_i(enabled))
|
290
|
+
end
|
291
|
+
|
292
|
+
# @return [bool]
|
293
|
+
def get_crossfade()
|
294
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetCrossfade, 0))
|
295
|
+
end
|
296
|
+
|
297
|
+
# @param crossfade [bool]
|
298
|
+
# @return [MBError]
|
299
|
+
def set_crossfade(crossfade)
|
300
|
+
send_message(find_hwnd(), WM_USER, MBC_SetCrossfade, to_i(crossfade))
|
301
|
+
end
|
302
|
+
|
303
|
+
# @return [MBReplayGainMode]
|
304
|
+
def get_replay_gain_mode()
|
305
|
+
send_message(find_hwnd(), WM_USER, MBC_GetReplayGainMode, 0)
|
306
|
+
end
|
307
|
+
|
308
|
+
# @param mode [MBReplayGainMode]
|
309
|
+
# @return [MBError]
|
310
|
+
def set_replay_gain_mode(mode)
|
311
|
+
send_message(find_hwnd(), WM_USER, MBC_SetReplayGainMode, mode)
|
312
|
+
end
|
313
|
+
|
314
|
+
# @param count [int]
|
315
|
+
# @return [MBError]
|
316
|
+
def queue_random_tracks()
|
317
|
+
send_message(find_hwnd(), WM_USER, MBC_QueueRandomTracks, count)
|
318
|
+
end
|
319
|
+
|
320
|
+
# @return [int]
|
321
|
+
def get_duration()
|
322
|
+
send_message(find_hwnd(), WM_USER, MBC_GetDuration, 0)
|
323
|
+
end
|
324
|
+
|
325
|
+
# @return [String]
|
326
|
+
def get_file_url()
|
327
|
+
hwnd = find_hwnd()
|
328
|
+
|
329
|
+
lr = send_message(hwnd, WM_USER, MBC_GetFileUrl, 0)
|
330
|
+
|
331
|
+
r = unpack_s(lr)
|
332
|
+
|
333
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
334
|
+
|
335
|
+
r
|
336
|
+
end
|
337
|
+
|
338
|
+
# @param file_property [MBFileProperty]
|
339
|
+
# @return [String]
|
340
|
+
def get_file_property(file_property)
|
341
|
+
hwnd = find_hwnd()
|
342
|
+
|
343
|
+
lr = send_message(hwnd, WM_USER, MBC_GetFileProperty, file_property)
|
344
|
+
|
345
|
+
r = unpack_s(lr)
|
346
|
+
|
347
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
348
|
+
|
349
|
+
r
|
350
|
+
end
|
351
|
+
|
352
|
+
# @param field [MBMetaData]
|
353
|
+
# @return [String]
|
354
|
+
def get_file_tag(field)
|
355
|
+
hwnd = find_hwnd()
|
356
|
+
|
357
|
+
lr = send_message(hwnd, WM_USER, MBC_GetFileTag, field)
|
358
|
+
|
359
|
+
r = unpack_s(lr)
|
360
|
+
|
361
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
362
|
+
|
363
|
+
r
|
364
|
+
end
|
365
|
+
|
366
|
+
# @return [String]
|
367
|
+
def get_lyrics()
|
368
|
+
hwnd = find_hwnd()
|
369
|
+
|
370
|
+
lr = send_message(hwnd, WM_USER, MBC_GetLyrics, 0)
|
371
|
+
|
372
|
+
r = unpack_s(lr)
|
373
|
+
|
374
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
375
|
+
|
376
|
+
r
|
377
|
+
end
|
378
|
+
|
379
|
+
# @return [String]
|
380
|
+
def get_downloaded_lyrics()
|
381
|
+
hwnd = find_hwnd()
|
382
|
+
|
383
|
+
lr = send_message(hwnd, WM_USER, MBC_GetDownloadedLyrics, 0)
|
384
|
+
|
385
|
+
r = unpack_s(lr)
|
386
|
+
|
387
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
388
|
+
|
389
|
+
r
|
390
|
+
end
|
391
|
+
|
392
|
+
# @return [String]
|
393
|
+
def get_artwork()
|
394
|
+
hwnd = find_hwnd()
|
395
|
+
|
396
|
+
lr = send_message(hwnd, WM_USER, MBC_GetArtwork, 0)
|
397
|
+
|
398
|
+
r = unpack_s(lr)
|
399
|
+
|
400
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
401
|
+
|
402
|
+
r
|
403
|
+
end
|
404
|
+
|
405
|
+
# @return [String]
|
406
|
+
def get_artwork_url()
|
407
|
+
hwnd = find_hwnd()
|
408
|
+
|
409
|
+
lr = send_message(hwnd, WM_USER, MBC_GetArtworkUrl, 0)
|
410
|
+
|
411
|
+
r = unpack_s(lr)
|
412
|
+
|
413
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
414
|
+
|
415
|
+
r
|
416
|
+
end
|
417
|
+
|
418
|
+
# @return [String]
|
419
|
+
def get_downloaded_artwork()
|
420
|
+
hwnd = find_hwnd()
|
421
|
+
|
422
|
+
lr = send_message(hwnd, WM_USER, MBC_GetDownloadedArtwork, 0)
|
423
|
+
|
424
|
+
r = unpack_s(lr)
|
425
|
+
|
426
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
427
|
+
|
428
|
+
r
|
429
|
+
end
|
430
|
+
|
431
|
+
# @return [String]
|
432
|
+
def get_downloaded_artwork_url()
|
433
|
+
hwnd = find_hwnd()
|
434
|
+
|
435
|
+
lr = send_message(hwnd, WM_USER, MBC_GetDownloadedArtworkUrl, 0)
|
436
|
+
|
437
|
+
r = unpack_s(lr)
|
438
|
+
|
439
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
440
|
+
|
441
|
+
r
|
442
|
+
end
|
443
|
+
|
444
|
+
# @param fading_percent [int]
|
445
|
+
# @return [String]
|
446
|
+
def get_artist_picture(fading_percent)
|
447
|
+
hwnd = find_hwnd()
|
448
|
+
|
449
|
+
lr = send_message(hwnd, WM_USER, MBC_GetArtistPicture, fading_percent)
|
450
|
+
|
451
|
+
r = unpack_s(lr)
|
452
|
+
|
453
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
454
|
+
|
455
|
+
r
|
456
|
+
end
|
457
|
+
|
458
|
+
# @param local_only [bool]
|
459
|
+
# @return [String]
|
460
|
+
def get_artist_picture_urls(local_only)
|
461
|
+
hwnd = find_hwnd()
|
462
|
+
|
463
|
+
lr = send_message(hwnd, WM_USER, MBC_GetArtistPictureUrls, to_i(local_only))
|
464
|
+
|
465
|
+
r = unpack_sa(lr)
|
466
|
+
|
467
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
468
|
+
|
469
|
+
r
|
470
|
+
end
|
471
|
+
|
472
|
+
# @return [String]
|
473
|
+
def get_artist_picture_thumb()
|
474
|
+
hwnd = find_hwnd()
|
475
|
+
|
476
|
+
lr = send_message(hwnd, WM_USER, MBC_GetArtistPictureThumb, 0)
|
477
|
+
|
478
|
+
r = unpack_s(lr)
|
479
|
+
|
480
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
481
|
+
|
482
|
+
r
|
483
|
+
end
|
484
|
+
|
485
|
+
# @return [bool]
|
486
|
+
def is_soundtrack()
|
487
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_IsSoundtrack, 0))
|
488
|
+
end
|
489
|
+
|
490
|
+
# @param local_only [bool]
|
491
|
+
# @return [String]
|
492
|
+
def get_soundtrack_picture_urls(local_only)
|
493
|
+
hwnd = find_hwnd()
|
494
|
+
|
495
|
+
lr = send_message(hwnd, WM_USER, MBC_GetSoundtrackPictureUrls,
|
496
|
+
to_i(local_only))
|
497
|
+
|
498
|
+
r = unpack_sa(lr)
|
499
|
+
|
500
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
501
|
+
|
502
|
+
r
|
503
|
+
end
|
504
|
+
|
505
|
+
# @return [int]
|
506
|
+
def get_current_index()
|
507
|
+
send_message(find_hwnd(), WM_USER, MBC_GetCurrentIndex, 0)
|
508
|
+
end
|
509
|
+
|
510
|
+
# @param offset [int]
|
511
|
+
# @return [int]
|
512
|
+
def get_next_index(offset)
|
513
|
+
send_message(find_hwnd(), WM_USER, MBC_GetNextIndex, offset)
|
514
|
+
end
|
515
|
+
|
516
|
+
# @return [bool]
|
517
|
+
def is_any_prior_tracks()
|
518
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_IsAnyPriorTracks, 0))
|
519
|
+
end
|
520
|
+
|
521
|
+
# @return [bool]
|
522
|
+
def is_any_following_tracks()
|
523
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_IsAnyFollowingTracks, 0))
|
524
|
+
end
|
525
|
+
|
526
|
+
# @param fileurl [String]
|
527
|
+
# @return [MBError]
|
528
|
+
def play_now(fileurl)
|
529
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_PlayNow, pack_s(fileurl))
|
530
|
+
end
|
531
|
+
|
532
|
+
# @param fileurl [String]
|
533
|
+
# @return [MBError]
|
534
|
+
def queue_next(fileurl)
|
535
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_QueueNext, pack_s(fileurl))
|
536
|
+
end
|
537
|
+
|
538
|
+
# @param fileurl [String]
|
539
|
+
# @return [MBError]
|
540
|
+
def queue_last(fileurl)
|
541
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_QueueLast, pack_s(fileurl))
|
542
|
+
end
|
543
|
+
|
544
|
+
# @return [MBError]
|
545
|
+
def clear_now_playing_list()
|
546
|
+
send_message(find_hwnd(), WM_USER, MBC_ClearNowPlayingList, 0)
|
547
|
+
end
|
548
|
+
|
549
|
+
# @param index [int]
|
550
|
+
# @return [MBError]
|
551
|
+
def remove_at(index)
|
552
|
+
send_message(find_hwnd(), WM_USER, MBC_RemoveAt, index)
|
553
|
+
end
|
554
|
+
|
555
|
+
# @param from_indices [Array<int>]
|
556
|
+
# @param to_index [int]
|
557
|
+
# @return [MBError]
|
558
|
+
def move_files(from_indices, to_index)
|
559
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_MoveFiles,
|
560
|
+
pack_iai(from_indices, to_index))
|
561
|
+
end
|
562
|
+
|
563
|
+
# @return [MBError]
|
564
|
+
def show_now_playing_assistant()
|
565
|
+
send_message(find_hwnd(), WM_USER, MBC_ShowNowPlayingAssistant, 0)
|
566
|
+
end
|
567
|
+
|
568
|
+
# @return [bool]
|
569
|
+
def get_show_time_remaining()
|
570
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetShowTimeRemaining, 0))
|
571
|
+
end
|
572
|
+
|
573
|
+
# @return [bool]
|
574
|
+
def get_show_rating_track()
|
575
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetShowRatingTrack, 0))
|
576
|
+
end
|
577
|
+
|
578
|
+
# @return [bool]
|
579
|
+
def get_show_rating_love()
|
580
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetShowRatingLove, 0))
|
581
|
+
end
|
582
|
+
|
583
|
+
# @param button [MBPlayButtonType]
|
584
|
+
# @return [bool]
|
585
|
+
def get_button_enabled(button)
|
586
|
+
to_b(send_message(find_hwnd(), WM_USER, MBC_GetButtonEnabled, button))
|
587
|
+
end
|
588
|
+
|
589
|
+
# @param index [int]
|
590
|
+
# @return [MBError]
|
591
|
+
def jump(index)
|
592
|
+
send_message(find_hwnd(), WM_USER, MBC_Jump, index)
|
593
|
+
end
|
594
|
+
|
595
|
+
# @param query [String]
|
596
|
+
# @param comparison [String]
|
597
|
+
# @param fields [Array<String>]
|
598
|
+
# @return [Array<String>]
|
599
|
+
def search(query, comparison="Contains",
|
600
|
+
fields=["ArtistPeople", "Title", "Album"])
|
601
|
+
hwnd = find_hwnd()
|
602
|
+
|
603
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Search,
|
604
|
+
pack_sssa(query, comparison, fields))
|
605
|
+
|
606
|
+
r = unpack_sa(lr)
|
607
|
+
|
608
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
609
|
+
|
610
|
+
r
|
611
|
+
end
|
612
|
+
|
613
|
+
# @param query [String]
|
614
|
+
# @param comparison [String]
|
615
|
+
# @param fields [Array<String>]
|
616
|
+
# @return [String]
|
617
|
+
def search_first(query, comparison="Contains",
|
618
|
+
fields=["ArtistPeople", "Title", "Album"])
|
619
|
+
hwnd = find_hwnd()
|
620
|
+
|
621
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_SearchFirst,
|
622
|
+
pack_sssa(query, comparison, fields))
|
623
|
+
|
624
|
+
r = unpack_s(lr)
|
625
|
+
|
626
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
627
|
+
|
628
|
+
r
|
629
|
+
end
|
630
|
+
|
631
|
+
# @param query [String]
|
632
|
+
# @param comparison [String]
|
633
|
+
# @param fields [Array<String>]
|
634
|
+
# @return [Array<int>]
|
635
|
+
def search_indices(query, comparison="Contains",
|
636
|
+
fields=["ArtistPeople", "Title", "Album"])
|
637
|
+
hwnd = find_hwnd()
|
638
|
+
|
639
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_SearchIndices,
|
640
|
+
pack_sssa(query, comparison, fields))
|
641
|
+
|
642
|
+
r = unpack_ia(lr)
|
643
|
+
|
644
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
645
|
+
|
646
|
+
r
|
647
|
+
end
|
648
|
+
|
649
|
+
# @param query [String]
|
650
|
+
# @param comparison [String]
|
651
|
+
# @param fields [Array<String>]
|
652
|
+
# @return [int]
|
653
|
+
def search_first_index(query, comparison="Contains",
|
654
|
+
fields=["ArtistPeople", "Title", "Album"])
|
655
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_SearchFirstIndex,
|
656
|
+
pack_sssa(query, comparison, fields))
|
657
|
+
end
|
658
|
+
|
659
|
+
# @param query [String]
|
660
|
+
# @param comparison [String]
|
661
|
+
# @param fields [Array<String>]
|
662
|
+
# @return [MBError]
|
663
|
+
def search_and_play_first(query, comparison="Contains",
|
664
|
+
fields=["ArtistPeople", "Title", "Album"])
|
665
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_SearchAndPlayFirst,
|
666
|
+
pack_sssa(query, comparison, fields))
|
667
|
+
end
|
668
|
+
|
669
|
+
# @!group Now Playing List
|
670
|
+
|
671
|
+
# @param index [int]
|
672
|
+
# @return [String]
|
673
|
+
def now_playing_list_get_list_file_url(index)
|
674
|
+
hwnd = find_hwnd()
|
675
|
+
|
676
|
+
lr = send_message(hwnd, WM_USER, MBC_NowPlayingList_GetListFileUrl, index)
|
677
|
+
|
678
|
+
r = unpack_s(lr)
|
679
|
+
|
680
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
681
|
+
|
682
|
+
r
|
683
|
+
end
|
684
|
+
|
685
|
+
# @param index [int]
|
686
|
+
# @param file_property [MBFileProperty]
|
687
|
+
# @return [String]
|
688
|
+
def now_playing_list_get_file_property(index, file_property)
|
689
|
+
hwnd = find_hwnd()
|
690
|
+
|
691
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_NowPlayingList_GetFileProperty,
|
692
|
+
pack_i(index, file_property))
|
693
|
+
|
694
|
+
r = unpack_s(lr)
|
695
|
+
|
696
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
697
|
+
|
698
|
+
r
|
699
|
+
end
|
700
|
+
|
701
|
+
# @param index [int]
|
702
|
+
# @param field [MBMetaData]
|
703
|
+
# @return [String]
|
704
|
+
def now_playing_list_get_file_tag(index, field)
|
705
|
+
hwnd = find_hwnd()
|
706
|
+
|
707
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_NowPlayingList_GetFileTag,
|
708
|
+
pack_i(index, field))
|
709
|
+
|
710
|
+
r = unpack_s(lr)
|
711
|
+
|
712
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
713
|
+
|
714
|
+
r
|
715
|
+
end
|
716
|
+
|
717
|
+
# @param query [String]
|
718
|
+
# @return [MBError]
|
719
|
+
def now_playing_list_query_files(query)
|
720
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_NowPlayingList_QueryFiles,
|
721
|
+
pack_s(query))
|
722
|
+
end
|
723
|
+
|
724
|
+
# @return [String]
|
725
|
+
def now_playing_list_query_get_next_file()
|
726
|
+
hwnd = find_hwnd()
|
727
|
+
|
728
|
+
lr = send_message(hwnd, WM_USER, MBC_NowPlayingList_QueryGetNextFile, 0)
|
729
|
+
|
730
|
+
r = unpack_s(lr)
|
731
|
+
|
732
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
733
|
+
|
734
|
+
r
|
735
|
+
end
|
736
|
+
|
737
|
+
# @return [String]
|
738
|
+
def now_playing_list_query_get_all_files()
|
739
|
+
hwnd = find_hwnd()
|
740
|
+
|
741
|
+
lr = send_message(hwnd, WM_USER, MBC_NowPlayingList_QueryGetAllFiles, 0)
|
742
|
+
|
743
|
+
r = unpack_s(lr)
|
744
|
+
|
745
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
746
|
+
|
747
|
+
r
|
748
|
+
end
|
749
|
+
|
750
|
+
# @param query [String]
|
751
|
+
# @return [Array<String>]
|
752
|
+
def now_playing_list_query_files_ex(query)
|
753
|
+
hwnd = find_hwnd()
|
754
|
+
|
755
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_NowPlayingList_QueryFilesEx,
|
756
|
+
pack_s(query))
|
757
|
+
|
758
|
+
r = unpack_sa(lr)
|
759
|
+
|
760
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
761
|
+
|
762
|
+
r
|
763
|
+
end
|
764
|
+
|
765
|
+
# @return [MBError]
|
766
|
+
def now_playing_list_play_library_shuffled()
|
767
|
+
send_message(find_hwnd(), WM_USER,
|
768
|
+
MBC_NowPlayingList_PlayLibraryShuffled, 0)
|
769
|
+
end
|
770
|
+
|
771
|
+
# @return [int]
|
772
|
+
def now_playing_list_get_item_count()
|
773
|
+
send_message(find_hwnd(), WM_USER, MBC_NowPlayingList_GetItemCount, 0)
|
774
|
+
end
|
775
|
+
|
776
|
+
# @!group Playlist
|
777
|
+
|
778
|
+
# @param playlist_url [String]
|
779
|
+
# @return [String]
|
780
|
+
def playlist_get_name(playlist_url)
|
781
|
+
hwnd = find_hwnd()
|
782
|
+
|
783
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Playlist_GetName,
|
784
|
+
pack_s(playlist_url))
|
785
|
+
|
786
|
+
r = unpack_s(lr)
|
787
|
+
|
788
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
789
|
+
|
790
|
+
r
|
791
|
+
end
|
792
|
+
|
793
|
+
# @param playlist_url [String]
|
794
|
+
# @return [MBPlaylistFormat]
|
795
|
+
def playlist_get_type(playlist_url)
|
796
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_GetType,
|
797
|
+
pack_s(playlist_url))
|
798
|
+
end
|
799
|
+
|
800
|
+
# @param playlist_url [String]
|
801
|
+
# @param filename [String]
|
802
|
+
# @return [bool]
|
803
|
+
def playlist_is_in_list(playlist_url, filename)
|
804
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_IsInList,
|
805
|
+
pack_s(playlist_url, filename))
|
806
|
+
end
|
807
|
+
|
808
|
+
# @return [MBError]
|
809
|
+
def playlist_query_playlists()
|
810
|
+
send_message(find_hwnd(), WM_USER, MBC_Playlist_QueryPlaylists, 0)
|
811
|
+
end
|
812
|
+
|
813
|
+
# @return [String]
|
814
|
+
def playlist_query_get_next_playlist()
|
815
|
+
hwnd = find_hwnd()
|
816
|
+
|
817
|
+
lr = send_message(hwnd, WM_USER, MBC_Playlist_QueryGetNextPlaylist, 0)
|
818
|
+
|
819
|
+
r = unpack_s(lr)
|
820
|
+
|
821
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
822
|
+
|
823
|
+
r
|
824
|
+
end
|
825
|
+
|
826
|
+
# @param playlist_url [String]
|
827
|
+
# @return [MBError]
|
828
|
+
def playlist_query_files(playlist_url)
|
829
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_QueryFiles,
|
830
|
+
pack_s(playlist_url))
|
831
|
+
end
|
832
|
+
|
833
|
+
# @return [String]
|
834
|
+
def playlist_query_get_next_file()
|
835
|
+
hwnd = find_hwnd()
|
836
|
+
|
837
|
+
lr = send_message(hwnd, WM_USER, MBC_Playlist_QueryGetNextFile, 0)
|
838
|
+
|
839
|
+
r = unpack_s(lr)
|
840
|
+
|
841
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
842
|
+
|
843
|
+
r
|
844
|
+
end
|
845
|
+
|
846
|
+
# @return [String]
|
847
|
+
def playlist_query_get_all_files()
|
848
|
+
hwnd = find_hwnd()
|
849
|
+
|
850
|
+
lr = send_message(hwnd, WM_USER, MBC_Playlist_QueryGetAllFiles, 0)
|
851
|
+
|
852
|
+
r = unpack_s(lr)
|
853
|
+
|
854
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
855
|
+
|
856
|
+
r
|
857
|
+
end
|
858
|
+
|
859
|
+
# @param playlist_url [String]
|
860
|
+
# @return [Array<String>]
|
861
|
+
def playlist_query_files_ex(playlist_url)
|
862
|
+
hwnd = find_hwnd()
|
863
|
+
|
864
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Playlist_QueryFilesEx,
|
865
|
+
pack_s(playlist_url))
|
866
|
+
|
867
|
+
r = unpack_sa(lr)
|
868
|
+
|
869
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
870
|
+
|
871
|
+
r
|
872
|
+
end
|
873
|
+
|
874
|
+
# @param folder_name [String]
|
875
|
+
# @param playlist_name [String]
|
876
|
+
# @param filenames [Array<String>]
|
877
|
+
# @return [String]
|
878
|
+
def playlist_create_playlist(folder_name, playlist_name, filenames)
|
879
|
+
hwnd = find_hwnd()
|
880
|
+
|
881
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Playlist_CreatePlaylist,
|
882
|
+
pack_sssa(folder_name, playlist_name, filenames))
|
883
|
+
|
884
|
+
r = unpack_s(lr)
|
885
|
+
|
886
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
887
|
+
|
888
|
+
r
|
889
|
+
end
|
890
|
+
|
891
|
+
# @param playlist_url [String]
|
892
|
+
# @return [MBError]
|
893
|
+
def playlist_delete_playlist(playlist_url)
|
894
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_DeletePlaylist,
|
895
|
+
pack_s(playlist_url))
|
896
|
+
end
|
897
|
+
|
898
|
+
# @param playlist_url [String]
|
899
|
+
# @param filenames [Array<String>]
|
900
|
+
# @return [MBError]
|
901
|
+
def playlist_set_files(playlist_url, filenames)
|
902
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_SetFiles,
|
903
|
+
pack_ssa(playlist_url, filenames))
|
904
|
+
end
|
905
|
+
|
906
|
+
# @param playlist_url [String]
|
907
|
+
# @param filenames [Array<String>]
|
908
|
+
# @return [MBError]
|
909
|
+
def playlist_append_files(playlist_url, filenames)
|
910
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_AppendFiles,
|
911
|
+
pack_ssa(playlist_url, filenames))
|
912
|
+
end
|
913
|
+
|
914
|
+
# @param playlist_url [String]
|
915
|
+
# @param index [int]
|
916
|
+
# @return [MBError]
|
917
|
+
def playlist_remove_at(playlist_url, index)
|
918
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_RemoveAt,
|
919
|
+
pack_si(playlist_url, index))
|
920
|
+
end
|
921
|
+
|
922
|
+
# @param playlist_url [String]
|
923
|
+
# @param from_indices [Array<int>]
|
924
|
+
# @param to_index [int]
|
925
|
+
# @return [MBError]
|
926
|
+
def playlist_move_files(playlist_url, from_indices, to_index)
|
927
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_MoveFiles,
|
928
|
+
pack_siai(playlist_url, from_indices, to_index))
|
929
|
+
end
|
930
|
+
|
931
|
+
# @param playlist_url [String]
|
932
|
+
# @return [MBError]
|
933
|
+
def playlist_play_now(playlist_url)
|
934
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_PlayNow,
|
935
|
+
pack_s(playlist_url))
|
936
|
+
end
|
937
|
+
|
938
|
+
# @param playlist_url [String]
|
939
|
+
# @return [int]
|
940
|
+
def playlist_get_item_count(playlist_url)
|
941
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Playlist_GetItemCount,
|
942
|
+
pack_s(playlist_url))
|
943
|
+
end
|
944
|
+
|
945
|
+
# @!group Library
|
946
|
+
|
947
|
+
# @param file_url [String]
|
948
|
+
# @param file_property [MBFileProperty]
|
949
|
+
# @return [String]
|
950
|
+
def library_get_file_property(file_url, file_property)
|
951
|
+
hwnd = find_hwnd()
|
952
|
+
|
953
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetFileProperty,
|
954
|
+
pack_si(file_url, file_property))
|
955
|
+
|
956
|
+
r = unpack_s(lr)
|
957
|
+
|
958
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
959
|
+
|
960
|
+
r
|
961
|
+
end
|
962
|
+
|
963
|
+
# @param file_url [String]
|
964
|
+
# @param field [MBMetaData]
|
965
|
+
# @return [String]
|
966
|
+
def library_get_file_tag(file_url, field)
|
967
|
+
hwnd = find_hwnd()
|
968
|
+
|
969
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetFileTag,
|
970
|
+
pack_si(file_url, field))
|
971
|
+
|
972
|
+
r = unpack_s(lr)
|
973
|
+
|
974
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
975
|
+
|
976
|
+
r
|
977
|
+
end
|
978
|
+
|
979
|
+
# @param file_url [String]
|
980
|
+
# @param field [MBMetaData]
|
981
|
+
# @param value [String]
|
982
|
+
# @return [MBError]
|
983
|
+
def library_set_file_tag(file_url, field, value)
|
984
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Library_SetFileTag,
|
985
|
+
pack_sis(file_url, field, value))
|
986
|
+
end
|
987
|
+
|
988
|
+
# @param file_url [String]
|
989
|
+
# @return [MBError]
|
990
|
+
def library_commit_tags_to_file(file_url)
|
991
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Library_CommitTagsToFile,
|
992
|
+
pack_s(file_url))
|
993
|
+
end
|
994
|
+
|
995
|
+
# @param file_url [String]
|
996
|
+
# @param lyrics_type [MBLyricsType]
|
997
|
+
# @return [String]
|
998
|
+
def library_get_lyrics(file_url, lyrics_type)
|
999
|
+
hwnd = find_hwnd()
|
1000
|
+
|
1001
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetLyrics,
|
1002
|
+
pack_si(file_url, lyrics_type))
|
1003
|
+
|
1004
|
+
r = unpack_s(lr)
|
1005
|
+
|
1006
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1007
|
+
|
1008
|
+
r
|
1009
|
+
end
|
1010
|
+
|
1011
|
+
# @param file_url [String]
|
1012
|
+
# @param index [int]
|
1013
|
+
# @return [String]
|
1014
|
+
def library_get_artwork(file_url, index)
|
1015
|
+
hwnd = find_hwnd()
|
1016
|
+
|
1017
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtwork,
|
1018
|
+
pack_si(file_url, index))
|
1019
|
+
|
1020
|
+
r = unpack_s(lr)
|
1021
|
+
|
1022
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1023
|
+
|
1024
|
+
r
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
# @param file_url [String]
|
1028
|
+
# @param index [int]
|
1029
|
+
# @return [String]
|
1030
|
+
def library_get_artwork_url(file_url, index)
|
1031
|
+
hwnd = find_hwnd()
|
1032
|
+
|
1033
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtworkUrl,
|
1034
|
+
pack_si(file_url, index))
|
1035
|
+
|
1036
|
+
r = unpack_s(lr)
|
1037
|
+
|
1038
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1039
|
+
|
1040
|
+
r
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
# @param artist_name [String]
|
1044
|
+
# @param fading_percent [int]
|
1045
|
+
# @param fading_color [int]
|
1046
|
+
# @return [String]
|
1047
|
+
def library_get_artist_picture(artist_name, fading_percent, fading_color)
|
1048
|
+
hwnd = find_hwnd()
|
1049
|
+
|
1050
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtistPicture,
|
1051
|
+
pack_si(artist_name, fading_percent, fading_color))
|
1052
|
+
|
1053
|
+
r = unpack_s(lr)
|
1054
|
+
|
1055
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1056
|
+
|
1057
|
+
r
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
# @param artist_name [String]
|
1061
|
+
# @param local_only [int]
|
1062
|
+
# @return [String]
|
1063
|
+
def library_get_artist_picture_urls(artist_name, local_only)
|
1064
|
+
hwnd = find_hwnd()
|
1065
|
+
|
1066
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtistPictureUrls,
|
1067
|
+
pack_sb(artist_name, local_only))
|
1068
|
+
|
1069
|
+
r = unpack_sa(lr)
|
1070
|
+
|
1071
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1072
|
+
|
1073
|
+
r
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
# @param artist_name [String]
|
1077
|
+
# @return [String]
|
1078
|
+
def library_get_artist_picture_thumb(artist_name)
|
1079
|
+
hwnd = find_hwnd()
|
1080
|
+
|
1081
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_GetArtistPictureThumb,
|
1082
|
+
pack_s(artist_name))
|
1083
|
+
|
1084
|
+
r = unpack_s(lr)
|
1085
|
+
|
1086
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1087
|
+
|
1088
|
+
r
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
# @param file_url [String]
|
1092
|
+
# @param category [MBLibraryCategory]
|
1093
|
+
# @return [String]
|
1094
|
+
def library_add_file_to_library(file_url, category)
|
1095
|
+
hwnd = find_hwnd()
|
1096
|
+
|
1097
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_AddFileToLibrary,
|
1098
|
+
pack_si(file_url, category))
|
1099
|
+
|
1100
|
+
r = unpack_s(lr)
|
1101
|
+
|
1102
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1103
|
+
|
1104
|
+
r
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
# @param query [String]
|
1108
|
+
# @return [MBError]
|
1109
|
+
def library_query_files(query)
|
1110
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Library_QueryFiles,
|
1111
|
+
pack_s(query))
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
# @return [String]
|
1115
|
+
def library_query_get_next_file()
|
1116
|
+
hwnd = find_hwnd()
|
1117
|
+
|
1118
|
+
lr = send_message(hwnd, WM_USER, MBC_Library_QueryGetNextFile, 0)
|
1119
|
+
|
1120
|
+
r = unpack_s(lr)
|
1121
|
+
|
1122
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1123
|
+
|
1124
|
+
r
|
1125
|
+
end
|
1126
|
+
|
1127
|
+
# @return [String]
|
1128
|
+
def library_query_get_all_files()
|
1129
|
+
hwnd = find_hwnd()
|
1130
|
+
|
1131
|
+
lr = send_message(hwnd, WM_USER, MBC_Library_QueryGetAllFiles, 0)
|
1132
|
+
|
1133
|
+
r = unpack_s(lr)
|
1134
|
+
|
1135
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1136
|
+
|
1137
|
+
r
|
1138
|
+
end
|
1139
|
+
|
1140
|
+
# @param query [String]
|
1141
|
+
# @return [Array<String>]
|
1142
|
+
def library_query_files_ex(query)
|
1143
|
+
hwnd = find_hwnd()
|
1144
|
+
|
1145
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_QueryFilesEx,
|
1146
|
+
pack_s(query))
|
1147
|
+
|
1148
|
+
r = unpack_sa(lr)
|
1149
|
+
|
1150
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1151
|
+
|
1152
|
+
r
|
1153
|
+
end
|
1154
|
+
|
1155
|
+
# @param artist_name [String]
|
1156
|
+
# @param minimum_artist_similarity_rating [double]
|
1157
|
+
# @return [MBError]
|
1158
|
+
def library_query_similar_artists(artist_name, minimum_artist_similarity_rating)
|
1159
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Library_QueryLookupTable,
|
1160
|
+
pack_sd(artist_name, minimum_artist_similarity_rating))
|
1161
|
+
end
|
1162
|
+
|
1163
|
+
# @param key_tags [String]
|
1164
|
+
# @param value_tags [String]
|
1165
|
+
# @param query [String]
|
1166
|
+
# @return [MBError]
|
1167
|
+
def library_query_lookup_table(key_tags, value_tags, query)
|
1168
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Library_QueryLookupTable,
|
1169
|
+
pack_s(key_tags, value_tags, query))
|
1170
|
+
end
|
1171
|
+
|
1172
|
+
# @param key [String]
|
1173
|
+
# @return [Array<String>]
|
1174
|
+
def library_query_get_lookup_table_value(key)
|
1175
|
+
hwnd = find_hwnd()
|
1176
|
+
|
1177
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_QueryGetLookupTableValue,
|
1178
|
+
pack_s(key))
|
1179
|
+
|
1180
|
+
r = unpack_s(lr)
|
1181
|
+
|
1182
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1183
|
+
|
1184
|
+
r
|
1185
|
+
end
|
1186
|
+
|
1187
|
+
# @param index [int]
|
1188
|
+
# @return [MBError]
|
1189
|
+
def library_jump(index)
|
1190
|
+
send_message(find_hwnd(), WM_USER, MBC_Library_Jump, index)
|
1191
|
+
end
|
1192
|
+
|
1193
|
+
# @param query [String]
|
1194
|
+
# @param comparison [String]
|
1195
|
+
# @param fields [Array<String>]
|
1196
|
+
# @return [Array<String>]
|
1197
|
+
def library_search(query, comparison="Contains",
|
1198
|
+
fields=["ArtistPeople", "Title", "Album"])
|
1199
|
+
hwnd = find_hwnd()
|
1200
|
+
|
1201
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_Search,
|
1202
|
+
pack_sssa(query, comparison, fields))
|
1203
|
+
|
1204
|
+
r = unpack_sa(lr)
|
1205
|
+
|
1206
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1207
|
+
|
1208
|
+
r
|
1209
|
+
end
|
1210
|
+
|
1211
|
+
# @param query [String]
|
1212
|
+
# @param comparison [String]
|
1213
|
+
# @param fields [Array<String>]
|
1214
|
+
# @return [String]
|
1215
|
+
def library_search_first(query, comparison="Contains",
|
1216
|
+
fields=["ArtistPeople", "Title", "Album"])
|
1217
|
+
hwnd = find_hwnd()
|
1218
|
+
|
1219
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_SearchFirst,
|
1220
|
+
pack_sssa(query, comparison, fields))
|
1221
|
+
|
1222
|
+
r = unpack_s(lr)
|
1223
|
+
|
1224
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1225
|
+
|
1226
|
+
r
|
1227
|
+
end
|
1228
|
+
|
1229
|
+
# @param query [String]
|
1230
|
+
# @param comparison [String]
|
1231
|
+
# @param fields [Array<String>]
|
1232
|
+
# @return [Array<int>]
|
1233
|
+
def library_search_indices(query, comparison="Contains",
|
1234
|
+
fields=["ArtistPeople", "Title", "Album"])
|
1235
|
+
hwnd = find_hwnd()
|
1236
|
+
|
1237
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Library_SearchIndices,
|
1238
|
+
pack_sssa(query, comparison, fields))
|
1239
|
+
|
1240
|
+
r = unpack_ia(lr)
|
1241
|
+
|
1242
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1243
|
+
|
1244
|
+
r
|
1245
|
+
end
|
1246
|
+
|
1247
|
+
# @param query [String]
|
1248
|
+
# @param comparison [String]
|
1249
|
+
# @param fields [Array<String>]
|
1250
|
+
# @return [int]
|
1251
|
+
def library_search_first_index(query, comparison="Contains",
|
1252
|
+
fields=["ArtistPeople", "Title", "Album"])
|
1253
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Library_SearchFirstIndex,
|
1254
|
+
pack_sssa(query, comparison, fields))
|
1255
|
+
end
|
1256
|
+
|
1257
|
+
# @param query [String]
|
1258
|
+
# @param comparison [String]
|
1259
|
+
# @param fields [Array<String>]
|
1260
|
+
# @return [MBError]
|
1261
|
+
def library_search_and_play_first(query, comparison="Contains",
|
1262
|
+
fields=["ArtistPeople", "Title", "Album"])
|
1263
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_Library_SearchAndPlayFirst,
|
1264
|
+
pack_sssa(query, comparison, fields))
|
1265
|
+
end
|
1266
|
+
|
1267
|
+
# @!group Setting
|
1268
|
+
|
1269
|
+
# @param field [MBMetaData]
|
1270
|
+
# @return [String]
|
1271
|
+
def setting_get_field_name(field)
|
1272
|
+
hwnd = find_hwnd()
|
1273
|
+
|
1274
|
+
lr = send_message(hwnd, WM_COPYDATA, MBC_Setting_GetFieldName, field)
|
1275
|
+
|
1276
|
+
r = unpack_s(lr)
|
1277
|
+
|
1278
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1279
|
+
|
1280
|
+
r
|
1281
|
+
end
|
1282
|
+
|
1283
|
+
# @param field [MBMetaData]
|
1284
|
+
# @return [MBDataType]
|
1285
|
+
def setting_get_data_type(field)
|
1286
|
+
send_message(find_hwnd(), WM_USER, MBC_Setting_GetDataType, field)
|
1287
|
+
end
|
1288
|
+
|
1289
|
+
# @!group Window
|
1290
|
+
|
1291
|
+
# @return [HWND (long)]
|
1292
|
+
def window_get_handle()
|
1293
|
+
send_message(find_hwnd(), WM_USER, MBC_Window_GetHandle, 0)
|
1294
|
+
end
|
1295
|
+
|
1296
|
+
# @return [HWND (pointer)]
|
1297
|
+
def window_get_handle_ptr()
|
1298
|
+
send_message_ptr(find_hwnd(), WM_USER, MBC_Window_GetHandle, 0)
|
1299
|
+
end
|
1300
|
+
|
1301
|
+
# @return [MBError]
|
1302
|
+
def window_close()
|
1303
|
+
send_message(find_hwnd(), WM_USER, MBC_Window_Close, 0)
|
1304
|
+
end
|
1305
|
+
|
1306
|
+
# @return [MBError]
|
1307
|
+
def window_restore()
|
1308
|
+
send_message(find_hwnd(), WM_USER, MBC_Window_Restore, 0)
|
1309
|
+
end
|
1310
|
+
|
1311
|
+
# @return [MBError]
|
1312
|
+
def window_minimize()
|
1313
|
+
send_message(find_hwnd(), WM_USER, MBC_Window_Minimize, 0)
|
1314
|
+
end
|
1315
|
+
|
1316
|
+
# @return [MBError]
|
1317
|
+
def window_maximize()
|
1318
|
+
send_message(find_hwnd(), WM_USER, MBC_Window_Maximize, 0)
|
1319
|
+
end
|
1320
|
+
|
1321
|
+
# @param x [int]
|
1322
|
+
# @param y [int]
|
1323
|
+
# @return [MBError]
|
1324
|
+
def window_move()
|
1325
|
+
send_message(find_hwnd(), WM_USER, MBC_Window_Move, pack_i(x, y))
|
1326
|
+
end
|
1327
|
+
|
1328
|
+
# @param w [int]
|
1329
|
+
# @param h [int]
|
1330
|
+
# @return [MBError]
|
1331
|
+
def window_resize()
|
1332
|
+
send_message(find_hwnd(), WM_USER, MBC_Window_Resize, pack_i(w, h))
|
1333
|
+
end
|
1334
|
+
|
1335
|
+
# @return [MBError]
|
1336
|
+
def window_bring_to_front()
|
1337
|
+
send_message(find_hwnd(), WM_USER, MBC_Window_BringToFront, 0)
|
1338
|
+
end
|
1339
|
+
|
1340
|
+
# @return [Array<int>]
|
1341
|
+
def window_get_position()
|
1342
|
+
hwnd = find_hwnd()
|
1343
|
+
|
1344
|
+
lr = send_message(hwnd, WM_USER, MBC_Window_GetPosition, 0)
|
1345
|
+
|
1346
|
+
r = unpack_ii(lr)
|
1347
|
+
|
1348
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1349
|
+
|
1350
|
+
r
|
1351
|
+
end
|
1352
|
+
|
1353
|
+
# @return [Array<int>]
|
1354
|
+
def window_get_size()
|
1355
|
+
hwnd = find_hwnd()
|
1356
|
+
|
1357
|
+
lr = send_message(hwnd, WM_USER, MBC_Window_GetSize, 0)
|
1358
|
+
|
1359
|
+
r = unpack_ii(lr)
|
1360
|
+
|
1361
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1362
|
+
|
1363
|
+
r
|
1364
|
+
end
|
1365
|
+
|
1366
|
+
# @!group General
|
1367
|
+
|
1368
|
+
# @return [MBMusicBeeVersion]
|
1369
|
+
def get_music_bee_version()
|
1370
|
+
send_message(find_hwnd(), WM_USER, MBC_MusicBeeVersion, 0)
|
1371
|
+
end
|
1372
|
+
|
1373
|
+
# @return [String]
|
1374
|
+
def get_music_bee_version_str()
|
1375
|
+
case send_message(find_hwnd(), WM_USER, MBC_MusicBeeVersion, 0)
|
1376
|
+
when MBMBV_v2_0
|
1377
|
+
"2.0"
|
1378
|
+
when MBMBV_v2_1
|
1379
|
+
"2.1"
|
1380
|
+
when MBMBV_v2_2
|
1381
|
+
"2.2"
|
1382
|
+
when MBMBV_v2_3
|
1383
|
+
"2.3"
|
1384
|
+
else
|
1385
|
+
"Unknown"
|
1386
|
+
end
|
1387
|
+
end
|
1388
|
+
|
1389
|
+
# @return [String]
|
1390
|
+
def get_music_bee_version_sym()
|
1391
|
+
case send_message(find_hwnd(), WM_USER, MBC_MusicBeeVersion, 0)
|
1392
|
+
when MBMBV_v2_0
|
1393
|
+
:v2_0
|
1394
|
+
when MBMBV_v2_1
|
1395
|
+
:v2_1
|
1396
|
+
when MBMBV_v2_2
|
1397
|
+
:v2_2
|
1398
|
+
when MBMBV_v2_3
|
1399
|
+
:v2_3
|
1400
|
+
else
|
1401
|
+
:Unknown
|
1402
|
+
end
|
1403
|
+
end
|
1404
|
+
|
1405
|
+
# @return [String]
|
1406
|
+
def get_plugin_version_str()
|
1407
|
+
hwnd = find_hwnd()
|
1408
|
+
|
1409
|
+
lr = send_message(hwnd, WM_USER, MBC_PluginVersion, 0)
|
1410
|
+
|
1411
|
+
r = unpack_s(lr)
|
1412
|
+
|
1413
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1414
|
+
|
1415
|
+
r
|
1416
|
+
end
|
1417
|
+
|
1418
|
+
# @return [Array<int>]
|
1419
|
+
def get_plugin_version()
|
1420
|
+
hwnd = find_hwnd()
|
1421
|
+
|
1422
|
+
lr = send_message(hwnd, WM_USER, MBC_PluginVersion, 0)
|
1423
|
+
|
1424
|
+
r = unpack_s(lr)
|
1425
|
+
|
1426
|
+
send_message(hwnd, WM_USER, MBC_FreeLRESULT, lr)
|
1427
|
+
|
1428
|
+
r.split(".").map { |s| s.to_i }
|
1429
|
+
end
|
1430
|
+
|
1431
|
+
# @return [MBError]
|
1432
|
+
def test()
|
1433
|
+
send_message(find_hwnd(), WM_USER, MBC_Test, 0)
|
1434
|
+
end
|
1435
|
+
|
1436
|
+
# @param text [String]
|
1437
|
+
# @param caption [String]
|
1438
|
+
# @return [MBError]
|
1439
|
+
def message_box(text, caption)
|
1440
|
+
send_message(find_hwnd(), WM_COPYDATA, MBC_MessageBox,
|
1441
|
+
pack_s(text, caption))
|
1442
|
+
end
|
1443
|
+
|
1444
|
+
|
1445
|
+
# Converts returned String to bytes
|
1446
|
+
# @param str [String to convert]
|
1447
|
+
# @return [String]
|
1448
|
+
def to_bytes(str)
|
1449
|
+
str.encode("UTF-16LE").force_encoding("BINARY")
|
1450
|
+
end
|
1451
|
+
|
1452
|
+
# Converts returned String to byte array
|
1453
|
+
# @param str [String to convert]
|
1454
|
+
# @return [Array<uint8>]
|
1455
|
+
def to_byte_array(str)
|
1456
|
+
str.encode("UTF-16LE").force_encoding("BINARY").unpack("C*")
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
private
|
1460
|
+
|
1461
|
+
# Window Message
|
1462
|
+
WM_USER = 0x0400
|
1463
|
+
WM_COPYDATA = 0x004A
|
1464
|
+
|
1465
|
+
# @return [HWND (pointer)]
|
1466
|
+
def find_hwnd()
|
1467
|
+
find_window(nil, "MusicBee IPC Interface\0".encode("UTF-16LE"))
|
1468
|
+
end
|
1469
|
+
|
1470
|
+
def to_b(i)
|
1471
|
+
i == 0 ? false : true
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
def to_i(b)
|
1475
|
+
b ? 1 : 0
|
1476
|
+
end
|
1477
|
+
end
|