handy

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

elinksmediaswitch (791B)


      1 #!/bin/sh
      2 # If $1 contains youtube, mpv it, if imgur gallery, extract filenames and 
      3 # view in feh. If gfycat, extract filenames with sed and view in mpv.
      4 # elinks  https://github.com/alex-wellbelove/cli-media-viewer
      5 
      6 if [[ $1 =~ "youtu" ]]; then
      7     mpv --hwdec=vaapi --vo=opengl --ytdl-format="bestvideo[height<=?640]+bestaudio/best" "$1"
      8 elif [[ $1 =~ "gifv" ]]; then
      9     urxvt -e mpv "$1"
     10 elif [[ $1 =~ "imgur.com/a/" ]]; then
     11     urxvt -e feh `elinksalbumview $1` -Z -F --draw-filename
     12 elif [[ $1 =~ "imgur.com/gallery/" ]]; then
     13     urxvt -e feh `elinksalbumview $1` -Z -F --draw-filename
     14 elif [[ $1 =~ "imgur" ]]; then
     15     urxvt -e feh -. `fehparser $1`
     16 elif [[ $1 =~ "gfycat" ]]; then
     17     urxvt -e mpv `echo $1 |sed -e 's/gfycat/zippy.gfycat/g'`.webm
     18 else 
     19 	urxvt -e elinks "$1"
     20 fi
     21