Convert from AMM to Now Reading

As part of my upgrad­ing to the latest/greatest ver­sion of Word­Press, I switched over to using the Now Read­ing plu­gin from AMM. I switched because devel­op­ment on AMM seems to have come to a com­plete halt and it was act­ing some­what flaky prior to the upgrade. One of the big prob­lems with switch­ing over was I didn’t want to have to man­u­ally enter in all books I’d already read and rated. As Now Read­ing sup­ports stor­ing so much more data, I had to write a bit of cus­tom SQL to import my exist­ing info. It’s not a great solu­tion, mostly because AMM didn’t store all of the same info (e.g. date entered, started and fin­ished).
INSERT INTO wp_now_reading(b_added, b_started, b_finished, b_title, b_nice_title, b_author, b_nice_author, b_image, b_asin, b_status, b_rating, b_review)
SELECT amm_dateadded, amm_dateadded, amm_dateadded, amm_title,
REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(LCASE(amm_title), ',', '' ), ')', '' ), '(', '' )
, ' ', '-' ), '...', '-' ), ':', '-' )
, '!', '-' ), '?', '-' ), '&', '-' )
, '\'', '' ), '--', '-' ), amm_author, REPLACE(REPLACE(REPLACE( LCASE( amm_author ) , '.', '' ) , '&', 'and' ) , ' ', '-' ), amm_smallImageURL, amm_asin, 'read', amm_rating *2, amm_userComments
FROM wp_amm amm
WHERE amm_ProductGroup = 'Book' AND amm_asin NOT IN (SELECT b_asin FROM wp_now_reading);

This short script copied over all my books for me and got every­thing setup as well as could be expected given the dif­fer­ences in the data. Below is a list of the assump­tions I made in writ­ing this script to con­vert to Now Reading:

  • AMM only stores one date, so I used that for all dates on the books I copied over.
  • The above script limit itself to books and skips any already in your wp_now_reading table.
  • Now Read­ing has addi­tional fields the title & author. I’m not sure what the “b_nice_author” field is used for, but the “b_nice_title” is used when you go to edit a spe­cific book. The for­mat of the “b_nice_” fields seems to be to replace any­thing other than a let­ter or a num­ber with a hyphen and to have all the let­ters be lower case. I tried to make sure I did the same with my script, how­ever you may need to double-check your data before run­ning this to make sure I didn’t miss a sym­bol you used.
  • I marked all the books I was copy­ing over as “read”.
  • AMM only allowed rat­ings of 1 — 5; while Now Read­ing allows 1 — 10. So when I copied the rat­ings over, I dou­bled them.

NOTE: If you have ques­tions about this script, post them in the com­ments here. Keep in mind that I’m not pro­vid­ing full fledged sup­port for the script and if you don’t know how to run this with­out ask­ing, then you prob­a­bly shouldn’t be mess­ing with it. Also, if you’re really going to try run­ning this script, then for god’s sake backup your data­base FIRST!

Similar Posts

About Mark McKibben

Mark works as a [REDACTED] for [REDACTED], currently residing in Iowa. CoffeeBear.net is a place for him to blather on about whatever strikes his fancy. He currently spends his "free" time working on a photography project, playing with his cat and attempting to keep his wife happy (not necessarily in that order).

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.