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

calling external handlers for special files #158

Open
bittorf opened this issue Jan 12, 2020 · 4 comments
Open

calling external handlers for special files #158

bittorf opened this issue Jan 12, 2020 · 4 comments

Comments

@bittorf
Copy link

bittorf commented Jan 12, 2020

i'am not happy with the way animations are working.

i see, that we can hack a little bit to work around this issue:
#100 (comment)
(but it is useless in montage-mode, is'nt it?)

what about something like:

pqiv \
    --mimetype 'video/mp4'  \
    --mimehandler 'mpv' \
    --mimetype 'audio/mpeg'  \
    --mimehandler 'mpg123' \
        "my_dir"
@phillipberndt
Copy link
Owner

Except for in montage mode, you can do this already by rebinding the keys to navigate images to also execute an external command.

In montage mode I don't see an easy way to do this right now, even conceptually.

@bittorf
Copy link
Author

bittorf commented Feb 7, 2020

after thinking a bit about an elegant solution,
this is my proposal:

we introduce an argument like this:

pqiv --checkcommand '/usr/local/bin/mycheck.sh'

This command takes the argument 'check' and the filename
and is called for each file (image or video), just before it is opened.

It returns 0 (ok, use pqiv's internal capabilies) or not 0.
In case of not 0, pqiv should open a black image and
calls the command again with argument 'show' and the filename.

that's it.

a naive implementation would be:

#!/bin/sh
ACTION="$1"
FILE="$2"

case "$ACTION" in
  check)
    case "$(file -b --mime-type "$FILE" )" in
      video/*)
        false
      ;;
      *)
        true
      ;;
    esac
  ;;
  show)
    mpv "$FILE"
  ;;
esac

This should made the code in pqiv simple.

@phillipberndt
Copy link
Owner

Finally got time to get back to this.. this won't help. In montage mode, pqiv renders out all images over time. You'd have tons of mpv windows popping up if this was applied to the thumbnails in montage mode. Outside montage mode (i.e. after selecting a file within) the approach from the other issue would still work.

@bittorf
Copy link
Author

bittorf commented May 9, 2020

When running in "montage mode", we can simply
have another ACTION, e.g. check, show and render!?

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