Merge branch '2897_mc_ext_updates'

* 2897_mc_ext_updates:
  Ticket #1686: use 'see' utility for vieweing images
  Ticket #1686: use 'see' utility as default pdf viewer when found
  Ticket #1686: use dvicat if dvi2tty not found
  Ticket #2723: use libreoffice instead of ooffice, if found.
  Ticket #2739: add support of PAR archives.
  Ticket #2739: add support of epub format.
  Ticket #2739: add support of comic books.
  Ticket #2767: mc.ext: add support of ape, aac and wvm4a formats.
  Ticket #2895: add support of SVG images.
  Ticket #2890: make a choice between archivers for 7z.
  Ticket #2890: make a choice between archivers for arj.
  Ticket #2891: add support of .war archives.
  Ticket #2892: mc.ext: expand support of file extentions for source files
  Ticket #2894: add support of Gnumeric's spreadsheets.
  Ticket #2897: a lot of updates of mc.ext and ext.d.
This commit is contained in:
Andrew Borodin 2012-10-09 14:27:35 +04:00
commit 91f919531b
5 changed files with 86 additions and 26 deletions

View File

@ -59,7 +59,8 @@ do_view_action() {
lha l "${MC_EXT_FILENAME}"
;;
arj)
unarj l "${MC_EXT_FILENAME}"
arj l "${MC_EXT_FILENAME}" 2>/dev/null || \
unarj l "${MC_EXT_FILENAME}"
;;
cab)
cabextract -l "${MC_EXT_FILENAME}"
@ -86,7 +87,9 @@ do_view_action() {
cpio -itv < "${MC_EXT_FILENAME}" 2>/dev/null
;;
7z)
7za l "${MC_EXT_FILENAME}" 2>/dev/null
7za l "${MC_EXT_FILENAME}" 2>/dev/null ||
7z l "${MC_EXT_FILENAME}"
;;
ace)
unace l "${MC_EXT_FILENAME}"
@ -125,6 +128,9 @@ do_open_action() {
xz)
xz -dc "${MC_EXT_FILENAME}" | ${pager}
;;
par2)
par2 r "${MC_EXT_FILENAME}"
;;
*)
;;
esac

View File

@ -23,6 +23,12 @@ staroffice_console() {
rm -rf "$tmp"
}
get_ooffice_executable() {
which libreoffice >/dev/null 2>&1 && \
echo "libreoffice" || \
echo "ooffice"
}
do_view_action() {
filetype=$1
@ -64,11 +70,16 @@ do_view_action() {
strings "${MC_EXT_FILENAME}"
;;
dvi)
dvi2tty "${MC_EXT_FILENAME}"
which dvi2tty >/dev/null 2>&1 && \
dvi2tty "${MC_EXT_FILENAME}" || \
catdvi "${MC_EXT_FILENAME}"
;;
djvu)
djvused -e print-pure-txt "${MC_EXT_FILENAME}"
;;
epub)
einfo -v "${MC_EXT_FILENAME}"
;;
*)
;;
esac
@ -86,19 +97,22 @@ do_open_action() {
fi
;;
pdf)
if [ -n "$DISPLAY" ]; then
(xpdf "${MC_EXT_FILENAME}" &)
else
if [ ! -n "$DISPLAY" ]; then
pdftotext -layout -nopgbrk "${MC_EXT_FILENAME}" - | ${PAGER:-more}
elif see > /dev/null 2>&1; then
(see "${MC_EXT_FILENAME}" &)
else
(xpdf "${MC_EXT_FILENAME}" &)
fi
#(acroread "${MC_EXT_FILENAME}" &)
#(ghostview "${MC_EXT_FILENAME}" &)
;;
ooffice)
if [ -n "$DISPLAY" ]; then
(ooffice "${MC_EXT_FILENAME}" &)
OOFFICE=`get_ooffice_executable`
(${OOFFICE} "${MC_EXT_FILENAME}" &)
else
if [ ` echo "${MC_EXT_FILENAME}" | grep -c "${STAROFFICE_REGEXP}"` -ne 0 ]; then
if [ `echo "${MC_EXT_FILENAME}" | grep -c "${STAROFFICE_REGEXP}"` -ne 0 ]; then
staroffice_console "${MC_EXT_FILENAME}"
else
odt2txt "${MC_EXT_FILENAME}" | ${PAGER:-more}
@ -108,6 +122,9 @@ do_open_action() {
abw)
(abiword "${MC_EXT_FILENAME}" &)
;;
gnumeric)
(gnumeric "${MC_EXT_FILENAME}" &)
;;
msdoc)
if [ -n "$DISPLAY" ]; then
(abiword "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
@ -130,7 +147,8 @@ do_open_action() {
;;
msppt)
if [ -n "$DISPLAY" ]; then
(ooffice %f >/dev/null 2>&1 &)
OOFFICE=`get_ooffice_executable`
(${OOFFICE} %f >/dev/null 2>&1 &)
else
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
ppthtml %f > "$tmp/page.html"
@ -152,6 +170,12 @@ do_open_action() {
djvu)
djview "${MC_EXT_FILENAME}" &
;;
comic)
cbrpager "${MC_EXT_FILENAME}" &
;;
epub)
lucidor "${MC_EXT_FILENAME}" >/dev/null &
;;
*)
;;
esac

