Great work Joop!
I don't think there is a bug in Calibre, the only problem I've found is that the calibre-debug command doesn't work if Calibre is running.
I've made a few changes, the script now does this:
- First, it closes calibre. I don't know if calibre has a command line switch for this, so I just use tskill calibre. Optionally, you can add ebook-device eject to prevent data loss.
- Second, date variables are set (no change here, good work on it btw).
- Use Wget to download today's paper - removed some unnecessary parameters, fixed a few others.
- Add news tag, add to calibre database (no change here I think).
- Set calibre to auto-upload to reader (small change here).
- Clean up temporary files
- Start calibre in tray.
In other words, if you have Calibre running (either normally or in the background), the script still works. If it's running, it just kills it and starts it again once it is done.
There are two issues:
- Killing calibre like this is not optimal, I'd rather have the calibre-debug command work while calibre is still running so that killing/closing is not necessary.
- The script only works to download today's paper. So it doesn't work if you try to download after midnight, or for example the next morning. Also, it doesn't work on Sunday. The way I wanted to fix this is by making the script follow the link under the 'Download ePaper' button on the NRC site, so that it always downloads the latest paper. However, I've not (yet) been able to do this with wget.
|