summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2016-08-25 06:56:02 +0200
committerTharre <tharre3@gmail.com>2016-10-07 20:13:40 +0000
commit921665ddc86ac02d211ba55804b546d77b6ecd7a (patch)
tree0e5eaf258487f0d09d266fe936431f936d54aeb7
parentcacd76fca9d0cb6f664df2cc8e1427301ef964eb (diff)
downloaddotfiles-921665ddc86ac02d211ba55804b546d77b6ecd7a.tar.gz
dotfiles-921665ddc86ac02d211ba55804b546d77b6ecd7a.tar.xz
dotfiles-921665ddc86ac02d211ba55804b546d77b6ecd7a.zip
zsh: add play for playing music from youtube
-rw-r--r--shell/_zshrc13
1 files changed, 13 insertions, 0 deletions
diff --git a/shell/_zshrc b/shell/_zshrc
index 668e1c8..6de5049 100644
--- a/shell/_zshrc
+++ b/shell/_zshrc
@@ -108,6 +108,19 @@ function 256color_test {
done )
}
+# requires youtube-dl, mpv
+function play {
+ # Skip DASH manifest for speed purposes. This might actually disable
+ # being able to specify things like 'bestaudio' as the requested format,
+ # but try anyway.
+ # Use "$*" so that quoting the requested song isn't necessary.
+ mpv $(youtube-dl --default-search=ytsearch: \
+ --max-downloads 1 \
+ --youtube-skip-dash-manifest \
+ --format="bestaudio" \
+ -g "$*")
+}
+
# update
function update_dotfiles() {
dotfiles="$HOME/dotfiles"