How to take a backup/export your kobo ebooks

I had an issue with my ebook reader – kobo, just wanted to test my ebook on another ebook reader – should be fine right? Turns out the books i bought and paid for on kobo don’t allow me to do that.

 

A quick google tells me there is a plugin called obok but it seems older and i ‘aint got no time fo dat!’ .  Plugged kobo in to my PC, told it to connect, opened a linux terminal and had a poke about . This is what i found.

velofille@tea:/media/velofille/KOBOeReader/.kobo$ ls
affiliate.conf  BookReader.sqlite  certificates  device.salt.conf  dict  guide  kepub  Kobo  KoboReader.sqlite  version
velofille@tea:/media/velofille/KOBOeReader/.kobo$ cd kepub/
velofille@tea:/media/velofille/KOBOeReader/.kobo/kepub$ ls -sh
total 28M
3.1M 0ebc1dcc-8ee2-4184-b89d-4ea7d63be35b  792K 642a7ebd-f337-421a-b285-db7f3034423d  496K c6f9076c-0f3d-4804-a2d8-dab922fde058
1.3M 2c1cadeb-805b-4f7c-866c-cc1a5b3a37df  384K 75a93a60-b844-4c15-aab3-264e05d2b9d2  1.5M cc2c97aa-478f-4909-98f6-57df0aedeab1
292K 2d7ff8d7-c55b-4ce7-b5c6-e2829dd0a181  320K 7dc7280d-3af5-445c-899a-2e9dc74c3fcc  764K e9fda9bc-b601-4b7f-a5bb-6f2e66285617
4.5M 349f9491-e5b5-449f-9e05-5969b374c986  796K 8a41e46c-9246-4cc3-9775-396fbed422ec  1.5M f4538279-26a6-45f7-af8a-22ecaf60f79b
832K 452e403a-301e-4ae8-adcb-2a063a0969b7  1.3M 9fd75d28-fb3e-4d6c-bbb1-6c17e4a2c699  1.7M fafe790d-3f52-4d3a-9fab-798f12114fba
1.7M 497eb736-14c9-4ac1-b3d3-14f930989485  324K b054220c-ad1b-42d4-b8d7-16a47b70aaa9  316K fdcc3a9e-4f6d-4f18-8c1f-82a5ccfacb13
1.7M 5c3fd797-79af-4fe6-80b5-abd5728f6c7a  1.4M b5755009-3b29-447e-bf24-1821fc728d86
2.1M 5fa748aa-8507-4674-b94f-a55fbd860e18  792K c1fd4250-b11c-4b3a-b99e-437405ea1fee
velofille@tea:/media/velofille/KOBOeReader/.kobo/kepub$ file *
0ebc1dcc-8ee2-4184-b89d-4ea7d63be35b: EPUB document
2c1cadeb-805b-4f7c-866c-cc1a5b3a37df: Zip data (MIME type "application/epub+zip"?)
2d7ff8d7-c55b-4ce7-b5c6-e2829dd0a181: EPUB document
349f9491-e5b5-449f-9e05-5969b374c986: EPUB document
452e403a-301e-4ae8-adcb-2a063a0969b7: EPUB document
497eb736-14c9-4ac1-b3d3-14f930989485: EPUB document
5c3fd797-79af-4fe6-80b5-abd5728f6c7a: EPUB document
5fa748aa-8507-4674-b94f-a55fbd860e18: EPUB document
642a7ebd-f337-421a-b285-db7f3034423d: EPUB document
75a93a60-b844-4c15-aab3-264e05d2b9d2: EPUB document
7dc7280d-3af5-445c-899a-2e9dc74c3fcc: EPUB document
8a41e46c-9246-4cc3-9775-396fbed422ec: EPUB document
9fd75d28-fb3e-4d6c-bbb1-6c17e4a2c699: EPUB document
b054220c-ad1b-42d4-b8d7-16a47b70aaa9: EPUB document
b5755009-3b29-447e-bf24-1821fc728d86: EPUB document
c1fd4250-b11c-4b3a-b99e-437405ea1fee: EPUB document
c6f9076c-0f3d-4804-a2d8-dab922fde058: EPUB document
cc2c97aa-478f-4909-98f6-57df0aedeab1: EPUB document
e9fda9bc-b601-4b7f-a5bb-6f2e66285617: EPUB document
f4538279-26a6-45f7-af8a-22ecaf60f79b: EPUB document
fafe790d-3f52-4d3a-9fab-798f12114fba: EPUB document
fdcc3a9e-4f6d-4f18-8c1f-82a5ccfacb13: EPUB document

Bingo! If you are in windows, just turn on hidden files, find the .kobo directory, then the kepub directory inside that. I copied those all off, renamed them to .epub and then imported the into calibre.

Rename:

velofille@tea:~/kobooks$ rename s/$/.epub/ *

