upstream changes
This commit is contained in:
@@ -178,12 +178,15 @@ ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
|
|||||||
ext cb[rz], has qcomicbook, X, flag f = qcomicbook "$@"
|
ext cb[rz], has qcomicbook, X, flag f = qcomicbook "$@"
|
||||||
ext cb[rz], has mcomix, X, flag f = mcomix -- "$@"
|
ext cb[rz], has mcomix, X, flag f = mcomix -- "$@"
|
||||||
ext cb[rz], has zathura, X, flag f = zathura -- "$@"
|
ext cb[rz], has zathura, X, flag f = zathura -- "$@"
|
||||||
|
ext cb[rz], has atril, X, flag f = atril -- "$@"
|
||||||
|
|
||||||
ext sla, has scribus, X, flag f = scribus -- "$@"
|
ext sla, has scribus, X, flag f = scribus -- "$@"
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
# Images
|
# Images
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
|
mime ^image, has viewnior, X, flag f = viewnior -- "$@"
|
||||||
|
|
||||||
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
|
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
|
||||||
mime ^image/svg, has display, X, flag f = display -- "$@"
|
mime ^image/svg, has display, X, flag f = display -- "$@"
|
||||||
|
|
||||||
@@ -199,6 +202,7 @@ mime ^image, has nomacs, X, flag f = nomacs -- "$@"
|
|||||||
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
|
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
|
||||||
mime ^image, has gpicview, X, flag f = gpicview -- "$@"
|
mime ^image, has gpicview, X, flag f = gpicview -- "$@"
|
||||||
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
|
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
|
||||||
|
mime ^image, has xviewer, X, flag f = xviewer -- "$@"
|
||||||
mime ^image, has mcomix, X, flag f = mcomix -- "$@"
|
mime ^image, has mcomix, X, flag f = mcomix -- "$@"
|
||||||
mime ^image, has gimp, X, flag f = gimp -- "$@"
|
mime ^image, has gimp, X, flag f = gimp -- "$@"
|
||||||
mime ^image, has krita, X, flag f = krita -- "$@"
|
mime ^image, has krita, X, flag f = krita -- "$@"
|
||||||
@@ -227,6 +231,9 @@ ext ace, has unace = unace l "$1" | less
|
|||||||
ext ace, has unace = for file in "$@"; do unace e "$file"; done
|
ext ace, has unace = for file in "$@"; do unace e "$file"; done
|
||||||
ext rar, has unrar = unrar l "$1" | less
|
ext rar, has unrar = unrar l "$1" | less
|
||||||
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
|
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
|
||||||
|
ext rar|zip, has qcomicbook, X, flag f = qcomicbook "$@"
|
||||||
|
ext rar|zip, has mcomix, X, flag f = mcomix -- "$@"
|
||||||
|
ext rar|zip, has zathura, X, flag f = zathura -- "$@"
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
# Fonts
|
# Fonts
|
||||||
|
|||||||
@@ -80,12 +80,16 @@ handle_extension() {
|
|||||||
exit 1;;
|
exit 1;;
|
||||||
|
|
||||||
## OpenDocument
|
## OpenDocument
|
||||||
odt|ods|odp|sxw)
|
odt|sxw)
|
||||||
## Preview as text conversion
|
## Preview as text conversion
|
||||||
odt2txt "${FILE_PATH}" && exit 5
|
odt2txt "${FILE_PATH}" && exit 5
|
||||||
## Preview as markdown conversion
|
## Preview as markdown conversion
|
||||||
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
||||||
exit 1;;
|
exit 1;;
|
||||||
|
ods|odp)
|
||||||
|
## Preview as text conversion (unsupported by pandoc for markdown)
|
||||||
|
odt2txt "${FILE_PATH}" && exit 5
|
||||||
|
exit 1;;
|
||||||
|
|
||||||
## XLSX
|
## XLSX
|
||||||
xlsx)
|
xlsx)
|
||||||
@@ -104,7 +108,15 @@ handle_extension() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
## JSON
|
## JSON
|
||||||
json|ipynb)
|
json)
|
||||||
|
jq --color-output . "${FILE_PATH}" && exit 5
|
||||||
|
python -m json.tool -- "${FILE_PATH}" && exit 5
|
||||||
|
;;
|
||||||
|
|
||||||
|
## Jupyter Notebooks
|
||||||
|
ipynb)
|
||||||
|
jupyter nbconvert --to markdown "${FILE_PATH}" --stdout | env COLORTERM=8bit bat --color=always --style=plain --language=markdown && exit 5
|
||||||
|
jupyter nbconvert --to markdown "${FILE_PATH}" --stdout && exit 5
|
||||||
jq --color-output . "${FILE_PATH}" && exit 5
|
jq --color-output . "${FILE_PATH}" && exit 5
|
||||||
python -m json.tool -- "${FILE_PATH}" && exit 5
|
python -m json.tool -- "${FILE_PATH}" && exit 5
|
||||||
;;
|
;;
|
||||||
@@ -128,9 +140,11 @@ handle_image() {
|
|||||||
local mimetype="${1}"
|
local mimetype="${1}"
|
||||||
case "${mimetype}" in
|
case "${mimetype}" in
|
||||||
## SVG
|
## SVG
|
||||||
# image/svg+xml|image/svg)
|
image/svg+xml|image/svg)
|
||||||
# convert -- "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6
|
rsvg-convert --keep-aspect-ratio --width "${DEFAULT_SIZE%x*}" "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}.png" \
|
||||||
# exit 1;;
|
&& mv "${IMAGE_CACHE_PATH}.png" "${IMAGE_CACHE_PATH}" \
|
||||||
|
&& exit 6
|
||||||
|
exit 1;;
|
||||||
|
|
||||||
## DjVu
|
## DjVu
|
||||||
# image/vnd.djvu)
|
# image/vnd.djvu)
|
||||||
@@ -149,16 +163,24 @@ handle_image() {
|
|||||||
convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
|
convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## `w3mimgdisplay` will be called for all images (unless overriden
|
## `w3mimgdisplay` will be called for all images (unless overridden
|
||||||
## as above), but might fail for unsupported types.
|
## as above), but might fail for unsupported types.
|
||||||
exit 7;;
|
exit 7;;
|
||||||
|
|
||||||
## Video
|
## Video
|
||||||
# video/*)
|
# video/*)
|
||||||
# # Thumbnail
|
# # Get embedded thumbnail
|
||||||
|
# ffmpeg -i "${FILE_PATH}" -map 0:v -map -0:V -c copy "${IMAGE_CACHE_PATH}" && exit 6
|
||||||
|
# # Get frame 10% into video
|
||||||
# ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
|
# ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
|
||||||
# exit 1;;
|
# exit 1;;
|
||||||
|
|
||||||
|
## Audio
|
||||||
|
# audio/*)
|
||||||
|
# # Get embedded thumbnail
|
||||||
|
# ffmpeg -i "${FILE_PATH}" -map 0:v -map -0:V -c copy \
|
||||||
|
# "${IMAGE_CACHE_PATH}" && exit 6;;
|
||||||
|
|
||||||
## PDF
|
## PDF
|
||||||
# application/pdf)
|
# application/pdf)
|
||||||
# pdftoppm -f 1 -l 1 \
|
# pdftoppm -f 1 -l 1 \
|
||||||
@@ -248,19 +270,23 @@ handle_image() {
|
|||||||
# mv "${TMPPNG}" "${IMAGE_CACHE_PATH}"
|
# mv "${TMPPNG}" "${IMAGE_CACHE_PATH}"
|
||||||
# }
|
# }
|
||||||
|
|
||||||
# case "${FILE_EXTENSION_LOWER}" in
|
case "${FILE_EXTENSION_LOWER}" in
|
||||||
# ## 3D models
|
## 3D models
|
||||||
# ## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH}
|
## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH}
|
||||||
# ## is hardcoded as jpeg. So we make a tempfile.png and just
|
## is hardcoded as jpeg. So we make a tempfile.png and just
|
||||||
# ## move/rename it to jpg. This works because image libraries are
|
## move/rename it to jpg. This works because image libraries are
|
||||||
# ## smart enough to handle it.
|
## smart enough to handle it.
|
||||||
# csg|scad)
|
# csg|scad)
|
||||||
# openscad_image "${FILE_PATH}" && exit 6
|
# openscad_image "${FILE_PATH}" && exit 6
|
||||||
# ;;
|
# ;;
|
||||||
# 3mf|amf|dxf|off|stl)
|
# 3mf|amf|dxf|off|stl)
|
||||||
# openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6
|
# openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6
|
||||||
# ;;
|
# ;;
|
||||||
# esac
|
drawio)
|
||||||
|
draw.io -x "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" \
|
||||||
|
--width "${DEFAULT_SIZE%x*}" && exit 6
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_mime() {
|
handle_mime() {
|
||||||
@@ -337,6 +363,11 @@ handle_mime() {
|
|||||||
mediainfo "${FILE_PATH}" && exit 5
|
mediainfo "${FILE_PATH}" && exit 5
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
exiftool "${FILE_PATH}" && exit 5
|
||||||
exit 1;;
|
exit 1;;
|
||||||
|
|
||||||
|
## ELF files (executables and shared objects)
|
||||||
|
application/x-executable | application/x-pie-executable | application/x-sharedlib)
|
||||||
|
readelf -WCa "${FILE_PATH}" && exit 5
|
||||||
|
exit 1;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user