-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path_createPackage.bat
720 lines (697 loc) · 28.9 KB
/
_createPackage.bat
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
@ECHO off
REM ------------------------------------------------------------------
REM Create packages (zip file) from js files v.20/01/2025
REM Requires 7za.exe on windows to compress (otherwise do it manually)
REM If it's not provided, can be downloaded from:
REM https://www.7-zip.org/download.html
REM Download 7-Zip Extra: standalone console version...
REM Move '7za.exe' to 'C:\Windows\' (or equivalent path)
REM Alternatively set path at zipExec variable
REM Bat file must be placed at the root of the js files
REM Usage:
REM _createPackage.bat [Number] [foobarPath]
REM Key:
REM Number If Number is provided, will build package without
REM user input
REM foobarPath If provided, will copy the package to the SMP
REM packages folder at profile, and run foobar2000
REM If it's already running, is qracefully quit first
REM If set to '.', will search for the binary file
REM relative to the current folder (4 folders up)
REM ------------------------------------------------------------------
SETLOCAL
SET packagesFolder=packages
SET zipExec=helpers-external\7z\7za_32.exe
SET hasErrors=false
SET foobarPath=%2
IF [%foobarPath%]==[.] (
SET foobarPath="..\..\..\..\foobar2000.exe"
)
ECHO ---------------------------------
ECHO ^| Package creator: ^|
ECHO ---------------------------------
ECHO (1) World-Map-SMP
ECHO (2) Playlist-Manager-SMP
ECHO (3) Not-a-Waveform-Seekbar-SMP
ECHO (4) Timeline-SMP
ECHO (5) Volume-Slider-SMP
ECHO.
IF [%~1]==[] (
CHOICE /C 12345 /N /M "CHOOSE PACKAGE TO BUILD (1-5): "
) ELSE (
IF [%1] EQU [0] (
ECHO 9| CHOICE /C 123456789 /N >NUL
) ELSE (
ECHO %1| CHOICE /C 123456789 /N /M "CHOOSE PACKAGE TO BUILD (1-5): "
)
)
IF %ERRORLEVEL% EQU 1 GOTO world_map
IF %ERRORLEVEL% EQU 2 GOTO playlist_manager
IF %ERRORLEVEL% EQU 3 GOTO not_a_waveform_seekbar
IF %ERRORLEVEL% EQU 4 GOTO timeline
IF %ERRORLEVEL% EQU 5 GOTO volume_slider
IF ERRORLEVEL 6 (
ECHO Package ^(%1^) not recognized.
GOTO:EOF
)
REM ------------------------------
REM Packages
REM ------------------------------
:world_map
REM package variables
REM version is automatically retrieved from main js file
REM any text must be JSON encoded
SET name=World-Map-SMP
SET id=FA5A85D5-5C81-4B9B-BF01-52872BA83EA7
SET description=https://regorxxx.github.io/foobar2000-SMP.github.io/scripts/world-map-smp/\r\n\r\nA foobar2000 UI Spider Monkey Panel which displays current artist's country on the world map and lets you generate autoplaylists based on selection and locale tag saving when integrated along WilB's Biography Script.\r\n\r\n• Map image configurable:\r\n - Full.\r\n - No Antarctica.\r\n - Custom. (coordinates may need a transformation to work)\r\n• Configurable X and Y factors for transformation (along custom image maps).\r\n• 2 modes:\r\n - Standard: Follow now playing track or selection.\r\n - Library: display statistics of entire library (independtly of the selection/playback).\r\n• Works with multiple selected tracks (draws all points on the map), allowing to show statistics of an entire playlist or library.\r\n• Fully configurable UI.\r\n• On playback the panel fetches tags from (by order of preference):\r\n - Track's tags.\r\n - JSON database.\r\n - WilB's Biography panel.\r\n• WilB's Biography integration\r\n• Tool-tip shows multiple info about the points and tracks selected.\r\n• AutoPlaylist creation on click over a point with any artist on your library from the selected country.\r\n• Fully Wine - Unix - non IE SOs compatible.
REM version
FOR /F "tokens=* USEBACKQ" %%F IN (`findstr /R "version:" world_map.js`) DO (SET version=%%F)
IF "%version%"=="" (
ECHO Main file not found or wrong version string
PAUSE>NUL
EXIT /B 1
)
SET version=%version:if (!window.ScriptInfo.PackageId) { window.DefineScript('World Map', { author: 'regorxxx', version: '=%
SET version=%version:', features: { drag_n_drop: false } }); }=%
REM features
SET enableDragDrop=false
SET shouldGrabFocus=false
REM global variable
SET root=%packagesFolder%\%name: =-%
REM package folder and file
CALL :check_root
CALL :copy_main world_map.js
REM main
CALL :check_folder main
CALL :check_folder main\filter_and_query
CALL :copy_file main\filter_and_query\remove_duplicates.js
CALL :copy_folder main\map
CALL :check_folder main\music_graph
CALL :copy_file main\music_graph\music_graph_descriptors_xxx_countries.js
CALL :copy_folder main\world_map
CALL :check_folder main\statistics
CALL :copy_file main\statistics\statistics_xxx.js
CALL :copy_file main\statistics\statistics_xxx_helper.js
CALL :check_folder main\window
CALL :copy_file main\window\window_xxx_background.js
CALL :copy_file main\window\window_xxx_background_menu.js
CALL :copy_file main\window\window_xxx_button.js
CALL :copy_file main\window\window_xxx_helpers.js
REM helpers
CALL :check_folder helpers
CALL :copy_file helpers\callbacks_xxx.js
CALL :copy_file helpers\helpers_xxx.js
CALL :copy_file helpers\helpers_xxx_basic_js.js
CALL :copy_file helpers\helpers_xxx_cache_volatile.js
CALL :copy_file helpers\helpers_xxx_console.js
CALL :copy_file helpers\helpers_xxx_crc.js
CALL :copy_file helpers\helpers_xxx_dummy.js
CALL :copy_file helpers\helpers_xxx_file.js
CALL :copy_file helpers\helpers_xxx_flags.js
CALL :copy_file helpers\helpers_xxx_foobar.js
CALL :copy_file helpers\helpers_xxx_global.js
CALL :copy_file helpers\helpers_xxx_global_post.js
CALL :copy_file helpers\helpers_xxx_input.js
CALL :copy_file helpers\helpers_xxx_playlists.js
CALL :copy_file helpers\helpers_xxx_properties.js
CALL :copy_file helpers\helpers_xxx_prototypes.js
CALL :copy_file helpers\helpers_xxx_prototypes_smp.js
CALL :copy_file helpers\helpers_xxx_so.js
CALL :copy_file helpers\helpers_xxx_tags.js
CALL :copy_file helpers\helpers_xxx_tags_cache.js
CALL :copy_file helpers\helpers_xxx_UI.js
CALL :copy_file helpers\helpers_xxx_UI_chars.js
CALL :copy_file helpers\helpers_xxx_UI_flip.js
CALL :copy_file helpers\helpers_xxx_web.js
CALL :copy_file helpers\helpers_xxx_web_update.js
CALL :copy_file helpers\menu_xxx.js
CALL :copy_file helpers\popup_xxx.js
CALL :check_folder helpers\readme
CALL :copy_file helpers\readme\world_map.txt
REM helpers external
CALL :copy_folder helpers-external\bitmasksorterjs
CALL :copy_folder helpers-external\checkso
CALL :copy_folder helpers-external\chroma.js
CALL :copy_folder helpers-external\cmdutils
CALL :copy_folder helpers-external\countries-mercator true
CALL :copy_folder helpers-external\countries-mercator-mask true
CALL :copy_folder helpers-external\namethatcolor
CALL :copy_folder helpers-external\natsort
CALL :delete_file helpers-external\chroma.js\chroma-ultra-light.min.js
CALL :delete_file helpers-external\countries-mercator\_Kosovo.png
CALL :delete_file helpers-external\countries-mercator\"_N. Cyprus.png"
CALL :delete_file helpers-external\countries-mercator\_Somaliland.png
CALL :delete_file helpers-external\countries-mercator\worldmap_natural.png
CALL :delete_file helpers-external\countries-mercator\worldmap_shapes.png
CALL :delete_file helpers-external\countries-mercator-mask\_Kosovo.png
CALL :delete_file helpers-external\countries-mercator-mask\"_N. Cyprus.png"
CALL :delete_file helpers-external\countries-mercator-mask\_Somaliland.png
CALL :delete_file helpers-external\countries-mercator-mask\worldmap_natural.png
CALL :delete_file helpers-external\countries-mercator-mask\worldmap_shapes.png
REM others
CALL :check_folder _images
CALL :copy_file _images\_Installation_v1.5_v1.4.JPG
CALL :copy_file _images\_Installation_v1.6.JPG
CALL :copy_file _images\world_map_01.JPG
CALL :copy_file _images\world_map_02.jpg
CALL :check_folder images
CALL :check_folder images\flags
CALL :copy_folder images\flags\32 true
CALL :copy_folder images\flags\64 true
CALL :copy_file images\MC_WorldMap.jpg
CALL :copy_file images\MC_WorldMap_No_Ant.jpg
CALL :copy_file images\MC_WorldMap_Shapes.png
CALL :copy_file images\MC_WorldMap_Shapes_No_Ant.png
CALL :check_folder images\hires
CALL :copy_file images\hires\MC_WorldMap.jpg
CALL :copy_file images\hires\MC_WorldMap.png
CALL :copy_file images\hires\MC_WorldMap_No_Ant.jpg
CALL :copy_file images\hires\MC_WorldMap_No_Ant.png
CALL :copy_file images\hires\MC_WorldMap_Shapes.png
CALL :copy_file images\hires\MC_WorldMap_Shapes_No_Ant.png
CALL :check_folder presets
CALL :check_folder presets\AutoHotkey
CALL :copy_file presets\AutoHotkey\foobar_preview_play.ahk
CALL :copy_file presets\AutoHotkey\foobar_preview_sel.ahk
CALL :copy_file presets\AutoHotkey\readme.txt
CALL :copy_folder presets\"World Map"
REM package info, zip and report
CALL :finish
GOTO:EOF
:playlist_manager
REM package variables
REM version is automatically retrieved from main js file
REM any text must be JSON encoded
SET name=Playlist-Manager-SMP
SET id=2A6AEDC9-BAE4-4D30-88E2-EDE7225B494D
SET description=https://regorxxx.github.io/foobar2000-SMP.github.io/scripts/playlist-manager-smp/\r\n\r\nPlaylist manager for foobar2000 and Spider Monkey Panel to save and load (auto)playlists on demand, synchronizing, ... along many more utilities.\r\n\r\n• Manages Playlist files, AutoPlaylists and Smart Playlists(XBMC or Kodi).\r\n• ListenBrainz integration: sync user's playlists, ...\r\n• Loads playlist files x100 times faster than standard foobar.\r\n• Multiple exporting options: compatible with Foobar2000 mobile, Kodi and XBMC systems, etc.\r\n• Group by categories, tags and inline searching.\r\n• Filters and Sorting.\r\n• Configurable UI.\r\n• Fully Wine - Unix - non IE SOs compatible.\r\n• Other scripts integration:\r\n - Playlist-Tools-SMP\r\n - ajquery-xxx\r\n - SMP Dynamic menus
REM version
FOR /F "tokens=* USEBACKQ" %%F IN (`findstr /R "version:" playlist_manager.js`) DO (SET version=%%F)
IF "%version%"=="" (
ECHO Main file not found or wrong version string
PAUSE>NUL
EXIT /B 1
)
SET version=%version:if (!window.ScriptInfo.PackageId) { window.DefineScript('Playlist Manager', { author: 'regorxxx', version: '=%
SET version=%version:', features: { drag_n_drop: true, grab_focus: true } }); }=%
REM features
SET enableDragDrop=true
SET shouldGrabFocus=true
REM global variable
SET root=%packagesFolder%\%name: =-%
REM package folder and file
CALL :check_root
CALL :copy_main playlist_manager.js
REM main
CALL :check_folder main
CALL :check_folder main\filter_and_query
CALL :copy_file main\filter_and_query\remove_duplicates.js
CALL :check_folder main\playlists
CALL :copy_file main\playlists\import_text_playlist.js
CALL :copy_file main\playlists\playlist_revive.js
CALL :copy_folder main\playlist_manager
CALL :check_folder main\window
CALL :copy_file main\window\window_xxx_button.js
CALL :copy_file main\window\window_xxx_helpers.js
CALL :copy_file main\window\window_xxx_input.js
CALL :copy_file main\window\window_xxx_scrollbar.js
CALL :check_folder main\statistics
CALL :copy_file main\statistics\statistics_xxx.js
CALL :copy_file main\statistics\statistics_xxx_helper.js
CALL :delete_file main\playlist_manager\playlist_manager_listenbrainz_extra.js
REM readmes
CALL :check_folder readmes
CALL :copy_file readmes\playlist_manager.pdf
CALL :check_folder readmes\_images
CALL :copy_file readmes\_images\export.gif
CALL :copy_file readmes\_images\foobarmobile.gif
CALL :copy_file readmes\_images\pools.gif
REM helpers
CALL :check_folder helpers
CALL :copy_file helpers\callbacks_xxx.js
CALL :copy_file helpers\helpers_xxx.js
CALL :copy_file helpers\helpers_xxx_basic_js.js
CALL :copy_file helpers\helpers_xxx_cache_volatile.js
CALL :copy_file helpers\helpers_xxx_clipboard.js
CALL :copy_file helpers\helpers_xxx_console.js
CALL :copy_file helpers\helpers_xxx_controller.js
CALL :copy_file helpers\helpers_xxx_crc.js
CALL :copy_file helpers\helpers_xxx_dummy.js
CALL :copy_file helpers\helpers_xxx_file.js
CALL :copy_file helpers\helpers_xxx_file_zip.js
CALL :copy_file helpers\helpers_xxx_flags.js
CALL :copy_file helpers\helpers_xxx_foobar.js
CALL :copy_file helpers\helpers_xxx_global.js
CALL :copy_file helpers\helpers_xxx_global_post.js
CALL :copy_file helpers\helpers_xxx_input.js
CALL :copy_file helpers\helpers_xxx_instances.js
CALL :copy_file helpers\helpers_xxx_levenshtein.js
CALL :copy_file helpers\helpers_xxx_playlists.js
CALL :copy_file helpers\helpers_xxx_playlists_files.js
CALL :copy_file helpers\helpers_xxx_playlists_files_fpl.js
CALL :copy_file helpers\helpers_xxx_playlists_files_xsp.js
CALL :copy_file helpers\helpers_xxx_playlists_files_xspf.js
CALL :copy_file helpers\playlist_history.js
CALL :copy_file helpers\helpers_xxx_properties.js
CALL :copy_file helpers\helpers_xxx_prototypes.js
CALL :copy_file helpers\helpers_xxx_prototypes_smp.js
CALL :copy_file helpers\helpers_xxx_so.js
CALL :copy_file helpers\helpers_xxx_tags.js
CALL :copy_file helpers\helpers_xxx_tags_cache.js
CALL :copy_file helpers\helpers_xxx_UI.js
CALL :copy_file helpers\helpers_xxx_UI_chars.js
CALL :copy_file helpers\helpers_xxx_UI_draw.js
CALL :copy_file helpers\helpers_xxx_UI_flip.js
CALL :copy_file helpers\helpers_xxx_utils.js
CALL :copy_file helpers\helpers_xxx_web.js
CALL :copy_file helpers\helpers_xxx_web_update.js
CALL :copy_file helpers\menu_xxx.js
CALL :copy_file helpers\popup_xxx.js
CALL :check_folder helpers\readme
CALL :copy_file helpers\readme\input_box.txt
CALL :copy_file helpers\readme\playlist_manager.txt
REM helpers external
CALL :copy_folder helpers-external\bitmasksorterjs
CALL :copy_folder helpers-external\7z
CALL :copy_folder helpers-external\checkso
CALL :copy_folder helpers-external\chroma.js
CALL :copy_folder helpers-external\cmdutils
CALL :copy_folder helpers-external\fuse
CALL :copy_folder helpers-external\keycode-2.2.0
CALL :copy_folder helpers-external\namethatcolor
CALL :copy_folder helpers-external\natsort
CALL :copy_folder helpers-external\SimpleCrypto-js
CALL :copy_folder helpers-external\xspf-to-jspf-parser
CALL :copy_folder helpers-external\xsp-to-jsp-parser
CALL :delete_file helpers-external\chroma.js\chroma-ultra-light.min.js
REM others
CALL :check_folder _images
CALL :copy_file _images\_Installation_v1.5_v1.4.JPG
CALL :copy_file _images\_Installation_v1.6.JPG
CALL :copy_file _images\playlist_manager_01.JPG
CALL :copy_file _images\playlist_manager_02.JPG
CALL :copy_file _images\playlist_manager_03.JPG
CALL :copy_file _images\playlist_manager_04.JPG
CALL :copy_file _images\playlist_manager_05.JPG
CALL :copy_file _images\playlist_manager_06.JPG
CALL :copy_file _images\playlist_manager_07.JPG
CALL :copy_file _images\playlist_manager_08.JPG
CALL :copy_file _images\playlist_manager_09.JPG
CALL :copy_file _images\buttons_wine.png
CALL :check_folder _resources
CALL :copy_file _resources\fontawesome-webfont.ttf
CALL :check_folder examples
CALL :copy_file examples\playlistManager_playlists_config.json
CALL :copy_file examples\playlist_xsp_example.xsp
CALL :copy_file examples\playlist_xsp_exampleTwo.xsp
CALL :copy_file examples\playlist_xspf_example.xspf
CALL :copy_file examples\playlist_codepages.zip
CALL :check_folder presets
CALL :copy_folder presets\Network
REM package info, zip and report
CALL :finish
GOTO:EOF
:not_a_waveform_seekbar
REM package variables
REM version is automatically retrieved from main js file
REM any text must be JSON encoded
SET name=Not-A-Waveform-Seekbar-SMP
SET id=293B12D8-CC8B-4D21-8883-1A29EAFC4074
SET description=https://github.com/regorxxx/Not-A-Waveform-Seekbar-SMP\r\n\r\nA seekbar for foobar2000, using Spider Monkey Panel, audiowaveform or ffprobe. It's based on RMS, peak levels, the actual waveform or visualization presets.\r\n\r\n• Uses audiowaveform by default (included).\r\n• ffprobe can be used if desired. Download it and copy ffprobe.exe into 'helpers-external\\ffprobe'.\r\n• Visualizer mode to simply show an animation which changes according to BPM (if tag exists).\r\n• Fully configurable using the R. Click menu:\r\n - Colors\r\n - Waveform modes\r\n - Analysis modes\r\n - Animations\r\n - Refresh rate (not recommended anything below 100 ms except on really modern CPUs)
REM version
FOR /F "tokens=* USEBACKQ" %%F IN (`findstr /R "version:" seekbar.js`) DO (SET version=%%F)
IF "%version%"=="" (
ECHO Main file not found or wrong version string
PAUSE>NUL
EXIT /B 1
)
SET version=%version:if (!window.ScriptInfo.PackageId) { window.DefineScript('Not-A-Waveform-Seekbar-SMP', { author: 'regorxxx', version: '=%
SET version=%version:' }); }=%
REM features
SET enableDragDrop=false
SET shouldGrabFocus=false
REM global variable
SET root=%packagesFolder%\%name: =-%
REM package folder and file
CALL :check_root
CALL :copy_main seekbar.js
REM main
CALL :copy_folder main\seekbar
CALL :check_folder main\window
CALL :copy_file main\window\window_xxx_background.js
CALL :copy_file main\window\window_xxx_background_menu.js
CALL :copy_file main\window\window_xxx_helpers.js
REM helpers
CALL :check_folder helpers
CALL :copy_file helpers\callbacks_xxx.js
CALL :copy_file helpers\helpers_xxx.js
CALL :copy_file helpers\helpers_xxx_basic_js.js
CALL :copy_file helpers\helpers_xxx_console.js
CALL :copy_file helpers\helpers_xxx_dummy.js
CALL :copy_file helpers\helpers_xxx_file.js
CALL :copy_file helpers\helpers_xxx_foobar.js
CALL :copy_file helpers\helpers_xxx_global.js
CALL :copy_file helpers\helpers_xxx_global_post.js
CALL :copy_file helpers\helpers_xxx_input.js
CALL :copy_file helpers\helpers_xxx_properties.js
CALL :copy_file helpers\helpers_xxx_prototypes.js
CALL :copy_file helpers\helpers_xxx_prototypes_smp.js
CALL :copy_file helpers\helpers_xxx_so.js
CALL :copy_file helpers\helpers_xxx_UI.js
CALL :copy_file helpers\helpers_xxx_UI_chars.js
CALL :copy_file helpers\helpers_xxx_web.js
CALL :copy_file helpers\helpers_xxx_web_update.js
CALL :copy_file helpers\menu_xxx.js
CALL :check_folder helpers\readme
CALL :copy_file helpers\readme\seekbar.txt
REM helpers external
CALL :copy_folder helpers-external\audiowaveform
CALL :copy_folder helpers-external\bitmasksorterjs
CALL :copy_folder helpers-external\chroma.js
CALL :copy_folder helpers-external\lz-string
CALL :copy_folder helpers-external\lz-utf8
CALL :copy_folder helpers-external\namethatcolor
CALL :delete_file helpers-external\chroma.js\chroma.min.js
REM package info, zip and report
CALL :finish
GOTO:EOF
:timeline
REM package variables
REM version is automatically retrieved from main js file
REM any text must be JSON encoded
SET name=Timeline-SMP
SET id=EAEB88D1-44AC-4B13-8960-FB3AAD78828D
SET description=https://github.com/regorxxx/Timeline-SMP\r\n\r\nA timeline for foobar2000, using Spider Monkey Panel, and Statistics-Framework-SMP (https://github.com/regorxxx/Statistics-Framework-SMP).\r\n\r\n• Draws date (X) and nº tracks (Y) per artist (Z) by default.\r\n• Contextual menu to create playlists clicking on any point.\r\n• Fully customizable data per axis with TitleFormat.\r\n• Asynchronous data calculations. \r\n• Point statistics.\r\n• Scroll with buttons and mouse dragging.\r\n• Zoom with mouse wheel.\r\n• Configurable background.\r\n• Highly configurable chart and data manipulation.
REM version
FOR /F "tokens=* USEBACKQ" %%F IN (`findstr /R "version:" timeline.js`) DO (SET version=%%F)
IF "%version%"=="" (
ECHO Main file not found or wrong version string
PAUSE>NUL
EXIT /B 1
)
SET version=%version:if (!window.ScriptInfo.PackageId) { window.DefineScript('Timeline', { author: 'regorxxx', version: '=%
SET version=%version:', features: { drag_n_drop: false, grab_focus: true } }); }=%
REM features
SET enableDragDrop=false
SET shouldGrabFocus=true
REM global variable
SET root=%packagesFolder%\%name: =-%
REM package folder and file
CALL :check_root
CALL :copy_main timeline.js
REM main
CALL :copy_folder main\timeline
CALL :copy_folder main\statistics
CALL :check_folder main\filter_and_query
CALL :copy_file main\filter_and_query\remove_duplicates.js
CALL :check_folder main\map
CALL :copy_file main\map\region_xxx.js
CALL :check_folder main\music_graph
CALL :copy_file main\music_graph\music_graph_descriptors_xxx_countries.js
CALL :copy_file main\music_graph\music_graph_descriptors_xxx_helper.js
CALL :copy_file main\music_graph\music_graph_xxx.js
CALL :copy_file main\music_graph\music_graph_descriptors_xxx_culture.js
CALL :copy_file main\music_graph\music_graph_descriptors_xxx.js
CALL :check_folder main\search
CALL :copy_file main\search\top_tracks_from_date.js
CALL :check_folder main\search_by_distance
CALL :copy_file main\search_by_distance\search_by_distance_culture.js
CALL :check_folder main\window
CALL :copy_file main\window\window_xxx_button.js
CALL :copy_file main\window\window_xxx_background.js
CALL :copy_file main\window\window_xxx_background_menu.js
CALL :copy_file main\window\window_xxx_helpers.js
CALL :check_folder main\world_map
CALL :copy_file main\world_map\world_map_tables.js
CALL :delete_file main\statistics\statistics_xxx_helper_fallback.js
REM helpers
CALL :check_folder helpers
CALL :copy_file helpers\callbacks_xxx.js
CALL :copy_file helpers\helpers_xxx.js
CALL :copy_file helpers\helpers_xxx_basic_js.js
CALL :copy_file helpers\helpers_xxx_cache_volatile.js
CALL :copy_file helpers\helpers_xxx_console.js
CALL :copy_file helpers\helpers_xxx_crc.js
CALL :copy_file helpers\helpers_xxx_dummy.js
CALL :copy_file helpers\helpers_xxx_file.js
CALL :copy_file helpers\helpers_xxx_flags.js
CALL :copy_file helpers\helpers_xxx_foobar.js
CALL :copy_file helpers\helpers_xxx_global.js
CALL :copy_file helpers\helpers_xxx_global_post.js
CALL :copy_file helpers\helpers_xxx_input.js
CALL :copy_file helpers\helpers_xxx_math.js
CALL :copy_file helpers\helpers_xxx_playlists.js
CALL :copy_file helpers\helpers_xxx_properties.js
CALL :copy_file helpers\helpers_xxx_prototypes.js
CALL :copy_file helpers\helpers_xxx_prototypes_smp.js
CALL :copy_file helpers\helpers_xxx_statistics.js
CALL :copy_file helpers\helpers_xxx_so.js
CALL :copy_file helpers\helpers_xxx_tags.js
CALL :copy_file helpers\helpers_xxx_tags_cache.js
CALL :copy_file helpers\helpers_xxx_UI.js
CALL :copy_file helpers\helpers_xxx_UI_chars.js
CALL :copy_file helpers\helpers_xxx_UI_flip.js
CALL :copy_file helpers\helpers_xxx_web.js
CALL :copy_file helpers\helpers_xxx_web_update.js
CALL :copy_file helpers\menu_xxx.js
CALL :copy_file helpers\menu_xxx_extras.js
CALL :copy_file helpers\popup_xxx.js
CALL :check_folder helpers\readme
CALL :copy_file helpers\readme\timeline_dynamic_query.txt
CALL :copy_file helpers\readme\timeline.txt
REM helpers external
CALL :copy_folder helpers-external\bitmasksorterjs
CALL :copy_folder helpers-external\natsort
CALL :copy_folder helpers-external\chroma.js
CALL :copy_folder helpers-external\namethatcolor
CALL :check_folder helpers-external\ngraph
CALL :copy_file helpers-external\ngraph\ngrpah_LICENSE
CALL :copy_file helpers-external\ngraph\README_xxx.txt
CALL :copy_file helpers-external\ngraph\README.md
CALL :copy_file helpers-external\ngraph\ngraph.graph.js
CALL :delete_file helpers-external\chroma.js\chroma-ultra-light.min.js
REM package info, zip and report
CALL :finish
GOTO:EOF
:volume_slider
REM package variables
REM version is automatically retrieved from main js file
REM any text must be JSON encoded
SET name=Volume-Slider-SMP
SET id=82303AA1-3DA0-4817-BE47-85A4AE09D5CD
SET description=https://github.com/regorxxx/Volume-Slider-SMP\r\n\r\nA volume slider for foobar2000, using Spider Monkey Panel.\r\n\r\n• Drag + L. Click to set volume.\r\n• Double L. Click on button to mute\\set full volume.\r\n• Configurable layout and colors using R. Click menu.\r\n• Elements may be disabled removing color or setting size to 0.
REM version
FOR /F "tokens=* USEBACKQ" %%F IN (`findstr /R "version:" volume_slider.js`) DO (SET version=%%F)
IF "%version%"=="" (
ECHO Main file not found or wrong version string
PAUSE>NUL
EXIT /B 1
)
SET version=%version:if (!window.ScriptInfo.PackageId) { window.DefineScript('Volume-Slider-SMP', { author: 'regorxxx', version: '=%
SET version=%version:' }); }=%
REM features
SET enableDragDrop=false
SET shouldGrabFocus=false
REM global variable
SET root=%packagesFolder%\%name: =-%
REM package folder and file
CALL :check_root
CALL :copy_main volume_slider.js
REM main
CALL :copy_folder main\volume
CALL :check_folder main\window
CALL :copy_file main\window\window_xxx_slider.js
CALL :copy_file main\window\window_xxx_helpers.js
REM helpers
CALL :check_folder helpers
CALL :copy_file helpers\callbacks_xxx.js
CALL :copy_file helpers\helpers_xxx.js
CALL :copy_file helpers\helpers_xxx_basic_js.js
CALL :copy_file helpers\helpers_xxx_console.js
CALL :copy_file helpers\helpers_xxx_dummy.js
CALL :copy_file helpers\helpers_xxx_file.js
CALL :copy_file helpers\helpers_xxx_flags.js
CALL :copy_file helpers\helpers_xxx_foobar.js
CALL :copy_file helpers\helpers_xxx_global.js
CALL :copy_file helpers\helpers_xxx_global_post.js
CALL :copy_file helpers\helpers_xxx_input.js
CALL :copy_file helpers\helpers_xxx_properties.js
CALL :copy_file helpers\helpers_xxx_prototypes.js
CALL :copy_file helpers\helpers_xxx_prototypes_smp.js
CALL :copy_file helpers\helpers_xxx_so.js
CALL :copy_file helpers\helpers_xxx_UI.js
CALL :copy_file helpers\helpers_xxx_UI_chars.js
CALL :copy_file helpers\helpers_xxx_web.js
CALL :copy_file helpers\helpers_xxx_web_update.js
CALL :copy_file helpers\menu_xxx.js
CALL :check_folder helpers\readme
CALL :copy_file helpers\readme\volume_slider.txt
REM helpers external
CALL :copy_folder helpers-external\bitmasksorterjs
CALL :copy_folder helpers-external\chroma.js
CALL :copy_folder helpers-external\namethatcolor
REM package info, zip and report
CALL :finish
GOTO:EOF
REM ------------------------------
REM Internals
REM ------------------------------
:delete_file
SET filePath=%1
IF EXIST %root%\%filePath% DEL /Q /F %root%\%filePath%
GOTO:EOF
:delete_folder
REM Copy functions are Async, so put these at the end
IF EXIST %1 (
DEL /Q /F /S %1\*.* >NUL
timeout 2 > NUL
RD /Q /S %1 >NUL
)
GOTO:EOF
:copy_main
SET filePath=%1
COPY /V /Y %filePath% %root%\main.js
IF ERRORLEVEL 1 (CALL :report_error %filePath%)
GOTO:EOF
:copy_file
SET filePath=%1
ECHO %filePath%
COPY /V /Y %filePath% %root%\%filePath%>nul
IF ERRORLEVEL 1 (CALL :report_error %filePath%)
GOTO:EOF
:copy_folder
SET folderPath=%1
IF NOT EXIST %root%\%folderPath% MD %root%\%folderPath%
IF [%2]==[true] (
ECHO %folderPath%
COPY /V /Y %folderPath% %root%\%folderPath%>nul
) ELSE (
COPY /V /Y %folderPath% %root%\%folderPath%
)
IF ERRORLEVEL 1 (CALL :report_error %folderPath%)
GOTO:EOF
:check_folder
SET folderPath=%1
IF NOT EXIST %root%\%folderPath% MD %root%\%folderPath%
GOTO:EOF
:check_root
CALL :delete_folder %root%
MD %root%
GOTO:EOF
:copy_files
SET folder=%1
SET files=%~2
CALL :check_folder %folder%
FOR %%f in (%files%) do (
ECHO %folder%\%%f
CALL :copy_file %folder%\%%f
)
GOTO:EOF
:copy_folders
SET folder=%1
SET folders=%~2
CALL :check_folder %folder%
FOR %%f in (%folders%) do (
CALL :copy_folder %folder%\%%f
)
GOTO:EOF
:create_package_info
SET filePath=package.json
IF EXIST %root%\%filePath% DEL /Q /F %root%\%filePath%
REM add bom EF BB BF bytes in HEX-editor
ECHO | SET /P dummyName=""> %root%\%filePath%
ECHO {>> %root%\%filePath%
ECHO "author": "Regorxxx",>> %root%\%filePath%
ECHO "description": "%description%",>> %root%\%filePath%
ECHO "enableDragDrop": %enableDragDrop%,>> %root%\%filePath%
ECHO "id": "{%id%}",>> %root%\%filePath%
ECHO "name": "%name%",>> %root%\%filePath%
ECHO "shouldGrabFocus": %shouldGrabFocus%,>> %root%\%filePath%
ECHO "version": "%version%">> %root%\%filePath%
ECHO | SET /p dummyName="}">> %root%\%filePath%
REM omit new line at end
REM https://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line
GOTO:EOF
:compress
SET fileName=%1-%version:.=-%-package.zip
SET version=%2
IF EXIST %packagesFolder%\fileName DEL /Q /F %packagesFolder%\fileName
7za --help >nul 2>&1 && (
ECHO Compressing...
7za a -aoa -mx=7 -bso0 -bsp0 -bb0 -y -bd %packagesFolder%\%fileName% .\%root%\*
) || (
IF EXIST %zipExec% (
ECHO Compressing...
%zipExec% a -aoa -mx=7 -bso0 -bsp0 -bb0 -y -bd %packagesFolder%\%fileName% .\%root%\*
) ELSE (
EXIT /B 1
)
)
GOTO:EOF
:clean_root
CALL :delete_folder %root%
ECHO Temp folder cleaned.
GOTO:EOF
:report
IF %hasErrors%==true (
ECHO Package was not created, some errors were found.
) ELSE (
IF ERRORLEVEL 1 (
ECHO 7z.exe not found, you must manually create a zip from the folder.
ECHO Check folder at: %root%
) ELSE (
SET output="Done. Check zip file at: %packagesFolder%\%name%-%version:.=-%-package.zip"
)
)
GOTO:EOF
:report_error
ECHO.
ECHO ERROR
ECHO Not found: %1
SET hasErrors=true
EXIT /B 1
GOTO:EOF
:test
REM Kill process and start again
CHCP 437 > nul
POWERSHELL $Process=Get-Process foobar2000 ^| Where-Object {$_.Path -like '*%foobarPath%*'} ; $Process.CloseMainWindow()>nul
IF %ERRORLEVEL% EQU 0 (
ECHO Closing foobar2000...
TIMEOUT /t 4 /nobreak>nul
)
SET packages=%foobarPath:foobar2000.exe=profile\foo_spider_monkey_panel\packages\%
ECHO Copying files to package folder...
REM COPY /V /Y %root% %packages%\{%id%}>nul
ROBOCOPY %root% %packages%\{%id%} /S /E /PURGE /NJH /NFL /NC /NDL /NJS /MT:16
IF ERRORLEVEL 8 (SET hasErrors=true)
ECHO Initializing foobar2000...
START "foobar2000" /D %foobarPath:foobar2000.exe=% /B %foobarPath%
GOTO:EOF
:runFoobar
IF EXIST %foobarPath% (
CALL :test
) ELSE (
ECHO foobar2000 binary does not exist: %foobarPath%
SET hasErrors=true
)
GOTO:EOF
REM package info, zip and report
:finish
IF NOT %hasErrors%==true (
CALL :create_package_info
CALL :compress %name% %version%
CALL :report
IF NOT [%foobarPath%]==[] (
ECHO Testing...
call :runFoobar
)
)
CALL :clean_root
IF NOT [%output%]==[] (
ECHO.
ECHO.
ECHO %output:"=%
)
PAUSE>NUL
IF %hasErrors%==true (EXIT /B 1)
GOTO:EOF