summaryrefslogblamecommitdiffstats
path: root/roles/caption/templates/inotify-process-captions.sh
blob: ce5f4168559d145516aff8c9a4ff0c4d5f3e7106 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                                                                          
#!/bin/bash
# {{ ansible_managed }}

# This script waits for new webm and mov files
# in the current directory (recursively) and then calls
# process-captions to process all the new files that need work.
inotifywait -r -m "{{ emacsconf_caption_dir }}" -e create -e moved_to |
    while read directory action file; do
        if [[ "$file" =~ .*(webm|mov)$ ]]; then 
            "{{ emacsconf_caption_dir }}"/process-captions.py | tee -a "{{ emacsconf_caption_dir }}/captions.log"
        elif [[ "$file" =~ .*(vtt|srv2|ogg|opus)$ ]]; then
            # Copy to backstage area
            rsync --ignore-existing $directory/$file orga@media.emacsconf.org:/var/www/media.emacsconf.org/{{ emacsconf_year }}/backstage/
        fi
    done