Posts Tagged 'Bible reading plan'

My Daily Bible Reading, automated

Bible and glasses

Readers, be warned: this is one of those geeky posts of mine. I basically put these up to remind myself how I did something.

One thing I’ve noticed is that I tend to be much more intentional about reading what shows up on my computer screen than I am in reading a physical book. Everything I want to read (almost) can be found at my fingertips through the internet.

Now, like some of you, I have tweaked the settings in my browser so that the tabs to which I always need access are set to open as default. And I thought how neat it would be to create a script that would take my daily bible readings, and put them into a webpage so that I would read the text as I start my day.

The challenges:

  1. To insert the text according to my preferred reading plan (by Grant Horner, found here).
  2. To set up a web page for each day of the year with that day’s readings.
  3. To serve each day’s webpage to my browser.

Here’s how I did it.

To set up the text the way I wanted, I wrote a script using the excellent tool “diatheke”. It’s a command-line tool that comes with my bible program (Xiphos, in case anyone is wondering). Diatheke allows me to search and select Bibles for verses (or topics, or phrases), and use the results of that search in lots of interesting ways. I won’t show you the whole script, but I will show you a line of the file, and explain what it does.

diatheke -b ESV -f HTML -k Matthew 1, Genesis 1, Romans 1, Job 1, Psalm 1, James 1, 1 Samuel 1, Isaiah 1, Acts 1, Proverbs 1 > biblechapter1.html

“diatheke” is the name of the program. “-b ESV” selects the version to read. “-f HTML” selects the format that will create a webpage. “-k Matthew 1, Genesis 1, etc.” selects each chapter of each book I want to read. And finally “> biblechapter1.html” puts all of the gathered information into a single webpage (called biblechapter1.html”).

The script does this 365 times, with the different chapters that I want. After running it, I now have 365 little webpages with just the text of Scripture for that day of the year.

INSERT EDIT: After having used this for a few days, I noticed that the version of diatheke has an annoying little bug in it: it appends the last verse of whatever the search terms as an extra line. I wanted to get rid of this extra appendage, and I used the following command to do it.

sed -i “s/^: .*/<br>/g” biblechapter*.html

“sed” is the Stream EDitor program on most Linux systems, and with the input -i, the specific command s/ switches every line that starts with a colon and a space ^: , no matter what comes behind it .* with an HTML carriage break <br>, and does so globally /g for every file that starts with the name biblechapter, and ends with .html.

Finally, I wrote a little “home page” file that would select a different Biblechapter page depending upon the day of the year. This one page has a script that calculates the day of the year, and then serves that numbered biblechapter file to my browser. Here’s what that file looks like, shortened for readability:

<html>
  <body>
<script type="text/javascript">

var ie=document.all
var doy=document.getElementById

//How will the IFRAME be displayed?
var iframeprops='width=1400 height=6000 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="yes"'

//Show all days of the year
var daycontent=new Array()
daycontent[1]="biblechapter1.html"
daycontent[2]="biblechapter2.html"
.
.
.   all the way through the whole year, 1 - 365
.
.
daycontent[364]="biblechapter364.html"
daycontent[365]="biblechapter365.html"

if (ie||doy)
document.write('<a href=""></a>')

var now = new Date();
var start = new Date(now.getFullYear(), 0, 0);
var diff = now - start;
var oneDay = 1000 * 60 * 60 * 24;
var mytoday = Math.floor(diff / oneDay);

function dayofyear_iframe(){
if (ie||doy){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=daycontent[mytoday]
}
}

window.onload=dayofyear_iframe

</script>  </body>
</html>

Once that was working, I simply had to tell my browser (Chrome) to open three tabs every time it started: my calendar, my email, and my Bible reading for the day.

Well, that’s what works for me. Are you using some kind of system or specific discipline to keep you in the Word… and the Word in you?


Pastor Ed Backell

Flickr Photos

Pastoral Tweets

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 230 other followers


%d bloggers like this: