-
-
Save zag/29245af11c4e1546d6669537a83c608c to your computer and use it in GitHub Desktop.
My Perl Wrapper for Xvfb and CutyCapt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use warnings; | |
use Getopt::Long; | |
use vars qw($url $out); | |
my $HOME = $ENV{'HOME'}; | |
my $opt = GetOptions("url=s" => \$url, | |
"out=s" => \$out, | |
); | |
print "Preparing to thumbnail $url to $out\n"; | |
my $xvfb = '/usr/local/bin/Xvfb :2 -screen 0 1024x768x24 -once -reset -terminate'; | |
my $qtcapt = "$HOME/bin/CutyCapt --url=$url --out=$out --auto-load-images=on"; | |
my $pid = fork(); | |
if($pid) { | |
sleep 2; | |
} | |
elsif($pid == 0) { | |
print "Beginning Xorg Virtual Framebuffer Process\n"; | |
my $return = system($xvfb); | |
#print "xvfb: $return\n"; | |
exit $return; | |
} | |
$ENV{'DISPLAY'} = ":2.0"; | |
print "Converting $url to $out\n"; | |
my $qtproc = system($qtcapt); | |
print "Status Complete. Return Value: $qtproc\n"; | |
exit $qtproc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment