Tweaking some mailcap definitions.

This commit is contained in:
Michael Lazar
2016-07-24 13:47:50 -07:00
parent 703ccca5a3
commit a115c7f423
3 changed files with 11 additions and 6 deletions

View File

@@ -24,6 +24,7 @@ image/*; feh -g 640x480 '%s'; test=test -n "$DISPLAY"
# Youtube videos are assigned a custom mime-type, which can be streamed with # Youtube videos are assigned a custom mime-type, which can be streamed with
# vlc or youtube-dl. # vlc or youtube-dl.
video/x-youtube; vlc '%s'; test=test -n "$DISPLAY" video/x-youtube; vlc '%s'; test=test -n "$DISPLAY"
video/x-youtube; youtube-dl -q -o - '%s' | mpv -; test=test -n "$DISPLAY"
# Mpv is a simple and effective video streamer # Mpv is a simple and effective video streamer
video/webm; mpv '%s'; test=test -n "$DISPLAY" video/webm; mpv '%s'; test=test -n "$DISPLAY"
@@ -43,6 +44,6 @@ image/x-imgur-album; echo
image/*; curl -s '%s' | convert - jpg:/tmp/rtv.jpg && img2txt -f utf8 /tmp/rtv.jpg; needsterminal; copiousoutput image/*; curl -s '%s' | convert - jpg:/tmp/rtv.jpg && img2txt -f utf8 /tmp/rtv.jpg; needsterminal; copiousoutput
# Ascii videos # Ascii videos
video/x-youtube; youtube-dl -q -o - "%s" | mplayer -cache 8192 -quiet - 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 video/*; wget '%s' -O - | mplayer -cache 8192 -vo caca -quiet -; needsterminal

View File

@@ -156,7 +156,7 @@ class ImgurAlbumMIMEParser(BaseMIMEParser):
urls.append('http:' + div.find('img').get('src')) urls.append('http:' + div.find('img').get('src'))
if urls: if urls:
return "' '".join(urls), 'image/x-imgur-album' return " ".join(urls), 'image/x-imgur-album'
else: else:
return url, None return url, None

View File

@@ -354,21 +354,25 @@ class Terminal(object):
return self.open_browser(url) return self.open_browser(url)
_logger.info('Executing command: %s', command) _logger.info('Executing command: %s', command)
if 'copiousoutput' in entry: needs_terminal = 'needsterminal' in entry
# TODO: open in pager copious_output = 'copiousoutput' in entry
pass
elif 'needsterminal' in entry: if needs_terminal or copious_output:
# Blocking, pause rtv until the process returns # Blocking, pause rtv until the process returns
with self.suspend(): with self.suspend():
os.system('clear')
p = subprocess.Popen( p = subprocess.Popen(
[command], stderr=subprocess.PIPE, [command], stderr=subprocess.PIPE,
universal_newlines=True, shell=True) universal_newlines=True, shell=True)
code = p.wait() code = p.wait()
if copious_output:
six.moves.input('Press any key to continue')
if code != 0: if code != 0:
_, stderr = p.communicate() _, stderr = p.communicate()
_logger.warning(stderr) _logger.warning(stderr)
self.show_notification( self.show_notification(
'Program exited with status=%s\n%s' % (code, stderr)) 'Program exited with status=%s\n%s' % (code, stderr))
else: else:
# Non-blocking, open a background process # Non-blocking, open a background process
with self.loader('Opening page', delay=0): with self.loader('Opening page', delay=0):