dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

mailcap (3949B)


      1 # Example mailcap file for Reddit Terminal Viewer
      2 # https://github.com/michael-lazar/rtv/
      3 #
      4 # Copy the contents of this file to {HOME}/.mailcap, or point to it using $MAILCAPS
      5 # Then launch RTV 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 RTV.
     23 ###############################################################################
     24 
     25 # Feh is a simple and effective image viewer
     26 # Note that rtv 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/gif; webimg -a '%s' ; test=test -n "$DISPLAY"
     31 image/*; webimg '%s' ; test=test -n "$DISPLAY"
     32 #image/*; feh -g 640x480 -. '%s'; test=test -n "$DISPLAY"
     33 
     34 # Youtube videos are assigned a custom mime-type, which can be streamed with
     35 # vlc or youtube-dl.
     36 #video/x-youtube; vlc '%s' --width 640 --height 480; test=test -n "$DISPLAY"
     37 video/x-youtube; mpv --ytdl-format=bestvideo+bestaudio/best '%s' --autofit=640x480; test=test -n "$DISPLAY"
     38 
     39 # Mpv is a simple and effective video streamer
     40 video/*; mpv '%s' --autofit=640x480 --loop=inf; test=test -n "$DISPLAY"
     41 
     42 ###############################################################################
     43 # Commands below this point will attempt to display media directly in the
     44 # terminal when a desktop is not available (e.g. inside of an SSH session)
     45 ###############################################################################
     46 
     47 # View images directly in your terminal with iTerm2
     48 # curl -L https://iterm2.com/misc/install_shell_integration_and_utilities.sh | bash
     49 # image/*; bash -c '[[ "%s" == http*  ]] && (curl -s %s | ~/.iterm2/imgcat) || ~/.iterm2/imgcat %s' && read -n 1; needsterminal
     50 
     51 # View true images in the terminal, supported by rxvt-unicode, xterm and st
     52 # Requires the w3m-img package
     53 # image/*; w3m -o 'ext_image_viewer=off' '%s'; needsterminal
     54 
     55 # Don't have a solution for albums yet
     56 #image/x-imgur-album; echo
     57 
     58 # 256 color images using half-width unicode characters
     59 # Much higher quality that img2txt, but must be built from source
     60 # https://github.com/rossy/img2xterm
     61 #image/*; curl -s '%s' | convert -resize 80x80 - jpg:/tmp/rtv.jpg && img2xterm /tmp/rtv.jpg; needsterminal; copiousoutput
     62 
     63 # Display images in classic ascii using img2txt and lib-caca
     64 #image/*; curl -s '%s' | convert - jpg:/tmp/rtv.jpg && img2txt -f utf8 /tmp/rtv.jpg; needsterminal; copiousoutput
     65 
     66 # Full motion videos - requires a framebuffer to view
     67 #video/x-youtube; mpv -vo drm -quiet '%s'; needsterminal
     68 #video/*; mpv -vo drm -quiet '%s'; needsterminal
     69 
     70 # Ascii videos
     71 # video/x-youtube; youtube-dl -q -o - '%s' | mplayer -cache 8192 -vo caca -quiet -; needsterminal
     72 # video/*; wget '%s' -O - | mplayer -cache 8192 -vo caca -quiet -; needsterminal
     73 #text/html; /usr/bin/firefox %s >/dev/null 2>&1; needsterminal
     74 #text/html; /usr/bin/w3m -I %{charset} -T text/html; copiusoutput
     75 #text/html; /usr/bin/lynx -dump -force_html -width=96 '%s'; needsterminal; copiusoutput
     76 text/html; /home/pyratebeard/.local/bin/htmldump -c %{charset} '%s'; copiousoutput