Convert from AMM to Now Reading

As part of my upgrading to the latest/greatest version of WordPress, I switched over to using the Now Reading plugin from AMM. I switched because development on AMM seems to have come to a complete halt and it was acting somewhat flaky prior to the upgrade. One of the big problems with switching over was I didn’t want to have to manually enter in all books I’d already read and rated. As Now Reading supports storing so much more data, I had to write a bit of custom SQL to import my existing info. It’s not a great solution, mostly because AMM didn’t store all of the same info (e.g. date entered, started and finished).
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 everything setup as well as could be expected given the differences in the data. Below is a list of the assumptions I made in writing this script to convert 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 Reading has additional 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 specific book. The format of the “b_nice_” fields seems to be to replace anything other than a letter or a number with a hyphen and to have all the letters be lower case. I tried to make sure I did the same with my script, however you may need to double-check your data before running this to make sure I didn’t miss a symbol you used.
  • I marked all the books I was copying over as “read”.
  • AMM only allowed ratings of 1 – 5; while Now Reading allows 1 – 10. So when I copied the ratings over, I doubled them.

NOTE: If you have questions about this script, post them in the comments here. Keep in mind that I’m not providing full fledged support for the script and if you don’t know how to run this without asking, then you probably shouldn’t be messing with it. Also, if you’re really going to try running this script, then for god’s sake backup your database FIRST!

Related Posts