Podcast by Email

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.

The Code

Save this code as poster.pl:

	use FileHandle;
	use MIME::Base64;
	use strict;
	# The base MovableType directory
	use constant MT_DIR => "/Library/WebServer/CGI-Executables/mt/";
	# The blog ID to post to
	use constant BLOG_ID => 1;
	# The blog login and password
	use constant BLOG_LOGIN => 
               "Melody";
	              use constant BLOG_PASSWORD => 
               Nelson";

	# The UNIX directory where the podcasts should go
	use constant PODCAST_DIR => "/Library/WebServer/Documents/podcast/";
	# The base URL to use for the podcasts

	use 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/ ...

Get Podcasting Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.