dotfiles

beau's configuration files
git clone https://git.beauhilton.com/dotfiles.git
Log | Files | Refs | README

mailcap (3541B)


      1 # Example mailcap file for Terminal UI for Reddit
      2 # https://gitlab.com/ajak/tuir/
      3 #
      4 # Copy the contents of this file to {HOME}/.mailcap, or point to it using $MAILCAPS
      5 # Then launch TUIR using the --enable-media flag. All shell commands defined in
      6 # this file depend on external programs that must be installed on your system.
      7 #
      8 # HELP REQUESTED! If you come up with your own commands (especially for OS X)
      9 # and would like to share, please post an issue on the GitHub tracker and we
     10 # can get them added to this file as references.
     11 #
     12 #
     13 #                              Mailcap 101
     14 # - The first entry with a matching MIME type will be executed, * is a wildcard
     15 # - %s will be replaced with the image or video url
     16 # - Add ``test=test -n "$DISPLAY"`` if your command opens a new window
     17 # - Add ``needsterminal`` for commands that use the terminal
     18 # - Add ``copiousoutput`` for commands that dump text to stdout
     19 
     20 ###############################################################################
     21 # Commands below this point will open media in a separate window without
     22 # pausing execution of TUIR.
     23 ###############################################################################
     24 
     25 # Feh is a simple and effective image viewer
     26 # Note that tuir returns a list of urls for imgur albums, so we don't put quotes
     27 # around the `%s`
     28 image/x-imgur-album; feh -g 640x480  -. %s; test=test -n "$DISPLAY"
     29 image/gif; mpv '%s' --autofit 640x480 --loop=inf; test=test -n "$DISPLAY"
     30 image/*; feh -g 640x480 -. '%s'; test=test -n "$DISPLAY"
     31 
     32 # Youtube videos are assigned a custom mime-type, which can be streamed with
     33 # vlc or youtube-dl.
     34 video/x-youtube; vlc '%s' --width 640 --height 480; test=test -n "$DISPLAY"
     35 video/x-youtube; mpv --ytdl-format=bestvideo+bestaudio/best '%s' --autofit 640x480; test=test -n "$DISPLAY"
     36 
     37 # Mpv is a simple and effective video streamer
     38 video/*; mpv '%s' --autofit 640x480 --loop=inf; test=test -n "$DISPLAY"
     39 
     40 ###############################################################################
     41 # Commands below this point will attempt to display media directly in the
     42 # terminal when a desktop is not available (e.g. inside of an SSH session)
     43 ###############################################################################
     44 
     45 # View images directly in your terminal with iTerm2
     46 # curl -L https://iterm2.com/misc/install_shell_integration_and_utilities.sh | bash
     47 # image/*; bash -c '[[ "%s" == http*  ]] && (curl -s %s | ~/.iterm2/imgcat) || ~/.iterm2/imgcat %s' && read -n 1; needsterminal
     48 
     49 # View true images in the terminal, supported by rxvt-unicode, xterm and st
     50 # Requires the w3m-img package
     51 # image/*; w3m -o 'ext_image_viewer=off' '%s'; needsterminal
     52 
     53 # Don't have a solution for albums yet
     54 image/x-imgur-album; echo
     55 
     56 # 256 color images using half-width unicode characters
     57 # Much higher quality that img2txt, but must be built from source
     58 # https://github.com/rossy/img2xterm
     59 image/*; curl -s '%s' | convert -resize 80x80 - jpg:/tmp/tuir.jpg && img2xterm /tmp/tuir.jpg; needsterminal; copiousoutput
     60 
     61 # Display images in classic ascii using img2txt and lib-caca
     62 image/*; curl -s '%s' | convert - jpg:/tmp/tuir.jpg && img2txt -f utf8 /tmp/tuir.jpg; needsterminal; copiousoutput
     63 
     64 # Full motion videos - requires a framebuffer to view
     65 video/x-youtube; mpv -vo drm -quiet '%s'; needsterminal
     66 video/*; mpv -vo drm -quiet '%s'; needsterminal
     67 
     68 # Ascii videos
     69 # video/x-youtube; youtube-dl -q -o - '%s' | mplayer -cache 8192 -vo caca -quiet -; needsterminal
     70 # video/*; wget '%s' -O - | mplayer -cache 8192 -vo caca -quiet -; needsterminal