Command line action with temporary files

Registered by Stani on 2009-06-12

The action would have two fields:
fields[_t('Command')] = self.CharField(' ')#should be a space not empty string

The command line should contain for example in.png and out.jpg. With a regular expression you can find a filename with in.* or out.*
Phatch should than save the temporary file as requested as in.* and open (&delete) the out.* Use the tempfile module for temporary files. Use the named temporary files. See core/lib/libtiff.py for an example:
    temp = tempfile.NamedTemporaryFile().name
    image.save(temp,'tiff',**options)

We can also investigate how to use a command line pipe action with imagemagick (use - for pipes in command line).
With this action the sky is the limit. For example you could use it to integrate imagemagick and even Blender in Phatch. Not very efficient yet when you use them one after each other, but that doesn't matter yet in relation to the power it gives. Later we can optimize that.

Blueprint information

Status:
Complete
Approver:
Stani
Priority:
Essential
Drafter:
Stani
Direction:
Approved
Assignee:
Stani
Definition:
Approved
Series goal:
Accepted for 0.2
Implementation:
Implemented
Milestone target:
milestone icon 0.2.1
Started by
Juho Vepsäläinen on 2009-06-13
Completed by
Stani on 2009-08-31

Whiteboard

Stani, 15-6-2009: We need a CommandLineField for it with file_in, file_out, pipe_in, pipe_out. Are the *_out parameters obligatory?

Juho, 15-6-2009: Note that I originally implemented input/output as generic (no filename/extension) to allow some extra flexibility. This allows you to do some specific imagemagick operation on some set of images (possibly different extensions). I agree that it's good to have possibility to provide extension for output at least.

Does providing pipes give any significant advantage over adding separate action for each command instead? Isn't phatch a piping system in a way? :)

Stani, 15-6-2009: No flexibility will be harmed in this action as discussed on irc.

Stani 17-06-2008, done only need to add an icon.

TODO:
- add checkbox: require input file, require output file

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.