From d33a5923c335332f7401826e01eb2033af717a76 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sat, 5 Nov 2022 07:55:34 -0400 Subject: Publishing and streaming --- roles/obs/overlay.svg | 28 +- roles/obs/tasks/emacs.yml | 39 +++ roles/obs/tasks/main.yml | 13 +- roles/obs/tasks/obs-setup.yml | 6 +- roles/obs/tasks/track.yml | 5 +- roles/obs/tasks/user.yml | 1 - roles/obs/templates/emacsconf-stream-config.el | 13 + roles/obs/templates/mpv.conf | 6 +- roles/obs/templates/scenes.json | 433 ++++--------------------- 9 files changed, 146 insertions(+), 398 deletions(-) create mode 100644 roles/obs/tasks/emacs.yml create mode 100644 roles/obs/templates/emacsconf-stream-config.el (limited to 'roles/obs') diff --git a/roles/obs/overlay.svg b/roles/obs/overlay.svg index 13e1b03..b3314f6 100644 --- a/roles/obs/overlay.svg +++ b/roles/obs/overlay.svg @@ -27,18 +27,18 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:zoom="0.62998576" - inkscape:cx="543.66308" - inkscape:cy="369.05596" + inkscape:cx="129.368" + inkscape:cy="373.81797" inkscape:document-units="in" inkscape:current-layer="layer1" inkscape:document-rotation="0" showgrid="false" units="in" - inkscape:window-width="1366" + inkscape:window-width="699" inkscape:window-height="709" - inkscape:window-x="0" + inkscape:window-x="667" inkscape:window-y="0" - inkscape:window-maximized="1" + inkscape:window-maximized="0" inkscape:showpageshadow="0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" />Initializing...Initializing...Initializing... diff --git a/roles/obs/tasks/emacs.yml b/roles/obs/tasks/emacs.yml new file mode 100644 index 0000000..0b013b3 --- /dev/null +++ b/roles/obs/tasks/emacs.yml @@ -0,0 +1,39 @@ +- name: Check out emacsconf-el + ansible.builtin.git: + repo: https://git.emacsconf.org/emacsconf-el + dest: "~{{ emacsconf_user }}/emacsconf-el" + register: elisp + failed_when: + - elisp.failed + - not 'Local modifications exist in repository' in elisp.msg + - not 'Failed to checkout branch' in elisp.msg + debugger: on_failed +- name: Install Emacs packages + become_user: "{{ emacsconf_user }}" + shell: | + emacs --batch --exec "(progn (require 'package) + (let ((packages (seq-remove #'package-installed-p '({% for package in packages %}{{ package }} {% endfor %})))) + (when packages + (package-refresh-contents) + (mapc #'package-install packages))))" + vars: + packages: + - modus-themes + - vertico + - orderless +- name: Set up Emacs configuration for interactive editing + template: + src: emacsconf-stream-config.el + dest: "{{ emacs_config_dir }}/emacsconf-stream-config.el" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" +- name: Add to Emacs configuration + lineinfile: + dest: "{{ emacs_config_dir }}/init.el" + state: present + regexp: "emacsconf-stream-config" + line: "(load-file \"{{ emacs_config_dir }}/emacsconf-stream-config.el\")" + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + create: yes + diff --git a/roles/obs/tasks/main.yml b/roles/obs/tasks/main.yml index bf856ec..8c1e059 100644 --- a/roles/obs/tasks/main.yml +++ b/roles/obs/tasks/main.yml @@ -11,6 +11,7 @@ name: - xserver-xorg-video-dummy - i3 + - inkscape # OBS overlaying PNG is prettier than SVG - socat - ffmpeg - pulseaudio @@ -54,7 +55,6 @@ replace: \1 {{ emacsconf_id }}-{{ item.id }} loop: "{{ emacsconf_tracks }}" - name: Allow sudo from {{ emacsconf_user }} to the stream users - tags: wip become: true become_user: root copy: @@ -63,3 +63,14 @@ {{ emacsconf_user }} ALL=({{ emacsconf_id }}-{{ item.id }}) NOPASSWD: ALL {% endfor %} dest: /etc/sudoers.d/50_emacsconf +- name: Create directories + file: + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + path: "{{ item }}" + state: directory + mode: 0775 + loop: + - /data/{{ emacsconf_id }}/stream + - /data/{{ emacsconf_id }}/overlays + diff --git a/roles/obs/tasks/obs-setup.yml b/roles/obs/tasks/obs-setup.yml index 59170f1..911f609 100644 --- a/roles/obs/tasks/obs-setup.yml +++ b/roles/obs/tasks/obs-setup.yml @@ -32,19 +32,21 @@ group: "{{ emacsconf_group }}" dest: "~{{ emacsconf_user }}/.config/obs-studio/basic/scenes/{{ item.id }}.json" - name: Copy overlay template for video - tags: obs-scene + tags: obs-scene, wip copy: src: overlay.svg dest: "~{{ emacsconf_user }}/video.svg" owner: "{{ emacsconf_user }}" group: "{{ emacsconf_group }}" + mode: 0664 - name: Copy overlay template for video - tags: obs-scene + tags: obs-scene, wip copy: src: overlay.svg dest: "~{{ emacsconf_user }}/other.svg" owner: "{{ emacsconf_user }}" group: "{{ emacsconf_group }}" + mode: 0664 - name: Create text files for OBS sources copy: content: "Initializing..." diff --git a/roles/obs/tasks/track.yml b/roles/obs/tasks/track.yml index a0acf16..14533df 100644 --- a/roles/obs/tasks/track.yml +++ b/roles/obs/tasks/track.yml @@ -27,7 +27,7 @@ group: "{{ emacsconf_group }}" state: directory - name: Add MPV profile - tags: mpv-conf + tags: mpv-conf, wip template: src: mpv.conf dest: "~{{ emacsconf_user }}/.config/mpv/mpv.conf" @@ -79,6 +79,9 @@ dest: "~{{ emacsconf_user }}/.config/i3/config" owner: "{{ emacsconf_user }}" group: "{{ emacsconf_group }}" + - name: Set up Emacs configuration + tags: wip + include: emacs.yml - name: Reset vars tags: obs-scene, obs-profile, mpv, wip set_fact: diff --git a/roles/obs/tasks/user.yml b/roles/obs/tasks/user.yml index caaf2d9..fae7d9f 100644 --- a/roles/obs/tasks/user.yml +++ b/roles/obs/tasks/user.yml @@ -14,7 +14,6 @@ state: directory mode: 700 - name: Set up SSH key access - tags: wip template: src: authorized_keys dest: "/home/{{ emacsconf_user }}/.ssh/authorized_keys" diff --git a/roles/obs/templates/emacsconf-stream-config.el b/roles/obs/templates/emacsconf-stream-config.el new file mode 100644 index 0000000..8770d60 --- /dev/null +++ b/roles/obs/templates/emacsconf-stream-config.el @@ -0,0 +1,13 @@ +;; {{ ansible_managed }} + +;; Configuration +(vertico-mode) +(fset 'yes-or-no-p 'y-or-n-p) +(modus-themes-load-vivendi) +(org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (shell . t))) +(setq backup-directory-alist '(("." . "~/.emacs.d/backups"))) +(setq completion-styles '(orderless)) +(setq completion-category-defaults nil) +(setq completion-category-overrides '((file (styles orderless)))) + + diff --git a/roles/obs/templates/mpv.conf b/roles/obs/templates/mpv.conf index b1bd1ca..dce6481 100644 --- a/roles/obs/templates/mpv.conf +++ b/roles/obs/templates/mpv.conf @@ -14,15 +14,15 @@ video-align-y=-1 sub-use-margins=yes sub-scale-by-window=yes sub-pos=103 -sub-margin-x=120 -sub-margin-y=20 +sub-margin-x=105 +sub-margin-y=60 sub-align-x=left # Style sub-font="{{ emacsconf_font }}" sub-color="1/0.82/0" sub-blur=0.2 sub-scale=0.9 -sub-font-size=40 +sub-font-size=30 sub-border-size=0 sub-border-color=0/1 sub-shadow-color=0/1 diff --git a/roles/obs/templates/scenes.json b/roles/obs/templates/scenes.json index a92f29e..6d8e7ad 100644 --- a/roles/obs/templates/scenes.json +++ b/roles/obs/templates/scenes.json @@ -2,159 +2,10 @@ "current_program_scene": "Video audio and screen", "current_scene": "Video audio and screen", "current_transition": "Fade", - "groups": [ - { - "balance": 0.5, - "deinterlace_field_order": 0, - "deinterlace_mode": 0, - "enabled": true, - "flags": 0, - "hotkeys": { - "libobs.hide_scene_item.Logo": [], - "libobs.hide_scene_item.News": [], - "libobs.hide_scene_item.URL": [], - "libobs.show_scene_item.Logo": [], - "libobs.show_scene_item.News": [], - "libobs.show_scene_item.URL": [] - }, - "id": "group", - "mixers": 0, - "monitoring_type": 0, - "muted": false, - "name": "{{ emacsconf_id }} base", - "prev_ver": 469762051, - "private_settings": {}, - "push-to-mute": false, - "push-to-mute-delay": 0, - "push-to-talk": false, - "push-to-talk-delay": 0, - "settings": { - "custom_size": true, - "cx": 494, - "cy": 715, - "id_counter": 0, - "items": [ - { - "align": 5, - "blend_method": "default", - "blend_type": "normal", - "bounds": { - "x": 0, - "y": 0 - }, - "bounds_align": 0, - "bounds_type": 0, - "crop_bottom": 0, - "crop_left": 0, - "crop_right": 0, - "crop_top": 0, - "group_item_backup": false, - "hide_transition": { - "duration": 0 - }, - "id": 8, - "locked": false, - "name": "News", - "pos": { - "x": 12, - "y": 0 - }, - "private_settings": {}, - "rot": 0, - "scale": { - "x": 1, - "y": 1 - }, - "scale_filter": "disable", - "show_transition": { - "duration": 0 - }, - "visible": true - }, - { - "align": 5, - "blend_method": "default", - "blend_type": "normal", - "bounds": { - "x": 0, - "y": 0 - }, - "bounds_align": 0, - "bounds_type": 0, - "crop_bottom": 0, - "crop_left": 0, - "crop_right": 0, - "crop_top": 0, - "group_item_backup": false, - "hide_transition": { - "duration": 0 - }, - "id": 7, - "locked": false, - "name": "URL", - "pos": { - "x": 114, - "y": 691 - }, - "private_settings": {}, - "rot": 0, - "scale": { - "x": 1, - "y": 1 - }, - "scale_filter": "disable", - "show_transition": { - "duration": 0 - }, - "visible": true - }, - { - "align": 5, - "blend_method": "default", - "blend_type": "normal", - "bounds": { - "x": 0, - "y": 0 - }, - "bounds_align": 0, - "bounds_type": 0, - "crop_bottom": 0, - "crop_left": 0, - "crop_right": 0, - "crop_top": 0, - "group_item_backup": false, - "hide_transition": { - "duration": 0 - }, - "id": 6, - "locked": false, - "name": "Logo", - "pos": { - "x": 0, - "y": 603 - }, - "private_settings": {}, - "rot": 0, - "scale": { - "x": 0.40234375, - "y": 0.40234375 - }, - "scale_filter": "disable", - "show_transition": { - "duration": 0 - }, - "visible": true - } - ] - }, - "sync": 0, - "versioned_id": "group", - "volume": 1 - } - ], + "groups": [], "modules": { "auto-scene-switcher": { - "active": false, + "active": true, "interval": 300, "non_matching_scene": "All track audio and screen", "switch_if_not_matching": true, @@ -236,8 +87,6 @@ "push-to-talk": false, "push-to-talk-delay": 0, "settings": { - "color2": 4294967295, - "drop_shadow": false, "font": { "face": "Sans Serif", "flags": 0, @@ -259,11 +108,11 @@ "enabled": true, "flags": 0, "hotkeys": {}, - "id": "text_ft2_source", + "id": "image_source", "mixers": 0, "monitoring_type": 0, "muted": false, - "name": "URL", + "name": "Other overlay", "prev_ver": 469762051, "private_settings": {}, "push-to-mute": false, @@ -271,17 +120,10 @@ "push-to-talk": false, "push-to-talk-delay": 0, "settings": { - "font": { - "face": "Sans Serif", - "flags": 0, - "size": 20, - "style": "" - }, - "from_file": true, - "text_file": "/home/{{ emacsconf_id }}-{{ item.id }}/url.txt" + "file": "/home/{{ emacsconf_id }}-{{ item.id }}/other.svg" }, "sync": 0, - "versioned_id": "text_ft2_source_v2", + "versioned_id": "image_source", "volume": 1 }, { @@ -295,7 +137,7 @@ "mixers": 0, "monitoring_type": 0, "muted": false, - "name": "Logo", + "name": "Video", "prev_ver": 469762051, "private_settings": {}, "push-to-mute": false, @@ -303,7 +145,32 @@ "push-to-talk": false, "push-to-talk-delay": 0, "settings": { - "file": "/home/{{ emacsconf_id }}-{{ item.id }}/logo.png" + "file": "/home/{{ emacsconf_id }}-{{ item.id }}/video.svg" + }, + "sync": 0, + "versioned_id": "image_source", + "volume": 1 + }, + { + "balance": 0.5, + "deinterlace_field_order": 0, + "deinterlace_mode": 0, + "enabled": true, + "flags": 0, + "hotkeys": {}, + "id": "image_source", + "mixers": 0, + "monitoring_type": 0, + "muted": false, + "name": "Video overlay", + "prev_ver": 469762051, + "private_settings": {}, + "push-to-mute": false, + "push-to-mute-delay": 0, + "push-to-talk": false, + "push-to-talk-delay": 0, + "settings": { + "file": "/home/{{ emacsconf_id }}-{{ item.id }}/video.png" }, "sync": 0, "versioned_id": "image_source", @@ -347,14 +214,14 @@ "flags": 0, "hotkeys": { "OBSBasic.SelectScene": [], - "libobs.hide_scene_item.Bottom": [], + "libobs.hide_scene_item.News": [], + "libobs.hide_scene_item.Other overlay": [], "libobs.hide_scene_item.Screen Capture (XSHM)": [], - "libobs.hide_scene_item.emacsconf base": [], "libobs.hide_scene_item.gen-qa": [], "libobs.hide_scene_item.gen-vid": [], - "libobs.show_scene_item.Bottom": [], + "libobs.show_scene_item.News": [], + "libobs.show_scene_item.Other overlay": [], "libobs.show_scene_item.Screen Capture (XSHM)": [], - "libobs.show_scene_item.emacsconf base": [], "libobs.show_scene_item.gen-qa": [], "libobs.show_scene_item.gen-vid": [] }, @@ -371,7 +238,7 @@ "push-to-talk-delay": 0, "settings": { "custom_size": false, - "id_counter": 22, + "id_counter": 24, "items": [ { "align": 5, @@ -498,54 +365,17 @@ "crop_left": 0, "crop_right": 0, "crop_top": 0, - "group_item_backup": true, + "group_item_backup": false, "hide_transition": { "duration": 0 }, - "id": 8, + "id": 23, "locked": false, - "name": "News", + "name": "Other overlay", "pos": { - "x": 21, - "y": 6 - }, - "private_settings": {}, - "rot": 0, - "scale": { - "x": 1, - "y": 1 - }, - "scale_filter": "disable", - "show_transition": { - "duration": 0 - }, - "visible": true - }, - { - "align": 5, - "blend_method": "default", - "blend_type": "normal", - "bounds": { "x": 0, "y": 0 }, - "bounds_align": 0, - "bounds_type": 0, - "crop_bottom": 0, - "crop_left": 0, - "crop_right": 0, - "crop_top": 0, - "group_item_backup": true, - "hide_transition": { - "duration": 0 - }, - "id": 7, - "locked": false, - "name": "URL", - "pos": { - "x": 123, - "y": 697 - }, "private_settings": {}, "rot": 0, "scale": { @@ -558,43 +388,6 @@ }, "visible": true }, - { - "align": 5, - "blend_method": "default", - "blend_type": "normal", - "bounds": { - "x": 0, - "y": 0 - }, - "bounds_align": 0, - "bounds_type": 0, - "crop_bottom": 0, - "crop_left": 0, - "crop_right": 0, - "crop_top": 0, - "group_item_backup": true, - "hide_transition": { - "duration": 0 - }, - "id": 6, - "locked": false, - "name": "Logo", - "pos": { - "x": 9, - "y": 609 - }, - "private_settings": {}, - "rot": 0, - "scale": { - "x": 0.40234375, - "y": 0.40234375 - }, - "scale_filter": "disable", - "show_transition": { - "duration": 0 - }, - "visible": true - }, { "align": 5, "blend_method": "default", @@ -613,50 +406,13 @@ "hide_transition": { "duration": 0 }, - "id": 21, + "id": 24, "locked": false, - "name": "{{ emacsconf_id }} base", + "name": "News", "pos": { - "x": 9, - "y": 6 - }, - "private_settings": {}, - "rot": 0, - "scale": { - "x": 1, - "y": 1 - }, - "scale_filter": "disable", - "show_transition": { - "duration": 0 - }, - "visible": true - }, - { - "align": 5, - "blend_method": "default", - "blend_type": "normal", - "bounds": { "x": 0, "y": 0 }, - "bounds_align": 0, - "bounds_type": 0, - "crop_bottom": 0, - "crop_left": 0, - "crop_right": 0, - "crop_top": 0, - "group_item_backup": false, - "hide_transition": { - "duration": 0 - }, - "id": 22, - "locked": false, - "name": "Bottom", - "pos": { - "x": 112, - "y": 654 - }, "private_settings": {}, "rot": 0, "scale": { @@ -736,11 +492,15 @@ "flags": 0, "hotkeys": { "OBSBasic.SelectScene": [], + "libobs.hide_scene_item.News": [], "libobs.hide_scene_item.Screen Capture (XSHM)": [], - "libobs.hide_scene_item.emacsconf base": [], + "libobs.hide_scene_item.Video": [], + "libobs.hide_scene_item.Video overlay": [], "libobs.hide_scene_item.gen-vid": [], + "libobs.show_scene_item.News": [], "libobs.show_scene_item.Screen Capture (XSHM)": [], - "libobs.show_scene_item.emacsconf base": [], + "libobs.show_scene_item.Video": [], + "libobs.show_scene_item.Video overlay": [], "libobs.show_scene_item.gen-vid": [] }, "id": "scene", @@ -756,7 +516,7 @@ "push-to-talk-delay": 0, "settings": { "custom_size": false, - "id_counter": 11, + "id_counter": 14, "items": [ { "align": 5, @@ -846,54 +606,17 @@ "crop_left": 0, "crop_right": 0, "crop_top": 0, - "group_item_backup": true, + "group_item_backup": false, "hide_transition": { "duration": 0 }, - "id": 8, + "id": 12, "locked": false, - "name": "News", + "name": "Video overlay", "pos": { - "x": 12, - "y": 0 - }, - "private_settings": {}, - "rot": 0, - "scale": { - "x": 1, - "y": 1 - }, - "scale_filter": "disable", - "show_transition": { - "duration": 0 - }, - "visible": true - }, - { - "align": 5, - "blend_method": "default", - "blend_type": "normal", - "bounds": { "x": 0, "y": 0 }, - "bounds_align": 0, - "bounds_type": 0, - "crop_bottom": 0, - "crop_left": 0, - "crop_right": 0, - "crop_top": 0, - "group_item_backup": true, - "hide_transition": { - "duration": 0 - }, - "id": 7, - "locked": false, - "name": "URL", - "pos": { - "x": 114, - "y": 691 - }, "private_settings": {}, "rot": 0, "scale": { @@ -904,7 +627,7 @@ "show_transition": { "duration": 0 }, - "visible": true + "visible": false }, { "align": 5, @@ -920,22 +643,22 @@ "crop_left": 0, "crop_right": 0, "crop_top": 0, - "group_item_backup": true, + "group_item_backup": false, "hide_transition": { "duration": 0 }, - "id": 6, + "id": 13, "locked": false, - "name": "Logo", + "name": "Video", "pos": { "x": 0, - "y": 603 + "y": 0 }, "private_settings": {}, "rot": 0, "scale": { - "x": 0.40234375, - "y": 0.40234375 + "x": 1, + "y": 1 }, "scale_filter": "disable", "show_transition": { @@ -961,9 +684,9 @@ "hide_transition": { "duration": 0 }, - "id": 11, + "id": 14, "locked": false, - "name": "{{ emacsconf_id }} base", + "name": "News", "pos": { "x": 0, "y": 0 @@ -985,38 +708,6 @@ "sync": 0, "versioned_id": "scene", "volume": 1 - }, - { - "balance": 0.5, - "deinterlace_field_order": 0, - "deinterlace_mode": 0, - "enabled": true, - "flags": 0, - "hotkeys": {}, - "id": "text_ft2_source", - "mixers": 0, - "monitoring_type": 0, - "muted": false, - "name": "Bottom", - "prev_ver": 469762051, - "private_settings": {}, - "push-to-mute": false, - "push-to-mute-delay": 0, - "push-to-talk": false, - "push-to-talk-delay": 0, - "settings": { - "font": { - "face": "Sans Serif", - "flags": 0, - "size": 28, - "style": "" - }, - "from_file": true, - "text_file": "/home/{{ emacsconf_id }}-{{ item.id }}/bottom.txt" - }, - "sync": 0, - "versioned_id": "text_ft2_source_v2", - "volume": 1 } ], "transition_duration": 300, -- cgit v1.2.3