diff --git a/group_vars/all b/group_vars/all index 214642c..b7251d6 100644 --- a/group_vars/all +++ b/group_vars/all @@ -78,6 +78,7 @@ browser_choices: - firefox -P work - firewarden chromium - tor-browser-en + - play - qcode passwordless_sudo: diff --git a/roles/mpv/files/play.sh b/roles/mpv/files/play.sh new file mode 100755 index 0000000..b95bb4f --- /dev/null +++ b/roles/mpv/files/play.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# Take advantage of mpv's youtube-dl integration to easily watch videos outside +# of the browser. Use sxhkd or xbindkeys to bind this script to a key. When +# you're on a YouTube page, copy the URL to your clipboardand and hit your key +# binding; the video will automatically begin streaming via mpv. +############################################################################### + +read -t 0 stdin + +if [ -n "$stdin" ]; then + source="$stdin" +elif [ -n "$1" ]; then + source="$1" +else + source=$(xclip -o -selection clipboard) +fi + +eval mpv "$source" diff --git a/roles/mpv/tasks/main.yml b/roles/mpv/tasks/main.yml index 3066d5c..a1f96a4 100644 --- a/roles/mpv/tasks/main.yml +++ b/roles/mpv/tasks/main.yml @@ -15,3 +15,6 @@ - activate firejail profiles tags: - firejail + +- name: Push play script + copy: src=play.sh dest=/usr/local/bin/play mode=0755