As it turned out, the ebook was fine, just had an odd font 🙂

Automating the chicken Coop

I’m not overly keen on cage eggs, so i got a few chooks for around home. Legally we are allowed 5 hens (no roosters) since we live in town. Not wanting to annoy neighbours i went for snuggly quiet little silkies which are the poodle of the chicken world .

Since I am not overly keen on early mornings, i have been trying to find a good way to automate the chicken coop. I made a basic sliding door up and down, tied a piece of string to that, ran it through a pully inside hte top of the coop and out the back.

This meant i pulled the string, it pulled the door up. I could tie it off during the day, or easily close it. Since the chicken coop is near my bedroom but outside, i ran the string in a bedroom window – on weekends i open window, pull string, close window and go back to sleep.

Now days thats getting a little old, i want to automate things!

When the chickens were smaller, i set up a raspberry pi with a basic install of rasbian, i installed a raspberry pi camera on that, and put it all in a case. This was ideal for just watching the chicks whilst at work, and when i was integrating new chicks.

Moving on to the more fun project, i ended up using scraps of things from all over the show. My son had an arduino car that had a servo AS3013 (3kg) that i took, along with a plastic end spinning thing. I attached a piece of dowel to that, and made a crappy mount.  This is what my high tech setup looks like.

The idea is that the string for the sliding door wraps about the dowel, pulling it up.

The 3 wires from the servo go on the 5V, ground, and pin 18 according to https://pinout.xyz/pinout/ground which has them neatly in a row, and the Pi itself goes in a nice container to keep dust away. I had to drill out some space for the wires going to the servo.

To make the servo work, i installed the RaPi GPIO librarys

sudo apt-get install -y wiringpi

After this i can just create scripts like this to run the servo (this is continuous rotation servo)

# opendoor.sh 
# This switches pin 18 to pwm if its not already
gpio -g mode 18 pwm
Now you can tell gpio to set the PWM clock to those numbers:
gpio pwm-ms
gpio pwmc 192
gpio pwmr 2000
# This here tells its the placement
gpio -g pwm 18 200
#sleep whilst it turns for 2 seconds
sleep 2
# Stop the turning and reset that
gpio -g pwm 18 150

Likely im doing this wrong, but it works for me, it was simple and easy to setup and do. THis is from tutorial at https://learn.adafruit.com/adafruits-raspberry-pi-lesson-8-using-a-servo-motor/software

Once i had the servo moving, the camera working, and all that , i made a web page that simply runs the php scripts using exec, this means i can click ‘pic’ and get a pic realtime without running a webcam. Terribly insecure and probably not good, but its on local network only, not a major issue. Door scripts are on a crontab to run at a set time.

I uploaded all the code for this to https://github.com/lizquilty/automated-chicken-coop

Now i just need to wait for a sunny day to install it all 🙂

Shell script to email when web page has updates/changed

Some shipping companies don’t have any sort of notification system for when updates happen to packages. For small things, this is probably not a major issue, but when i ordered my huge Patio roof, i needed to be at home when it was being delivered to help unload.

Unfortunately the website did not have any notifications, and the alternative was to hit reload on the page all the time to check. I figured this should be easy to script and so wrote this small shell script to watch the page, and email me if there were any updates

 

#!/bin/bash
#
# URL to check
url="http://fasttracker-nz.tollgroup.com/onetoll-fast-tracker.aspx?ConsignmentNumber=xxxxxxxxxx"
 
# Temp file to store the tracking page
temp=/tmp/trackingcheck
 
# Get the page, remove dynamic content of newrelic and diff feedback on that
modified=$(wget -q -O $temp $url ; diff ${temp} ${temp}.1 |grep -v newrelic |grep -v --  "--" |grep -v 8c8 )
 
# This is a good idea if it has the Last Modified headers, but in my case it didn't
#modified=$(curl -sI "$url" | grep ^Last-Modified)
 
# set email address
email="liz@xxxxxx.com"
 
# Check if the modified variable exists and is more than 0 characters
if [[ ! -z "$modified" && ${#modified} -gt 0 ]]; then
    # Email me the changes if there are any
    echo $url has changed  $modified  - modified| mail -s "Tracking Update"  ${email}
    # Copy the recent grab of the page to the second file to compare to next time
    cp ${temp} ${temp}.1
fi

The initial idea was to check for Last-Modified headers, but they did not have those, so i ended up dumping the page to /tmp/trackingcheck and comparing against /tmp/trackingcheck.1 . I had to adapt my diff command to remove the newrelic dynamic content lines, which probably could have been done, but over all the script worked nicely.
I set up a cron task to run that every 10 minutes. If the page has changed, it emails me, and copies the temp file to /tmp/trackingcheck.1

*/10 * * * * /home/velofille/tracking.sh