If you use elfeed its nice to watch video entries in mpv without a side trip to the browser. Stolen from Prot somewhere or other.
(defun prot/elfeed-mpv-dwim ()
"Play entry link with external `mpv' program.
When there is an audio enclosure (podcast), play just the audio.
Else spawn a video player at a resolution that accounts for the
current monitor's width."
(interactive)
(let\* ((entry (if (eq major-mode 'elfeed-show-mode)
elfeed-show-entry
(elfeed-search-selected :ignore-region)))
(link (elfeed-entry-link entry))
(enclosure (elt (car (elfeed-entry-enclosures entry)) 0)) ; fragile?
(audio "")
;; Here the display width checks if I am on the laptop
(height (if (<= (display-pixel-width ) 1366) 720 1080))
(video (format "--ytdl-format=bestvideo[height<=?%s]+bestaudio/best" height))
;; (buf (pop-to-buffer "*elfeed-mpv-output*"))
)
(run-hooks 'prot/elfeed-mpv-hook)
(if enclosure ; make this its own parametrised function
(progn
(start-process "f fuckoff audio-mpv" nil "mpv" enclosure)
(message (concat "Launching MPV for " (propertize enclosure 'face 'success))))
(start-process "f fuckoff video-mpv" nil "mpv" video link)
(message (concat "Launching MPV for " (propertize link 'face 'success))))))
At one point I wrote script to prompt for a name if passed more than one argument and create a playlist and remember the last n playlists and regular files opened so you could in turn pull up this list and narrow with rofi but as of late I'm just adding videos to jellyfin.
Umpv is a script that emulates single instance mode whereby arguments are simply pushed to the existing players playlist instead of opening a new player.
https://github.com/jellyfin/jellyfin-mpv-shim
Other fun tricks
If you use jaro instead of xdg-open you can make video links automatically open in mpv while regular web links open in your browser of choice.
https://github.com/isamert/jaro
If you use elfeed its nice to watch video entries in mpv without a side trip to the browser. Stolen from Prot somewhere or other.
At one point I wrote script to prompt for a name if passed more than one argument and create a playlist and remember the last n playlists and regular files opened so you could in turn pull up this list and narrow with rofi but as of late I'm just adding videos to jellyfin.Umpv is a script that emulates single instance mode whereby arguments are simply pushed to the existing players playlist instead of opening a new player.
https://github.com/mpv-player/mpv/blob/master/TOOLS/umpv