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.