dotfiles

My dotfiles for Arch Linux
git clone git://git.janispagel.de/dotfiles.git
Log | Files | Refs | README

mpv-youtube.bash (663B)


      1 #!/bin/env bash
      2 
      3 BOOKMARKS_PATH="$HOME/.local/share/bookmarks/bookmarks.html"
      4 CACHEFILE=$HOME/.cache/mpv-youtube.last
      5 LASTENTRY=`< $CACHEFILE`
      6 
      7 ENTRY=$(cat <(printf 'Last: %s\n\n' "$LASTENTRY") <(paste -d' ' <(pup -f $BOOKMARKS_PATH "dt a attr{adddate}") <(pup -f $BOOKMARKS_PATH "dt a text{}") <(pup -f $BOOKMARKS_PATH "dt a attr{href}") | egrep "https?://(www\.)?youtube\.(com|de)" | sort -r | cut -d' ' -f2-) | dmenu -p "YouTube Bookmarks:" -i -l 30)
      8 if [ -z "$ENTRY" ]; then
      9 	exit 0
     10 else
     11 	echo $ENTRY > $CACHEFILE
     12 fi
     13 LINK=$(echo $ENTRY | tr ' ' '\n' | tail -1)
     14 mpv --no-terminal --force-window --keep-open=yes --ytdl --no-osc --x11-name="mpv-youtube" "$LINK"