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.

 

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.

New Site Theme

I’ve been playing around with a lot of different themes for this blog lately. The problem with themes is that they still require customization. You can spend hours tweaking someone’s theme and decide that it’s not for your site. I’ve gone through so many of those!

I think I’m finally settling on this theme called Freelancer by GeneratePress. It’s clean, responsive, and free! Also, it’s pretty simple and simple is all I really need for a blog site. Trying not to over engineer everything in my life.

In any event, I hadn’t updated this blog in over a year and I do have a number of articles I was thinking about writing. Now that I’m ‘happy’ with the design/layout of the site, I may actually do some writing!

PowerShell Logging Module

(Edited 11/30/15 – Completely forgot SqlChow’s contributions! Sorry!)

Wow – two blog posts in two days!  A record for me.  So today’s post I wanted to try something new.  I wanted to start sharing some of my code via a download over this WordPress CMS. Well, that’s not the only reason, I do like to share stuff so if this helps someone out, leave a comment, etc.

So the very first download I want to do was a very useful module that I hobbled together that I used in some of my automated PowerShell scripts — a logging module!

Read morePowerShell Logging Module