Release SnapSnap: Take easy screenshots (repo release)


Caine

Hardcore Member
Joined
Jun 5, 2008
Messages
4,138
Location
Netherlands
Anyway, I will do a small update tomorrow with preconfigured hotkey and hopefully SD card saving. My current save path is /media/mmcblk0p1/screenshots, but I'm not sure if SD labels will prevent that working for some people. Some reading to do on that in the morning.
That will most certainly not work for all people, with the path to my SD card being "/media/KARL/screenshots" for example :S
Then use something like this:



Code:
mount | grep /dev/mmcblk0 | awk '{print $3}'
 

notaz

Certified Guru
Joined
Aug 23, 2005
Messages
4,913
Location
Lithuania
Website
notaz.gp2x.de
The question of hotkey is still open..

We could slide it into pndevmapperd's config maybe so that it could take a snapshot even when SDL is up, but I like to minimize the number of things evmapperd worries about; still, it handle sthings like brightness up/down, so should be able to handle a snapper pretty easily
And it seems pndevmapperd can only do single keys that an app might be using for itself, say we use F12 but something like qemu could need it too and you'd end up with heaps of unwanted screenshots.
 

gruso

thunderbox
Joined
Feb 28, 2008
Messages
7,461
Age
44
Location
Sydney, Australia
Website
pandorapress.net
Thanks Caine. I'll need to set a variable then, to be used in the next part of the script. (First time playing with this kind of thing). This is working for me so far:



Code:
mount | grep /dev/mmcblk0 | awk -v avar=$dir '{print $3}'

mkdir $dir screenshots



The above is just the install script. The screengrab script itself will need to grep again for the save path (haven't tested this one yet):





Code:
mount | grep /dev/mmcblk0 | awk -v avar=$dir '{print $3}'

fbgrab $dir/screenshots/filename.png


A couple of thoughts..

  • The 'print' function seems superfluous to me, I just want to set a variable. But I get polite suggestion on usage if I don't include it. Insight on this?
  • Perhaps I could do away with folder creation in the install script all together, and just have the screengrab script check the location, and create the folder if needed before saving the shot. That feels a little inefficient to me, but it would mean it doesn't matter which SD card you have in.


Notaz, I'd love to see this in firmware of course. I'm going to keep playing in the meantime though. :) My default hotkey will be F10 for simplicity (easily user changed) but this may not suit an official version. I worry about anything involving Alt or Ctrl, as these buttons can interrupt the game you're trying to capture.
 
Last edited by a moderator:

fusion_power

Advanced Member
Joined
Dec 25, 2005
Messages
13,134
Location
germany
Website
Visit site
If the Pandora would have a "PRINT" key, the Problem already would be solved. :D I guess, the PRINT function works under Linux like it works under Windows (just putting a hardcopy screengrab in the Clipboard) so it should be already somewhere in Angstrom, I hope. The only bug that annoyes me in Angström on the Pandora is, that the clipboard is always emptied when closing the app you have copied from (text, links...for example). This should be fixed first.
 
Last edited by a moderator:

gruso

thunderbox
Joined
Feb 28, 2008
Messages
7,461
Age
44
Location
Sydney, Australia
Website
pandorapress.net
Perhaps an official version should have no default key, but an easy config dialogue where users set their preference. This worked fine in gshot on the GP2X, where input options were very limited - you would just set something sensible before launching a game.
 

GiraffeeDreams

Always Dreaming
Joined
May 19, 2011
Messages
784
Age
33
Location
Houston, Tx.
Perhaps an official version should have no default key, but an easy config dialogue where users set their preference. This worked fine in gshot on the GP2X, where input options were very limited - you would just set something sensible before launching a game.

That's what I had in mind to begin with, binding it with CTRL + S for example, may make PicoDrive bring up the menu, so making it easily interchangable is quite important.
 

Caine

Hardcore Member
Joined
Jun 5, 2008
Messages
4,138
Location
Netherlands
Thanks Caine. I'll need to set a variable then, to be used in the next part of the script. (First time playing with this kind of thing). This is working for me so far:



Code:
mount | grep /dev/mmcblk0 | awk -v avar=$dir '{print $3}'

mkdir $dir screenshots



The above is just the install script. The screengrab script itself will need to grep again for the save path (haven't tested this one yet):





Code:
mount | grep /dev/mmcblk0 | awk -v avar=$dir '{print $3}'

fbgrab $dir/screenshots/filename.png



A couple of thoughts..
  • The 'print' function seems superfluous to me, I just want to set a variable. But I get polite suggestion on usage if I don't include it. Insight on this?
  • Perhaps I could do away with folder creation in the install script all together, and just have the screengrab script check the location, and create the folder if needed before saving the shot. That feels a little inefficient to me, but it would mean it doesn't matter which SD card you have in.


The print in the awk script just tells the script to dump $3 (i.e. the third column) to the standard output (i.e. print it to the terminal).



If you only reference the result of the awk script once, then you do not need to create a variable for it:





Code:
mkdir $(mount | awk '/^\/dev\/mmcblk0p/ {print $3}')/screenshots

In this particular case, I eliminated grep as awk can actually do the matching itself. The term '/^\/dev\/mmcblk0p/ is a regular expression which looks for /dev/mmcblk0p at the beginning of a line (the / needs to be escaped).



The form of the Awk script here is: '/search_pattern/ {action}', which means that action is executed if a line matches the regular expression search_pattern



If you need that value multiple times in the same shell script then simply assign the result to a variable like this:



Code:
dir=$(mount | awk '/^\/dev\/mmcblk0p/ {print $3}')

mkdir $dir/screenshots

name=screen$(date +%y%m%d-%H%M%S).png

fbgrab $dir/screenshots/$name

notify-send 'captured screen as' $name

The optional notify-send will show a small popup dialog in the bottom right corner of your screen.
 
Last edited by a moderator:

gruso

thunderbox
Joined
Feb 28, 2008
Messages
7,461
Age
44
Location
Sydney, Australia
Website
pandorapress.net
Thanks very much Caine. :) I was having an issue with my script working from SD but not NAND; but using your newer examples everything is working fine. Just need to incorporate Notaz' fb overlay trick, have lunch, then upload a new beta.


