Step 3 - Using Python Script to Ensure Webcam Images from Different Sources is Publicly Accessible

Before beginning the download and storage process, each webcam source must be checked to ensure the webcam image is accessible by the python script. Some websites may differ in image update time; one webcam may update its feed every 10 minutes, while others every 20-30 minutes.Thus the python script must be modified in order to accommodate the website, as well as the image.

Calgary is the original server for this project, and will be the main portal for accessing all of the directories containing webcam images.
Note: The project has been moved over to the littlestorm server as of 2025. Because of this, permission errors may be frequent and the command “chmod 770” will need to be used to give permission for the added directories/scripts/data.

There are two scripts used for the saving images

Image_scraping.py: This is the main script that will be used for most cameras. It uses the actively updated direct camera link to save the image.
rename-image-date-new.sh: After using the previous script, a renaming script is used for dating and organizing the scraped images. The first script that was used, did not record the errors or organize the saved images into a new directory called renamed-images. The new script that was created allows more efficient location of errors recorded in cronError.log, and also has the images in their own directory.
image_scraping+renameing_UCN.py: This script allows for adjustment of the camera link. This script has been created because some of the camera images rather than readily updating themselves with the same link, the link itself changes with the new date and time.
Sort_Camera-images.py: Once the images have been collected and renamed with their date/time, they must be sorted further to easily access certain image dates, rather than having a huge list of hundreds of images. This script sorts the images under a “classified_images” directory. Under this directory, there are more directories with years and months.

Once the proper script is chosen, it is then tested with the cameras before the automation (crontab) is put into place. This is important to check for errors.