ranger-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ranger-users] PDF preview


From: Guillaume Bouchard
Subject: Re: [Ranger-users] PDF preview
Date: Wed, 29 Jan 2014 19:52:51 +0100

On Wed, Jan 29, 2014 at 5:36 PM, niku <address@hidden> wrote:
> Welcome to the mailing list.

Thank you.

>> Thank you for this amazing project.
>
> I hope you are crediting the correct people. Ranger is largely the
> work of Roman Zimbelmann / hut.

Sure. My "thank" was kind of a thank you to the mailing list entity.

Is this the place for a technical discussion ? If not, please could
you indicate me where they should go ?

The solution I propose is to create a secondary scope.sh like file for
image, scope_image.sh.

Like scope.sh it switchs on mimetypes, but instead of returning the
content, it returns the command to execute:

case "$mimetype" in
     application/pdf)
             echo "pdftoppm --png $path %s"
     application/blender)
             eoch "blender --do_a_render $path %s"
     video/*)
             echo "ffmpegthumbnailer ..."


(%s refer to a placeholder where ranger will put the name of the
temporary output file)

Then the logic in ranger should be something like (crappy pseudo-code):

command = call('scope_image.sh', path)
if not command;
     # fallback to the standard "scope.sh" file behavior
else:
     # nice, we have a command, store it


And later, in display:

if we_have_a_command:
      # (possibly cached):
      # execute the command using a temporary/unique output file name
      # display the temporary file
elif we_may_have_txt_content:
      # display them as usual

For now, I see no special drawback to this approach, so before
finishing coding this, I would like your feedbacks.

Cheers

-- 
Guillaume



reply via email to

[Prev in Thread] Current Thread [Next in Thread]