summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--README.org31
-rw-r--r--group_vars/all.yml3
-rw-r--r--inventory.yml18
-rw-r--r--roles/caption/tasks/aeneas.yml12
-rw-r--r--roles/caption/tasks/main.yml16
-rwxr-xr-xroles/caption/templates/process-captions.py7
6 files changed, 71 insertions, 16 deletions
diff --git a/README.org b/README.org
index b4f6a13..5e1a87c 100644
--- a/README.org
+++ b/README.org
@@ -6,6 +6,12 @@ ansible-galaxy collection install community.general
Production: needs prod-vars.yml, see prod-vars.yml.sample
Docker: needs docker-vars.yml, see docker-vars.yml.sample
+* How to use this playbook
+
+1. Install ansible on your local machine and check out this repo.
+2. Copy the ansible_vars block from conf.org to prod-vars.yml in this repo (alongside inventory.yml), or set emacsconf-ansible-directory in Emacs and then use emacsconf-ansible-tangle-vars to tangle the file.
+3. Find the ansible-playbook command you want to run and try it out.
+
* Wiki
** Ikiwiki
*** Prod
@@ -166,8 +172,31 @@ Use a test pattern (don't know if this works)
ansible-playbook -i inventory.yml prod-playbook.yml --tags test -e icecast_test_track=dev -e icecast_test=pattern
* Captioning
-Set up whisper
+Set up whisper:
ansible-playbook -i inventory.yml prod-playbook.yml --tags caption
+Update caption script:
+
+ansible-playbook -i inventory.yml prod-playbook.yml --tags process-captions
+
ffmpeg -y -i handwritten/reencode.webm -t 60 -vcodec copy -acodec copy test.webm
+* Other useful things
+
+nodemon -w . -e yml -x 'ansible-playbook -i inventory.yml prod-playbook.yml --tags vnc; true'
+* OBS
+
+sudo su - orga -c vncserver
+ssh -L 15902:127.0.0.1:5902 res
+
+Resizing VNC after connection
+xrandr -s 1280x720
+
+pacmd load-module module-null-sink sink_name=DevelopmentSink sink_properties=device.description="DevelopmentSink"
+
+pavucontrol
+vncserver -kill :1
+vncserver -kill :2
+
+Firefox profiles like to be created in an X environment
+firefox -no-remote -CreateProfile "{{ emacsconf_id }}-{{ item.item.id }}
diff --git a/group_vars/all.yml b/group_vars/all.yml
index f7bbbc4..7ab7c6b 100644
--- a/group_vars/all.yml
+++ b/group_vars/all.yml
@@ -11,8 +11,11 @@ emacsconf_tracks:
id: gen
watch: https://emacsconf.org/{{ emacsconf_year }}/watch/gen/
watch_lowres: https://live.emacsconf.org/{{ emacsconf_year }}/watch/gen-480p/
+ vnc_id: 5
- name: Development
id: dev
watch: https://emacsconf.org/{{ emacsconf_year }}/watch/dev/
watch_lowres: https://live.emacsconf.org/{{ emacsconf_year }}/watch/dev-480p/
+ vnc_id: 6
icecast_emacsconf_user: emacsconf
+emacsconf_home: /home/{{ emacsconf_user }}
diff --git a/inventory.yml b/inventory.yml
index f91434d..f3603b0 100644
--- a/inventory.yml
+++ b/inventory.yml
@@ -6,6 +6,18 @@ prod:
ansible_become: true
emacsconf_group: org
cpus: 12
+ obs:
+ ansible_host: res.emacsconf.org
+ ansible_python_interpreter: /usr/bin/python3
+ ansible_become: true
+ emacsconf_group: org
+ cpus: 12
+ # obs:
+ # ansible_host: obs
+ # remote_user: sacha
+ # ansible_ssh_user: sacha
+ # ansible_python_interpreter: /usr/bin/python3
+ # ansible_become: true
front:
ansible_host: front0.emacsconf.org
remote_user: orga
@@ -43,12 +55,6 @@ prod:
ansible_ssh_user: orga
ansible_python_interpreter: /usr/bin/python3
ansible_become: true
- obs:
- ansible_host: obs
- remote_user: sacha
- ansible_ssh_user: sacha
- ansible_python_interpreter: /usr/bin/python3
- ansible_become: true
all:
hosts:
localhost:
diff --git a/roles/caption/tasks/aeneas.yml b/roles/caption/tasks/aeneas.yml
new file mode 100644
index 0000000..e280e7e
--- /dev/null
+++ b/roles/caption/tasks/aeneas.yml
@@ -0,0 +1,12 @@
+- name: Install packages
+ package:
+ name:
+ - espeak
+ - python3-espeak
+ - ffmpeg
+ - libespeak-dev
+- name: Install aeneas
+ ansible.builtin.pip:
+ name:
+ - numpy
+ - aeneas
diff --git a/roles/caption/tasks/main.yml b/roles/caption/tasks/main.yml
index 353b83b..3fa997c 100644
--- a/roles/caption/tasks/main.yml
+++ b/roles/caption/tasks/main.yml
@@ -17,6 +17,8 @@
- tqdm
- torchaudio
- num2words
+- name: Set up aeneas
+ include: aeneas.yml
- name: Create group
group:
name: "{{ emacsconf_group }}"
@@ -31,7 +33,7 @@
path: "{{ emacsconf_caption_dir }}"
state: directory
- name: Copy the script for processing the files
- tags: process-captions
+ tags: process-captions, wip
template:
src: process-captions.py
dest: "{{ emacsconf_caption_dir }}/process-captions.py"
@@ -63,9 +65,9 @@
group: "{{ emacsconf_group }}"
mode: "g+rwX"
recurse: true
-- name: Restart caption monitoring service
- become: true
- service:
- name: captions
- enabled: true
- state: started
+# - name: Restart caption monitoring service
+# become: true
+# service:
+# name: captions
+# enabled: true
+# state: started
diff --git a/roles/caption/templates/process-captions.py b/roles/caption/templates/process-captions.py
index b650bec..da99203 100755
--- a/roles/caption/templates/process-captions.py
+++ b/roles/caption/templates/process-captions.py
@@ -47,6 +47,7 @@ TRIM_AUDIO = False
MODEL = os.environ.get('MODEL', 'large') # Set to tiny for testing
WORK_DIR = "{{ emacsconf_caption_dir }}"
JSON_FILE = os.path.join(WORK_DIR, 'talks.json')
+DO_SRV2 = False
# ----------------------------------------------------------------
@@ -94,7 +95,7 @@ def get_files_to_work_on(directory):
else:
val['base'] = os.path.join(os.path.dirname(val['video'] or val['audio']),
base_name(val['video'] or val['audio']))
- if ALWAYS or (not 'vtt' in val or not 'srv2' in val):
+ if ALWAYS or (not 'vtt' in val or (DO_SRV2 and not 'srv2' in val)):
if not 'audio' in val and 'video' in val:
# No audio, need to convert it
val = extract_audio(val)
@@ -141,6 +142,8 @@ def generate_captions(work):
result = clean_up_timestamps(result)
with open(new_file, 'w') as vtt:
whisper.utils.write_vtt(result['segments'], file=vtt)
+ with open(work['base'] + '.txt')
+ whisper.utils.write_txt(result['segments'], file=txt)
work['vtt'] = new_file
if 'srv2' in work: del work['srv2']
return work
@@ -209,7 +212,7 @@ if len(needs_work) > 0:
if work['audio']:
if ALWAYS or not 'vtt' in work:
work = generate_captions(work)
- if ALWAYS or not 'srv2' in work:
+ if DO_SRV2 and (ALWAYS or not 'srv2' in work):
work = generate_srv2(work)
# print("Aligning words", audio_file, datetime.datetime.now())
# word_cuts = align_words(cuts)