View File

@ -32,9 +32,14 @@ do_open_action() {
xcf)
(gimp "${MC_EXT_FILENAME}" &)
;;
svg)
(inkscape "${MC_EXT_FILENAME}" &)
;;
*)
if [ -n "$DISPLAY" ]; then
(gqview "${MC_EXT_FILENAME}" &)
elif see >/dev/null 2>&1; then
(see "${MC_EXT_FILENAME}" &)
else
zgv "${MC_EXT_FILENAME}"
fi

View File

@ -12,7 +12,8 @@ do_view_action() {
case "${filetype}" in
*)
cat "${MC_EXT_FILENAME}"
mplayer -identify -vo null -ao null -frames 0 "${MC_EXT_FILENAME}" 2>&1 | \
sed -n 's/^ID_//p'
;;
esac
}

View File

@ -117,8 +117,8 @@ regex/^\[git\]
### Archives ###
# .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk
regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk|\.gem$
# .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk, .gem, .war
regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk$|\.gem$|\.war$
Open=%cd %p/utar://
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view tar.gz
@ -278,24 +278,20 @@ type/^ASCII\ mail\ text
### Sources ###
# C
shell/.c
# C/C++
regex/i/\.(c|cc|cpp)$
Include=editor
# C/C++ header
regex/i/\.(h|hh|hpp)$
Include=editor
# Fortran
shell/.f
shell/i/.f
Include=editor
# Header
regex/\.(h|hpp)$
Include=editor
# Asm
shell/.s
Include=editor
# C++
regex/\.(C|cc|cpp)$
# Assembler
regex/i/\.(s|asm)$
Include=editor
include/editor
@ -391,6 +387,12 @@ type/^PC\ bitmap
type/^PNG
Include=image
type/^JNG
Include=image
type/^MNG
Include=image
type/^TIFF
Include=image
@ -419,6 +421,10 @@ shell/.xpm
shell/.ico
Include=image
shell/i/.svg
View=%view{ascii} @EXTHELPERSDIR@/image.sh view svg
Open=@EXTHELPERSDIR@/image.sh open svg
include/image
Open=@EXTHELPERSDIR@/image.sh open ALL_FORMATS
View=%view{ascii} @EXTHELPERSDIR@/image.sh view ALL_FORMATS
@ -426,7 +432,7 @@ include/image
### Sound files ###
regex/i/\.(wav|snd|voc|au|smp|aiff|snd|m4a)$
regex/i/\.(wav|snd|voc|au|smp|aiff|snd|m4a|ape|aac|wvm4a)$
Open=@EXTHELPERSDIR@/sound.sh open common
regex/i/\.(mod|s3m|xm|it|mtm|669|stm|ult|far)$
@ -544,6 +550,10 @@ regex/i/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|o
shell/.abw
Open=@EXTHELPERSDIR@/doc.sh open abw
# Gnumeric
shell/i/.gnumeric
Open=@EXTHELPERSDIR@/doc.sh open gnumeric
# Microsoft Word Document
regex/i/\.(do[ct]|wri)$
Open=@EXTHELPERSDIR@/doc.sh open msdoc
@ -590,6 +600,16 @@ regex/i/\.djvu?$
Open=@EXTHELPERSDIR@/doc.sh open djvu
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view djvu
# Comic Books
regex/i/\.cb[zr]$
Open=@EXTHELPERSDIR@/doc.sh open comic
# Epub
shell/i/.epub
Open=@EXTHELPERSDIR@/doc.sh open epub
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view epub
### Miscellaneous ###
# Compiled Java classes
@ -706,6 +726,10 @@ regex/\.xz$
Open=@EXTHELPERSDIR@/archive.sh view xz %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view xz
# Parity Archive
type/^Parity\ Archive\ Volume\ Set
Open=@EXTHELPERSDIR@/archive.sh open par2
### Default ###
# Default target for anything not described above