August 2005
Beginner
464 pages
12h 36m
English
Use an email parser on your ISP server to automate podcasting to Movable Type.
Wouldn’t it be great if you could email your podcasts to your weblog and have them posted automatically? The text content of the message becomes the podcast entry, the subject becomes the title, and any attachments are put into the right spot and are linked into the body of the blog entry.
This simple Perl script does just that.
Save this code as poster.pl:
use FileHandle; use MIME::Base64; use strict; # The base MovableType directoryuse constant MT_DIR =>"/Library/WebServer/CGI-Executables/mt/";# The blog ID to post touse constant BLOG_ID => 1;# The blog login and passworduse constant BLOG_LOGIN =>"Melody";use constant BLOG_PASSWORD =>Nelson";# The UNIX directory where the podcasts should gouse constant PODCAST_DIR =>"/Library/WebServer/Documents/podcast/";# The base URL to use for the podcastsuse constant PODCAST_URL =>"http://myhost.com/podcast/";BEGIN { unshift @INC, MT_DIR . 'lib'; unshift @INC, MT_DIR . 'extlib'; } use MT::XMLRPCServer; use SOAP::Lite; $MT::XMLRPCServer::MT_DIR = MT_DIR; use constant WAITING_FOR_BOUNDARY => 1; use constant IN_HEADER => 2; use constant IN_BODY => 3; my $boundary = undef; my $state = WAITING_FOR_BOUNDARY; my $header = ""; my $body = ""; my $subject = undef; my $textbody = undef; my $podcasturl = undef; sub process($$) { my ( $header, $body ) = @_; if ( $header =~ /text\/plain;/ ) { $textbody = $body; } if ( $header =~ /audio\/mpeg/ ...
Read now
Unlock full access