1 mypalmike Apr 21, 2008 10:30
3 mypalmike Apr 21, 2008 20:25
Thanks for your kind feedback.
The script got slightly messed up when posting here...
regex_sglquote = re.compile( 'XXX' )
'XXX' here should be '[ampersand]039[semicolon]' instead of just a single quote character.
There may be other problems - I happened to just notice this one. I will place the script on my site tonight so that it can be downloaded without this issue. See the "external links" section of www.mypalmike.com.
FYI... I switched to b2evolution because sphpblog was getting very slow with the growing size of my content. People who regularly visited and commented sent me email complaining about the performance - things like one minute delays after clicking "post comment". I presumed, apparently correctly, it was due to the fact that the content in sphpblog is stored in files rather than a db, making efficient indexing impossible. The script I posted converted my ~400 entries and ~5000 comments (including comment spam... grrr!) with no obvious problems. The resulting site is leaps and bounds more responsive. :) Thanks to the b2evolution developers for making such a cool piece of software. (Simplephpblog is also a very cool piece of software, I might add.)
Even though the script is meant to be fairly generic, there is certainly stuff that will not convert properly with this script, as it was designed somewhat based on the tags that existed in my own content. For instance, all my img tags point to images on the relative path 'images/' on my site, so img tags which reference external sites will not translate properly.
4 r_kleineisel Sep 23, 2008 16:54
I have a small addition to this great script. This will import posts with more than 1 category. Probably not very elegant, but I don't know anything of python. You should have written this in perl ;-)
def emitentry( entry ):
dict = parse( entry )
author = defaultauthor
if dict.has_key( 'AUTHOR' ) and ( not alwaysoverrideauthor ):
author = dict ['AUTHOR']
title = dict[ 'SUBJECT' ]
epochTimestamp = float( dict[ 'DATE' ] )
timestamp = datetime.utcfromtimestamp( epochTimestamp ) + delta
# Author must come first for b2evolution importer...
print 'AUTHOR:', author
print 'TITLE:', title
print 'DATE:', timestamp.strftime( "%m/%d/%Y %H:%M:%S")
prim_category = 'Uncategorized'
if dict.has_key( 'CATEGORIES' ):
cats = dict['CATEGORIES']
cats = cats.split(',')
prim_cat = cats[0]
cats.remove(prim_cat)
prim_cat_num = int( prim_cat )
if categorymap.has_key( prim_cat_num ):
prim_category = categorymap[ prim_cat_num ]
for cat in cats:
cat_num = int(cat)
if categorymap.has_key( cat ):
catname = categorymap[ cat ]
print "CATEGORY:", catname
print 'PRIMARY CATEGORY:', prim_category
# print 'STATUS: publish'
# print 'ALLOW COMMENTS: 1'
# print 'ALLOW PINGS: 0'
print '-----'
print 'BODY:'
print filterBody( dict['CONTENT'] )
print '-----'
5 amaxson Jul 09, 2010 06:47
This is exactly what I was looking for. Unfortunately when I try to execute the script it makes it through three blog entries before returning the following error.
File "sphpblog.py", line 66, in parse
dict[parts[idx]] = parts[idx+1]
IndexError: list index out of range
Hopefully someone here speaks Python, because I don't, and I have 7 years of blog entries to convert. Any ideas?
mypalmike wrote:
i haven't tried this for myself but it looks like you are blazing the trail for a lot of people that would like to switch but don't want to loose their audience...good job!
~mochababy~