Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix previews (video, pdf) and support uppercase file extensions #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions scripts/vimg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function draw_preview {
render_at_size "${5}" "${6}" "${2}" "${7}"

elif [[ "$1" == "videopreview" ]]; then
if ! command -v viu &> /dev/null; then
if ! command -v ffmpegthumbnailer &> /dev/null; then
echo "ffmpegthumbnailer could not be found in your path,\nplease install it to display video previews"
exit
fi
Expand All @@ -47,14 +47,15 @@ function draw_preview {
elif [[ "$1" == "pdfpreview" ]]; then
path="${2##*/}"
echo -e "Loading preview..\nFile: $path"
[[ ! -f "${TMP_FOLDER}/${path}.png" ]] && pdftoppm -png -singlefile "$2" "${TMP_FOLDER}/${path}.png"
[[ ! -f "${TMP_FOLDER}/${path}.png" ]] && pdftoppm -png -singlefile "$2" "${TMP_FOLDER}/${path}"
clear
render_at_size "${5}" "${6}" "${TMP_FOLDER}/${path}.png" "${7}"
fi
}

function parse_options {
extension="${1##*.}"
extension="${extension,,}"
case $extension in
jpg | png | jpeg | webp | svg)
draw_preview imagepreview "$1" $2 $3 $4 $5 $6
Expand Down