-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeetsgui.html
More file actions
1253 lines (1206 loc) · 81.9 KB
/
Copy pathbeetsgui.html
File metadata and controls
1253 lines (1206 loc) · 81.9 KB
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
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="da">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BeetsGUI</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="BeetsGUI">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg:#0f0f0f; --bg2:#1a1a1a; --bg3:#252525; --bg4:#2e2e2e;
--text:#e8e6e1; --text2:#a09e99; --text3:#6a6866;
--border:#2e2e2e; --border2:#3a3a3a;
--accent:#c8a96e; --accent2:#8b6f3e;
--red:#c05c5c; --red-bg:#2a1515;
--yellow:#c8a040; --yellow-bg:#252010;
--green:#5c9e6e; --green-bg:#152a1e;
--radius:6px; --radius-lg:10px;
--font-mono:'Courier New',Courier,monospace;
}
@media (prefers-color-scheme:light) {
:root {
--bg:#f5f4f0; --bg2:#eceae4; --bg3:#e2e0d8; --bg4:#d8d6ce;
--text:#1a1918; --text2:#5a5856; --text3:#8a8886;
--border:#d0cec6; --border2:#c4c2ba;
--red-bg:#fce8e8; --yellow-bg:#fdf5e0; --green-bg:#e8f4ec;
}
}
html,body { height:100%; background:var(--bg); color:var(--text); font-family:'SF Mono','Menlo',var(--font-mono); font-size:13px; line-height:1.6; }
.app { display:flex; flex-direction:column; height:100vh; max-width:860px; margin:0 auto; }
.app-header { display:flex; align-items:baseline; gap:0.75rem; padding:1rem 1.25rem 0; border-bottom:1px solid var(--border); flex-shrink:0; }
.prefs-btn { align-self:center; background:none; border:none; color:var(--text3); cursor:pointer; font-size:15px; margin-left:auto; padding:0.2rem 0.3rem; transition:color 0.1s; }
.prefs-btn:hover { color:var(--text2); }
#prefs-dialog { background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-lg); color:var(--text); margin:auto; max-height:85vh; padding:0; width:min(620px, 92vw); }
#prefs-dialog::backdrop { background:rgba(0,0,0,0.55); }
.prefs-header { align-items:center; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; padding:0.85rem 1.25rem; }
.prefs-title { color:var(--accent); font-size:13px; font-weight:700; letter-spacing:0.1em; text-transform:uppercase; }
.prefs-close { background:none; border:none; color:var(--text3); cursor:pointer; font-size:16px; padding:0.2rem 0.4rem; }
.prefs-close:hover { color:var(--text); }
.prefs-body { max-height:calc(85vh - 54px); overflow-y:auto; padding:1.25rem; }
.app-title { font-size:15px; font-weight:700; letter-spacing:0.12em; text-transform:uppercase; color:var(--accent); }
.app-sub { font-size:11px; color:var(--text3); letter-spacing:0.04em; }
.tabs { display:flex; padding:0 1.25rem; border-bottom:1px solid var(--border); flex-shrink:0; overflow-x:auto; scrollbar-width:none; }
.tabs::-webkit-scrollbar { display:none; }
.tab-btn { background:none; border:none; border-bottom:2px solid transparent; color:var(--text3); cursor:pointer; font-family:inherit; font-size:11px; letter-spacing:0.08em; text-transform:uppercase; padding:0.6rem 0.9rem; white-space:nowrap; transition:color 0.1s,border-color 0.1s; margin-bottom:-1px; }
.tab-btn:hover { color:var(--text2); }
.tab-btn.active { color:var(--accent); border-bottom-color:var(--accent); }
.content { flex:1; overflow-y:auto; padding:1.25rem; padding-bottom:0; }
.tab-panel { display:none; }
.tab-panel.active { display:block; }
.cmd-box { flex-shrink:0; border-top:1px solid var(--border); background:var(--bg); }
.cmd-box summary { cursor:pointer; color:var(--text3); font-size:10px; letter-spacing:0.06em; text-transform:uppercase; padding:0.5rem 1.25rem; user-select:none; }
.cmd-box summary:hover { color:var(--text2); }
.cmd-box[open] summary { border-bottom:1px solid var(--border); }
.cmd-box-body { display:flex; align-items:center; gap:0.5rem; padding:0.6rem 1.25rem; }
.cmd-field { flex:1; background:var(--bg2); border:1px solid var(--border2); border-radius:var(--radius); color:var(--accent); font-family:var(--font-mono); font-size:12px; padding:0.5rem 0.75rem; outline:none; overflow-x:auto; white-space:nowrap; }
.btn-copy { background:var(--accent); border:none; border-radius:var(--radius); color:var(--bg); cursor:pointer; font-family:inherit; font-size:11px; font-weight:700; letter-spacing:0.08em; padding:0.45rem 1rem; text-transform:uppercase; transition:opacity 0.1s; white-space:nowrap; }
.btn-copy:hover { opacity:0.85; }
.btn-copy.copied { background:var(--green); }
label { color:var(--text2); font-size:11px; letter-spacing:0.06em; text-transform:uppercase; }
input[type="text"],input[type="password"],input[type="number"],select,textarea { background:var(--bg2); border:1px solid var(--border2); border-radius:var(--radius); color:var(--text); font-family:var(--font-mono); font-size:12px; padding:0.4rem 0.6rem; outline:none; width:100%; transition:border-color 0.1s; }
input:focus,select:focus,textarea:focus { border-color:var(--accent2); }
textarea { resize:vertical; }
select { cursor:pointer; }
.field { display:flex; flex-direction:column; gap:0.3rem; margin-bottom:0.75rem; }
.field-row { display:flex; gap:0.5rem; align-items:flex-end; }
.field-row .field { flex:1; margin-bottom:0; }
.check-group { display:flex; flex-direction:column; gap:0.3rem; }
.check-item,.radio-item { display:flex; align-items:center; gap:0.5rem; font-size:12px; color:var(--text); cursor:pointer; }
input[type="checkbox"],input[type="radio"] { width:auto; accent-color:var(--accent); cursor:pointer; }
.check-row { display:flex; flex-wrap:wrap; gap:0.4rem 1rem; }
.section { margin-bottom:1.25rem; }
.section-title { font-size:10px; letter-spacing:0.14em; text-transform:uppercase; color:var(--text3); border-bottom:1px solid var(--border); padding-bottom:0.3rem; margin-bottom:0.75rem; }
.drop-zone { border:1.5px dashed var(--border2); border-radius:var(--radius-lg); padding:1.25rem; text-align:center; color:var(--text3); cursor:default; transition:background 0.15s,border-color 0.15s; margin-bottom:0.75rem; font-size:12px; }
.drop-zone.drag-over { background:var(--bg3); border-color:var(--accent2); color:var(--text2); }
.drop-zone .drop-icon { font-size:20px; margin-bottom:0.25rem; display:block; }
.drop-zone .drop-hint { font-size:10px; color:var(--text3); margin-top:0.3rem; }
.btn { background:var(--bg3); border:1px solid var(--border2); border-radius:var(--radius); color:var(--text); cursor:pointer; font-family:inherit; font-size:11px; letter-spacing:0.06em; padding:0.4rem 0.75rem; text-transform:uppercase; transition:background 0.1s,border-color 0.1s; white-space:nowrap; }
.btn:hover { background:var(--bg4); border-color:var(--accent2); }
.btn-primary { background:var(--accent2); border-color:var(--accent); color:var(--text); }
.btn-primary:hover { background:var(--accent); color:var(--bg); }
.btn-danger { background:var(--red-bg); border-color:var(--red); color:var(--red); }
.btn-danger:hover { background:var(--red); color:#fff; }
.btn-warn { background:var(--yellow-bg); border-color:var(--yellow); color:var(--yellow); }
.btn-row { display:flex; gap:0.4rem; flex-wrap:wrap; margin-bottom:0.75rem; }
.btn-sm { font-size:10px; padding:0.3rem 0.55rem; }
.alert { border-radius:var(--radius); padding:0.5rem 0.75rem; font-size:11px; margin-bottom:0.6rem; line-height:1.5; }
.alert-red { background:var(--red-bg); border:1px solid var(--red); color:var(--red); }
.alert-yellow { background:var(--yellow-bg); border:1px solid var(--yellow); color:var(--yellow); }
.alert-green { background:var(--green-bg); border:1px solid var(--green); color:var(--green); }
.tip-wrap { position:relative; display:inline-block; }
.tip-icon { color:var(--text3); cursor:help; font-style:normal; font-size:11px; margin-left:0.3rem; }
.tip-icon:hover + .tip-box,.tip-icon:focus + .tip-box { display:block; }
.tip-box { display:none; position:absolute; bottom:calc(100% + 6px); left:0; z-index:100; background:var(--bg4); border:1px solid var(--border2); border-radius:var(--radius); color:var(--text2); font-size:11px; line-height:1.5; max-width:280px; padding:0.5rem 0.65rem; white-space:normal; pointer-events:none; }
.pre-out { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-lg); color:var(--accent); font-family:var(--font-mono); font-size:11px; line-height:1.7; max-height:380px; overflow:auto; padding:1rem; white-space:pre; margin-bottom:0.6rem; }
.lib-results { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-lg); max-height:420px; overflow:auto; margin-bottom:0.6rem; }
.lib-row { display:flex; align-items:baseline; justify-content:space-between; gap:0.75rem; padding:0.55rem 0.85rem; border-bottom:1px solid var(--border); font-size:12px; }
.lib-row:last-child { border-bottom:none; }
.lib-row-title { color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lib-row-artist { color:var(--text2); }
.lib-row-year { color:var(--text3); }
.lib-row-meta { color:var(--text3); font-size:10px; letter-spacing:0.04em; white-space:nowrap; }
.lib-empty { color:var(--text3); font-size:12px; padding:1.5rem; text-align:center; }
.lib-count { color:var(--text3); font-size:10px; letter-spacing:0.06em; text-transform:uppercase; margin-bottom:0.5rem; }
details.section summary.section-title { cursor:pointer; user-select:none; }
details.section summary.section-title::-webkit-details-marker { color:var(--text3); }
.kbd { background:var(--bg3); border:1px solid var(--border2); border-radius:3px; color:var(--text3); font-size:9px; padding:0.05rem 0.3rem; margin-right:0.35rem; }
.decision-head { display:flex; align-items:center; justify-content:space-between; gap:0.75rem; flex-wrap:wrap; margin-bottom:0.75rem; }
.decision-current { font-size:12px; color:var(--text2); }
.decision-actions { display:flex; gap:0.4rem; flex-wrap:wrap; }
.candidate-list { display:flex; flex-direction:column; gap:0.5rem; margin-bottom:0.75rem; }
.candidate-card { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-lg); padding:0.65rem 0.85rem; cursor:pointer; transition:border-color 0.1s; }
.candidate-card.selected { border-color:var(--accent); }
.candidate-head { display:flex; align-items:baseline; gap:0.5rem; }
.candidate-index { background:var(--bg3); border-radius:3px; color:var(--text3); font-size:10px; padding:0.05rem 0.35rem; }
.candidate-title { flex:1; font-size:13px; color:var(--text); }
.candidate-sim { color:var(--text3); font-size:11px; }
.candidate-artist { color:var(--text2); font-size:12px; margin-top:0.15rem; }
.candidate-meta { color:var(--text3); font-size:10px; margin-top:0.25rem; }
.diff { color:var(--accent); font-weight:700; }
.track-diff { margin-top:0.4rem; font-size:10px; color:var(--text3); }
.track-diff summary { cursor:pointer; }
.track-diff-row { padding:0.15rem 0; }
.dup-compare { display:flex; gap:0.75rem; margin-bottom:0.75rem; flex-wrap:wrap; }
.dup-side { flex:1; min-width:200px; }
.dup-side .candidate-card { cursor:default; }
.rec-badge { background:var(--accent2); border-radius:3px; color:var(--text); font-size:9px; letter-spacing:0.06em; padding:0.05rem 0.35rem; text-transform:uppercase; }
.import-log-wrap summary { color:var(--text3); cursor:pointer; font-size:10px; letter-spacing:0.06em; text-transform:uppercase; margin-bottom:0.4rem; }
.auth-card { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-lg); margin-bottom:0.75rem; overflow:hidden; }
.auth-card-hd { display:flex; align-items:center; justify-content:space-between; padding:0.75rem 1rem; cursor:pointer; user-select:none; border-bottom:1px solid transparent; transition:background 0.1s; }
.auth-card-hd:hover { background:var(--bg3); }
.auth-card.open .auth-card-hd { border-bottom-color:var(--border); }
.auth-card-title { font-size:12px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; }
.auth-card-chevron { color:var(--text3); transition:transform 0.2s; }
.auth-card.open .auth-card-chevron { transform:rotate(180deg); }
.auth-card-body { display:none; padding:0.85rem 1rem; }
.auth-card.open .auth-card-body { display:block; }
.auth-status { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--border2); margin-right:0.5rem; vertical-align:middle; }
.plugin-grid { display:flex; flex-wrap:wrap; gap:0.3rem 1rem; }
.path-preview { font-size:11px; color:var(--accent); font-family:var(--font-mono); background:var(--bg2); border-radius:var(--radius); padding:0.35rem 0.6rem; margin-top:0.3rem; border:1px solid var(--border); }
hr.divider { border:none; border-top:1px solid var(--border); margin:0.75rem 0; }
.mono { font-family:var(--font-mono); }
.badge { font-size:9px; letter-spacing:0.06em; text-transform:uppercase; background:var(--bg3); border:1px solid var(--border2); border-radius:3px; color:var(--text3); padding:1px 5px; vertical-align:middle; }
.badge-rec { background:var(--green-bg); border-color:var(--green); color:var(--green); }
#splash { position:fixed;inset:0;background:var(--bg);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1.2rem;z-index:9999;transition:opacity 0.45s ease; }
#splash img { width:96px;height:96px;border-radius:20px;box-shadow:0 4px 24px rgba(0,0,0,0.4); }
#splash .splash-title { font-size:18px;font-weight:700;letter-spacing:0.16em;text-transform:uppercase;color:var(--accent); }
</style>
</head>
<body>
<div id="splash">
<img src="assets/icon.png" alt="BeetsGUI">
<span class="splash-title">BeetsGUI</span>
</div>
<script>window.addEventListener('load',function(){setTimeout(function(){var s=document.getElementById('splash');if(s){s.style.opacity='0';setTimeout(function(){s.remove();},600);}},1800);});</script>
<div class="app">
<div class="app-header">
<span class="app-title">BeetsGUI</span>
<span class="app-sub">beets music library assistant</span>
<button class="prefs-btn" onclick="openPrefs()" title="Preferences (⌘,)">⚙</button>
</div>
<div class="tabs" role="tablist">
<button class="tab-btn active" onclick="switchTab('inbox',this)">Inbox</button>
<button class="tab-btn" onclick="switchTab('library',this)">Library</button>
<button class="tab-btn" onclick="switchTab('export',this)">Export</button>
</div>
<div class="content">
<!-- INBOX -->
<div id="tab-inbox" class="tab-panel active">
<div class="section">
<div class="section-title">
<span>Scan for new music</span>
<span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">Matches each file's artist/title against your library — works no matter where a previous copy or move import put the files.</span></span>
</div>
<div class="drop-zone" id="scan-drop"><span class="drop-icon">🔍</span><span>Drag folder here</span><div class="drop-hint">Or type the path below</div></div>
<div class="field">
<label>Path</label>
<div class="field-row">
<div class="field" style="margin-bottom:0"><input type="text" id="scan-path" placeholder="/Volumes/Harddisk/Music"></div>
<button class="btn btn-sm" onclick="setPath('scan-path','~/Music')">~/Music</button>
<button class="btn btn-sm" onclick="promptVolume('scan-path')">Volumes/…</button>
</div>
</div>
<div class="check-row" id="scan-excl">
<label class="check-item"><input type="checkbox" value="Samples"> Samples</label>
<label class="check-item"><input type="checkbox" value="Stems"> Stems</label>
<label class="check-item"><input type="checkbox" value="Ableton"> Ableton</label>
<label class="check-item"><input type="checkbox" value="Splice"> Splice</label>
<label class="check-item"><input type="checkbox" value="One Shots"> One Shots</label>
</div>
<div class="btn-row"><button class="btn btn-primary" onclick="scanUnimported()">Scan for unimported music</button></div>
<div class="lib-count" id="scan-count"></div>
<div class="lib-results" id="scan-results"></div>
</div>
<details class="section">
<summary class="section-title">Utilities</summary>
<div class="alert alert-green" style="font-size:10px; margin:0.6rem 0;">Uses <span class="mono">fd</span> — 5-10× faster than find, ignores hidden system folders automatically. Requires: <span class="mono">brew install fd</span></div>
<div class="btn-row">
<button class="btn" onclick="buildFindCmd('count')"><span>Count files</span></button>
<button class="btn" onclick="buildFindCmd('save')"><span>Save list to file</span></button>
<button class="btn" onclick="buildFindCmd('du')"><span>Folder sizes (du)</span></button>
<button class="btn" onclick="buildFindCmd('itunes')"><span>Find iTunes lib.</span></button>
</div>
</details>
<hr class="divider">
<div id="import-setup">
<div class="section">
<div class="section-title">
<span>Music path</span>
<span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">Beets can import .zip and .tar archives directly — no need to unpack manually.</span></span>
</div>
<div class="drop-zone" id="import-drop">
<span class="drop-icon">📂</span>
<span>Drag folder or zip/tar here</span>
<div class="drop-hint">Or type the path below</div>
</div>
<div class="field">
<label>Path</label>
<div class="field-row">
<div class="field" style="margin-bottom:0">
<input type="text" id="import-path" placeholder="/Volumes/Harddisk/Music" oninput="checkiCloud(this.value)">
</div>
<button class="btn btn-sm" onclick="setPath('import-path','~/Music')">~/Music</button>
<button class="btn btn-sm" onclick="promptVolume('import-path')">Volumes/…</button>
</div>
</div>
<div id="import-warnings"></div>
</div>
<div class="section">
<div class="section-title">
<span>File handling</span>
<span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">Move is safe — beets recognises already-imported files and never creates duplicates.</span></span>
</div>
<div class="check-group">
<label class="radio-item"><input type="radio" name="import-handling" value="copy" checked><span>Copy (default)</span></label>
<label class="radio-item"><input type="radio" name="import-handling" value="move"><span>Move</span></label>
<label class="radio-item"><input type="radio" name="import-handling" value="keep"><span>Keep in place</span></label>
</div>
</div>
<div class="section">
<label class="check-item"><input type="checkbox" id="import-incremental"><span>Incremental (skip already imported)</span></label>
</div>
<details class="section">
<summary class="section-title">Advanced</summary>
<div class="check-group" style="margin-top:0.6rem;">
<label class="radio-item"><input type="radio" name="import-mode" value="interactive" checked><span>Interactive (default)</span></label>
<label class="radio-item"><input type="radio" name="import-mode" value="fast"><span>Fast (no prompts)</span></label>
<label class="radio-item"><input type="radio" name="import-mode" value="quiet"><span>Quiet</span></label>
<label class="radio-item">
<input type="radio" name="import-mode" value="timid">
<span>Timid</span>
<span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">Only prompts when beets is uncertain about a match. Recommended for electronic music — auto-accepts obvious matches, asks for confirmation on low scores. Adjust strong_rec_thresh in Settings.</span></span>
</label>
</div>
<div class="check-group" style="margin-top:0.6rem;">
<label class="check-item"><input type="checkbox" id="import-singleton"><span>Singleton mode (single tracks, not albums)</span></label>
<label class="check-item"><input type="checkbox" id="import-log" onchange="toggleLog()"><span>Log to file</span></label>
</div>
<div id="log-path-wrap" style="display:none; margin-top:0.5rem;">
<div class="field"><label>Log file path</label><input type="text" id="import-log-path" value="~/beets-import.log"></div>
</div>
</details>
<div class="section">
<div class="section-title">
<span>Exclude folders</span>
<span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">Exclusions are set in config.yaml under import: ignore: — not in the command itself. Enable them in Settings.</span></span>
</div>
<div class="alert alert-yellow" style="margin-bottom:0.5rem; font-size:10px;">Exclusions are set in config.yaml (Preferences), not directly in the command.</div>
<div class="check-row">
<label class="check-item"><input type="checkbox" disabled checked> Samples</label>
<label class="check-item"><input type="checkbox" disabled checked> Stems</label>
<label class="check-item"><input type="checkbox" disabled checked> Splice</label>
<label class="check-item"><input type="checkbox" disabled checked> Ableton</label>
<label class="check-item"><input type="checkbox" disabled checked> One Shots</label>
<label class="check-item"><input type="checkbox" disabled checked> *.als</label>
</div>
</div>
<div class="btn-row">
<button class="btn btn-primary" onclick="startImport()">Start Import</button>
</div>
<div id="import-start-error"></div>
</div>
<div id="import-run" style="display:none;">
<div class="section-title">Import running</div>
<div class="lib-count" id="import-progress-text"></div>
<div id="import-decision" style="display:none;"></div>
<div class="btn-row">
<button class="btn btn-danger" onclick="abortImport()">Abort</button>
</div>
<details class="import-log-wrap">
<summary>Raw log</summary>
<pre class="pre-out" id="import-log-lines"></pre>
</details>
</div>
</div>
<!-- LIBRARY -->
<div id="tab-library" class="tab-panel">
<div class="section">
<div class="section-title">Search</div>
<div class="field"><label>Free text</label><input type="text" id="lib-query" placeholder="Burial" oninput="buildLibCmd();loadLibrary();"></div>
<div class="field-row">
<div class="field">
<label>Field</label>
<select id="lib-field" onchange="buildLibCmd()">
<option value="">— no field —</option>
<option value="artist">artist</option><option value="album">album</option>
<option value="year">year</option><option value="format">format</option>
<option value="bitrate">bitrate</option><option value="genre">genre</option>
<option value="bpm">bpm</option><option value="key">key</option>
</select>
</div>
<div class="field"><label>Field value</label><input type="text" id="lib-field-val" placeholder="2005..2010" oninput="buildLibCmd()"></div>
</div>
</div>
<div class="section">
<div class="section-title">Your library</div>
<div class="lib-count" id="lib-count"></div>
<div class="lib-results" id="lib-results"><div class="lib-empty">Loading…</div></div>
</div>
<div class="section">
<div class="section-title">View</div>
<div class="check-group" style="margin-bottom:0.5rem;">
<label class="radio-item"><input type="radio" name="lib-type" value="" checked onchange="buildLibCmd()"><span>Tracks (default)</span></label>
<label class="radio-item"><input type="radio" name="lib-type" value="-a" onchange="buildLibCmd()"><span>Albums</span> <span class="mono">-a</span></label>
</div>
<div class="field">
<label><span>Output format</span> <span class="mono">-f</span>
<span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">Use $artist, $album, $year, $title, $format, $bitrate, $path etc. to shape output.</span></span>
</label>
<input type="text" id="lib-format" placeholder="" oninput="buildLibCmd()">
</div>
<div class="btn-row">
<button class="btn btn-sm" onclick="setFormat('$artist - $album ($year)')"><span>artist · album · year</span></button>
<button class="btn btn-sm" onclick="setFormat('[$format] $bitrate $artist - $title')">format · bitrate</button>
<button class="btn btn-sm" onclick="setFormat('$path')"><span>path</span></button>
<button class="btn btn-sm" onclick="setFormat('$artist - $title | BPM: $bpm | Key: $key')">BPM + Key</button>
</div>
<div class="field">
<label class="check-item"><input type="checkbox" id="lib-export" onchange="buildLibCmd()"><span>Export to file</span> <span class="mono">> ~/Desktop/library.txt</span></label>
</div>
</div>
<hr class="divider">
<div class="section-title" style="margin-bottom:0.5rem;">Quick commands</div>
<div class="btn-row">
<button class="btn" onclick="setCmd('beet stats')">beet stats</button>
<button class="btn" onclick="setCmd('beet fields')">beet fields</button>
<button class="btn" onclick="setCmd('beet version')">beet version</button>
<button class="btn" onclick="setCmd('while true; do beet list -a | wc -l; sleep 2; done')" title="Monitor the library (replaces watch on macOS)">monitor (loop)</button>
</div>
<hr class="divider">
<div class="section">
<div class="section-title">
<span>Duplicates</span>
<span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">During import: beets ranks quality automatically and asks only when it can't tell. After import: the duplicates plugin compares on MusicBrainz ID, not filenames.</span></span>
</div>
<div class="alert alert-yellow">Always preview first — delete buttons are red and secondary.</div>
<div class="btn-row">
<button class="btn btn-primary" onclick="setCmd("beet duplicates -f '$path $format $bitrate'")"><span>Preview duplicates (details)</span></button>
</div>
<div class="btn-row">
<button class="btn btn-danger" onclick="confirmDangerousCmd('beet duplicates -k bitrate -d', 'This permanently deletes all duplicates with the lowest bitrate. Run preview FIRST. Continue?')">⚠ <span>Delete lowest bitrate</span></button>
<button class="btn btn-danger" onclick="confirmDangerousCmd('beet duplicates -k format -d', 'This permanently deletes all duplicates with the lowest format. Run preview FIRST. Continue?')">⚠ <span>Delete lowest format</span></button>
</div>
<div class="alert alert-red" style="font-size:10px;">Delete commands remove files permanently. Always run preview first.</div>
</div>
<div class="section">
<div class="section-title">Cover art</div>
<div class="btn-row">
<button class="btn" onclick="setCmd('beet fetchart')">fetchart <span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">Checks the folder first (cover.jpg, folder.jpg, front.jpg), then the internet.</span></span></button>
<button class="btn" onclick="setCmd('beet embedart')">embedart</button>
</div>
</div>
<div class="section">
<div class="section-title">Metadata</div>
<div class="field-row">
<div class="field"><label>Field</label><input type="text" id="mod-field" placeholder="artist" oninput="buildModifyCmd()"></div>
<div class="field"><label>New value</label><input type="text" id="mod-value" placeholder="Burial" oninput="buildModifyCmd()"></div>
<div class="field"><label>Query</label><input type="text" id="mod-query" placeholder="album:Untrue" oninput="buildModifyCmd()"></div>
</div>
<div class="btn-row"><button class="btn btn-primary" onclick="buildModifyCmd()"><span>Build modify command</span></button></div>
<hr class="divider">
<div class="btn-row">
<button class="btn" onclick="setCmd('beet update')">update</button>
<button class="btn" onclick="setCmd('beet write')">write</button>
<button class="btn" onclick="setCmd('beet mbsync')">mbsync</button>
<button class="btn" onclick="setCmd('beet bpsync')">bpsync</button>
<button class="btn" onclick="setCmd('beet missing')">missing</button>
</div>
</div>
<details class="section">
<summary class="section-title">Formats</summary>
<div style="margin-top:0.6rem;">
<div class="section-title">Find audio files (fd)</div>
<div class="alert alert-green" style="font-size:10px; margin-bottom:0.5rem;">Uses <span class="mono">fd</span> — ignores .Spotlight-V100, .Trashes and other hidden system folders automatically.</div>
<div class="drop-zone" id="find-drop2"><span class="drop-icon">📁</span><span>Drag folder here</span><div class="drop-hint">Or type the path</div></div>
<div class="field"><label>Path</label><input type="text" id="conv-src" placeholder="/Volumes/Harddisk" oninput="buildConvFindCmd()"></div>
<div class="btn-row">
<button class="btn" onclick="buildConvFindCmd('wav')"><span>Find WAV</span></button>
<button class="btn" onclick="buildConvFindCmd('aiff')"><span>Find AIFF</span></button>
<button class="btn" onclick="buildConvFindCmd('count')"><span>Count WAV+AIFF</span></button>
</div>
</div>
<div style="margin-top:1rem;">
<div class="section-title">
Beets convert → ALAC (ffmpeg)
<span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">Uses beets' own convert plugin with ffmpeg. Makes copies — originals are NOT deleted automatically. Requires: <span class="mono">pipx inject beets beets-convert</span> + <span class="mono">brew install ffmpeg</span></span></span>
</div>
<div class="alert alert-green" style="font-size:10px; margin-bottom:0.5rem;">
<b>Important:</b> <span class="mono">beet convert</span> makes copies of the files — originals are untouched. Verify the output before deleting originals manually.
</div>
<div class="alert alert-yellow" style="font-size:10px; margin-bottom:0.75rem;">
Add to config.yaml (Preferences does not enable convert automatically — paste manually):<br>
<pre style="margin-top:0.3rem; white-space:pre; font-size:10px; color:var(--accent);">convert:
format: alac
never_convert_lossy_files: yes
formats:
alac:
command: ffmpeg -i $source -c:a alac -map_metadata 0 $dest
extension: m4a</pre>
</div>
<div class="field-row">
<div class="field">
<label>Source format</label>
<select id="beet-conv-fmt" onchange="buildBeetsConvCmd()">
<option value="AIFF">AIFF</option>
<option value="WAV">WAV</option>
<option value="FLAC">FLAC</option>
</select>
</div>
<div class="field" style="align-self:flex-end;">
<label class="check-item"><input type="checkbox" id="beet-conv-pretend" checked onchange="buildBeetsConvCmd()"><span>Preview (--pretend)</span></label>
</div>
</div>
<div class="btn-row">
<button class="btn btn-primary" onclick="buildBeetsConvCmd()">Build beet convert command</button>
</div>
<hr class="divider">
<div style="font-size:10px; color:var(--text3); margin-bottom:0.5rem;">Delete originals from the database AFTER verifying (files stay on disk):</div>
<div class="btn-row">
<button class="btn btn-warn" onclick="setCmd('beet remove format:AIFF')">⚠ Remove AIFF from DB</button>
<button class="btn btn-warn" onclick="setCmd('beet remove format:WAV')">⚠ Remove WAV from DB</button>
</div>
</div>
<div style="margin-top:1rem;">
<div class="section-title">Convert with XLD</div>
<div class="drop-zone" id="xld-drop"><span class="drop-icon">🎵</span><span>Drag source file or folder here</span></div>
<div class="field"><label>Source file/folder</label><input type="text" id="xld-src" placeholder="/Volumes/Harddisk/album.wav" oninput="buildXldCmd()"></div>
<div class="field-row">
<div class="field"><label>Output format</label><select id="xld-fmt" onchange="buildXldCmd()"><option value="alac">ALAC</option><option value="flac">FLAC</option><option value="aiff">AIFF</option><option value="mp3">MP3 320</option></select></div>
<div class="field"><label>Output folder</label><input type="text" id="xld-out" placeholder="~/Music/Converted" oninput="buildXldCmd()"></div>
</div>
<div class="check-group" style="margin-bottom:0.5rem;">
<label class="radio-item"><input type="radio" name="xld-mode" value="single" checked onchange="buildXldCmd()"><span>Single file</span></label>
<label class="radio-item"><input type="radio" name="xld-mode" value="batch" onchange="buildXldCmd()"><span>All WAV in folder (loop)</span></label>
</div>
<div class="btn-row"><button class="btn btn-primary" onclick="buildXldCmd()"><span>Build XLD command</span></button></div>
</div>
<div style="margin-top:1rem;">
<div class="section-title">WAV tags from filename</div>
<div class="alert alert-yellow" style="font-size:10px;">Use "Import with fromfilename" in the Inbox tab after converting.<br>Beets guesses metadata from the filename (Artist - Title.wav) and searches MusicBrainz.</div>
</div>
</details>
<details class="section">
<summary class="section-title">Remove from library</summary>
<div style="margin-top:0.6rem;">
<div class="field"><label>Query</label><input type="text" id="rm-query" placeholder="artist:Burial album:Untrue"></div>
<div class="btn-row">
<button class="btn btn-warn" onclick="buildRemoveCmd(false)">⚠ <span>Remove from database</span></button>
<button class="btn btn-danger" onclick="confirmDangerousCmd(buildRemoveCmdStr(true), 'This permanently deletes the file from disk. Run preview FIRST. Continue?')">⚠ <span>Also delete file from disk</span></button>
</div>
<div class="alert alert-yellow" style="font-size:10px;"><b>beet remove</b> only removes from database, not disk. <b>beet remove -d</b> deletes the file permanently.</div>
<hr class="divider">
<div class="section-title" style="margin-bottom:0.4rem;">Remove short files (one shots) from database</div>
<div class="alert alert-yellow" style="font-size:10px; margin-bottom:0.5rem;">Removes tracks under X seconds from the database (files stay on disk). Beets has no duration import filter — use this after importing.</div>
<div class="field-row">
<div class="field" style="max-width:120px;"><label>Max seconds</label><input type="number" id="short-secs" value="10" min="1" max="60" oninput="buildShortRemoveCmd()"></div>
<div class="field" style="align-self:flex-end;">
<button class="btn btn-sm" onclick="buildShortRemovePreview()">Preview short files</button>
</div>
<div class="field" style="align-self:flex-end;">
<button class="btn btn-warn btn-sm" onclick="buildShortRemoveCmd()">⚠ Remove from DB</button>
</div>
</div>
</div>
</details>
</div>
<!-- EXPORT -->
<div id="tab-export" class="tab-panel">
<div class="section">
<div class="section-title">Export .m3u for Lexicon</div>
<div class="btn-row">
<button class="btn btn-primary" onclick="setCmd('beet list -f \'$path\' > ~/Desktop/beets_export.m3u')"><span>Export .m3u for Lexicon</span></button>
<span class="tip-wrap"><i class="tip-icon" tabindex="0">ℹ</i><span class="tip-box">Saves all tracks as .m3u on the desktop. In Lexicon: File → Import → M3U playlist. Go to Library and search first to export a subset.</span></span>
</div>
</div>
<div class="section">
<div class="section-title">Playlists → Lexicon / Traktor</div>
<div class="alert alert-yellow" style="font-size:10px; margin-bottom:0.5rem;">Run this <b>before</b> importing with move — exports your folders as .m3u files so Lexicon and Traktor can relocate them.</div>
<div class="field"><label>Path to playlist folders</label><input type="text" id="pl-path" placeholder="/Volumes/Harddisk/OldPlaylists"></div>
<div class="btn-row">
<button class="btn btn-primary" onclick="buildPlaylistExportCmd()"><span>Export folders → .m3u</span></button>
<button class="btn" onclick="setCmd('beet list -f \'$path\' > ~/Desktop/beets_alle_tracks.txt')"><span>Save tracklist (for Traktor relocation)</span></button>
</div>
<hr class="divider">
<div class="section-title" style="margin-bottom:0.4rem;">Traktor: Relocate files after move</div>
<div class="alert alert-yellow" style="font-size:10px;">1. In Traktor: Right-click <b>Track Collection</b> → <b>Check Consistency</b><br>2. Select ALL missing tracks (<b>Cmd+A</b>)<br>3. Click <b>Relocate</b> → navigate to your Beets library folder<br>4. ⚠ Select multiple files at a time — avoids Traktor 4.2 freeze<br>5. Cues and grids follow automatically</div>
</div>
<div class="section">
<div class="section-title">Playlists on this Mac (USB mirror)</div>
<div class="field">
<label>Playlist folder</label>
<div class="field-row">
<div class="field" style="margin-bottom:0"><input type="text" id="usb-dir" placeholder="~/Playlister" value="~/Playlister"></div>
<button class="btn btn-sm btn-primary" onclick="listPlaylists()">List playlists</button>
</div>
</div>
<div class="lib-results" id="usb-results"></div>
</div>
</div>
<dialog id="prefs-dialog">
<div class="prefs-header">
<span class="prefs-title">Preferences</span>
<button class="prefs-close" onclick="closePrefs()">✕</button>
</div>
<div class="prefs-body">
<div class="section">
<div class="section-title">Library</div>
<div class="field"><label>directory — library path</label><input type="text" id="cfg-dir" placeholder="~/Music/Library" oninput="buildConfig()"></div>
<div class="field"><label>library — database file</label><input type="text" id="cfg-lib" placeholder="~/Music/library.db" oninput="buildConfig()"></div>
</div>
<div class="section">
<div class="section-title">Import strategy</div>
<div class="check-group">
<label class="radio-item"><input type="radio" name="cfg-import" value="copy" checked onchange="buildConfig()"><span>Copy (default)</span></label>
<label class="radio-item"><input type="radio" name="cfg-import" value="move" onchange="buildConfig()"><span>Move</span></label>
<label class="radio-item"><input type="radio" name="cfg-import" value="none" onchange="buildConfig()"><span>Keep in place</span></label>
</div>
</div>
<div class="section">
<div class="section-title">Folder structure</div>
<div class="field-row">
<div class="field"><label>Artist part</label><select id="path-artist" onchange="updatePathPreview()"><option value="$albumartist">$albumartist</option><option value="$artist">$artist</option></select></div>
<div class="field"><label>Album part</label><select id="path-album" onchange="updatePathPreview()"><option value="$year - $album">$year - $album</option><option value="$album">$album</option><option value="$album ($year)">$album ($year)</option></select></div>
<div class="field"><label>Track part</label><select id="path-track" onchange="updatePathPreview()"><option value="$track - $title">$track - $title</option><option value="$track. $title">$track. $title</option><option value="$title">$title</option></select></div>
</div>
<div class="path-preview" id="path-preview">Burial/2007 - Burial/01 - Archangel.alac</div>
</div>
<div class="section">
<div class="section-title">Plugins — Metadata sources</div>
<div class="plugin-grid">
<label class="check-item"><input type="checkbox" class="plugin" value="musicbrainz" checked onchange="buildConfig()"> musicbrainz <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="chroma" checked onchange="buildConfig()"> chroma <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="beatport4" checked onchange="buildConfig()"> beatport4 <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="discogs" checked onchange="buildConfig()"> discogs <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="deezer" onchange="buildConfig()"> deezer</label>
<label class="check-item"><input type="checkbox" class="plugin" value="spotify" onchange="buildConfig()"> spotify</label>
<label class="check-item"><input type="checkbox" class="plugin" value="tidal" onchange="buildConfig()"> tidal</label>
</div>
</div>
<div class="section">
<div class="section-title">Plugins — Enrichment</div>
<div class="plugin-grid">
<label class="check-item"><input type="checkbox" class="plugin" value="fetchart" checked onchange="buildConfig()"> fetchart <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="embedart" checked onchange="buildConfig()"> embedart <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="lastgenre" checked onchange="buildConfig()"> lastgenre <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="fromfilename" checked onchange="buildConfig()"> fromfilename <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="bpsync" checked onchange="buildConfig()"> bpsync <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="convert" onchange="buildConfig()"> convert</label>
<label class="check-item"><input type="checkbox" class="plugin" value="autobpm" onchange="buildConfig()"> autobpm</label>
<label class="check-item"><input type="checkbox" class="plugin" value="keyfinder" onchange="buildConfig()"> keyfinder</label>
<label class="check-item"><input type="checkbox" class="plugin" value="lyrics" onchange="buildConfig()"> lyrics</label>
</div>
</div>
<div class="section">
<div class="section-title">Plugins — Maintenance</div>
<div class="plugin-grid">
<label class="check-item"><input type="checkbox" class="plugin" value="duplicates" checked onchange="buildConfig()"> duplicates <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="missing" onchange="buildConfig()"> missing</label>
<label class="check-item"><input type="checkbox" class="plugin" value="mbsync" checked onchange="buildConfig()"> mbsync <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="importfeeds" checked onchange="buildConfig()"> importfeeds <span class="badge badge-rec">recommended</span></label>
<label class="check-item"><input type="checkbox" class="plugin" value="dirfields" onchange="buildConfig()"> dirfields</label>
</div>
</div>
<div class="section">
<div class="section-title">Import — exclude folders</div>
<div class="alert alert-green" style="font-size:10px; margin-bottom:0.5rem;">
<b>valid_extensions</b> is recommended as a whitelist — blocks all non-audio (.jpg, .als, .nml, wavedata) without listing them explicitly. Always enabled in the generated config.
</div>
<div class="check-row">
<label class="check-item"><input type="checkbox" class="excl" value="Samples" checked onchange="buildConfig()"> Samples</label>
<label class="check-item"><input type="checkbox" class="excl" value="Sample" checked onchange="buildConfig()"> Sample</label>
<label class="check-item"><input type="checkbox" class="excl" value="Stems" checked onchange="buildConfig()"> Stems</label>
<label class="check-item"><input type="checkbox" class="excl" value="Splice" checked onchange="buildConfig()"> Splice</label>
<label class="check-item"><input type="checkbox" class="excl" value="Ableton" checked onchange="buildConfig()"> Ableton</label>
<label class="check-item"><input type="checkbox" class="excl" value="One Shots" checked onchange="buildConfig()"> One Shots</label>
<label class="check-item"><input type="checkbox" class="excl" value="One-Shots" checked onchange="buildConfig()"> One-Shots</label>
<label class="check-item"><input type="checkbox" class="excl" value="One_Shots" checked onchange="buildConfig()"> One_Shots</label>
<label class="check-item"><input type="checkbox" class="excl" value="stem-*" checked onchange="buildConfig()"> stem-*</label>
<label class="check-item"><input type="checkbox" class="excl" value="Coverart" checked onchange="buildConfig()"> Coverart</label>
<label class="check-item"><input type="checkbox" class="excl" value="Stripes" onchange="buildConfig()"> Stripes</label>
<label class="check-item"><input type="checkbox" class="excl" value="Transients" onchange="buildConfig()"> Transients</label>
<label class="check-item"><input type="checkbox" class="excl" value="Music Lib + Traktor" checked onchange="buildConfig()"> Music Lib + Traktor</label>
<label class="check-item"><input type="checkbox" class="excl" value="TRAKTOR*" checked onchange="buildConfig()"> TRAKTOR*</label>
<label class="check-item"><input type="checkbox" class="excl" value="*.als" checked onchange="buildConfig()"> *.als</label>
<label class="check-item"><input type="checkbox" class="excl" value="*.nml" checked onchange="buildConfig()"> *.nml</label>
</div>
</div>
<div class="section">
<div class="section-title">Generated config.yaml</div>
<pre class="pre-out" id="config-out"># Fill in the fields above</pre>
<div class="btn-row">
<button class="btn btn-primary" onclick="copyConfig()"><span>Copy config.yaml</span></button>
<button class="btn" onclick="buildConfig()"><span>Generate</span></button>
</div>
<div class="alert alert-yellow" style="font-size:10px;">Paste in terminal: <span class="mono">beet config -e</span> — opens the config file in your editor.</div>
</div>
<hr class="divider">
<div class="section-title" style="margin-bottom:0.75rem;">Services</div>
<div class="auth-card open" id="card-discogs">
<div class="auth-card-hd" onclick="toggleCard('card-discogs')">
<span><span class="auth-status" id="status-discogs"></span><span class="auth-card-title">Discogs</span></span>
<span class="auth-card-chevron">▲</span>
</div>
<div class="auth-card-body">
<div class="check-group" style="margin-bottom:0.75rem;">
<label class="radio-item"><input type="radio" name="discogs-method" value="token" checked onchange="buildConfig()">Personal Access Token <span class="badge badge-rec">recommended</span></label>
<label class="radio-item"><input type="radio" name="discogs-method" value="oauth" onchange="buildConfig()"><span>OAuth (automatic on first import)</span></label>
</div>
<div id="discogs-token-wrap">
<div class="field">
<label>Token</label>
<div class="field-row">
<div class="field" style="margin-bottom:0"><input type="text" id="discogs-token" placeholder="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" oninput="buildConfig()"></div>
<button class="btn btn-sm" onclick="window.open('https://www.discogs.com/settings/developers','_blank')">Get token ↗</button>
</div>
</div>
<div class="alert alert-yellow" style="font-size:10px;">1. Log in to Discogs → Settings → Developer<br>2. Click "Generate new token" → copy token</div>
</div>
<div id="discogs-oauth-wrap" style="display:none;">
<div class="alert alert-yellow" style="font-size:10px;">OAuth happens automatically when you run <span class="mono">beet import</span> for the first time with the discogs plugin active. Beets opens a browser and saves the token to <span class="mono">~/.config/beets/</span>.</div>
</div>
<div class="alert alert-red" style="font-size:10px; margin-top:0.5rem;">⚠ Discogs token gives full access to your account — keep it private.</div>
</div>
</div>
<div class="auth-card" id="card-mb">
<div class="auth-card-hd" onclick="toggleCard('card-mb')">
<span><span class="auth-status" id="status-mb"></span><span class="auth-card-title">MusicBrainz</span></span>
<span class="auth-card-chevron">▼</span>
</div>
<div class="auth-card-body">
<div class="field"><label>Username</label><input type="text" id="mb-user" placeholder="your_username" oninput="buildConfig()"></div>
<div class="field"><label>Password</label><input type="password" id="mb-pass" placeholder="••••••••" oninput="buildConfig()"></div>
<div class="alert alert-yellow" style="font-size:10px;">⚠ Password stored in plain text in config.yaml. Create account: <a href="https://musicbrainz.org/account/register" target="_blank" style="color:inherit;">musicbrainz.org</a></div>
</div>
</div>
<div class="auth-card" id="card-bp4">
<div class="auth-card-hd" onclick="toggleCard('card-bp4')">
<span><span class="auth-status" id="status-bp4"></span><span class="auth-card-title">Beatport4</span></span>
<span class="auth-card-chevron">▼</span>
</div>
<div class="auth-card-body">
<div class="alert alert-yellow" style="font-size:10px; margin-bottom:0.6rem;">Requires: <span class="mono">pipx inject beets beets-beatport4</span><br>Plugin must be named <b>beatport4</b> in config (not beatport).</div>
<div class="check-group" style="margin-bottom:0.75rem;">
<label class="radio-item"><input type="radio" name="bp4-method" value="userpass" checked onchange="toggleBp4Method()"><span>Username</span> + <span>Password</span> <span class="badge badge-rec">recommended</span></label>
<label class="radio-item"><input type="radio" name="bp4-method" value="token" onchange="toggleBp4Method()"><span>Token file (advanced)</span></label>
</div>
<div id="bp4-userpass-wrap">
<div class="field"><label>Username</label><input type="text" id="bp4-user" placeholder="your_beatport_login" oninput="buildConfig()"></div>
<div class="field"><label>Password</label><input type="password" id="bp4-pass" placeholder="••••••••" oninput="buildConfig()"></div>
</div>
<div id="bp4-token-wrap" style="display:none;">
<div class="alert alert-yellow" style="font-size:10px;">1. Log in to beatport.com in Chrome/Edge<br>2. Open Developer Tools (Cmd+Opt+I) → Network<br>3. Filter on "token" → find POST request → copy Response JSON<br>4. Save as <span class="mono">~/.config/beets/beatport_token.json</span><br>Token is read automatically by the plugin.</div>
</div>
<div class="field-row" style="margin-top:0.5rem;">
<div class="field" style="max-width:160px;"><label>Priority (lower = higher)</label><input type="number" id="bp4-priority" value="0.3" min="0" max="1" step="0.05" oninput="buildConfig()"></div>
<div class="field" style="align-self:flex-end;"><label class="check-item"><input type="checkbox" id="bp4-art" checked onchange="buildConfig()"><span>Fetch album art (art: yes)</span></label></div>
</div>
<div class="alert alert-yellow" style="font-size:10px; margin-top:0.4rem;">⚠ Login credentials stored in plain text in config.yaml.</div>
</div>
</div>
<hr class="divider">
<div class="section-title" style="margin-bottom:0.5rem;">Note: beet version</div>
<div class="alert alert-yellow" style="font-size:10px; margin-bottom:0.75rem;"><b>beet version</b> (not --plugins) shows active plugins.<br>Plugins only activate when listed under <span class="mono">plugins:</span> in config.yaml.<br>⚠ Never run <span class="mono">beet config -e</span> while the GUI is editing.</div>
<div class="btn-row">
<button class="btn btn-primary" onclick="buildConfig(); document.getElementById('config-out').scrollIntoView({behavior:'smooth'})"><span>Save to config</span></button>
<button class="btn" onclick="setCmd('beet version')">beet version</button>
</div>
</div>
</dialog>
</div>
<details class="cmd-box" id="cmd-box">
<summary>Command</summary>
<div class="cmd-box-body">
<input type="text" class="cmd-field" id="cmd-out" readonly value="beet import ~/Music">
<button class="btn-copy" id="copy-btn" onclick="copyCmd()">Copy</button>
</div>
</details>
</div>
<script>
let activeTab='inbox';
function switchTab(name,btn){
document.querySelectorAll('.tab-panel').forEach(p=>p.classList.remove('active'));
document.querySelectorAll('.tab-btn').forEach(b=>b.classList.remove('active'));
document.getElementById('tab-'+name).classList.add('active');
if(btn)btn.classList.add('active');
activeTab=name;
if(name==='library'){buildLibCmd();loadLibrary();}
}
function openPrefs(){
buildConfig();
document.getElementById('prefs-dialog').showModal();
}
function closePrefs(){document.getElementById('prefs-dialog').close();}
document.addEventListener('keydown',e=>{
if((e.metaKey||e.ctrlKey)&&e.key===','){e.preventDefault();openPrefs();}
});
function setCmd(cmd){document.getElementById('cmd-out').value=cmd;}
function copyCmd(){
const v=document.getElementById('cmd-out').value;
navigator.clipboard.writeText(v).then(()=>{
const b=document.getElementById('copy-btn');
b.textContent='Copied!';b.classList.add('copied');
setTimeout(()=>{b.textContent='Copy';b.classList.remove('copied');},1800);
});
}
// Confirm dialog for dangerous (destructive) commands
function confirmDangerousCmd(cmd, msg) {
if (confirm(msg)) { setCmd(cmd); }
}
function setupDrop(zoneId,targetId,onDrop){
const zone=document.getElementById(zoneId);if(!zone)return;
zone.addEventListener('dragover',e=>{e.preventDefault();e.dataTransfer.dropEffect='copy';zone.classList.add('drag-over');});
zone.addEventListener('dragleave',()=>zone.classList.remove('drag-over'));
zone.addEventListener('drop',e=>{
e.preventDefault();zone.classList.remove('drag-over');
const item=e.dataTransfer.items&&e.dataTransfer.items[0];
if(item&&item.kind==='file'){
const file=item.getAsFile(),path=file.path||'';
if(path){document.getElementById(targetId).value=path;}
else{
document.getElementById(targetId).value=file.name;
const w=document.createElement('div');w.className='alert alert-yellow';w.style.fontSize='10px';w.style.marginTop='0.3rem';w.textContent='Path is relative. Copy the full path manually from Finder (⌘I on the folder).';
zone.parentNode.insertBefore(w,zone.nextSibling);setTimeout(()=>w.remove(),4000);
}
if(onDrop)onDrop(path||file.name);
}
});
}
setupDrop('import-drop','import-path',p=>checkiCloud(p));
setupDrop('scan-drop','scan-path');
setupDrop('find-drop2','conv-src',()=>buildConvFindCmd());
setupDrop('xld-drop','xld-src',()=>buildXldCmd());
document.body.addEventListener('dragover',e=>e.preventDefault());
document.body.addEventListener('drop',e=>e.preventDefault());
function toggleLog(){document.getElementById('log-path-wrap').style.display=document.getElementById('import-log').checked?'block':'none';}
function setPath(fieldId,value){document.getElementById(fieldId).value=value;}
function promptVolume(fieldId){fieldId=fieldId||'import-path';const name=prompt('Disk name (e.g. Harddisk):');if(name){document.getElementById(fieldId).value='/Volumes/'+name;}}
function checkiCloud(path){
const warn=document.getElementById('import-warnings');
if(path.includes('Mobile Documents')||path.toLowerCase().includes('icloud'))warn.innerHTML='<div class="alert alert-red">'+'⚠ WARNING: This path is inside iCloud! This can corrupt your Traktor/Lexicon collection. Move music to a local folder or external drive before importing.'+'</div>';
else warn.innerHTML='';
}
// ── Import triage ────────────────────────────────────────────────────────────
// Turns the /import/* SSE stream into a decision queue: candidate cards for
// album/item matches, a compare view for duplicates, and a keyboard-first
// flow so a 40-album import never needs the mouse.
let importState={jobId:null,es:null,decision:null,selected:0,decided:0,log:[],running:false};
function importOptionsPayload(){
return {
path: document.getElementById('import-path').value.trim(),
handling: document.querySelector('input[name="import-handling"]:checked').value,
incremental: document.getElementById('import-incremental').checked,
mode: document.querySelector('input[name="import-mode"]:checked').value,
singleton: document.getElementById('import-singleton').checked,
log_path: document.getElementById('import-log').checked
? (document.getElementById('import-log-path').value.trim()||'~/beets-import.log') : null,
};
}
function startImport(){
const payload=importOptionsPayload();
const errEl=document.getElementById('import-start-error');
errEl.innerHTML='';
if(!payload.path){errEl.innerHTML='<div class="alert alert-red">Enter a path to import.</div>';return;}
fetch('/import/start',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)})
.then(r=>r.json())
.then(data=>{
if(!data.ok){errEl.innerHTML='<div class="alert alert-red">'+escapeHtml(data.error)+'</div>';return;}
attachImport(data.id);
})
.catch(()=>{errEl.innerHTML='<div class="alert alert-red">Could not reach the server.</div>';});
}
function checkCurrentImport(){
fetch('/import/current').then(r=>r.json()).then(data=>{
if(!data.id)return;
attachImport(data.id);
if(data.decision){importState.decision=data.decision;importState.selected=0;renderDecision();}
}).catch(()=>{});
}
function attachImport(jobId){
importState.jobId=jobId;importState.running=true;importState.decided=0;
importState.log=[];importState.decision=null;
setImportUiRunning(true);renderImportProgress();
if(importState.es)importState.es.close();
const es=new EventSource('/import/'+jobId+'/events');
importState.es=es;
es.onmessage=e=>handleImportEvent(JSON.parse(e.data));
}
function handleImportEvent(ev){
if(ev.type==='status'){importLog(ev.message);renderImportProgress();}
else if(ev.type==='error'){importLog('Error: '+ev.message);renderImportProgress();}
else if(ev.type==='decision'){
if(importState.decision&&importState.decision.decision_id===ev.decision_id)return;
importState.decision=ev;importState.selected=0;renderDecision();
} else if(ev.type==='done'){
importState.decided=ev.decided;importState.decision=null;importState.running=false;
importLog(ev.aborted?'Import aborted.':'Import finished — '+ev.decided+' decision'+(ev.decided===1?'':'s')+'.');
renderImportProgress();renderDecision();setImportUiRunning(false);
if(importState.es){importState.es.close();importState.es=null;}
}
}
function setImportUiRunning(running){
document.getElementById('import-setup').style.display=running?'none':'block';
document.getElementById('import-run').style.display=running?'block':'none';
}
function abortImport(){
if(!importState.jobId)return;
fetch('/import/'+importState.jobId+'/abort',{method:'POST'});
}
function importLog(msg){
importState.log.push(msg);
const el=document.getElementById('import-log-lines');
if(el)el.textContent=importState.log.join('\n');
}
function renderImportProgress(){
const el=document.getElementById('import-progress-text');
if(!el)return;
el.textContent=importState.running
?(importState.decided+' decided so far'+(importState.decision?' — waiting for you':' — working…'))
:'';
}
function sendDecision(choice,candidate){
const d=importState.decision;
if(!d)return;
const payload={decision_id:d.decision_id,choice};
if(candidate!=null)payload.candidate=candidate;
importState.decision=null;renderDecision();renderImportProgress();
fetch('/import/'+importState.jobId+'/decide',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)})
.then(r=>r.json())
.then(data=>{if(!data.ok)importLog('Decision error: '+data.error);})
.catch(()=>importLog('Could not reach the server.'));
}
function decideImport(choice){sendDecision(choice);}
function applyCandidate(i){sendDecision('apply',i);}
function selectCandidate(i){importState.selected=i;renderDecision();}
function renderDecision(){
const wrap=document.getElementById('import-decision');
const d=importState.decision;
if(!d){wrap.style.display='none';wrap.innerHTML='';return;}
wrap.style.display='block';
if(d.kind==='resume')wrap.innerHTML=renderResumeDecision(d);
else if(d.kind==='duplicate')wrap.innerHTML=renderDuplicateDecision(d);
else wrap.innerHTML=renderMatchDecision(d);
}
function renderResumeDecision(d){
return '<div class="decision-head"><div class="decision-current">Resume interrupted import of <b>'+escapeHtml(d.path)+'</b>?</div></div>'+
'<div class="decision-actions">'+
'<button class="btn btn-primary" onclick="decideImport(\'resume\')"><span class="kbd">Enter</span>Resume</button>'+
'<button class="btn" onclick="decideImport(\'restart\')"><span class="kbd">N</span>Restart</button>'+
'</div>';
}
function qualityLabel(o){
if(!o)return'';
if(o.bitdepth!=null)return(o.format||'')+' '+o.bitdepth+'-bit/'+Math.round((o.samplerate||0)/1000)+'kHz';
if(o.bitrate!=null)return(o.format||'')+' '+Math.round(o.bitrate/1000)+'kbps';
return o.format||'';
}
function renderDuplicateDecision(d){
const rec=d.recommendation;
let html='<div class="decision-head"><div class="decision-current">Possible duplicate</div></div>';
html+='<div class="dup-compare">';
html+='<div class="dup-side"><div class="lib-row-meta">Already in library</div>'+
d.existing.map(e=>'<div class="candidate-card">'+escapeHtml(e.artist||'')+' — '+escapeHtml(e.name||'')+
'<div class="lib-row-meta">'+e.tracks+' track'+(e.tracks===1?'':'s')+' · '+escapeHtml(qualityLabel(e))+'</div></div>').join('')+
'</div>';
html+='<div class="dup-side"><div class="lib-row-meta">Incoming'+(rec==='remove'?' <span class="rec-badge">recommended</span>':'')+'</div>'+
'<div class="candidate-card'+(rec==='remove'?' selected':'')+'">'+escapeHtml(d.new.artist||'')+' — '+escapeHtml(d.new.name||'')+
'<div class="lib-row-meta">'+d.new.tracks+' track'+(d.new.tracks===1?'':'s')+' · '+escapeHtml(qualityLabel(d.new))+'</div></div></div>';
html+='</div>';
html+='<div class="decision-actions">'+
'<button class="btn" onclick="decideImport(\'keep\')"><span class="kbd">K</span>Keep both</button>'+
'<button class="btn" onclick="decideImport(\'skip\')"><span class="kbd">S</span>Skip new</button>'+
'<button class="btn" onclick="decideImport(\'merge\')"><span class="kbd">M</span>Merge</button>'+
'<button class="btn btn-danger'+(rec==='remove'?' btn-primary':'')+'" onclick="decideImport(\'remove\')"><span class="kbd">R</span>Replace (delete old)</button>'+
'</div>';
return html;
}
function fieldDiff(newVal,curVal){
const same=(newVal||'')===(curVal||'');
return '<span class="'+(same?'':'diff')+'">'+escapeHtml(newVal||'—')+'</span>';
}
function candidateCard(c,i,d){
const curArtist=d.current.artist,curTitle=d.kind==='album'?d.current.album:d.current.title;
const selected=i===importState.selected;
const renamed=(c.tracks||[]).filter(t=>t.current!==t.new);
const trackNote=c.tracks&&c.tracks.length
?c.tracks.length+' track'+(c.tracks.length===1?'':'s')+(renamed.length?', '+renamed.length+' renamed':'')
:'';
const trackDetail=renamed.length?'<details class="track-diff"><summary>Show renamed tracks</summary>'+
renamed.map(t=>'<div class="track-diff-row">'+escapeHtml(t.current)+' → '+escapeHtml(t.new)+'</div>').join('')+
'</details>':'';
return '<div class="candidate-card'+(selected?' selected':'')+'" onclick="selectCandidate('+i+')">'+
'<div class="candidate-head">'+
'<span class="candidate-index">'+(i+1)+'</span>'+
'<div class="candidate-title">'+fieldDiff(c.title,curTitle)+' <span class="lib-row-year">'+(c.year||'')+'</span></div>'+
'<div class="candidate-sim">'+c.similarity+'%</div>'+
'</div>'+
'<div class="candidate-artist">'+fieldDiff(c.artist,curArtist)+'</div>'+
'<div class="candidate-meta">'+[c.label,c.country,c.media,c.albumtype].filter(Boolean).map(escapeHtml).join(' · ')+'</div>'+
(trackNote?'<div class="lib-row-meta">'+trackNote+'</div>'+trackDetail:'')+
'<button class="btn btn-primary btn-sm" onclick="event.stopPropagation();applyCandidate('+i+')">Apply <span class="kbd">'+(i+1)+'</span></button>'+
'</div>';
}
function renderMatchDecision(d){
const cur=d.kind==='album'?(d.current.artist+' — '+d.current.album):(d.current.artist+' — '+d.current.title);
let html='<div class="decision-head">'+
'<div class="decision-current">Currently on disk: <b>'+escapeHtml(cur)+'</b> · '+d.item_count+' track'+(d.item_count===1?'':'s')+'</div>'+
'<div class="decision-actions">'+
'<button class="btn" onclick="decideImport(\'asis\')"><span class="kbd">A</span>As-is</button>'+
'<button class="btn btn-danger" onclick="decideImport(\'skip\')"><span class="kbd">S</span>Skip</button>'+
'</div></div>';
html+=d.candidates.length
?'<div class="candidate-list">'+d.candidates.map((c,i)=>candidateCard(c,i,d)).join('')+'</div>'
:'<div class="lib-empty">No candidates found.</div>';
return html;
}
document.addEventListener('keydown',function(e){
if(activeTab!=='inbox'||!importState.decision||document.getElementById('prefs-dialog').open)return;
const tag=(document.activeElement.tagName||'').toLowerCase();
if(tag==='input'||tag==='textarea'||tag==='select')return;
const d=importState.decision,key=e.key;
if(d.kind==='resume'){
if(key==='Enter')decideImport('resume');
else if(key.toLowerCase()==='n')decideImport('restart');
return;
}
if(d.kind==='duplicate'){
const k=key.toLowerCase();
if(k==='k')decideImport('keep');
else if(k==='s')decideImport('skip');
else if(k==='m')decideImport('merge');
else if(k==='r')decideImport('remove');
return;
}
if(key>='1'&&key<='9'){
const i=parseInt(key,10)-1;
if(i<d.candidates.length)applyCandidate(i);