Added --copy-mailcap command
This commit is contained in:
55
rtv/templates/mailcap
Normal file
55
rtv/templates/mailcap
Normal file
@@ -0,0 +1,55 @@
|
||||
# Example mailcap file for Reddit Terminal Viewer
|
||||
|
||||
# Copy the contents of this file to {HOME}/.mailcap, or point to using $MAILCAPS
|
||||
# Then launch RTV using the --enable-media flag. All shell commands defined in
|
||||
# this file depend on external programs that must be installed on your system.
|
||||
#
|
||||
# See https://github.com/michael-lazar/rtv/
|
||||
# If something is not working, you can save debug stderr messages to a log file
|
||||
# by launching rtv with the --log flag.
|
||||
# If you come up with your own commands and would like to share them, post an
|
||||
# issue on the GitHub tracker and they will be added as examples.
|
||||
|
||||
###############################################################################
|
||||
# Commands below this point will open media in a separate window without
|
||||
# pausing execution of RTV.
|
||||
###############################################################################
|
||||
|
||||
# Feh is a simple and effective image viewer
|
||||
# Note that rtv returns a list of urls for imgur albums, so we don't put quotes
|
||||
# around the `%s`
|
||||
image/x-imgur-album; feh -g 640x480 %s; test=test -n "$DISPLAY"
|
||||
image/*; feh -g 640x480 '%s'; test=test -n "$DISPLAY"
|
||||
|
||||
# Youtube videos are assigned a custom mime-type, which can be streamed with
|
||||
# vlc or youtube-dl.
|
||||
video/x-youtube; vlc '%s' --width 640 --height 480; test=test -n "$DISPLAY"
|
||||
video/x-youtube; youtube-dl -q -o - '%s' | mpv - --autofit 640x480; test=test -n "$DISPLAY"
|
||||
|
||||
# Mpv is a simple and effective video streamer
|
||||
video/webm; mpv '%s' --autofit 640x480; test=test -n "$DISPLAY"
|
||||
video/*; mpv '%s' --autofit 640x480; test=test -n "$DISPLAY"
|
||||
|
||||
###############################################################################
|
||||
# Commands below this point will attempt to display media directly in the
|
||||
# terminal when X is not available.
|
||||
###############################################################################
|
||||
|
||||
# View true images in the terminal, supported by rxvt-unicode, xterm and st
|
||||
# Requires the w3m-img package
|
||||
# image/*; w3m -o 'ext_image_viewer=off' '%s'; needsterminal
|
||||
|
||||
# Don't have a solution for albums yet
|
||||
image/x-imgur-album; echo
|
||||
|
||||
# 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/rtv.jpg && img2xterm /tmp/rtv.jpg; needsterminal; copiousoutput
|
||||
|
||||
# Display images in classic ascii using img2txt and lib-caca
|
||||
image/*; curl -s '%s' | convert - jpg:/tmp/rtv.jpg && img2txt -f utf8 /tmp/rtv.jpg; needsterminal; copiousoutput
|
||||
|
||||
# Ascii videos
|
||||
video/x-youtube; youtube-dl -q -o - '%s' | mplayer -cache 8192 -vo caca -quiet -; needsterminal
|
||||
video/*; wget '%s' -O - | mplayer -cache 8192 -vo caca -quiet -; needsterminal
|
||||
132
rtv/templates/rtv.cfg
Normal file
132
rtv/templates/rtv.cfg
Normal file
@@ -0,0 +1,132 @@
|
||||
; Reddit Terminal Viewer Configuration File
|
||||
; https://github.com/michael-lazar/rtv
|
||||
;
|
||||
; This file should be placed in $XDG_CONFIG/rtv/rtv.cfg
|
||||
; If $XDG_CONFIG is not set, use ~/.config/rtv/rtv.cfg
|
||||
|
||||
[rtv]
|
||||
##################
|
||||
# General Settings
|
||||
##################
|
||||
|
||||
; Turn on ascii-only mode to disable all unicode characters.
|
||||
; This may be necessary for compatibility with some terminal browsers.
|
||||
ascii = False
|
||||
|
||||
; Turn on monochrome mode to disable color.
|
||||
monochrome = False
|
||||
|
||||
; Enable debugging by logging all HTTP requests and errors to the given file.
|
||||
;log = /tmp/rtv.log
|
||||
|
||||
; Default subreddit that will be opened when the program launches.
|
||||
subreddit = front
|
||||
;subreddit = python
|
||||
;subreddit = python+linux+programming
|
||||
;subreddit = all
|
||||
|
||||
; Allow rtv to store reddit authentication credentials between sessions.
|
||||
persistent = True
|
||||
|
||||
; Clear any stored credentials when the program starts.
|
||||
clear_auth = False
|
||||
|
||||
; Maximum number of opened links that will be saved in the history file.
|
||||
history_size = 200
|
||||
|
||||
; Open external links using programs defined in the mailcap config.
|
||||
enable_media = True
|
||||
|
||||
################
|
||||
# OAuth Settings
|
||||
################
|
||||
; This sections defines the paramaters that will be used during the OAuth
|
||||
; authentication process. rtv is registered as an "installed app",
|
||||
; see https://github.com/reddit/reddit/wiki/OAuth2 for more information.
|
||||
|
||||
; These settings are defined at https://www.reddit.com/prefs/apps and should
|
||||
; not be altered unless you are defining your own developer application.
|
||||
oauth_client_id = E2oEtRQfdfAfNQ
|
||||
oauth_client_secret = praw_gapfill
|
||||
oauth_redirect_uri = http://127.0.0.1:65000/
|
||||
|
||||
; Port that the rtv webserver will listen on. This should match the redirect
|
||||
; uri defined above.
|
||||
oauth_redirect_port = 65000
|
||||
|
||||
; Access permissions that will be requested.
|
||||
oauth_scope = edit,history,identity,mysubreddits,privatemessages,read,report,save,submit,subscribe,vote
|
||||
|
||||
[bindings]
|
||||
##############
|
||||
# Key Bindings
|
||||
##############
|
||||
; If you would like to define custom bindings, copy this section into your
|
||||
; config file with the [bindings] heading. All commands must be bound to at
|
||||
; least one key for the config to be valid.
|
||||
;
|
||||
; 1.) Plain keys can be represented by either uppercase/lowercase characters
|
||||
; or the hexadecimal numbers referring their ascii codes. For reference, see
|
||||
; https://en.wikipedia.org/wiki/ASCII#ASCII_printable_code_chart
|
||||
; e.g. Q, q, 1, ?
|
||||
; e.g. 0x20 (space), 0x3c (less-than sign)
|
||||
;
|
||||
; 2.) Special ascii control codes should be surrounded with <>. For reference,
|
||||
; see https://en.wikipedia.org/wiki/ASCII#ASCII_control_code_chart
|
||||
; e.g. <LF> (enter), <ESC> (escape)
|
||||
;
|
||||
; 3.) Other special keys are defined by curses, they should be surrounded by <>
|
||||
; and prefixed with KEY_. For reference, see
|
||||
; https://docs.python.org/2/library/curses.html#constants
|
||||
; e.g. <KEY_LEFT> (left arrow), <KEY_F5>, <KEY_NPAGE> (page down)
|
||||
;
|
||||
; Notes:
|
||||
; - Curses <KEY_ENTER> is unreliable and should always be used in conjunction
|
||||
; with <LF>.
|
||||
; - Use 0x20 for the space key.
|
||||
; - A subset of Ctrl modifiers are available through the ascii control codes.
|
||||
; For example, Ctrl-D will trigger an <EOT> signal. See the table above for
|
||||
; a complete reference.
|
||||
|
||||
; Base page
|
||||
EXIT = q
|
||||
FORCE_EXIT = Q
|
||||
HELP = ?
|
||||
SORT_HOT = 1
|
||||
SORT_TOP = 2
|
||||
SORT_RISING = 3
|
||||
SORT_NEW = 4
|
||||
SORT_CONTROVERSIAL = 5
|
||||
MOVE_UP = k, <KEY_UP>
|
||||
MOVE_DOWN = j, <KEY_DOWN>
|
||||
PAGE_UP = m, <KEY_PPAGE>, <NAK>
|
||||
PAGE_DOWN = n, <KEY_NPAGE>, <EOT>
|
||||
UPVOTE = a
|
||||
DOWNVOTE = z
|
||||
LOGIN = u
|
||||
DELETE = d
|
||||
EDIT = e
|
||||
INBOX = i
|
||||
REFRESH = r, <KEY_F5>
|
||||
|
||||
; Submission page
|
||||
SUBMISSION_TOGGLE_COMMENT = 0x20
|
||||
SUBMISSION_OPEN_IN_BROWSER = o, <LF>, <KEY_ENTER>
|
||||
SUBMISSION_POST = c
|
||||
SUBMISSION_EXIT = h, <KEY_LEFT>
|
||||
SUBMISSION_OPEN_IN_PAGER = l, <KEY_RIGHT>
|
||||
SUBMISSION_OPEN_IN_URLVIEWER = b
|
||||
|
||||
; Subreddit page
|
||||
SUBREDDIT_SEARCH = f
|
||||
SUBREDDIT_PROMPT = /
|
||||
SUBREDDIT_POST = c
|
||||
SUBREDDIT_OPEN = l, <KEY_RIGHT>
|
||||
SUBREDDIT_OPEN_IN_BROWSER = o, <LF>, <KEY_ENTER>, <KEY_ENTER>
|
||||
SUBREDDIT_OPEN_SUBSCRIPTIONS = s
|
||||
SUBREDDIT_OPEN_MULTIREDDITS = S
|
||||
SUBREDDIT_FRONTPAGE = p
|
||||
|
||||
; Subscription page
|
||||
SUBSCRIPTION_SELECT = l, <LF>, <KEY_ENTER>, <KEY_RIGHT>
|
||||
SUBSCRIPTION_EXIT = h, s, S, <ESC>, <KEY_LEFT>
|
||||
Reference in New Issue
Block a user