#!/usr/bin/perl -w ### # Perl modules that need to be installed ### use MIME::Parser; use MIME::Entity; use MIME::Base64; use XMLRPC::Lite; # Define the name of the script just for reference $scriptName = "handBall-login.pl"; #%INPUT_VARS = {}; #&input_vars_receive; #&input_vars_parse; #&populateQueryFields; #$imgRef = $queryString{ "img" }; #$userNameValue = $INPUT_VARS{"img"}; #$imgRef = $INPUT_VARS{"img"}; #$ENV{"img"} $imgRef = $ENV{"QUERY_STRING"}; ### # User Configurable Variables ### my $temp_folder = "/home/.fidel/catmindeye/catmindeye.com/temp"; ## CHANGE THIS LINE my $attachment_output_folder = "/home/.fidel/catmindeye/catmindeye.com/videoposts"; ## CHANGE THIS LINE my $attachment_output_folder_relative = "/videoposts"; ## CHANGE THIS LINE my $blog_xmlrpc_url = "http://www.catmindeye.com/mt/mt-xmlrpc.cgi"; ## CHANGE THIS LINE my $blog_id = 7; ## CHANGE THIS LINE my $blog_username = "cat"; ## CHANGE THIS LINE my $blog_password = "thurston"; ## CHANGE THIS LINE ### # Other Variables that *may be* changed ### my $max_chars = 70; # Number of chars to allow in a line of text from an incoming message my $delete_messages = 1; # Delete messages from your inbox as they are processed my $delete_temp_files = 0; # Delete temporary files that are created my $print_output = 1; # Print output my $post_to_blog = 1; # Post to your blog? my $use_gif = 0; # 1 to allow GIF's as attachments, 0 to not allow them (T-Mobile issues) my @bad_attachments = ("masthead.jpg"); # A list of attachment filename regular expressions that you don't want included my $umask = '0002'; # File creation to 775, 0022 would be 755 my %mime_types = ("image\/jpeg", "jpg", "image\/jpg", "jpg", "image\/gif", "gif", "video\/3gpp", "3gp", "audio\/x-wav", "wav", "video\/mp4", "mp4", "video\/3gpp2", "3g2", "video\/mpeg", "mpg", "video\/quicktime", "mov", "video\/x-quicktime", "mov", "video/x-msvideo", "avi" ); # A list of the attachment mime types to extract ### # Main Program Execution ### if ($print_output) { print("Running at: " . localtime() . "\n"); } #spec the directory where java puts the images $imgDir = "http://www.catmindeye.com/temp/"; if ($post_to_blog) { my $attachment_html = ""; for (my $i = 0; $i <= $#attachments; $i++) { my $attachment = $attachments[$i]; my $attachment_type = $attachments_type[$i]; my $attachment_relative = "$imgDir$imgRef"; if ($attachment_type eq "jpg" || $attachment_type eq "gif") { $attachment_html .= "\n"; } elsif ( $attachment_type eq "3gp" || $attachment_type eq "wav" || $attachment_type eq "mp4" || $attachment_type eq "3g2" || $attachment_type eq "mpg" || $attachment_type eq "mov" || $attachment_type eq "avi" ) { $attachment_html .= "

"; } } my $postresult=XMLRPC::Lite ->proxy($blog_xmlrpc_url) ->call('metaWeblog.newPost',$blog_id,$blog_username,$blog_password, { 'title'=>"From Java", 'description'=>"", 'mt_allow_comments'=>1, 'mt_allow_pings'=>1 }, 1 ) ->result; if ($print_output) { print "Post to Blog Result: " . $postresult . "\n"; print "--------------------------\n"; } } elsif ($print_output) { print "Not Posted to Blog"; print "--------------------------\n"; } if ($delete_temp_files) { $parser->filer->purge; } ######################################################### # Takes data from an HTML Form or URL string ######################################################### #sub input_vars_receive #{ $formData = $ENV{'QUERY_STRING'}; # if ($ENV{'REQUEST_METHOD'} eq 'POST') # { read(STDIN, $formData, $ENV{'CONTENT_LENGTH'}); # } else # { read(STDIN, $formData, $ENV{'CONTENT_LENGTH'}); # } #} ######################################################### # Parses form info ######################################################### #sub input_vars_parse #{ local($name,$value,$pair); # local(@pairs) = split(/&/, $formData); # Get parameter names, their values and copy into $INPUT_VARS array # foreach $pair (@pairs) # { ($name,$value)=split(/=/,$pair); # $value=~tr/+/ /s; # $value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; # $INPUT_VARS{$name}=$value; # } #}