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?

Advertisements

2 Responses to “My Daily Bible Reading, automated”


  1. 1 tbuchanan October 21, 2016 at 8:12 am

    I know this is an older post but could you show more of your daily reading script? I’m not a coder but have an interest in duplicating your efforts to have a daily reading pattern via the computer. Thanks.

    • 2 pastoredb October 21, 2016 at 10:01 am

      Friend, thanks for responding! First off, to create a script for your daily Bible reading means that you have to have a plan for which portions you’re going to read.

      As I mentioned in the post, I used the Grant Horner system, which gives me a selection from 10 different portions of Scripture: Gospels, Torah, Pauline epistles, catholic epistles, wisdom lit, Psalms, Proverbs, History, Prophets, and Acts.

      I put together a spreadsheet that had each book in each category with the number of chapters (i.e. Matthew had 28 entries under Gospels, Psalms had 150 entries, etc.). I then repeated those patterns to fill up 365 days (there were 89 entries under Gospels, 186 entries under Torah, etc.).

      Once I had the Bible reading mapped out for every day in the year, I put those entries into a script that used the “diatheke” program I mentioned to output the content of each chapter into html code for each day (referred to above as biblechapter1.html, biblechapter2.html, and on for the whole year).

      The above script that I shared is what grabs the contents of those bible chapters, and serves them to me locally in my browser when I first start it up.

      Hope that helps you figure out how to do something similar on your own computer, friend!

      Keep Following Jesus – PastorEdB


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Pastor Ed Backell

Flickr Photos

teepeeindiangirls1

x-default

rachelthrone

More Photos

Pastoral Tweets

  • 1 Pet. 3:20-21~ Remember Reasons To Hope: 7) God Prepares Ways To Rescue His People; 8) God Rescues From Being Overwhelmed 1 day ago
  • 1 Pet. 3:22~ Remember Reason To Hope: 9) Jesus In The Perfect Position To Save: AT THE TOP; over Angels, Authorities, Powers, AND Problems! 1 day ago
  • 1 Pet. 3:17-19~ Remember Reasons To Hope: 4) God Values Your Life; 5) Jesus Already Paid For Your Sin; 6) Stuck? Jesus Can Free You 1 day ago
  • 1 Pet. 3:13-16~ Remember Reasons To Hope: 1) You Are Not Alone When You Suffer; 2) Your Hope Is Reasonable; 3) Your Hope Doesn’t Need Power 1 day ago
  • Posts from 1 Peter: Reasons for Hope pastoredb.wordpress.com/2017/05/21/pos… 1 day ago

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

Join 753 other followers


%d bloggers like this: