« First picture of Lowe's servaline genet | Main | Stupid Plot Tricks »

Merging blogs in Movable Type

Turns out merging Death Upon My Shoulder into MMG was as easy as writing and running this:

#!/usr/bin/perl

use lib "/my/cgi-bin/lib";
use MT;
use MT::Entry;
use strict;

my $mt = MT->new (Config => '/my/cgi-bin/mt.cfg');
my @entries = MT::Entry->load({blog_id => 3});
for my $entry (@entries) {
$entry->blog_id(2);
my $text = $entry->text;
$text .= $entry->convert_breaks ? "\n" : "<p>";
$text .= '[Originally posted to <a href="http://www.mememachinego.com/archives/ 000194.html#000194">Death Upon My Shoulder</a>; <a href="http://www.mememachinego.com/archives/ 000254.html#000254">subsequently merged</a> into MemeMachineGo!]';
$text .= "</p>" unless $entry->convert_breaks;
$entry->text($text);
$entry->save;
}


Now that I know how to manipulate MT programmatically, there are all sorts of things I could do (that I probably will never make the time for.) If the next version of MT still doesn't have posting by email, I'll write it myself so Jym can finally do all his composition in Emacs and not resort to text editing in a browser (actually that would be my preference as well.)

Thanks to Ben Trott for his pointer in the MT Support Forum.

Comments

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)