Categories
Development General Tech

Calibre-Web and Audiobooks

I’ve been investing a lot of time into learning python and trying to contribute to the calibre-web project.  The calibre-web project  is another web solution for the ever popular Calibre e-book management software.  It has a very clean, Bootstrap-based interface and comes a ton of features that you can’t find, or isn’t as mature in other offerings.

Here’s a screenshot that is used on the readme.md of the repo:

calibre-web
calibre-web interface

Go to the repo to get a list of all of the features.  I’ve been using the repo for well over a year as my website for my books.  I can’t recommend it enough!

Upcoming feature (hopefully): Audiobooks!

A contributor to the repo, Aaron Labiosa (aka modembug), had added a feature that allows for the hosting of audiobooks.  Modembug’s feature is scheduled to be in the v1.1 release. I help clean up some of the code, so I got to know the code a bit.

Audiobooks has become a one of my latest rabbit holes to run into.  I’ve started listening to audiobooks a little earlier this year again after being away from them for some time.  Due to a recent job change, I may have a long commute again and so I figure, why not look into some audiobooks to kill the time?

The issue I encountered was that it’s really hard to download an audiobook for the average user if they are not using iTunes or Amazon’s Audible.  If you have a collection of audiobooks disk from ripping them from cd or whatever,  you have to figure out how to get the file(s) from your computer to whatever audio device you’re using.  This can be incredibly painful process which may require physical access to your home machine.

Moembug’s feature allows you to store an audiobook that has been converted into a single file on the calibre-web application.  In addition to storage and hosting, the website will allow you to either listen to the audiobook via streaming or download the audiobook to your device.  This was the answer I was looking for!  I don’t have to be physically home to get to one of my audiobooks, nor would I have to preload my audiobooks to a cloud service in anticipation of listening to them.   Or at least I thought it was the complete solution.

The Problem

All of my devices are IOS devices.  Obviously, I would like the ability to download one of my audiobooks on the fly to my iPhone and listen to it with CarPlay.  If I attempt to stream an m4a version of the audiobook – everything will work.  However, it’ll eat away at my data plan.  However, if I attempt to download it, IOS will error out.  I assume it’s because of the sandboxing.

However, I did find a solution.  Basically use an IOS app that has a builtin browser to download the file.  Hopefully one that can play audiobooks, or at least transfer it to a location where you can use it.  Enter Documents by Readdle.  This app has it’s own browser and does play audiobooks!

On top of that, I found really great audiobook player called Bound.  Although Bound isn’t free ($3.99 USD), it’s worth every penny as it allows you to download your audiobook from a number of cloud sources and it’s a great audiobook player.

Now with the two apps and the new feature that is hopefully coming soon to calibre-web, I’ll be able to download and access my audiobooks while I’m away from the house, with only a minimal amount of jumping through hoops!

Hopefully the above will provide you with some thoughts on how to get audiobooks to your device without having to rely on iTunes or Amazon’s Audible.

-JT

Categories
Development Tech Tip

Docker Image Building – Lessons learned

(edited on 3/8/18 – typos/grammar)

My cps-WhatsNew script has a new permanent page on the blog site now. In addition, it has a new Docker image!  Check out the links and let me know what you think.

While the cps-WhatsNew script is relatively simple, I was thinking about how could I make it easier to implement the solution.  Docker was a clear choice.  As I’ve only been a consumer of Docker images, this “short” project was a very interesting foray into building my own image. Embarrassingly enough, it took much longer to complete than I had anticipated.

It took close to 3 full days of off and on effort and research to get everything put together and optimized.  The optimization part was the longest and I’m still not happy with the size of the docker image now that I’ve published everything.

Here are some hard-won lessons:

Categories
General

Updated cps-WhatsNew

After months of procrastination and over-engineering, I’ve finally made some updates to the cps-WhatsNew program.

New features:

  • Dev mode – allows for the testing of the script by changing a setting in the configuration file.  The program will do everything normally except it will not send any emails.
  • Database mode – added the ability to change where the program gets it data for the distribution list.  It can now be either the configuration file or the cps application database.
  • DL Exclusion list – added the ability to keep an exclusion list of emails.  This is really only used with the Database mode above.  Basically there is a list of email addresses in the configuration file that can be edited.

I set up this program on my server that contains the Calibre-Web application.  As the database is a SQLite database, its pretty important that we don’t write to it at the same time that the cps application is running. However, I’ve scheduled the timing of sending of this newsletter at an off-peak time so everything should be okay.

That last bit is where I was over engineering everything.  I had originally thought to create another database entirely for the cps-WhatsNew program to avoid any sort of contention with the Calibre-Web database.  I thought I would simply sync the user table over – or really just a subset of the data and add a column for people that wanted to be excluded from the newsletter.  After starting down this path and creating a lot of the CRUD code, I realize that I was really over-engineering the solution.  I could simply just do a select statement on the existing database to accomplish everything I needed.  The database contention would be there with my over-engineered sync’ing solution or the simpler select statement.

I think the only other thing I want to do with the program is make it easier to customize the introduction paragraph of the newsletter.  Currently everything is hardcoded in the HTML files.  I’ll probably just have the program look for a specific file for the introductory paragraph.  Thus seperateing the message from the main body of the newsletter. This should be pretty easy to add.

 

Categories
General

cps-WhatsNew – Newsletter for Calibre-web

Thought I would do a quick post on a new git repo I just put together:  cps-WhatsNew.

Its Python script that puts together a newsletter for the calibre-web repo.  I love the calibre-web repo as an interface to my calibre instance.  For my purposes, I thought it would be cool to send an email newsletter letting users know what new books have been posted.

While I haven’t tested it, I’m sure it would work for most OPDS feeds.  — Maybe with some minor adjustments to the book thumbnail code.

In any event, this was my first official Python script.  I’m sure its over-commentated and over-engineered – just like everything else I do!   I think it turn out well.  I used/learned, besides general Python, templating with jinja2 (without flask), a great emailing package – marrow, in-depth logging.  Also starting using JetBrains PyCharm IDE – Community Edition.  Excellent IDE of which i’m certain I would never use it to its fullest. (good GIT integration!)

I’m pretty impressed with Python.  I can’t believe it’s taken me this long to take the time to start learning the language.

Categories
General

A couple of Stamps

Did a couple of stamps of Pros and Cons for a presentation lately. Figure I put them on the site to share.

final-stamp-profinal-stamp-cons