dots

git clone git://mattcarlson.org/repos/dots.git
Log | Files | Refs

thumb.sh (1433B)


      1 #!/bin/sh
      2 #
      3 # thumb
      4 
      5 main() {
      6     youtube-dl -i --add-metadata                                                                                                                       \
      7     -f bestaudio/best -x                                                                                                                               \
      8     --embed-thumbnail                                                                                                                                  \
      9     --convert-thumbnails png                                                                                                                           \
     10     --exec-before-download "ffmpeg -i %(thumbnails.-1.filepath)q -vf crop=\"'if(gt(ih,iw),iw,ih)':'if(gt(iw,ih),ih,iw)'\" _%(thumbnails.-1.filepath)q" \
     11     --exec-before-download "rm %(thumbnails.-1.filepath)q"                                                                                             \
     12     --exec-before-download "mv _%(thumbnails.-1.filepath)q %(thumbnails.-1.filepath)q"                                                                 \
     13     -o "%(playlist_index)s-%(title)s.%(ext)s"                                                                                                          \
     14     -k                                                                                                                                                 \
     15     "${@}"
     16 }
     17 
     18 main "${@}"