# Example mailcap file for Terminal UI for Reddit # https://gitlab.com/ajak/tuir/ # # Copy the contents of this file to {HOME}/.mailcap, or point to it using $MAILCAPS # Then launch TUIR using the --enable-media flag. All shell commands defined in # this file depend on external programs that must be installed on your system. # # Mailcap 101 # - The first entry with a matching MIME type will be executed, * is a wildcard # - %s will be replaced with the image or video url # - Add ``test=test -n "$DISPLAY"`` if your command opens a new window # - Add ``needsterminal`` for commands that use the terminal # - Add ``copiousoutput`` for commands that dump text to stdout image/x-imgur-album; feh -g 640x480 -. %s; test=test -n "$DISPLAY" image/gif; mpv --title="tuir" '%s' --loop=inf; test=test -n "$DISPLAY" image/*; feh -g 640x480 -. '%s'; test=test -n "$DISPLAY" video/x-youtube; mpv --ytdl-format=bestvideo+bestaudio/best '%s' ; test=test -n "$DISPLAY" video/*; mpv '%s' --loop=inf; test=test -n "$DISPLAY" *; dmenuhandler '%s'; test=test -n "$DISPLAY" # 256 color images using half-width unicode characters # Much higher quality that img2txt, but must be built from source # https://github.com/rossy/img2xterm image/*; curl -s '%s' | convert -resize 80x80 - jpg:/tmp/tuir.jpg && img2xterm /tmp/tuir.jpg; needsterminal; copiousoutput # Display images in classic ascii using img2txt and lib-caca image/*; curl -s '%s' | convert - jpg:/tmp/tuir.jpg && img2txt -f utf8 /tmp/tuir.jpg; needsterminal; copiousoutput # Full motion videos - requires a framebuffer to view #video/x-youtube; mpv -vo drm -quiet '%s'; needsterminal #video/*; mpv -vo drm -quiet '%s'; needsterminal # Ascii videos video/*; mpv -cache 8192 -vo caca -quiet '%s'; needsterminal