From c21242a13f1cf0989c220ec8256305c85f0f6bcc Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Wed, 4 Feb 2026 18:46:31 +0100 Subject: Add mpv role w/testing --- roles/mpv/files/input.conf | 228 ++++++++++++++++++++++++++++++++++ roles/mpv/files/mpv.conf | 20 +++ roles/mpv/meta/argument_specs.yml | 6 + roles/mpv/meta/main.yml | 11 ++ roles/mpv/tasks/install-archlinux.yml | 6 + roles/mpv/tasks/main.yml | 24 ++++ 6 files changed, 295 insertions(+) create mode 100644 roles/mpv/files/input.conf create mode 100644 roles/mpv/files/mpv.conf create mode 100644 roles/mpv/meta/argument_specs.yml create mode 100644 roles/mpv/meta/main.yml create mode 100644 roles/mpv/tasks/install-archlinux.yml create mode 100644 roles/mpv/tasks/main.yml (limited to 'roles/mpv') diff --git a/roles/mpv/files/input.conf b/roles/mpv/files/input.conf new file mode 100644 index 00000000..1f20ef56 --- /dev/null +++ b/roles/mpv/files/input.conf @@ -0,0 +1,228 @@ +# Ref: /usr/share/doc/mpv/input.conf +# If this is enabled, treat all the following bindings as default. +default-bindings start + +# Mouse button configurations +MBTN_LEFT ignore +MBTN_LEFT_DBL cycle fullscreen # toggle fullscreen +MBTN_RIGHT cycle pause # toggle pause/playback mode +MBTN_BACK ignore +MBTN_FORWARD ignore +Ctrl+MBTN_LEFT ignore + +# Mouse wheels, touchpad configurations +WHEEL_UP add volume 2 +WHEEL_DOWN add volume -2 +WHEEL_LEFT ignore +WHEEL_RIGHT ignore + +# Arrow configurations +RIGHT seek 5 # seek 5 seconds forward +LEFT seek -5 # seek 5 seconds backward +UP seek 60 # seek 1 minute forward +DOWN seek -60 # seek 1 minute backward + +# Other configurations +q quit # exit +ctrl+w quit # exit +Q quit-watch-later # exit and remember the playback position + +ESC set fullscreen no # leave fullscreen +SPACE cycle pause # toggle pause/playback mode +o show-progress # show playback progress +A cycle-values video-aspect-override "16:9" "4:3" "2.35:1" "no" # cycle the video aspect ratio +E cycle edition # switch edition +ctrl+h cycle-values hwdec "no" "auto" # toggle hardware decoding + +POWER quit +PLAY cycle pause # toggle pause/playback mode +PAUSE cycle pause # toggle pause/playback mode +PLAYPAUSE cycle pause # toggle pause/playback mode +PLAYONLY set pause no # unpause +PAUSEONLY set pause yes # pause +STOP quit +FORWARD seek 60 # seek 1 minute forward +REWIND seek -60 # seek 1 minute backward +NEXT playlist-next # skip to the next file +PREV playlist-prev # skip to the previous file +VOLUME_UP add volume 2 +VOLUME_DOWN add volume -2 +MUTE cycle mute # toggle mute + +# Subtitle control +Shift+RIGHT add sub-delay -0.1 # shift subtitles 100 ms earlier +Shift+LEFT add sub-delay +0.1 # delay subtitles by 100 ms +Shift+UP add sub-scale +0.1 # increase the subtitle font size +Shift+DOWN add sub-scale -0.1 # decrease the subtitle font size +v cycle sub-visibility # hide or show the subtitles +k add sub-pos -1 # move subtitles up +j add sub-pos +1 # move subtitles down +r ignore +R ignore +t ignore +z ignore +x ignore +Z ignore + +# Audio control +Ctrl+RIGHT add audio-delay 0.100 # change audio/video sync by delaying the audio +Ctrl+LEFT add audio-delay -0.100 # change audio/video sync by shifting the audio earlier +Ctrl+UP add volume 2 # change audio/video sync by delaying the audio +Ctrl+DOWN add volume -2 # change audio/video sync by shifting the audio earlier +m cycle mute # toggle mute + +ctrl++ ignore +ctrl+- ignore +ctrl+KP_ADD ignore +ctrl+KP_SUBTRACT ignore + +# Screenshot control +s screenshot # take a screenshot of the video in its original resolution with subtitles +S screenshot video # take a screenshot of the video in its original resolution without subtitles +Ctrl+s screenshot window # take a screenshot of the window with OSD and subtitles +Alt+s screenshot each-frame # automatically screenshot every frame; issue this command again to stop taking screenshots + +# Disabled configurations +Ctrl+Shift+LEFT ignore +Ctrl+Shift+RIGHT ignore +Alt+left ignore +Alt+right ignore +Alt+up ignore +Alt+down ignore +Alt++ ignore +ZOOMIN ignore +Alt+- ignore +ZOOMOUT ignore +Alt+KP_ADD ignore +Alt+KP_SUBTRACT ignore +Ctrl+WHEEL_UP ignore +Ctrl+WHEEL_DOWN ignore +Alt+BS ignore +HOME ignore +PGUP ignore +PGDWN ignore +Shift+PGUP ignore +Shift+PGDWN ignore +[ ignore +] ignore +{ ignore +} ignore +BS ignore +Shift+BS ignore +Shift+Ctrl+BS ignore +p ignore +. ignore +, ignore +> ignore +< ignore +ENTER ignore +Shift+HOME ignore +Shift+END ignore +O ignore +P ignore +i ignore +I ignore +? ignore +` ignore +9 ignore +/ ignore +KP_DIVIDE ignore +0 ignore +* ignore +KP_MULTIPLY ignore +1 ignore +2 ignore +3 ignore +4 ignore +5 ignore +6 ignore +7 ignore +8 ignore +Alt+0 ignore +Alt+1 ignore +Alt+2 ignore +b ignore +d ignore +Alt+v ignore +V ignore +u ignore +#j remapped +J ignore +SHARP ignore +_ ignore +T ignore +f ignore +w ignore +W ignore +e ignore +l ignore +L ignore +ctrl+c ignore +Ctrl+v ignore +DEL ignore +F8 ignore +F9 ignore +g ignore +g-p ignore +g-s ignore +g-S ignore +g-a ignore +g-v ignore +g-t ignore +g-c ignore +g-e ignore +g-l ignore +g-d ignore +g-h ignore +g-w ignore +g-b ignore +g-r ignore +g-m ignore +MENU ignore +ctrl+p ignore + +Alt+KP1 ignore +Alt+KP5 ignore +Alt+KP3 ignore + +KP1 ignore +KP2 ignore +KP4 ignore +KP5 ignore +KP6 ignore +KP8 ignore +KP9 ignore + +Ctrl+KP1 ignore +Ctrl+KP2 ignore +Ctrl+KP3 ignore +Ctrl+KP4 ignore +Ctrl+KP5 ignore +Ctrl+KP6 ignore +Ctrl+KP7 ignore +Ctrl+KP8 ignore +Ctrl+KP9 ignore + +Ctrl+KP_END ignore +Ctrl+KP_DOWN ignore +Ctrl+KP_PGDWN ignore +Ctrl+KP_LEFT ignore +Ctrl+KP_BEGIN ignore +Ctrl+KP_RIGHT ignore +Ctrl+KP_HOME ignore +Ctrl+KP_UP ignore +Ctrl+KP_PGUP ignore + +# +# Legacy bindings (may or may not be removed in the future) +# +! ignore +@ ignore + +# +# Not assigned by default +# (not an exhaustive list of unbound commands) +# + +# ? cycle sub-forced-events-only # display only DVD/PGS forced subtitle events +# ? stop # stop playback (quit or enter idle mode) diff --git a/roles/mpv/files/mpv.conf b/roles/mpv/files/mpv.conf new file mode 100644 index 00000000..8787c760 --- /dev/null +++ b/roles/mpv/files/mpv.conf @@ -0,0 +1,20 @@ +# Ref: /usr/share/doc/mpv/mpv.conf +# Specify high quality video rendering preset (for --vo= only) +# Offers superior image fidelity and visual quality for an enhanced viewing +# experience on capable hardware +profile=high-quality + +# Subtitle Size +sub-font-size=48 + +# Enable fuzzy searching +sub-auto=fuzzy + +# Bold the subtitles to increase readability +# sub-bold=yes + +# Subtitle language order +slang=en,ar,de + +# Audio language order (if available) +alang=en,ar,de diff --git a/roles/mpv/meta/argument_specs.yml b/roles/mpv/meta/argument_specs.yml new file mode 100644 index 00000000..2705194d --- /dev/null +++ b/roles/mpv/meta/argument_specs.yml @@ -0,0 +1,6 @@ +--- +argument_specs: + main: + short_description: "Install mpv on Linux distribution" + description: "Install mpv on Linux distribution" + options: {} diff --git a/roles/mpv/meta/main.yml b/roles/mpv/meta/main.yml new file mode 100644 index 00000000..dc60c4b3 --- /dev/null +++ b/roles/mpv/meta/main.yml @@ -0,0 +1,11 @@ +--- +dependencies: [] +galaxy_info: + author: "a14m" + description: "Install mpv" + license: "MIT" + min_ansible_version: "2.18" + platforms: + - name: "ArchLinux" + versions: + - "all" diff --git a/roles/mpv/tasks/install-archlinux.yml b/roles/mpv/tasks/install-archlinux.yml new file mode 100644 index 00000000..0f7fd761 --- /dev/null +++ b/roles/mpv/tasks/install-archlinux.yml @@ -0,0 +1,6 @@ +--- +- name: "Ensure mpv is installed" + become: true + ansible.builtin.package: + name: "mpv" + state: "present" diff --git a/roles/mpv/tasks/main.yml b/roles/mpv/tasks/main.yml new file mode 100644 index 00000000..77e42d6f --- /dev/null +++ b/roles/mpv/tasks/main.yml @@ -0,0 +1,24 @@ +--- +- name: "Include OS-specific tasks" + ansible.builtin.include_tasks: "install-{{ ansible_facts['os_family'] | lower }}.yml" + +- name: "Create config directories" + become: true + ansible.builtin.file: + path: "{{ item }}" + state: "directory" + mode: "0755" + loop: + - "/etc/mpv" + +- name: "Configure system defaults" + become: true + ansible.builtin.copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + mode: "0644" + loop: + - src: "mpv.conf" + dest: "/etc/mpv/mpv.conf" + - src: "input.conf" + dest: "/etc/mpv/input.conf" -- cgit v1.2.3