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

Use 2> /dev/null to supress error messages for some special files #5

Open
RayZ0rr opened this issue May 9, 2023 · 3 comments
Open

Comments

@RayZ0rr
Copy link

RayZ0rr commented May 9, 2023

I am using this plugin with vifm and I have say it works great ❤️ (my terminal is wezterm which has sizel capabilities)

Sometimes there are files such as password-protected pdf files. These files don't show preview but currently show a big error msg.
This kinda messes up the display in the adjacent pane too.

So, maybe use > /dev/null for cleaner messages?

case "$action" in
  "clear")
    cleanup
    ;;
  "draw")
    [ ! -f "${PCACHE}.jpg" ] && convert "$image_file"'[0]' "${PCACHE}.jpg"
    # FILE="$PWD/$image_file"
    image "${PCACHE}.jpg" "$width" "$height" 2> /dev/null  <-- here
    ;;
  "video")
    [ ! -f "${PCACHE}.jpg" ] && \
    ffmpegthumbnailer -i "$4" -o "${PCACHE}.jpg" -s 0 -q 5
    image "${PCACHE}.jpg" "$width" "$height" 2> /dev/null  <-- here
    ;;
  "epub")
    [ ! -f "${PCACHE}.jpg" ] && \
    epub-thumbnailer "$image_file" "$PCACHE" 1024
    image "${PCACHE}.jpg" "$width" "$height" 2> /dev/null  <-- here
    ;;
  "pdf")
    [ ! -f "${PCACHE}.jpg" ] && \
    pdftoppm -jpeg -f 1 -singlefile "$image_file" "$PCACHE"
    image "${PCACHE}.jpg" "$width" "$height" 2> /dev/null  <-- here
    ;;
@eylles
Copy link
Owner

eylles commented May 9, 2023

Ah thanks, i'm looking into improving this to have it do some stuf automagically with a wrapper but that is besides this issue.

Hmmm iirc there should be one utility that allowed to unlock password protected pdfs, think it was pdfjam but will look up once i get home.

@RayZ0rr RayZ0rr changed the title Use /dev/null to supress error messages for some special files Use 2> /dev/null to supress error messages for some special files May 10, 2023
@RayZ0rr
Copy link
Author

RayZ0rr commented May 10, 2023

Using a separate utility to preview special files, say password-protected pdfs, is a good idea. But I think it's better if these files, especially password-protected pdf files, don't show any preview because they might have sensitive content. In order to preview, it also gets cached which might not be desirable.

I think just redirecting the stderr would be sufficient as it also reduces your maintenance burden from adding more complexity(new utility to keep track of).

EDIT :- there was a typo in my first post and title. It should be 2> /dev/null instead of > /dev/null

@eylles
Copy link
Owner

eylles commented May 10, 2023

Still got more to do on this, will try to push some of the changes i want to push this week and try to do the stderr redirection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants