summaryrefslogtreecommitdiffstats
path: root/2020/organizers-notebook.md
blob: e28478478797278e9f041341b745270c60bc56dc (plain) (blame)
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
<!-- automatically generated from organizers-notebook.org. Please edit that file instead. -->
[[!toc levels=4]]

-   [Export and tangle]((progn (org-md-export-to-markdown) (org-babel-tangle)))
-   [Execute buffer]((org-babel-execute-buffer))


# Tasks


## Manually transcribe

Either subtitles (with timestamps) or a text transcript (no timestamps) is perfectly okay.

-   [ ] mplsCorwin: emacsconf-2020&#x2013;03-idea-to-novel-superstructure-emacs-for-writing&#x2013;questions&#x2013;bala-ramadurai.webm
-   [ ] mplsCorwin: emacsconf-2020&#x2013;08-building-reproducible-emacs&#x2013;andrew-tropin.webm
-   [X] sachac: emacsconf-2020&#x2013;10-lead-your-future-with-org&#x2013;andrea.webm
    Added transcript to info/10.md, seeing if YouTube can automatically
    assign timing. Took about 24 minutes to transcribe 8 minute talk. If
    it doesn't work out, I might manually time it. &#x2026; It worked!
-   [ ] zaeph: emacsconf-2020&#x2013;24-analyze-code-quality-through-emacs-a-smart-forensics-approach-and-the-story-of-a-hack&#x2013;andrea.webm


## Edit automatic subtitles

To reduce duplication of work, make sure you have the latest copy of organizers-notebook.org. Mark the one you
want to do by prepending your name to the TODO title, and commit
organizers-notebook.org back to the repo.

I modified the `subed` package to work with VTT files. The modified version is at  <https://github.com/sachac/subed/tree/subed-vtt> , and I've submitted a pull request. It's pretty cool! If you copy the webm to the same directory and name it with the same filename (except ending in .webm instead of .vtt, of course), subed will automatically synchronize as you move through the subtitles. [Demo](https://sachachua.com/blog/2020/12/editing-subtitles-in-emacs-with-subed-with-synchronized-video-playback-through-mpv/)

-   [ ] <./subtitles/emacsconf-2020--00-opening-remarks-autogen.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--03-idea-to-novel-superstructure-emacs-for-writing--bala-ramadurai-autogen.vtt>
    See <info/03/screenplay.fountain>
-   [X] sachac <./subtitles/emacsconf-2020--04-music-in-plain-text--jonathan-gregory.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--05-bard-bivoumacs-building-a-bandcamp-like-page-for-an-album-of-music--grant-shangreaux.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--05-bard-bivoumacs-building-a-bandcamp-like-page-for-an-album-of-music--questions--grant-shangreaux.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--07-beyond-vim-and-emacs-a-scalable-ui-paradigm--questions--sid-kasivajhula.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--07-beyond-vim-and-emacs-a-scalable-ui-paradigm--sid-kasivajhula.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--09-orgmode-your-life-in-plain-text--rainer-koenig.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--11-the-org-gtd-package-opinions-about-getting-things-done--aldric.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--12-one-big-ass-org-file-or-multiple-tiny-ones-finally-the-end-of-the-debate--leo-vivier-autogen.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--13-experience-report-steps-to-emacs-hyper-notebooks--joseph-corneli-raymond-puzio-cameron-ray-smith-autogen.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--14-readme-driven-design--adam-ard-autogen.vtt>
-   [X] sachac <./subtitles/emacsconf-2020--15-moving-from-jekyll-to-orgmode-an-experience-report--adolfo-villafiorita-autogen.vtt>
-   [X] sachac <./info/16.md>  <./subtitles/emacsconf-2020--16-org-roam-presentation-demonstration-and-whats-on-the-horizon--leo-vivier.vtt>
-   [X] sachac <./info/17.md>  <./subtitles/emacsconf-2020--17-org-mode-and-org-roam-for-scholars-and-researchers--noorah-alhasan.vtt>
-   [X] sachac  <./info/18.md>  <./subtitles/emacsconf-2020--18-org-roam-technical-presentation--leo-vivier.vtt>
-   [X] sachac  <./info/19.md>  <./subtitles/emacsconf-2020--19-sharing-blogs-and-more-with-org-webring--brett-gilio-autogen.vtt>
-   [X] sachac <./info/20.md>  <./subtitles/emacsconf-2020--20-omg-macros--corwin-brust-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--21-on-why-most-of-the-best-features-in-eev-look-like-5-minute-hacks--eduardo-ochs-autogen.vtt>
-   [ ] sachac <./subtitles/emacsconf-2020--22-powering-up-special-blocks--musa-al-hassy-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--23-incremental-parsing-with-emacs-tree-sitter--questions--tuan-anh-nguyen-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--23-incremental-parsing-with-emacs-tree-sitter--tuan-anh-nguyen-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--25-traverse-complex-json-structures-with-live-feedback-counsel-jq--zen-monk-alain-m-lafon-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--26-emacs-as-a-highschooler-how-it-changed-my-life--pierce-wang-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--26-emacs-as-a-highschooler-how-it-changed-my-life--questions--pierce-wang-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--27-state-of-retro-gaming-in-emacs-chip8--vasilij-wasamasa-schneidermann-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--28-welcome-to-the-dungeon--erik-elmshauser-corwin-brust-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--30-a-tour-of-vterm--gabriele-bozzola-sbozzolo-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--30-a-tour-of-vterm--questions--gabriele-bozzola-sbozzolo-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--31-lakota-language-and-emacs--grant-shangreaux-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--31-lakota-language-and-emacs--questions--grant-shangreaux-autogen.vtt>
-   [ ] bhavin192 <./subtitles/emacsconf-2020--32-object-oriented-code-in-the-gnus-newsreader--eric-abrahamsen-autogen.vtt>
-   [ ] bhavin192 <./subtitles/emacsconf-2020--33-maxima-a-computer-algebra-system-in-emacs--fermin.vtt>
-   [ ] bhavin192 <./subtitles/emacsconf-2020--34-extend-emacs-to-modern-gui-applications-with-eaf--matthew-zeng-autogen.vtt>
-   [X] bhavin192 <./info/35.md> <./subtitles/emacsconf-2020--35-waveing-at-repetitive-repetitive-repetitive-music-zmusic--zachary-kanfer-autogen.vtt>
-   [X] bhavin192 <./info/35.md> <./subtitles/emacsconf-2020--35-waveing-at-repetitive-repetitive-repetitive-music-zmusic--questions--zachary-kanfer-autogen.vtt>
-   [X] bhavin192 <./info/38.md> <./subtitles/emacsconf-2020--38-emacs-development-update--john-wiegley.vtt>
-   [X] bhavin192 <./info/39.md> <./subtitles/emacsconf-2020--39-nongnu-elpa--questions--richard-stallman.vtt>
-   [X] bhavin192 <./info/39.md> <./subtitles/emacsconf-2020--39-nongnu-elpa--richard-stallman.vtt>
-   [ ] <./subtitles/emacsconf-2020--40-closing-remarks-part-1-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--40-closing-remarks-part-2-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--41-opening-remarks-autogen.vtt>
-   [ ] <./subtitles/emacsconf-2020--42-closing-remarks-autogen.vtt>


