07
Jun

In case it hasn’t yet become abundantly clear, I’m something of a geek. A nerd too, pick you moniker of choice. But I’m going to step over the line and reveal something truly appallingly dorky even. Way back in the days of my youth, I was a young lass with an interest in computers. I’d messed around in Basic a tiny bit, but I actually spent a lot of my time in an application that was sort of a precursor to the spreadsheet, called MAGIC. Looking for info on it, there’s just a tiny blurb on this page on Wikipedia. My memories of the details of the program are hazy - I was probably ten years old at the time, so forgive the lack of detail. So I don’t quite remember how I did it, but what I did was write a database to keep track of my book collection.

You’re probably busy laughing at me right about now, but that’s ok. I have no shame of my youthful transgressions (or lack thereof). I read a lot and had a large collection of books, and keeping track of them, being able to sort them by title and author and all that jazz was just totally awesome to me. Flash forward to April 2006. I’ve got this blog and I’m trying to populate it with stuff. I’m searching out plugins and other nifty things to add to the site and I find the most wonderous thing - a plugin to track my books and what I’m reading! Rob Miller’s Now Reading let’s you search Amazon to find the book’s information, then stores the pertinent bits on your blog and let’s you rate it, review it, and say when you read it.

If you’re reading my blog in an aggregator, you’re missing out on the constantly updating sidebar where I list out books I’m reading. Don’t worry, you’re not missing much. I read a lot of junk. Here’s my full library of everything I’ve been reading for the last year or so: http://tara.teich.net/blog/library/.

The author of the plugin has a nifty extra bit on his site - he has a count of pages read as well! I wanted this too! I went over to his forum and found a thread on the topic. He’d actually already explained how to make a new plugin to add this functionality, so I dropped that onto my blog and voila, now you can see that I’ve read (as of right now) a total of 39,416 pages since April of 2006. That’s pretty darn cool.

I made some minor changes to the extra Now Reading Pages plugin that Rob had posted - his version would only add page data when you added a new book to your library. I wanted to loop over all the books I already had and add the page count, so I added that bit of minor functionality. If anyone’s interested, I’ll post a link. It requires Rob’s awesome plugin, so make sure you get that (and if you like it, give him your support!), then when you activate mine, it’ll pull all the page counts down from Amazon. NOTE: This is slow. Just be patient and wait, it’ll eventually finish. Well. How long it takes depends on the size of your library. My 120ish book library took several seconds to get through.

DOWNLOAD HERE

2 Responses to “Categorization Obsession”

Hello Tara!

I was just over reading the Now Reading forum and read the thread talking about now reading pages. I set my test site up a few weeks ago and had copied what Rob had put in that thread and installed it as a plugin. It *did* display page counts from amazon but I was at a loss as to what to do with the info to get it to display in the library where it says how many books you have read.

So today I found your site, and downloaded your version of the plugin. Can you please tell me what I need to do so that I can show the number of pages read this year along with the rest of the info

you know, the bit that goes:

There are currently there are a total of 166 books overall; 37 books read in the last year; 5 books read in the last month. I read 4 books a month. > I have read 10000 pages this year

elle
September 28th, 2007

I’m not so great with the php. This is what I did to get my total pages read, inside a php block, store the pages read in a variable.

$pages_read = intval($wpdb->get_var("
SELECT
SUM(m_value) AS pages_read
FROM
{$wpdb->prefix}now_reading, {$wpdb->prefix}now_reading_meta
WHERE
b_status = 'read'
AND
m_book = b_id
AND
m_key = 'pages'
"));

Then you can use $pages_read to do what you want. Print it out, divide it by the number of books you’ve read to figure out how many pages/book you’ve read.

Oh, and to put that line like where mine is, edit your library.php file. Let me know if that helps.

September 28th, 2007





Note: This post is over a year old. You may want to check later in this blog to see if there is new information relevant to your comment.