1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
|
#include <algorithm>
#include "playlists.h"
#include "api__playlist.h"
#include "PlaylistsXML.h"
#include <shlwapi.h>
#include <limits.h>
#include <strsafe.h>
#pragma comment(lib, "Rpcrt4")
using namespace Nullsoft::Utility;
/*
benski> Notes to maintainers
be sure to call DelayLoad() before doing anything.
This is mainly done because the XML parsing service isn't guaranteed to be registered before this service.
It also improves load time.
*/
/* --------------------------------------------- */
PlaylistInfo::PlaylistInfo()
{
filename[0] = 0;
title[0] = 0;
length = 0;
numItems = 0;
iTunesID = 0;
cloud = 0;
UuidCreate(&guid);
}
PlaylistInfo::PlaylistInfo( const wchar_t *_filename, const wchar_t *_title, GUID playlist_guid )
{
StringCbCopyW( filename, sizeof( filename ), _filename );
if ( _title )
StringCbCopyW( title, sizeof( title ), _title );
else
title[ 0 ] = 0;
length = 0;
numItems = 0;
if ( playlist_guid == INVALID_GUID )
UuidCreate( &guid );
else
guid = playlist_guid;
iTunesID = 0;
cloud = 0;
}
PlaylistInfo::PlaylistInfo( const PlaylistInfo © )
{
StringCbCopyW( filename, sizeof( filename ), copy.filename );
StringCbCopyW( title, sizeof( title ), copy.title );
length = copy.length;
numItems = copy.numItems;
guid = copy.guid;
iTunesID = copy.iTunesID;
cloud = copy.cloud;
}
/* --------------------------------------------- */
Playlists::Playlists()
{
iterator = 0;
triedLoaded = false;
loaded = false;
dirty = false;
}
bool Playlists::DelayLoad()
{
if ( triedLoaded )
return loaded;
PlaylistsXML loader( this );
const wchar_t *g_path = WASABI_API_APP->path_getUserSettingsPath();
wchar_t playlistsFilename[ MAX_PATH ] = { 0 };
wchar_t oldPlaylistsFilename[ MAX_PATH ] = { 0 };
wchar_t newPlaylistsFolder[ MAX_PATH ] = { 0 };
PathCombineW( playlistsFilename, g_path, L"plugins" );
PathAppendW( playlistsFilename, L"ml" );
PathAppendW( playlistsFilename, L"playlists" );
CreateDirectoryW( playlistsFilename, NULL );
lstrcpynW( newPlaylistsFolder, playlistsFilename, MAX_PATH );
PathAppendW( playlistsFilename, L"playlists.xml" );
PathCombineW( oldPlaylistsFilename, g_path, L"plugins" );
PathAppendW( oldPlaylistsFilename, L"ml" );
PathAppendW( oldPlaylistsFilename, L"playlists.xml" );
bool migrated = false;
if ( PathFileExistsW( oldPlaylistsFilename ) && !PathFileExistsW( playlistsFilename ) )
{
if ( MoveFileW( oldPlaylistsFilename, playlistsFilename ) )
{
migrated = true;
PathRemoveFileSpecW( oldPlaylistsFilename );
}
}
switch ( loader.LoadFile( playlistsFilename ) )
{
case PLAYLISTSXML_SUCCESS:
loaded = true;
triedLoaded = true;
if ( AGAVE_API_STATS )
AGAVE_API_STATS->SetStat( api_stats::PLAYLIST_COUNT, (int)playlists.size() );
if ( playlists.size() && migrated )
{
for ( PlaylistInfo l_playlist : playlists )
{
wchar_t path[ MAX_PATH ] = { 0 }, file[ MAX_PATH ] = { 0 };
lstrcpynW( file, l_playlist.filename, MAX_PATH );
PathStripPathW( file );
PathCombineW( path, oldPlaylistsFilename, file );
if ( PathFileExistsW( path ) )
{
wchar_t new_path[ MAX_PATH ] = { 0 };
PathCombineW( new_path, newPlaylistsFolder, file );
MoveFileW( path, new_path );
}
}
dirty = true;
Flush();
}
break;
case PLAYLISTSXML_NO_PARSER:
// if there's XML parser, we'll try again on the off-chance it eventually gets loaded (we might still be in the midst of loading the w5s/wac components)
break;
default:
loaded = true;
triedLoaded = true;
break;
}
return loaded;
}
void Playlists::Lock()
{
playlistsGuard.Lock();
}
void Playlists::Unlock()
{
playlistsGuard.Unlock();
}
size_t Playlists::GetIterator()
{
return iterator;
}
static void WriteEscaped( FILE *fp, const wchar_t *str )
{
// TODO: for speed optimization,
// we should wait until we hit a special character
// and write out everything else so before it,
// like how ASX loader does it
while ( str && *str )
{
switch ( *str )
{
case L'&':
fputws( L"&", fp );
break;
case L'>':
fputws( L">", fp );
break;
case L'<':
fputws( L"<", fp );
break;
case L'\'':
fputws( L"'", fp );
break;
case L'\"':
fputws( L""", fp );
break;
default:
fputwc( *str, fp );
break;
}
// write out the whole UTF-16 character
wchar_t *next = CharNextW( str );
while ( ++str != next )
fputwc( *str, fp );
}
}
bool TitleSortAsc( PlaylistInfo &item1, PlaylistInfo &item2 )
{
int comp = CompareStringW( LOCALE_USER_DEFAULT, NORM_IGNORECASE | NORM_IGNOREWIDTH, item1.title, -1, item2.title, -1 );
return comp == CSTR_LESS_THAN;
}
bool TitleSortDesc( PlaylistInfo &item1, PlaylistInfo &item2 )
{
int comp = CompareStringW( LOCALE_USER_DEFAULT, NORM_IGNORECASE | NORM_IGNOREWIDTH, item1.title, -1, item2.title, -1 );
return comp == CSTR_GREATER_THAN;
}
bool NumberOfEntrySortAsc( PlaylistInfo &item1, PlaylistInfo &item2 )
{
return !!( item1.numItems < item2.numItems );
}
bool NumberOfEntrySortDesc( PlaylistInfo &item1, PlaylistInfo &item2 )
{
return !!( item1.numItems > item2.numItems );
}
int Playlists::Sort( size_t sort_type )
{
if ( !DelayLoad() )
return 0;
int sorted = 1;
switch ( sort_type )
{
case SORT_TITLE_ASCENDING:
std::sort( playlists.begin(), playlists.end(), TitleSortAsc );
break;
case SORT_TITLE_DESCENDING:
std::sort( playlists.begin(), playlists.end(), TitleSortDesc );
break;
case SORT_NUMBER_ASCENDING:
std::sort( playlists.begin(), playlists.end(), NumberOfEntrySortAsc );
break;
case SORT_NUMBER_DESCENDING:
std::sort( playlists.begin(), playlists.end(), NumberOfEntrySortDesc );
break;
default:
sorted = 0;
break;
}
dirty = true;
if ( sorted )
Flush();
return sorted;
}
void Playlists::Flush()
{
AutoLockT<Playlists> lock( this );
if ( !triedLoaded && !loaded ) // if the playlists.xml file was never even attempted to be loaded, don't overwrite
return;
if ( !dirty ) // if we've not seen any changes then no need to re-save
return;
const wchar_t *g_path = WASABI_API_APP->path_getUserSettingsPath();
wchar_t rootPath[ MAX_PATH ] = { 0 };
wchar_t playlistsBackupFilename[ MAX_PATH ] = { 0 };
wchar_t playlistsDestination[ MAX_PATH ] = { 0 };
PathCombineW( rootPath, g_path, L"plugins" );
CreateDirectoryW( rootPath, NULL );
PathAppendW( rootPath, L"ml" );
CreateDirectoryW( rootPath, NULL );
PathAppendW( rootPath, L"playlists" );
CreateDirectoryW( rootPath, NULL );
int g_path_size = wcslen( rootPath );
PathCombineW( playlistsBackupFilename, rootPath, L"playlists.xml.backup" );
PathCombineW( playlistsDestination, rootPath, L"playlists.xml" );
CopyFileW( playlistsDestination, playlistsBackupFilename, FALSE );
FILE *fp = _wfopen( playlistsDestination, L"wb" );
if ( !fp ) // bah
{
dirty = false;
return;
}
fseek( fp, 0, SEEK_SET );
fputwc( L'\xFEFF', fp );
fwprintf( fp, L"<?xml version=\"1.0\" encoding=\"UTF-16\"?>" );
fwprintf( fp, L"<playlists playlists=\"%u\">", (unsigned int)playlists.size() );
if ( AGAVE_API_STATS )
AGAVE_API_STATS->SetStat( api_stats::PLAYLIST_COUNT, (int)playlists.size() );
for ( PlaylistInfo &l_play_list_info : playlists )
{
fputws( L"<playlist filename=\"", fp );
const wchar_t *fn = l_play_list_info.filename;
if ( !_wcsnicmp( rootPath, fn, g_path_size ) )
{
fn += g_path_size;
if ( *fn == L'\\' )
++fn;
}
WriteEscaped( fp, fn );
fputws( L"\" title=\"", fp );
WriteEscaped( fp, l_play_list_info.title );
GUID guid = l_play_list_info.guid;
fwprintf( fp, L"\" id=\"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}\"",
(int)guid.Data1, (int)guid.Data2, (int)guid.Data3,
(int)guid.Data4[ 0 ], (int)guid.Data4[ 1 ],
(int)guid.Data4[ 2 ], (int)guid.Data4[ 3 ],
(int)guid.Data4[ 4 ], (int)guid.Data4[ 5 ],
(int)guid.Data4[ 6 ], (int)guid.Data4[ 7 ] );
fwprintf( fp, L" songs=\"%u\" seconds=\"%u\"", l_play_list_info.numItems, l_play_list_info.length );
if ( l_play_list_info.iTunesID )
fwprintf( fp, L" iTunesID=\"%I64u\"", l_play_list_info.iTunesID );
if ( l_play_list_info.cloud )
fwprintf( fp, L" cloud=\"1\"" );
fwprintf( fp, L"/>" );
}
fwprintf( fp, L"</playlists>" );
fclose( fp );
dirty = false;
}
size_t Playlists::GetCount()
{
DelayLoad();
return playlists.size();
}
const wchar_t *Playlists::GetFilename( size_t index )
{
if ( !DelayLoad() || index >= playlists.size() )
return 0;
return playlists[ index ].filename;
}
const wchar_t *Playlists::GetName( size_t index )
{
if ( !DelayLoad() || index >= playlists.size() )
return 0;
return playlists[ index ].title;
}
GUID Playlists::GetGUID( size_t index )
{
if ( !DelayLoad() || index >= playlists.size() )
return INVALID_GUID;
return playlists[ index ].guid;
}
int Playlists::GetPosition( GUID playlist_guid, size_t *index )
{
if ( !DelayLoad() )
return API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS;
size_t indexCount = 0;
for ( PlaylistInfo &l_play_list_info : playlists )
{
if ( l_play_list_info.guid == playlist_guid )
{
*index = indexCount;
return API_PLAYLISTS_SUCCESS;
}
++indexCount;
}
return API_PLAYLISTS_FAILURE;
}
template <class val_t>
static int GetWithSize( void *data, size_t dataLen, val_t value )
{
switch ( dataLen )
{
case 1:
{
if ( value > _UI8_MAX ) // check for overflow
return API_PLAYLISTS_BAD_SIZE;
*(uint8_t *)data = (uint8_t)value;
return API_PLAYLISTS_SUCCESS;
}
case 2:
{
if ( value > _UI16_MAX ) // check for overflow
return API_PLAYLISTS_BAD_SIZE;
*(uint16_t *)data = (uint16_t)value;
return API_PLAYLISTS_SUCCESS;
}
case 4:
{
if ( value > _UI32_MAX )
return API_PLAYLISTS_BAD_SIZE;
*(uint32_t *)data = (uint32_t)value;
return API_PLAYLISTS_SUCCESS;
}
case 8:
{
if ( value > _UI64_MAX )
return API_PLAYLISTS_BAD_SIZE;
*(uint64_t *)data = (uint64_t)value;
return API_PLAYLISTS_SUCCESS;
}
}
return API_PLAYLISTS_BAD_SIZE;
}
template <class val_t>
static int SetWithSize( void *data, size_t dataLen, val_t *value )
{
switch ( dataLen )
{
case 1:
{
*value = ( val_t ) * (uint8_t *)data;
return API_PLAYLISTS_SUCCESS;
}
case 2:
{
*value = ( val_t ) * (uint16_t *)data;
return API_PLAYLISTS_SUCCESS;
}
case 4:
{
*value = ( val_t ) * (uint32_t *)data;
return API_PLAYLISTS_SUCCESS;
}
case 8:
{
*value = ( val_t ) * (uint64_t *)data;
return API_PLAYLISTS_SUCCESS;
}
}
return API_PLAYLISTS_BAD_SIZE;
}
int Playlists::GetInfo( size_t index, GUID info, void *data, size_t dataLen )
{
if ( !DelayLoad() )
return API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS;
if ( index >= playlists.size() )
return API_PLAYLISTS_INVALID_INDEX;
if ( info == api_playlists_itemCount )
return GetWithSize( data, dataLen, playlists[ index ].numItems );
else if ( info == api_playlists_totalTime )
return GetWithSize( data, dataLen, playlists[ index ].length );
else if ( info == api_playlists_iTunesID )
return GetWithSize( data, dataLen, playlists[ index ].iTunesID );
else if ( info == api_playlists_cloud )
return GetWithSize( data, dataLen, playlists[ index ].cloud );
return API_PLAYLISTS_UNKNOWN_INFO_GUID;
}
int Playlists::MoveBefore( size_t index1, size_t index2 )
{
if ( !DelayLoad() )
return API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS;
if ( index1 >= playlists.size() )
return API_PLAYLISTS_INVALID_INDEX;
PlaylistInfo copy = playlists[ index1 ];
if ( index2 >= playlists.size() )
{
playlists.push_back( copy );
playlists.erase(playlists.begin() + index1 );
}
else
{
playlists.insert(playlists.begin() + index2, copy );
if ( index1 >= index2 )
index1++;
playlists.erase(playlists.begin() + index1 );
}
dirty = true;
++iterator;
return API_PLAYLISTS_SUCCESS;
}
size_t Playlists::AddPlaylist( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid )
{
if ( !DelayLoad() )
return -1;
AutoLockT<Playlists> lock( this );
if ( playlist_guid != INVALID_GUID )
{
for ( size_t index = 0; index < playlists.size(); index++ )
{
if ( playlists[ index ].guid == playlist_guid )
{
if ( lstrcmpiW( playlists[ index ].title, playlistName ) )
{
dirty = true;
StringCbCopyW( playlists[ index ].title, sizeof( playlists[ index ].title ), playlistName );
WASABI_API_SYSCB->syscb_issueCallback( api_playlists::SYSCALLBACK, api_playlists::PLAYLIST_RENAMED, index, 0 );
}
return -2;
}
}
}
size_t newIndex = AddPlaylist_NoCallback( filename, playlistName, playlist_guid );
WASABI_API_SYSCB->syscb_issueCallback( api_playlists::SYSCALLBACK, api_playlists::PLAYLIST_ADDED, newIndex, 0 );
return newIndex;
}
size_t Playlists::AddCloudPlaylist( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid )
{
if ( !DelayLoad() )
return -1;
AutoLockT<Playlists> lock( this );
if ( playlist_guid != INVALID_GUID )
{
for ( size_t index = 0; index < playlists.size(); index++ )
{
if ( playlists[ index ].guid == playlist_guid )
{
// we make sure that this playlist has a 'cloud' flag
// as without it, our detection of thing isn't ideal.
if ( !playlists[ index ].cloud )
playlists[ index ].cloud = 1;
if ( lstrcmpW( playlists[ index ].title, playlistName ) )
{
dirty = true;
StringCbCopyW( playlists[ index ].title, sizeof( playlists[ index ].title ), playlistName );
WASABI_API_SYSCB->syscb_issueCallback( api_playlists::SYSCALLBACK, api_playlists::PLAYLIST_RENAMED, index, 0 );
}
return -2;
}
}
}
size_t newIndex = AddPlaylist_NoCallback( filename, playlistName, playlist_guid );
int cloud = 1;
SetInfo( newIndex, api_playlists_cloud, &cloud, sizeof( cloud ) );
WASABI_API_SYSCB->syscb_issueCallback( api_playlists::SYSCALLBACK, api_playlists::PLAYLIST_ADDED, newIndex, 0 );
return newIndex;
}
size_t Playlists::AddPlaylist_internal( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid, size_t numItems, size_t length, uint64_t iTunesID, size_t cloud )
{
PlaylistInfo newPlaylist( filename, playlistName, playlist_guid );
newPlaylist.numItems = (int)numItems;
newPlaylist.length = (int)length;
newPlaylist.iTunesID = iTunesID;
newPlaylist.cloud = (int)cloud;
playlists.push_back( newPlaylist );
size_t newIndex = playlists.size() - 1;
return newIndex;
}
size_t Playlists::AddPlaylist_NoCallback( const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid )
{
AutoLockT<Playlists> lock( this );
PlaylistInfo newPlaylist( filename, playlistName, playlist_guid );
dirty = true;
playlists.push_back( newPlaylist );
++iterator;
size_t newIndex = playlists.size() - 1;
return newIndex;
}
int Playlists::SetGUID( size_t index, GUID playlist_guid )
{
if ( !DelayLoad() )
return API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS;
if ( index >= playlists.size() )
return API_PLAYLISTS_INVALID_INDEX;
dirty = true;
playlists[ index ].guid = playlist_guid;
return API_PLAYLISTS_SUCCESS;
}
int Playlists::RenamePlaylist( size_t index, const wchar_t *name )
{
if ( !DelayLoad() )
return API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS;
if ( index >= playlists.size() )
return API_PLAYLISTS_INVALID_INDEX;
dirty = true;
if ( lstrcmpW( playlists[ index ].title, name ) )
{
StringCbCopyW( playlists[ index ].title, sizeof( playlists[ index ].title ), name );
WASABI_API_SYSCB->syscb_issueCallback( api_playlists::SYSCALLBACK, api_playlists::PLAYLIST_RENAMED, index, 0 );
}
return API_PLAYLISTS_SUCCESS;
}
int Playlists::MovePlaylist( size_t index, const wchar_t *filename )
{
if ( !DelayLoad() )
return API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS;
if ( index >= playlists.size() )
return API_PLAYLISTS_INVALID_INDEX;
dirty = true;
StringCbCopyW( playlists[ index ].filename, sizeof( playlists[ index ].filename ), filename );
iterator++;
return API_PLAYLISTS_SUCCESS;
}
int Playlists::SetInfo( size_t index, GUID info, void *data, size_t dataLen )
{
if ( !DelayLoad() )
return API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS;
if ( index >= playlists.size() )
return API_PLAYLISTS_INVALID_INDEX;
dirty = true;
if ( info == api_playlists_itemCount )
return SetWithSize( data, dataLen, &playlists[ index ].numItems );
else if ( info == api_playlists_totalTime )
return SetWithSize( data, dataLen, &playlists[ index ].length );
else if ( info == api_playlists_iTunesID )
return SetWithSize( data, dataLen, &playlists[ index ].iTunesID );
else if ( info == api_playlists_cloud )
return SetWithSize( data, dataLen, &playlists[ index ].cloud );
dirty = false;
return API_PLAYLISTS_UNKNOWN_INFO_GUID;
}
int Playlists::RemovePlaylist( size_t index )
{
if ( !DelayLoad() )
return API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS;
if ( index >= playlists.size() )
return API_PLAYLISTS_INVALID_INDEX;
dirty = true;
WASABI_API_SYSCB->syscb_issueCallback( api_playlists::SYSCALLBACK, api_playlists::PLAYLIST_REMOVED_PRE, index, 0 );
playlists.erase(playlists.begin() + index );
iterator++;
WASABI_API_SYSCB->syscb_issueCallback( api_playlists::SYSCALLBACK, api_playlists::PLAYLIST_REMOVED_POST, index, 0 );
return API_PLAYLISTS_SUCCESS;
}
int Playlists::ClearPlaylists()
{
AutoLockT<Playlists> lock( this );
if ( !DelayLoad() )
return API_PLAYLISTS_UNABLE_TO_LOAD_PLAYLISTS;
dirty = true;
playlists.clear();
return API_PLAYLISTS_SUCCESS;
}
const PlaylistInfo &Playlists::GetPlaylistInfo(size_t i)
{
return playlists[i];
}
#define CBCLASS Playlists
START_DISPATCH;
VCB( API_PLAYLISTS_LOCK, Lock );
VCB( API_PLAYLISTS_UNLOCK, Unlock );
CB( API_PLAYLISTS_GETITERATOR, GetIterator );
VCB( API_PLAYLISTS_FLUSH, Flush );
CB( API_PLAYLISTS_GETCOUNT, GetCount );
CB( API_PLAYLISTS_GETFILENAME, GetFilename );
CB( API_PLAYLISTS_GETNAME, GetName );
CB( API_PLAYLISTS_GETGUID, GetGUID );
CB( API_PLAYLISTS_GETPOSITION, GetPosition );
CB( API_PLAYLISTS_GETINFO, GetInfo );
CB( API_PLAYLISTS_MOVEBEFORE, MoveBefore );
CB( API_PLAYLISTS_ADDPLAYLIST, AddPlaylist );
CB( API_PLAYLISTS_ADDPLAYLISTNOCB, AddPlaylist_NoCallback );
CB( API_PLAYLISTS_ADDCLOUDPLAYLIST, AddCloudPlaylist );
CB( API_PLAYLISTS_SETGUID, SetGUID );
CB( API_PLAYLISTS_RENAMEPLAYLIST, RenamePlaylist );
CB( API_PLAYLISTS_MOVEPLAYLIST, MovePlaylist );
CB( API_PLAYLISTS_SETINFO, SetInfo );
CB( API_PLAYLISTS_REMOVEPLAYLIST, RemovePlaylist );
CB( API_PLAYLISTS_CLEARPLAYLISTS, ClearPlaylists );
CB( API_PLAYLISTS_SORT, Sort );
END_DISPATCH;
#undef CBCLASS
|