You are not logged in.
Pages: 1
crunchooter is a script inspired by cruncbang rc.xml:
<keybind key="Print">
<action name="Execute">
<execute>scrot '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/ & gpicview ~/images/$f'</execute>
</action>
</keybind>I was fed up to open my images with gpicview, cause I don't use gpicview; it's more convenient to use gnome-open instead. Moreover, I was fed up to have my images directory muddled by screenshots… crunchooter uses "~/images/shots/", but in the near future, I think it will use an environment variable, something like:
export SHOTSDIR="$HOME/my/preferred/path/to/save/screenshots"which it could be more adaptable…
It can use optipng to compress screenshots, on the fly… furthermore, it uses / tmp before moving the image in the folder… while the original command uses the $HOME before moving.
For a behavior similar to the original command line, just use:
crunchooter -othe image will open in your default program…
add -c option to compress using optipng:
crunchooter -octhe image is compressed into a sub process started in background and open in your default program… no wait.
# crunchooter --help
Usage: crunchooter [options]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-c, --compress use optipng to compress image
-o, --open open file using gnome-openExample of commands to install crunchooter in your ~/bin below:
cd ~/bin
wget http://88.174.112.74/share/debian/crunchooter.tar -O crunchooter.tar
tar -xvf crunchooter.tar
rm -v *.tarSome displays debugging can still be seen in the terminal. It's still fresh ... please disregard. Additional options could happen in the future, like a countdown. If you have ideas and / or suggestions, please.
Last edited by ~HP (2010-02-21 19:34:15)
Offline
Looks interesting, I will try and give it a try later tonight. 
Offline
I came back to this topic so that I could download the script and give it a try, but I cannot find it. Did you post a link to it, or am I just having a moment? 
Offline
Did you post a link to it, or am I just having a moment?
wget http://88.174.112.74/share/debian/crunchooter.tar -O crunchooter.tar
I was working on adding the sound of the camera…
… like in Mac OS X.
Last edited by ~HP (2010-02-21 21:25:00)
Offline
Doh! My mistake, sorry. 
Offline
Good script
I messed around with it to use internal python functions like gtk.gdk to take the screenshot and PIL to optimize the png because usually that ends up running faster. In this case though using the external commands actually is faster. If you want I can post the code, but if you use gtk.gdk for screens it takes about .3 seconds longer on my machine, can't vouch for the actual memory or cpu usage, but it would be usable on machines without scrot. Using PIL is much slower than optipng, but neither of them actually compressed the image any.
edit: also you can get rid of commands, subprocess also has getstatusoutput
I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.
Offline
edit: also you can get rid of commands, subprocess also has getstatusoutput
exact… but I use subprocess when I don't want to wait… except with gnome-open.
in the coming days, I will update the script, on my server, with modifications, to use SHOTSDIR, instead of a variable hardcoded. if someone has a good piece of code in python to read wav or mp3, it would be useful to me; at the moment I'm using sox to read a wav! I tried pyglet and pygame with mixed results.
Offline
if someone has a good piece of code in python to read wav or mp3 […]
I found an huge piece of code using pygst (Python GStreamer), works well…
crunchooter doesn't use /tmp anymore… now, it saves screenshots directly to the right path!
It could use env SHOTSDIR, and I think to add an option to force another path directly from the command line.
Update could arrive in coming days.
Offline
New version…
Usage: crunchooter [options]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-c, --compress use optipng to compress image
-o, --open open file using gnome-open
--silent disable the noise that accompanies taking a screenshotUses threading trying to improve performance (may be), uses a maximum total of 4 threads. Play a sound when taking a screenshot… depends on pygst (pthon-pygst). Comments, ideas and / or suggestions welcome.
Last edited by ~HP (2010-02-23 13:28:46)
Offline
If anyone's interested, I just made a bash script that gives a time-out before taking the picture. I called it "deskgrab" but it could be anything; it's really just two commands strung together. The only reason why I made one was so I could put it in menu.xml (and I don't code, so I'm proud of it anyway
) Basically it's this:
#! /bin/bash
sleep $1 && crunchooter -oc
exit 0The argument is how long to sleep. I didn't know how to put the "s" after the number so it's just put in the argument for deskgrab. Just thought I'd pass that along...
Punch all your friends.
Offline
[…] Basically it's this:
#! /bin/bash sleep $1 && crunchooter -oc exit 0The argument is how long to sleep. I didn't know how to put the "s" […]
#!/usr/bin/env bash
sleep ${1}s && {
crunchooter -oc 2> /dev/null
exit $?
}
exit 1Use a redirection to avoid debugging information (which is printed on stderr), an option to display them will come soon; they will be hidden by default.
About shebang : http://www.in-ulm.de/~mascheck/various/shebang/
Use an exit code corresponding to the exit code returned by the last "function" $?
Continue to learn bash, it's a good start
.
Last edited by ~HP (2010-02-23 20:08:50)
Offline
Updated…
# crunchooter --version
crunchooter 1.1aBetter use of threads
Debug option
No more boring output
# crunchooter --help
Usage: crunchooter [options]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-c, --compress use optipng to compress image
-o, --open open file using gnome-open
--silent disable the noise that accompanies taking a screenshot
--debug print some debugging information# crunchooter -oc --debug
Wait: 2010-02-23-1266956166_1680x1050_scrot.png (0:00:00.371891)
Wait: 2010-02-23-1266956166_1680x1050_scrot.png (0:00:00.909249)
Execution time: 0:00:01.209342Most of time seems to pe spent waiting for scrot… almost 1 seconds… 2 waiting time should not be added because it comes from two processes running in parallel,, so I think we should retain only the larger of the two.
Last edited by ~HP (2010-02-23 20:21:15)
Offline
Just a suggestion: change -o so it can accept a program. For example -o gimp.
Note: ** Please read before posting **
BTW if you wish to contact me, send me an e-mail instead of a PM.
Offline
Added with this kind of syntax:
# crunchooter --open-with=gimpcause I think, simple options like -o and --open are the simplest and the most generic; and if you choose an editor there is no need to compress the image which will be edited.
# crunchooter --help
Usage: crunchooter [options]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-c, --compress use optipng to compress image
-o, --open open using gnome-open
--open-with=APP open using application APP
--debug print some debugging information
--silent disable the noise that accompanies taking a screenshotWill be released soon.
Offline
Updated on my server…
see first post for instructions.
Offline
New option delay will coming soon:
there will be no need for relying on bash script! 
Last edited by ~HP (2010-02-24 19:02:57)
Offline
^^AH you got me! I'll just slip into oblivion....

I hope that chain of smilies worked to show my true emotion.
Punch all your friends.
Offline
mahatman2 
New version… new options…
restores the option to select, using mouse, from scrot
implement a stupid option in order to mimic screencapture under Mac OS X, which names screenshot 'Image n+1.png'
Indeed, crunchooter was inspired by CrunchBang one hand and the other by Mac OS X (especially for the sound played).
I use --select option like this, in my rc.xml:
<keybind key="Print">
<action name="Execute">
<execute>crunchooter -oc</execute>
</action>
</keybind>
<keybind key="S-Print">
<action name="Execute">
<execute>crunchooter -ocs</execute>
</action>
</keybind>
<keybind key="A-Print">
<action name="Execute">
<execute>crunchooter -ocd10</execute>
</action>
</keybind>Offline
Pages: 1
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.