Committer: bradfitzeasier fake phoneposting.
default wav file, and run the phonepostd daemon (in --once mode) for you
U trunk/bin/lj-fake-phonepost.pl
Modified: trunk/bin/lj-fake-phonepost.pl
===================================================================
--- trunk/bin/lj-fake-phonepost.pl 2006-10-06 05:20:27 UTC (rev 3610)
+++ trunk/bin/lj-fake-phonepost.pl 2006-10-06 06:55:51 UTC (rev 3611)
@@ -12,19 +12,22 @@
sub usage {
my $msg = $_[0] ? "\n$_[0]\n\n" : "";
- die "${msg}usage: $0 [OPTS]
+ die "${msg}usage: $0 [OPTS] []
OPTS:
--implicit Act like user hung up during the call
--security= One of 'public', 'private', 'friends'
+ --runspool Run the spool processor once to inject into LJ
"
}
my $opt_implicit = 0;
+my $opt_run = 0;
my $opt_security = "public";
usage() unless GetOptions(
- "implicit" => \$opt_implicit,
+ "implicit" => \$opt_implicit,
"security=s" => \$opt_security,
+ "runspool" => \$opt_run,
);
$opt_implicit = 1 if $opt_implicit;
@@ -33,7 +36,11 @@
unless $opt_security =~ /^public|private|friends$/;
my ($user, $file) = @ARGV;
-usage() unless scalar @ARGV == 2 && -e $file;
+usage() unless scalar @ARGV == 1 || scalar @ARGV == 2;
+$file ||= "$ENV{LJHOME}/var/devdata/evillaugh.wav";
+if ($file && ! -e $file) {
+ die "File '$file' doesn't exist";
+}
use lib "$ENV{LJHOME}/cgi-bin";
require "ljlib.pl";
@@ -59,6 +66,10 @@
EOF
close QINFO;
+ if ($opt_run){
+ system("$ENV{LJHOME}/other_sites/phonepost/phonepostd.pl --once");
+ }
+
}
else {
die "Unable to copy wav into place: $!\n";