# Assumptions and settings

Note that re-evaluating a defvar won't change the value, so if you want to change the value after this is already loaded, use `(setq ...)`.

    (defvar conf/year 2020 "Year of conference.")
    (defvar conf/buffer-minutes 3 "Number of minutes to use as a buffer between talks.")
    (defvar conf/timezones '("EST" "America/Los_Angeles" "UTC" "CET" "Asia/Singapore") "List of timezones")
    (defvar conf/autogenerate-talk-pages nil "Set this to t at the beginning of the conference, when we're still autogenerating individual talk pages.
    Otherwise you might overwrite hand-edited talk pages.")
    (defvar conf/collaborative-pad "https://etherpad.wikimedia.org/p/emacsconf-2020" "URL of collaborative pad.")
    (defvar conf/streaming-nick "bandali" "IRC nick of main organizer in charge of streaming.")
    (defvar conf/topic-templates nil "List of (channel topic-template) entries for mass-setting channel topics.")
    (defvar conf/rooms '(("A" "http://example.org?room=a")
                         ("B" "http://example.org?room=b")
                         ("C" "http://example.org?room=c")) 
      "List of (code join-url) entries. Room codes should be uppercase.") ; actually set this in organizers' wiki index.org
    (setq conf/topic-templates 
          '(("#emacsconf" "EmacsConf 2020 is over, thanks for joining! | Subscribe to https://lists.gnu.org/mailman/listinfo/emacsconf-discuss for updates")
            ("#emacsconf-accessible" "EmacsConf 2020 is over. Thanks for making it more accessible! | Subscribe to https://lists.gnu.org/mailman/listinfo/emacsconf-discuss for updates")
            ("#emacsconf-org" "EmacsConf2020 is over, thanks for joining! | Dedicated channel for EmacsConf organizers and speakers | this is intended as an internal, low-traffic channel; for main discussion around EmacsConf, please join #emacsconf | Subscribe to https://lists.gnu.org/mailman/listinfo/emacsconf-discuss for updates")))


# Workflows

STREAM - main organizer, CHECK - secondary organizer or volunteer, PAD - organizer focusing on pad


## Planning

-   Collect e-mail addresses of accepted speakers into a list for easy pasting into Bcc (organizers' private wiki)
-   See submissions.org for Org scheduling code; 3 minutes of buffer was okay last time, but more would be better for Q&A; opening remarks time could be trimmed


### Code for scheduling

    (defun conf/get-talk-info ()
      (let (talk results)
        (org-map-entries (lambda ()
                           (let ((heading (org-heading-components)))
                             (cond
                              ((and (elt heading 2) (or (null talk)
                                                        (<= (car heading)
                                                            (plist-get talk :level)))) ;; has a todo, therefore is a talk
                               (when talk (setq results (cons talk results)))
                               (setq talk (list
                                           :type 'talk
                                           :title (elt heading 4)
                                           :talk-id (org-entry-get (point) "TALK_ID")
                                           :status (elt heading 2)
                                           :level (car heading)
                                           :scheduled (org-entry-get (point) "SCHEDULED")
                                           :duration (org-entry-get (point) "DURATION")
                                           :time (org-entry-get (point) "MIN_TIME")
                                           :speakers (org-entry-get (point) "NAME"))))
                              ((string-match "^ *Talk information *$" (elt heading 4))
                               (plist-put talk :info
                                          (org-export-as 'md t nil t)))
                              ((or (null talk) (< (car heading) (plist-get talk :level)))  ;; heading above
                               (when talk
                                 (setq results (cons talk results))
                                 (setq talk nil))
                               (setq results (cons
                                              (list :type 'headline
                                                    :level (car heading)
                                                    :speakers (org-entry-get (point) "NAME")
                                                    :duration (org-entry-get (point) "DURATION")
                                                    :talk-id (org-entry-get (point) "TALK_ID")
                                                    :title (elt heading 4)
                                                    :scheduled (org-entry-get (point) "SCHEDULED"))
                                              results))))))
                         nil 'tree)
        (when talk (setq results (cons talk results)))
        (reverse results)))
    
    (defun conf/filter-talks (list)
      "Return only talk info in LIST."
      (seq-filter
       (lambda (talk) (eq (plist-get talk :type) 'talk))
       list))
    
    (defun conf/get-talk-info-from-file (&optional filename)
      (with-temp-buffer
        (insert-file-contents (or filename "submissions.org"))
        (org-mode)
        (org-show-all)
        (goto-char (point-min))
        (goto-char (org-find-property "ID" "talks"))
        (conf/get-talk-info)))
    
    
    (defun conf/find-talk (filter &optional info)
      (setq info (or info (conf/filter-talks conf/info)))
      (when (stringp filter) (setq filter (list filter)))
      (or (seq-find (lambda (o) (string= (plist-get o :talk-id) (car filter))) info)
          (seq-find (lambda (o)
                      (let ((case-fold-search t)
                            (all (mapconcat (lambda (f) (plist-get o f)) '(:title :speakers :talk-id) " ")))
                        (null (seq-contains-p
                               (mapcar (lambda (condition) (string-match condition all)) filter)
                               nil))))
                    info)))
    
    (defun conf/goto-talk-id (id)
      (goto-char (org-find-property "TALK_ID" id)))
    
    (defun conf/assign-ids ()
      "Assign numeric talk IDs."
      (interactive)
      (goto-char (point-min))
      ;; Determine the maximum ID assigned so far
      (let ((id
             (1+
              (apply 'max
                     (or (mapcar
                          'string-to-number
                          (org-map-entries
                           (lambda ()
                             (let ((org-trust-scanner-tags t))
                               (org-entry-get (point) "TALK_ID"))) "TALK_ID>0" 'file))
                         '(0))))))
        (goto-char (point-min))
        (while (re-search-forward "^ *:NAME: " nil t)
          (unless (org-entry-get (point) "TALK_ID")
            (org-set-property "TALK_ID" (format "%02d" id))
            (org-set-property "CUSTOM_ID" (format "talk%02d" id))
            (setq id (1+ id))))))
    
    (defun conf/update-talks ()
      "Update times, tables, and schedules."
      (interactive)
      (save-excursion
        (conf/update-times)
        (conf/update-tables)
        (conf/update-schedules)))
    
    (defun conf/update-times ()
      "Check whether we need more time or less time based on TARGET_TIME and MIN_TIME_SUM."
      (goto-char (point-min))
      (org-map-entries
       (lambda ()
         (when (org-entry-get (point) "TARGET_TIME")
           (conf/org-sum-min-time-in-subtree)
           (org-entry-put
            (point)
            "DIFFERENCE"
            (let ((diff
                   (-
                    (string-to-number (org-entry-get (point) "TARGET_TIME"))
                    (string-to-number (org-entry-get (point) "MIN_TIME_SUM")))))
              (cond
               ((> diff 0) (format "Extra: %d" diff))
               ((< diff 0) (format "Needs: %d" (- diff)))
               (t "")))))) nil 'file))
    
    (defun conf/update-tables ()
      "Update the time checks and table reports."
      (goto-char (point-min))
      (while (re-search-forward "#\\+CALL: check_time()" nil t)
        (org-ctrl-c-ctrl-c))
      (goto-char (point-min))
      (while (re-search-forward "#\\+BEGIN: columnview" nil t)
        (org-ctrl-c-ctrl-c)))
    
    (defun conf/update-schedules ()
      "Schedule the talks based on the MIN_TIME and 3 minutes of buffer.
    Talks with a FIXED_TIME property are not moved."
      (interactive)
      (goto-char (org-find-exact-headline-in-buffer "Talks"))
      (let (current-time scheduled end-time duration (buffer (seconds-to-time (* conf/buffer-minutes 60))))  ;; assumption: 3 minutes between talks
        (org-map-entries (lambda ()
                           (if (org-entry-get (point) "FIXED_TIME")
                               (setq current-time (org-get-scheduled-time (point))))
                           (when (org-entry-get (point) "MIN_TIME")
                             (setq duration (* (string-to-number (org-entry-get (point) "MIN_TIME")) 60)
                                   end-time (time-add current-time (seconds-to-time duration)))
                             (org-set-property "SCHEDULED" (format "%s-%s" (org-format-time-string "%Y-%m-%d %H:%M" current-time)
                                                                   (org-format-time-string "%H:%M" end-time)))
                             (setq current-time (time-add end-time buffer))))
                         nil 'tree)))
    
    (defun conf/org-sum-min-time-in-subtree ()
      "Add up all the MIN_TIME properties of headings underneath the current one
    The total is written to the MIN_TIME_SUM property of this heading"
      (interactive)
      (org-entry-put
       (point)
       "MIN_TIME_SUM"
       (save-excursion
         (format "%d"
                 (apply
                  '+
                  (mapcar 'string-to-number
                          (delq nil
                                (org-map-entries
                                 (lambda () (org-entry-get (point) "MIN_TIME")) nil 'tree))))))))


### Generate schedule file

    (defun conf/format-talk-link (talk)
      (and talk (if (plist-get talk :talk-id)
                    (format "<a href=\"/%d/talks/%s\">%s</a>"
                            year
                            (plist-get talk :talk-id)
                            (plist-get talk :title))
                  (plist-get talk :title))))
    
    (defun conf/format-talk-info-as-schedule (info)
      (format "<table width=\"100%%\">%s</table>"
              (mapconcat
               (lambda (o)
                 (let* ((time-fmt "%l:%M %p")
                        (timestamp (org-timestamp-from-string (plist-get o :scheduled)))
                        (start (if timestamp (format-time-string time-fmt (org-timestamp-to-time (org-timestamp-split-range timestamp))) ""))
                        (end (if timestamp (format-time-string time-fmt (org-timestamp-to-time (org-timestamp-split-range timestamp t))) ""))
                        (title (plist-get o :title))
                        (speakers (plist-get o :speakers)))
                   (if (eq (plist-get o :type) 'headline)
                       (format "<tr><td colspan=\"4\"><strong>%s<strong></td></tr>"
                               (if (plist-get o :talk-id)
                                   (conf/format-talk-link o)
                                 title))
                     (format "<tr><td width=100>~%s</td><td width=100>~%s</td><td>%s</td><td>%s</td></tr>"
                             start end (conf/format-talk-link o) speakers))))
               (cdr info) "\n")))
    
    (defun conf/filter-talks (info)
      (seq-filter (lambda (o) (plist-get o :talk-id)) info))
    
    (defun conf/split-out-talk-information ()
      (interactive)
      (let ((talks (conf/filter-talks conf/info)))
        (mapc (lambda (o)
                (with-temp-buffer
                  (insert
                   (format "# %s\n%s\n\n%s"
                           (plist-get o :title)
                           (plist-get o :speakers)
                           (plist-get o :info)))
                  (write-file (expand-file-name (format "%s.md" (plist-get o :talk-id)) "info"))))
              talks)))
    
    (defun conf/format-talk-pages (info)
      (let* ((talks (conf/filter-talks info))
             (next-talks (cdr talks))
             (prev-talks (cons nil talks)))
        (mapc (lambda (o)
                (with-temp-buffer
                  (let* ((timestamp (org-timestamp-from-string (plist-get o :scheduled)))
                         (next-talk (conf/format-talk-link (pop next-talks)))
                         (prev-talk (conf/format-talk-link (pop prev-talks)))
                         (schedule (mapconcat
                                    (lambda (tz)
                                      (format "%s - %s"
                                              (format-time-string "%A, %b %e %Y, ~%l:%M %p"
                                                                  (org-timestamp-to-time (org-timestamp-split-range timestamp)) tz)
                                              (format-time-string "%l:%M %p %Z"
                                                                  (org-timestamp-to-time (org-timestamp-split-range timestamp t)) tz)))
                                    conf/timezones
                                    "  \n"))
                         (nav-links (format "Back to the [[schedule]]  \n%s%s"
                                            (if prev-talk (format "Previous: %s  \n" prev-talk) "")
                                            (if next-talk (format "Next: %s  \n" next-talk) ""))))
                    (insert (format "[[%s title=\"%s\"]]
      [[%s copyright=\"Copyright &copy; %s %s\"]]
    
      <!-- To edit the talk information, change info/TALKID.md. Boilerplate automatically generated from submissions.org using conf/generate-schedule-files --->\n
    
      %s
    
      [[!inline pages=\"internal(%s/info/%s)\" raw=\"yes\"]]
    
      %s
    
      %s
    
      "
                                    "!meta"
                                    (replace-regexp-in-string "\"" "\\\\\"" (plist-get o :title))
                                    "!meta" 
                                    conf/year
                                    (plist-get o :speakers)
                                    nav-links
                                    conf/year
                                    (plist-get o :talk-id)
                                    schedule
                                    nav-links)))
                  (write-file (format "talks/%s.md" (plist-get o :talk-id)))))
              talks)))
    
    (defun conf/generate-pad-template ()
      "Generate a template for copying and pasting into the pad.
    Writes it to pad-template.html."
      (interactive "p")
      (let* ((talks (conf/filter-talks conf/info))
             (text (concat
                  "<p>Conference info, how to watch/participate: https://emacsconf.org/2020/<br />
    Guidelines for conduct: https://emacsconf.org/conduct/</p>
    
    <p>Except where otherwise noted, the material on the EmacsConf pad are dual-licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International Public License; and the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) an later version.
    Copies of these two licenses are included in the EmacsConf wiki repository, in the COPYING.GPL and COPYING.CC-BY-SA files (https://emacsconf.org/COPYING/).</p>
    
    <p>By contributing to this pad, you agree to make your contributions available under the above licenses. You are also promising that you are the author of your changes, or that you copied them from a work in the public domain or a work released under a free license that is compatible with the above two licenses. DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION.</p>
    
    <p>
    This pad is here to be curated by everybody and its rough structure is like this:
    <ol><li>General info and license
    <li>A section for each talk -> please do add questions and notes
    <li>A general feedback section
    </ol>
    </p>
      "
           (mapconcat
            (lambda (o)
              (let ((url (format "https://emacsconf.org/%s/schedule/%s" conf/year (plist-get o :talk-id))))
                (format "-------------------------------------------------------------------------------------------------<br/><strong>Talk%s: %s</strong><br />
    Speaker(s): %s<br />  
    Talk page: <a href=\"%s\">%s</a><br />
    Actual start of talk EST: &nbsp;&nbsp;&nbsp;  Start of Q&A: &nbsp;&nbsp;  End of Q&A: &nbsp;&nbsp;<br />
    <strong>Questions:</strong>
    Speakers may answer in any order or skip questions. As much as possible, put your questions at the top level instead of under another question. If adding an answer, please indicate [speaker] or your nick accordingly. Volunteers, please add new slots as ones get filled.<br />
    <ul>
      <li>Q1:&nbsp;<ul><li>A:&nbsp;</li></ul></li>
      <li>Q2:&nbsp;<ul><li>A:&nbsp;</li></ul></li>
      <li>Q3:&nbsp;<ul><li>A:&nbsp;</li></ul></li>
      <li>Q4:&nbsp;<ul><li>A:&nbsp;</li></ul></li>
    </ul>
    
    <strong>Links and other notes:</strong>
    <ul>
      <li>sample text</li>
      <li>sample text</li>
      <li>sample text</li>
      <li>sample text</li>
    </ul>
    " (plist-get o :talk-id) (plist-get o :title) (plist-get o :speakers) url url))) talks "<br/><br/>\n") 
           "<br/><br/>-------------------------------------------------------------------------------------------------<br/>
    <strong>General Feedback: What went well?</strong><br/><br/>
    <ul>
      <li>sample text</li>
      <li>sample text</li>
      <li>sample text</li>
      <li>sample text</li>
    </ul>
    <br /><br />
    -------------------------------------------------------------------------------------------------<br/>
    <strong>General Feedback: What to improve?</strong><br/><br/>
    <ul>
      <li>sample text</li>
      <li>sample text</li>
      <li>sample text</li>
      <li>sample text</li>
    </ul>
    <br/><br/>
    -------------------------------------------------------------------------------------------------<br/>
    <strong>Colophon:</strong>
    <ul></ul>")))
        (with-current-buffer (find-file "pad-template.html")
          (erase-buffer)
          (insert text)
          (save-buffer)))
      (browse-url-of-file "pad-template.html"))
    
    (defun conf/generate-talks-page ()
      (let ((info conf/info))
        (with-temp-buffer
          (find-file "talk-details.md")
          (erase-buffer)
          (insert (format "<table><thead><th>Duration</th><th>Title</th><th>Speakers</th></thead><tbody>%s</tbody></table>"
                          (mapconcat
                           (lambda (o)
                             (let* ((title (plist-get o :title))
                                    (speakers (plist-get o :speakers)))
                               (if (null (plist-get o :talk-id))
                                   (format "<tr><td colspan=\"3\">%s</td></tr>" (conf/format-talk-link o))
                                 (format "<tr><td>%s</td><td>%s</td><td>%s</td><tr>" 
                                         (plist-get o :duration)
                                         (conf/format-talk-link o)
                                         (plist-get o :speakers)))))
                           info "\n")))
          (save-buffer))))
    
    (defun conf/generate-schedule-files (&optional filename)
      (interactive)
      (with-temp-buffer
        (insert (conf/format-talk-info-as-schedule conf/info))
        (write-file "schedule-details.md"))
      (when conf/autogenerate-talk-pages (conf/format-talk-pages conf/info)))

Set the info based on submissions.org.

    (setq conf/info (conf/get-talk-info-from-file "submissions.org"))


## Before the conference

-   Do tech checks and get alternative ways to contact speakers (phone number? IRC nick? Something that goes ding?)
-   Install Mute Tab extension if desired
-   Send encoding tips for prerecs
-   Normalize audio for prerecs
-   Ask speakers for prerecs, links, slides, other resources
-   Put prerecs in `orga@front0:~/prerecs` so that people can use mediainfo to check duration
-   Plan volunteer availability
-   Set up local icecast server and have live0 relay
-   Create individual talk pages and schedule.
-   Set up pad with Q1: Q2: Q3: Q4: slots: `conf/generate-pad-template`


### Tech check

-   Explain process
-   Test audio, webcam, screensharing, collaborative pad
    -   Music demos and other things that use system audio will need to be prerecorded (or done through virtual loopback device, maybe? Technical risk.)
    -   Multi-monitor setups might not be handled well by BBB; share window instead of desktop
-   Check if comfortable checking into IRC: #emacsconf-org
-   Ask about Q&A preference; OR:
    -   live Q&A
    -   Q&A over pad or IRC
    -   no Q&A
-   Get IRC nick and phone number for emergency contact, store in private wiki
-   Try to record name pronunciation
-   Encourage webcam for Q&A, although make it clear that it's totally optional
-   Possible picture-in-picture approach to maximize screen real estate
    -   Linux: share desktop, run cheese, set Always on Top


## During the conference


### Start of streaming

-   STREAM starts streaming and has live0 relay
-   STREAM displays time on screen: `watch TZ=America/New_York date` ?
-   CHECK confirms stream and starts low-resolution mirror


#### ffmpeg: mirror main stream to low-resolution stream

Needs the `$main480p` environment variable set to somethnig of the form `icecast://username:password@site:port/mount-point.webm`. Icecast configuration can be found on `live0` at `/etc/icecast2/icecast.xml`. It was okay to run this command directly on `live0` in 2020, since that kept the speed at roughly 1x.

    while true; do ffmpeg -f webm -reconnect_at_eof 1 -reconnect_streamed 1  -re -i http://localhost:8000/main.webm -vf scale=854:480 -f webm -c:a copy -b:v 500k -maxrate 1M -bufsize 1M  -content_type video/webm -c:v libvpx  $main480p done


### Shortly before the presentation

-   Speaker checks in via IRC ~30m before
-   CHECK directs speaker to available room
-   Speaker joins talk room
-   CHECK makes speaker presenter and moderator, does last-minute tech check
    -   Hello, thanks
    -   Speaker tries screen sharing and webcam
    -   check screen readability
    -   CHECK briefs speaker on process, including:
        -   confirming preferences:
            -   prerec / live talk
            -   live Q&A / IRC / no Q&A
            -   live Q&A: reading questions themselves (can do in any order, can skip) or asking STREAM to read questions to them
        -   encouragement of webcam, although it's optional
        -   how STREAM will join and then give them the go-ahead
        -   closing any tabs watching the stream as their talk starts (otherwise the audio is confusing)
        -   starting with saying their name clearly and doing a quick intro to their talk
-   CHECK notifies STREAM with link to the talk room and preferences for prerec or live talk, live Q&A / IRC / no Q&A
-   STREAM joins meeting and gives go-ahead
-   CHECK starts recording in BBB
-   CHECK announces on IRC
-   PAD clears the pad colours and updates timestamp


### During the presentation

-   OR:
    -   Live presentation? 
        -   Speaker presents, keeping an eye on the collaborative pad for questions
        -   STREAM stays with speaker to stream and to help with questions and timing
    -   Prerecorded? STREAM plays prerecorded video on computer
    -   Streamed live from somewhere else?
        -   Make sure to have a separate way to communicate (ex: IRC)
-   OTHER keeps an eye on audio levels and tells STREAM if adjustments are needed
-   If there is another speaker, CHECK moves to next room for setup
-   OTHER moves past prerecs to public directory (maybe even current?)
    -   (It would be pretty cool if we can figure out how to make the previous talks available for watching)


### Q&A

-   STREAM joins speaker's room if not already there
-   STREAM gives go-ahead to start Q&A
-   Speaker reads questions off the pad or gets questions from STREAM
-   Time is indicated by having an organizer type into the Etherpad, or speaking up if needed
-   If moderation is needed, organizers add a reminder that speakers can choose to skip questions or answer in any order
-   STREAM goes to next talk when ready


### Lunch break

-   STREAM plays music
-   STREAM quickly highlights `#emacsconf-accessible`, Etherpad, notes


### Scenarios


#### Prerecorded presentations

-   STREAM will play it on the computer and stream from there (or ideally, send it directly to the stream)


#### Tech issues

-   If can't be easily resolved, play pre-recorded talk early and try again later (or follow up)
-   Stream a technical issues slide to the end point


### Code for ERC


#### Load data

    (defvar conf/info nil "List of plists with the following keys: `:talk-id', `:name', `:speakers', and other info.") ; Set from submissions.org


#### Announce topics

    (defmacro conf/erc-with-channels (channel-list &rest forms)
      (declare (indent 1) (debug (form form body)))
      `(mapcar (lambda (channel)
                 (with-current-buffer (erc-get-buffer channel)
                   ,@forms))
               ,channel-list))
    
    (defun conf/get-room (room)
      (cadr (assoc (upcase room) conf/rooms)))
    
    (defun erc-cmd-CONFTOPIC (&rest message)
      "Set the topic to MESSAGE | template in the conference channels.
    If MESSAGE is not specified, reset the topic to the template."
      (mapc (lambda (template) 
              (with-current-buffer (erc-get-buffer (car template))
                (erc-cmd-TOPIC (if message (concat (if (stringp message) message (s-join " " message)) " | " (cadr template))
                                 (cadr template)))))
            conf/topic-templates))
    
    (defun erc-cmd-CHECKIN (room nick)
      "Send instructions for ROOM and `conf/collaborative-pad' to NICK."
      (let ((room-url (conf/get-room room)))
        (unless room-url (error "Please specify nick and room name"))
        (erc-send-message (format "%s: Thanks for checking in! I'll send you some private messages with the instructions for room %s, so please check there. (Let me know if you don't get them!)" nick
        (upcase room)))
        (erc-message "PRIVMSG" (format "%s You can use this BBB room for your presentation: %s . I'll join you there shortly to set up the room and do the last-minute tech check." nick room-url))
        (erc-message "PRIVMSG" (format "%s The collaborative pad we'll be using for questions is at %s . We'll collect questions from #emacsconf and put them there. If you'd like to jump to your part of the document, you might be able to keep an eye on questions. Alternatively, we can read questions to you." nick conf/collaborative-pad))
        (erc-message "PRIVMSG" (format "%s Amin will join when it's time for your presentation, and he will give you the go-ahead when it's time to present. See you in the BBB room!" nick))))
    
    (defun erc-cmd-READY (code &rest filter)
      "Notify #emacsconf-org and `conf/streaming-nick' that CODE is ready for the talk specified by FILTER.
    FILTER can be the talk ID or strings to match against the title or speaker names."
      (let ((room-url (conf/get-room code))
            (talk (conf/find-talk filter)))
        (unless room-url (error "Could not find room"))
        (unless talk (error "Could not find talk"))
        (with-current-buffer (erc-get-buffer "#emacsconf-org")
          (erc-send-message (format "Ready in Room %s: %s (%s)"
                                    (upcase code)
                                    (plist-get talk :title)
                                    (plist-get talk :speakers))))
        (erc-message "PRIVMSG" 
                     (format "%s Ready in Room %s ( %s ): %s (%s)"
                             conf/streaming-nick
                             (upcase code)
                             room-url
                             (plist-get talk :title)
                             (plist-get talk :speakers)))))
    
    (defun erc-cmd-ANNOUNCE (&rest filter)
      "Set the channel topics to announce the talk specified by FILTER.
    FILTER can be the talk ID or strings to match against the title or speaker names."
      (let ((info (conf/find-talk filter)) message)
        (unless info (error "Could not find talk."))
        (erc-cmd-CONFTOPIC (format "talk%s: %s (%s)"
                                   (plist-get info :talk-id)
                                   (plist-get info :title)
                                   (plist-get info :speakers)))))
    
    (defun erc-cmd-BROADCAST (&rest message)
      "Say MESSAGE in all the conference channels."
      (conf/erc-with-channels (mapcar 'car conf/topic-templates)
                              (erc-send-message (s-join " " message))))


## After the conference


### Convert pad, copy sections to individual pages

This makes the links available right away


### Split individual files

Post to individual pages, and make a talks page with durations. Change individual schedule pages to redirect to talks (or start there in the first place).

Announcement example: <https://lists.gnu.org/r/emacsconf-discuss/2020-12/msg00000.html>


#### Splitting up the stream recording into individual files

NOTE: ffmpeg has a hard time splitting with -c:v copy unless it's on a
keyframe boundary. If it isn't on a keyframe, then you'll have a few
seconds of black video until the next keyframe kicks in.

Here's an example of what we had for splitting.

    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss   13:04 -to   20:08    -c:a copy -c:v copy emacsconf-2020--00-opening-remarks.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss   27:24 -to   51:39    -c:a copy -c:v copy emacsconf-2020--03-an-emacs-developer-story-from-user-to-package-maintainer--leo-vivier.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 1:00:08 -to 1:09:22    -c:a copy -c:v copy emacsconf-2020--03-idea-to-novel-superstructure-emacs-for-writing--questions--bala-ramadurai.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 1:41:28 -to 1:55:13    -c:a copy -c:v copy emacsconf-2020--05-bard-bivoumacs-building-a-bandcamp-like-page-for-an-album-of-music--questions--grant-shangreaux.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 1:57:24 -to 2:11:05    -c:a copy -c:v copy emacsconf-2020--06-trivial-emacs-kits--corwin-brust.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 2:32:00 -to 2:36:35    -c:a copy -c:v copy emacsconf-2020--07-beyond-vim-and-emacs-a-scalable-ui-paradigm--questions--sid-kasivajhula.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 4:55:00 -to 5:11:38    -c:a copy -c:v copy emacsconf-2020--12-one-big-ass-org-file-or-multiple-tiny-ones-finally-the-end-of-the-debate--leo-vivier.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 5:47:44 -to 6:04:17    -c:a copy -c:v copy emacsconf-2020--15-moving-from-jekyll-to-orgmode-an-experience-report--adolfo-villafiorita.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 6:06:00 -to 6:27:56    -c:a copy -c:v copy emacsconf-2020--16-org-roam-presentation-demonstration-and-whats-on-the-horizon--leo-vivier.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 7:24:00 -to 7:27:09.50 -c:a copy -c:v copy emacsconf-2020--40-closing-remarks-part-1.webm
    ffmpeg -y -i main.webm-2020-11-28--08-48.webm -ss 7:28:00 -to 7:50:50    -c:a copy -c:v copy emacsconf-2020--20-omg-macros--corwin-brust.webm
    
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss   15:40 -to   27:27    -c:a copy -c:v copy emacsconf-2020--41-opening-remarks.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss   34:48 -to 1:03:54.75 -c:a copy -c:v copy emacsconf-2020--22-powering-up-special-blocks--musa-al-hassy.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 1:30:40 -to 1:49:18    -c:a copy -c:v copy emacsconf-2020--23-incremental-parsing-with-emacs-tree-sitter--questions--tuan-anh-nguyen.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 4:33:04 -to 4:37:30    -c:a copy -c:v copy emacsconf-2020--26-emacs-as-a-highschooler-how-it-changed-my-life--questions--pierce-wang.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 4:50:00 -to 5:59:30    -c:a copy -c:v copy emacsconf-2020--28-welcome-to-the-dungeon--erik-elmshauser-corwin-brust.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 6:08:20 -to 6:12:42.40 -c:a copy -c:v copy emacsconf-2020--30-a-tour-of-vterm--questions--gabriele-bozzola-sbozzolo.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 6:25:18 -to 6:31:04.90 -c:a copy -c:v copy emacsconf-2020--31-lakota-language-and-emacs--questions--grant-shangreaux.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 6:58:20 -to 7:20:38    -c:a copy -c:v copy emacsconf-2020--33-maxima-a-computer-algebra-system-in-emacs--fermin.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 6:58:20 -to 7:20:38    -c:a copy -c:v copy emacsconf-2020--33-maxima-a-computer-algebra-system-in-emacs--fermin.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 7:55:44 -to 8:02:02    -c:a copy -c:v copy emacsconf-2020--35-waveing-at-repetitive-repetitive-repetitive-music-zmusic--questions--zachary-kanfer.webm
    ffmpeg -y -i main.webm-2020-11-29--08-44.webm -ss 8:03:32 -to 8:40:01.10 -c:a copy -c:v copy emacsconf-2020--42-closing-remarks.webm

This fiddles with the `-ss` to make it divisible by 4. Run this code before a copy of the ffmpeg scripts (adjusting the value of adjust as needed) and it will show only the lines that need tweaking.

    (save-excursion
      (while (re-search-forward "^ffmpeg.*?-ss +\\([^ ]++?\\) +.*$" nil t)
        (let* ((adjust 4)
               (from (save-match-data
                      (let ((s (match-string 1)) num)
                        (if (string-match "\\(\\([0-9]+\\):\\)?\\([0-9]+\\):\\([0-9]+\\)\\(.[0-9]+\\)?" s)
                            (progn
                              (setq num
                                    (+ (* 3600 (string-to-number (or (match-string 2 s) "0")))
                                       (* 60 (string-to-number (or (match-string 3 s) "0")))
                                       (string-to-number (or (match-string 4 s) "0"))
                                       (string-to-number (concat "0" (or (match-string 5 s) "")))))
                              (if (> (% num adjust) 0)
                                  (number-to-string (- num (% num adjust)))
                                nil))
                          s)))))
          (if from
              (replace-match from nil nil nil 1)
            (replace-match "")))))

Thanks to SirVolta and bandali for figuring out keyframe issue!

Further reading:

(all links work with LibreJS enabled)
<https://blog.video.ibm.com/streaming-video-tips/keyframes-interframe-video-compression/>
<https://blog.streamspot.com/blog/compression-codecs-keyframes-and-the-basics-of-stream-quality>
<https://blog.superuser.com/2012/02/24/ffmpeg-the-ultimate-video-and-audio-manipulation-tool/>
<https://superuser.com/questions/138331/using-ffmpeg-to-cut-up-video>
<http://blog.webmproject.org/2010/05/inside-webm-technology-vp8-alternate.html>


### Collect speaker feedback

Another collaborative pad


### Encode highly-compressed versions

Thanks to ArneBab for this ffmpeg script which is now documented in [Extreme compression of Video with VP9 (webm) using ffmpeg](https://www.draketo.de/software/ffmpeg-compression-vp9-av1). We modified it to keep the original audio.

Usage: compress-video.sh input-filename.webm output-filename.webm

    Q=56
    nice ffmpeg -y -i $1 -c:v libvpx-vp9 -b:v 0 -crf $Q -aq-mode 2 -an -tile-columns 0 -tile-rows 0 -frame-parallel 0 -cpu-used 8 -auto-alt-ref 1 -lag-in-frames 25 -g 240 -pass 1 -f webm -threads 8 /dev/null &&
    nice ffmpeg -y -i $1 -c:v libvpx-vp9 -b:v 0 -crf $Q -c:a copy -tile-columns 2 -tile-rows 2 -frame-parallel 0 -cpu-used -5 -auto-alt-ref 1 -lag-in-frames 25 -pass 2 -g 240 -threads 8 $2

Here's the original version which compresses audio too. Usage: compress-video-compressed-audio.sh input-filename.webm output-filename.webm

    Q=56
    nice ffmpeg -y -i $1 -c:v libvpx-vp9 -b:v 0 -crf $Q -aq-mode 2 -an -tile-columns 0 -tile-rows 0 -frame-parallel 0 -cpu-used 8 -auto-alt-ref 1 -lag-in-frames 25 -g 999 -pass 1 -f webm -threads 8 /dev/null &&
    nice ffmpeg -y -i $1 -c:v libvpx-vp9 -b:v 0 -crf $Q -aq-mode 2 -c:a libopus -b:a 12k -tile-columns 2 -tile-rows 2 -frame-parallel 0 -cpu-used -5 -auto-alt-ref 1 -lag-in-frames 25 -pass 2 -g 999 -threads 8 $2


### Upload to alternative video hosting platforms once main announcement has been out for a few days

-   Create playlist, too
-   Try to do Peertube via Toobnix first (bandali's in charge)


### Add subtitles

Take advantage of provided scripts or autogenerated files


#### Code sachac used to move sbv files from the Downloads directory

Autogenerated captions can save a bit of time when setting up
captions. This code renames a downloaded file to match the current
file's naming scheme and moves it to the right directory.

    (defvar conf/subtitle-directory (expand-file-name "subtitles" default-directory) "Directory where subtitles will be kept.")
    (defvar conf/download-directory "~/Downloads" "Directory where downloaded files are saved.")
    
    (defun my/latest-file (path &optional filter)
      "Returns the newest file in PATH.
    If FILTER is specified, files should match this regex."
      (car (sort (seq-remove #'file-directory-p (directory-files path 'full filter t)) #'file-newer-than-file-p)))
    (defun my/rename-latest-download-as-subtitle-file ()
      "Rename the most recent downloaded file to match the current file and move it to `conf/subtitle-directory'.
    To use this, open a Dired buffer with a list of the correctly-named
    videos. Move your cursor to the line for the video that you have just
    downloaded captions for, then call `my/rename-latest-download-as-subtitle-file.'"
      (interactive)
      (let* ((file (my/latest-file conf/download-directory))
             (new-file (expand-file-name (concat (file-name-base (dired-get-filename)) "-autogen." (file-name-extension file)) conf/subtitle-directory)))
        (rename-file file new-file t)
        (message "%s" new-file)))
    ;; Ex: (local-set-key [f5] 'my/rename-latest-download)

To convert from SBV to VTT (used for the HTML5 video player) and fix
timestamps so that they're not overlapping, install `python3-webtt`
and run <subtitles/fix.py> like this: `fix.py
   emacsconf-2020--04-music-in-plain-text--jonathan-gregory.sbv`.


### Add transcript sections

    (defvar conf/wiki-directory "~/vendor/emacsconf-wiki" "Directory that has the public conference wiki.")
    
    (defmacro conf/with-talk-info-file (talk &rest body)
      "Evaluate BODY in the info file for TALK.
    If TALK is not specified, do it in the current buffer."
      (declare (indent 1))
      `(if ,talk
          (with-current-buffer
              (find-file-noselect
               (expand-file-name (format "%d/info/%s.md" conf/year
                                         (plist-get talk :talk-id))
                                 conf/wiki-directory))
            ,@body)
         ,@body))
    
    (defun conf/add-transcript (&optional talk)
      "Try to add transcript for the current talk."
      (interactive)
      (conf/with-talk-info-file talk
        (goto-char (point-min))
        (let (subtitles subed-auto-find-video all)
          (while (re-search-forward "subtitles=\"/\\(.+?\\)\"" nil t)
            (setq subtitles (cons (match-string 1) subtitles))
            (when (re-search-forward "^$\\|\\[View transcript" nil t)
              (unless (string= (match-string 0) "[View transcript")
                (insert
                 (if (string-match "questions" (car subtitles))
                     "[View transcript for Q&A](#transcript-questions)\n"
                   "[View transcript](#transcript)\n")))))
          (when subtitles
            (mapc
             (lambda (subtitle-file)
               (with-current-buffer (find-file-noselect (expand-file-name subtitle-file conf/wiki-directory))
                 (goto-char (point-min))
                 (subed-mode)
                 (let (text)
                   (while (subed-forward-subtitle-text)
                     (setq text (cons (subed-subtitle-text) text)))
                   (setq all (mapconcat 'identity (reverse text) "\n"))))
               (if (re-search-forward (format "<!-- transcript: %s -->[ \t]*\n\\([.\r\n]*?\\)<!-- /transcript -->" (regexp-quote subtitle-file)) nil t)
                   (progn
                     (goto-char (match-beginning 1))
                     (delete-region (match-beginning 1) (match-end 1)))
                 (goto-char (point-max))
                 (insert (format "\n\n<!-- transcript: %s -->\n\n" subtitle-file))
                 (insert (if (string-match "questions" subtitle-file)
                             "<a name=\"transcript-questions\"></a>\n# Transcript: Q&A\n\n"
                           "<a name=\"transcript\"></a>\n# Transcript\n\n"))
                 (save-excursion (insert "\n\n<!-- /transcript -->\n")))
               (save-excursion (insert all)))
             (reverse subtitles))))))
    
    ;; (conf/add-transcript (conf/find-talk "03")), or call from a talk info page 


# Other useful tidbits


## Translating timezones

    (setq my/timezones '("America/Toronto" "America/Los_Angeles" "UTC" "Europe/Berlin" "Asia/Kolkata" "Asia/Shanghai" "Asia/Singapore"))
    (defun my/summarize-times (time timezones)
      (let (prev-day)
        (mapconcat
         (lambda (tz)
           (let ((cur-day (format-time-string "%a %b %-e" time tz))
                 (cur-time (format-time-string "%H%MH %Z" time tz)))
             (if (equal prev-day cur-day)
                 cur-time
               (setq prev-day cur-day)
               (concat cur-day " " cur-time))))
         (sort timezones (lambda (a b) (< (car (current-time-zone nil a)) (car (current-time-zone nil b)))))
         " / ")))
    (defun my/org-summarize-event-in-timezones ()
      (interactive)
      (save-window-excursion
        (save-excursion
          (when (derived-mode-p 'org-agenda-mode) (org-agenda-goto))
          (when (re-search-forward org-element--timestamp-regexp nil (save-excursion (org-end-of-subtree) (point)))
            (goto-char (match-beginning 0))
            (let* ((times (org-element-timestamp-parser))
                   (start-time (org-timestamp-to-time (org-timestamp-split-range times)))
                   (msg (format "%s - %s - %s"
                               (org-get-heading t t t t)
                               (my/summarize-times start-time my/timezones)
                               ;; (cond
                               ;;  ((time-less-p (org-timestamp-to-time (org-timestamp-split-range times t)) (current-time))
                               ;;   "(past)")
                               ;;  ((time-less-p (current-time) start-time)
                               ;;   (concat "in " (format-seconds "%D %H %M%Z" (time-subtract start-time (current-time)))))
                               ;;  (t "(ongoing)"))
                               (org-entry-get (point) "LOCATION"))))
              (message "%s" msg)
              (kill-new msg))))))


## Restarting ikiwiki manually

This is needed when you change the template or if the ikiwiki process gets stuck on something.

    ssh front 'sudo -iu ikiwiki ikiwiki --setup ~ikiwiki/emacsconf.setup'