Yeah, another scripting update

I swear, I hate doing these as much as you love reading them. You know how you shouldn’t put something out there – like software – before it’s at least somewhat tested? Yeah. This is one of those cases.

Storyist is a jerk. There, I said it. By making the “story” file just one long file – and because the cheapest method of doing word counts in Google is stuff it all into a single string (like a long line without carriage returns) and counting how many words are in the string – my novel does more than just choke the email end of Google scripts. It also causes the google app engine to just timeout 9 times out of 10. Believe me, I ran it ten times to get that number (or maybe it was fifty?).

So, another day, another rendition of the Storyist scripts. Remember how I said yesterday I should put this all in github or something? Well, turns out I had the same thought the last time I took on a project like this, and actually did make a fork of Jamie’s repo. So rather than pollute my dropbox, I’ve started updating on github. Bonus – this means you can file issues against it, and that we can all track changes as we chart Mikey’s inability to write coherent shell scripts.

I should warn you, this latest version of the scripts will not generate diff emails any more for Storyist files (everything else should be fine). In order to be able to track word counts and streaks, I kind of cheated. And by kind of, I mean I totally did. Instead of relying on shaky Javascript (I’m the shaky part in that, but anyway), I’m just using some plain old simple wc and bash to take the word count of your previous version, the word count of your current version, and displaying the difference of those two numbers. Then on the Google side, if we see a file named “-count.txt”, instead of processing it like normal we just read it in and add whatever number it has to our fiction word count. (Sorry nonfiction writers). A pain to test, but a much simpler way of getting the stats in there without breaking too much more.

With luck, this will be the last update on Storyist and Google in the same post for at least a day. Maybe more.