Categories
Know the Code

More Moblogging…

By the way, Mike, who is so wonderful as it is, created a script for me so I could moblog to MT using a SprintPCS phone. (The MT plugin that is out there won’t work for Sprint’s funky system.) I haven’t bothered to make it pretty yet, but you can see the photos here. Much fun was had tonight, and I’ll post all of my photos online soon – have to enjoy this Samarita first though…

If you want the SprintPCS Moblog code, Mike can hook you up.

By Christine

Christine is an Avenger of Sexiness. Her Superpower is helping Hot Mamas grow their Confidence by rediscovering their Beauty. She lives in the Heights in Houston, Texas, works as a boudoir photographer, and writes about running a Business of Awesome. In her spare time, she loves to knit, especially when she travels. She & her husband Mike have a food blog at Spoon & Knife.

10 replies on “More Moblogging…”

Too cool! I JUST JUST JUST got a camera phone myself. GSM coverage in my area was not too good up until now. I got a camera phone on Friday (nokia 3650, love it!) and set up a moblog at textamerica.com on Saturday before my day-trip to Ft. Lauderdale. I’m totally addicted. I love your new moblog, it’s really neat!

Actually, you don’t want this script if you have a Nokia 3650 phone because I’m assuming that you don’t use Sprint. If you use T-Mobile or one of the many other phone companies, you would want the other plugin.

I’ve already asked him to write it up for Scripty, but he hasn’t had time yet. Soon…

I would love the code, as I haven’t figured out how to moblog with my Sprint PCS phone. It’s a Sanyo SCP-5300, if that makes any difference. Can he/you e-mail it to me? Pretty please?

I use mt Sony T-610 and Bluettoth to post to my MoBlog via a PocketPC. It works great and a new tool for that was released this morning. Its a “desktop” client for the PocketPC called Pocket SharpMT (ie its the companion to SharpMT). It was designed for Moveabletype and it works great!

Its at http://www.randyrants.com/sharpmt

Does the SprintPCS script require some sort of Procmail filtering?

I was attempting to use Mfop2 to post to MT, but just realized what a pain-in-the-butt my Sprint service will be.

The Mfop2 service seems to work, but instead of a picture post I get a generic Sprint message directing me to their album site.

hey 🙂 coudl u please share this lovely code with us? i tried to email your buddy mike but he never got back to me (fully understandable…but damnnnn i want to get this goin with my sprint phone too)

thanks!

this is what Mike sent me, though I have no idea what to do with it:

###############
## moblog-filter.pl
##
## Author: Mike Tremoulet
##
## This script provides a procmail-capable filter to process
## shared pictures from Sprint PCS phones. Incoming mail should
## basically be piped to this program
##
## Version: 0.2
## Date: 19 July 2003
##
## CHANGELOG:
## 18 July 2003 0.1 initial release
## 19 July 2003 0.2 added Image::Magick resize code
## added comment support
###############

# Do not change these four lines.
use strict;
use warnings;
use LWP::UserAgent;
use Net::Blogger;
use Image::Magick;

### BEGIN CONFIGURATION INFORMATION

# Absolute filesystem path to image directory WITH TRAILING SLASH.
my $image_path = “/path/to/images/”;
# Absolute URL for the image directory WITH TRAILING SLASH.
my $image_url = “http://www.example.com/moblog/images/”;

# Config parameters for Net::Blogger
# Engine URL – where the Blogger API-compliant server is. Required if
# target engine type is not blogger.
my $engine_url = “http://www.example.com/mt-xmlrpc.cgi”;
# Engine type – valid values are “blogger”, “movabletype”, “manila”, etc.
my $engine_type = “movabletype”;
# Blog name – the name of the blog known to the server. Case sensitive.
my $blogname = “Moblog”;
# Username and password for the blog system
my $username = “username”;
my $password = “password”;
# Do we publish the post or not? 1 = yes, 0 = no
my $publish = 1;

### END CONFIGURATION INFORMATION

### DO NOT TOUCH BELOW THIS LINE
my ($line, $uri, $filename, $fullfilename, $agent, $response, $comment);
my $commentregex = “(.*)”;

while (my $line = >) {
chomp($line);
if ($line =~ m/(http:\/\/pictures\.sprintpcs\.com\/shareImage\/([0-9_]+\.jpg)\?)border=.+?(invite=[^””]+)/i) {
$uri = $1 . $3;
$filename = $2;
$fullfilename = $image_path . $filename;
}
elsif ($line =~ m/$commentregex/) {
$comment = $1;
}
}

$agent = LWP::UserAgent->new();
# set the agent to spoof Sprint to realize we’re not a mobile device
$agent->agent(‘Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)’);
$response = $agent->get($uri);

if ($response->is_success()) {
open(FILE, “>$fullfilename”) || die(“Unable to open file $fullfilename.”);
binmode(FILE);
print FILE $response->content;
close(FILE);
}
else {
# need better error handling
die(“Problem retrieving image file: ” . $response->status_line);
# print $response->status_line;
}

# Now we resize the image to 1/4 its original.
my $thumbfilename = $image_path . “thumb_” . $filename;
my $thumburl = $image_url . “thumb_” . $filename;

my $image = Image::Magick->new;
$image->Read(filename=>$fullfilename);
$image->Resize(width=>$image->Get(‘width’)/2, height=>$image->Get(‘height’)/2);
$image->Write(filename=>$thumbfilename);

# Go post to the blog.
my $apisvr = Net::Blogger->new(engine=>$engine_type, username=>$username, password=>$password);
$apisvr->Proxy($engine_url);
$apisvr->BlogId($apisvr->GetBlogId(blogname=>$blogname));

# my $postbody = “”;
my $postbody = ““;

if ($comment) {
$postbody = $postbody . “
” . $comment;
}

$apisvr->newPost(postbody=>\$postbody, publish=>\$publish);

lemme know if you figure it out.

Comments are closed.