MagPi – auto-downloader is designed to notify your when the new magazine is available as a PDF. Why should you care about it? This is a great source of inspiration if you are familiar with the RPI already, or a great way to get you going if you are new to the RPI. Either way, the MagPi can be free if you decide to use PDF file only. Each month the file is uploaded to the server, but since the dates aren’t fixed, simple calendar reminder won’t work. The fun way of doing this is getting the Raspberry Pi to notify us about the new issue of the Mag Pi.
There are other alternatives to get the magazine as well. These are various ways you could obtain your copy of MagPi:
- Periodically check the https://www.raspberrypi.org/magpi/issues/
- Sign up for a newsletter and you will get weekly updates including mentions when MagPi is out!
- Download the app, and pay the subscription fee, to receive your MagPi as soon as it is available!
- Subscribe and get the paper copy of the magazine delivered to your doorstep!
- Follow @TheMagp1 on Twitter
- You can follow this tutorial and hire your Raspberry Pi to do the job for you.
Requirements for MagPi auto-downloader
In this scenario, we will be sending the PDF download instructions to an Android device. Apart from phone or tablet, Raspberry PI, we will also need few things.
To install this, please open the terminal and use:
sudo apt-get install python3-pip pip install requests sudo apt-get install python3-bs4
The script and the Tasker project:
You will have to connect AutoRemote to the Raspberry Pi, and you are in luck as I already have the tutorial for you. Click here to set it up. The script checks each day if the new issue is available then notifies the device via AutoRemote.
To check if a new issue is available I use parsed details from the website. If a new entry is found, the link is composed and sent to your phone.
Now that we have this sorted, time to schedule the job. We will use cron to execute the script once a day. MagPi comes out on various days, once a month. To get the timely notification we need to check for the new issues every day!
To set the schedule of MagPi – auto-downloader open the cron:
and add the line:
0 1 */1 * * python3 /path/to/your/file/MagPi_watcher.py &
Cron takes the commands that are structured in the following way: * * * * * command /path & – if you want it in the background. (*/1 = in a daily interval, & means run in the background)
Each * is responsible for a timer: