From 921665ddc86ac02d211ba55804b546d77b6ecd7a Mon Sep 17 00:00:00 2001 From: Tharre Date: Thu, 25 Aug 2016 06:56:02 +0200 Subject: zsh: add play for playing music from youtube --- shell/_zshrc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'shell') 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" -- cgit v1.2.3-70-g09d2