@Mario - Glad you drew attention to that, I didn't notice it. I'll keep the focus on single shots for now, but once that is all ironed out we might look at timed stuff!
 

gruso

thunderbox
Joined
Feb 28, 2008
Messages
7,461
Age
44
Location
Sydney, Australia
Website
pandorapress.net
Ok screenshot fiends, a little treat courtesy of another tool hidden away on the Pandora:



Code:
watch

Install SnapSnap, then open a terminal and:





Code:
watch -n 15 snapsnap

...swapping "15" for your interval of choice in seconds. Now go and play something, and your screenshot folder will fill up. When you're done, hit ctrl-c back in the terminal to end.


You will notice errors in the terminal, thanks to my dirty script which attempts to create the screenshot folder every time. This is normal, but usually out of view. I should probably set it up to check for the folder before trying to create it. It works though :/


Who wants a gallery? http://imgur.com/a/h5AyK
 
Last edited by a moderator:

MarioPandio

Well-Known Member
Joined
Aug 28, 2010
Messages
1,378
Location
Half way up the stair
You had me craning in there for the PandElite pic to see your progress for some reason! Damn games of yesteryear have such severe power.


So this will work from your original uploaded SnapSnap.pnd and the watch terminal command?
 

gruso

thunderbox
Joined
Feb 28, 2008
Messages
7,461
Age
44
Location
Sydney, Australia
Website
pandorapress.net
Yep. Once you've run the SnapSnap PND, the script is installed to NAND and can be used like any other shell command. So run the PND once, then at any time later you can open a terminal and do this.


(No progress in any of these games really, it's a fresh SD card. Not that I'd have much to show for Elite anyway!)
 

MarioPandio

Well-Known Member
Joined
Aug 28, 2010
Messages
1,378
Location
Half way up the stair
Nice but something isnt quite working to plan here. Give us a sec to upload pics.


The screenshots folder gets created on the root of the SD fine. The f10 hotkey works fine. As does the watch <whatevertiming> command and ctrl-c to end it again in the terminal and it notifies about each snapshot but it isn't saving to that folder, or any directory I have found so far.


I then hooked up via SD mass storage to upload pics of screenshots within a screenshot of a screenshot just for a laugh, as I was able to take static or continuos pics with my scripts during your scripts and via them on the pandora thereafter, until I hooked up to SD mass storage. Then there is no screenshots folder (which was empty) and no longer any pics I had taken with my scripts of your scripts any more. It is getting early here and I shall try again, as I should have rebooted after the install and I reckon that will fix things.
 

gruso

thunderbox
Joined
Feb 28, 2008
Messages
7,461
Age
44
Location
Sydney, Australia
Website
pandorapress.net
Ok, you lost me in the second paragraph. Peter Piper picked a peck of yo dawg.


tl;dr My screenshots aren't saving, yours are? I haven't had to reboot, but do that anyway and let me know. Also:


- which hotfix are you on?


- try different cards in the left slot if you have them, note their details & labels if behaviour is different


- does 'snapsnap' on the command line produce an image?
 
Last edited by a moderator:

MarioPandio

Well-Known Member
Joined
Aug 28, 2010
Messages
1,378
Location
Half way up the stair
Correct and sorry about that,


edit : Brief


HF7a2


Card label BOOT (fat) and OS (ext2)


snapsnap on CLI produces an error related to OS partitions permissions perhaps.


Inane:


Creates screenshots folder in root of SD1 fine. Documentation works via links just fine. f10 fine, takes a snap and notifies. It adds itself into the keyboard shortcut menu as "snapsnap - f10". It doesn't actually save any images to the screenshots folder though.


Your last request of snapsnap on CLI is having an issue with the fact I am booting from SD via SD Installer.


It says it :


mkdir: cannot make it on the root partition (BOOT) where it has made it already as : file exists (the empty screenshots folder)


mkdir: cannot create directory ' media/ROOT/screenshots': permission denied (seems here is the issue perhaps?)


usage: fbgrab various details.


I will post images as they will be clearer.
 
Last edited by a moderator:

MarioPandio

Well-Known Member
Joined
Aug 28, 2010
Messages
1,378
Location
Half way up the stair
F10 hotkey


http://img819.imageshack.us/img819/9456/f10z.png


CLI snapsnap error





Screengrab of F10 working


http://img195.imageshack.us/img195/1245/ctrlsandf10.png


Toggled screengrab of f10 working


 
Top