From c29f7c22df39e4099247e3edc7eec99a61177052 Mon Sep 17 00:00:00 2001 From: Pig Monkey Date: Fri, 15 Apr 2016 17:56:41 -0700 Subject: [PATCH] add play script for mpv + youtube-dl integration I recommend binding play to a key via sxhkd. Enjoy streaming video from anywhere, without allowing all the javascripts in your browser. --- group_vars/all | 1 + roles/mpv/files/play.sh | 19 +++++++++++++++++++ roles/mpv/tasks/main.yml | 3 +++ 3 files changed, 23 insertions(+) create mode 100755 roles/mpv/files/play.sh 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