[Bin, Awesome] Add script to read YouTube videos in mpv
New script to read YouTube videos in mpv, with possibility to choose the video resolution Also add shortcut in Awesome to invoke this script
This commit is contained in:
parent
b9d4d6b180
commit
6519fa6793
@ -924,7 +924,8 @@ Most of these keybindings are available at root-level of Awesome and will be dec
|
||||
| u | modkey, meta | shell | rofi-umount | volume unmounting helper | rofi |
|
||||
| w | modkey, control | shell | wacom-setup | set up my wacom tablet | rofi |
|
||||
| w | modkey, shift | shell | rofi-wifi-menu | connect to available wifi | rofi |
|
||||
| y | modkey | shell | rofi-ytdl | download video from web | rofi |
|
||||
| y | modkey | shell | ytplay | play web video in mpv | rofi |
|
||||
| y | modkey, shift | shell | rofi-ytdl | download video from web | rofi |
|
||||
|
||||
** Awesome
|
||||
:PROPERTIES:
|
||||
|
@ -1268,6 +1268,40 @@ A quick and useful script I often use is a ~curl~ request to [[http://v2.wttr.in
|
||||
end
|
||||
#+END_SRC
|
||||
|
||||
* ytplay
|
||||
:PROPERTIES:
|
||||
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/ytplay
|
||||
:CUSTOM_ID: Weather-4ed00bb0
|
||||
:END:
|
||||
~ytplay~ is a simple script I’ve written that allows me to play in mpv any YouTube video at the desired resolution. The script relies on ~dmenu~ (or ~rofi~ in dmenu-mode), ~youtube-dl~ and of course ~mpv~ itself.
|
||||
#+BEGIN_SRC fish
|
||||
set URL (rofi -dmenu -i -p "Video URL")
|
||||
if test -n "$URL"
|
||||
set FORMAT \
|
||||
(youtube-dl --list-formats "$URL" | \
|
||||
egrep "webm.*[0-9]+x[0-9]+" | \
|
||||
awk '{print $3 " " $1}' | \
|
||||
sort -gu | \
|
||||
rofi -dmenu -i -p "Resolution" | \
|
||||
string split " ")
|
||||
set FCODE $FORMAT[2]
|
||||
mpv --ytdl-format=$FCODE "$URL"
|
||||
end
|
||||
#+END_SRC
|
||||
|
||||
I’ll even add a ~.desktop~ entry for this script:
|
||||
#+BEGIN_SRC conf-desktop :tangle ~/.local/share/applications/ytplay.desktop :mkdirp yes
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Version=1.0
|
||||
Name=ytplay (YouTube in mpv)
|
||||
Comment=Play YouTube videos in mpv
|
||||
Exec=/home/phundrak/.local/bin/ytplay
|
||||
Path=/home/phundrak/.local/bin
|
||||
Terminal=false
|
||||
Categories=Media
|
||||
#+END_SRC
|
||||
|
||||
* ytdl - a ~youtube-dl~ wrapper
|
||||
:PROPERTIES:
|
||||
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/ytdl
|
||||
|
Loading…
Reference in New Issue
Block a user