diff --git a/Calendar/Settings-Web-UI.html b/Calendar/Settings-Web-UI.html index 30b6ac5..ea9337b 100644 --- a/Calendar/Settings-Web-UI.html +++ b/Calendar/Settings-Web-UI.html @@ -9,295 +9,303 @@

-
-
-
- Setting Generator -
For Inky-Calendar Project of Ace-Innovation Laboratory (by aceisace) Project
- If no value is filled in for any of the row, the default value will be used. -
- -
-
-
-
- - -
+
+
+
+ Setting Generator +
For Inky-Calendar Project of Ace-Innovation Laboratory (by aceisace)
+ +
+
+ If no value is filled in for any of the row, the default value will be used. +
+ +
+
+ +
+ + +
- - -
+ + +
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
-
- -
-
- - -
-
- - -
-
-
+
+ +
+
+ + +
+
+ + +
+
+
-
- - -
-
- - -
- -
- -
-
- - -
-
- - -
-
-
+
+ + +
+
+ + +
+ +
+ +
+
+ + +
+
+ + +
+
+
-
- - -
+
+ + +
-
- - -
+
+ + +
-
- -
-
- - -
-
- - -
-
-
+
+ +
+
+ + +
+
+ + +
+
+
-
- -
-
- - -
-
- - -
-
- - -
-
-
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
-
- -
-
- - -
-
- - -
-
-
+
+ +
+
+ + +
+
+ + +
+
+
-
- -
-
- - -
-
- - -
-
-
+
+ +
+
+ + +
+
+ + +
+
+
-
-
- -

- Developed by Toby Chui for Inky-Calendar Project, modified by aceisace Licensed under MIT -
- - MIT License - -
-

Copyright 2019 Toby Chui
+ +
+ +

+ Developed by Toby Chui for Inky-Calendar Project, modified by aceisace Licensed under MIT +

+ + MIT License + +
+

Copyright 2019 Toby Chui
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-
-
-
-
-
- - + var units = "metric"; + if ($('#imperial').is(':checked')){ + units = "imperial"; + } + + var hours = "24"; + if ($('#12_hours').is(':checked')){ + hours = "12"; + } + //console.log(ical_urls, rss_urls,update_interval, additional_feature, api_key, location, week_starts_on, events_max_range, calibration_hours, display_colours, language, units, hours); + createPythonSetting(ical_urls, rss_urls,update_interval, additional_feature, api_key, location, week_starts_on, events_max_range, calibration_hours, display_colours, language, units, hours); + } + + function rk(content,key,value){ + //Use to replace key-value pair in template string + return content.split("{" + key + "}").join(value); + } + + function createPythonSetting(a,b,c,d,e,f,g,h,i,j,k,l,m){ + var box = template; + box = rk(box,"ical_urls",a); + box = rk(box,"rss_urls",b); + box = rk(box,"update_interval",c); + box = rk(box,"additional_feature",d); + box = rk(box,"api_key",e); + box = rk(box,"location",f); + box = rk(box,"week_starts_on",g); + box = rk(box,"events_max_range",h); + box = rk(box,"calibration_hours",i); + box = rk(box,"display_colours",j); + box = rk(box,"language",k); + box = rk(box,"units",l); + box = rk(box,"hours",m); + var config = new Blob([box], {type : "text/plain"}); + var link = document.createElement('link'); + link.href = window.URL.createObjectURL(config); + var a = document.createElement('A'); + a.href = link.href; + a.download = link.href.substr(link.href.lastIndexOf('/') + 1); + document.body.appendChild(a); + $(a).attr('download','settings.py'); + a.click(); + document.body.removeChild(a); + } + + + - \ No newline at end of file + diff --git a/Calendar/icon_positions_locations.py b/Calendar/icon_positions_locations.py index ccc1354..324a423 100644 --- a/Calendar/icon_positions_locations.py +++ b/Calendar/icon_positions_locations.py @@ -9,7 +9,7 @@ from PIL import Image from settings import language im_open = Image.open -path = '/home/pi/Calendar/Calendar/' +path = '/home/pi/Inky-Calendar/Calendar/' wpath = path+'weather-icons/' mpath = path+'translations/'+language+'/months/' weekpath = path+'translations/'+language+'/week/' diff --git a/Calendar/settings.py.sample b/Calendar/settings.py.sample index c5ac8d8..196bbde 100644 --- a/Calendar/settings.py.sample +++ b/Calendar/settings.py.sample @@ -1,20 +1,16 @@ -""" To quickly get started, fill in the following details:""" - ical_urls = [ "https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics" - ] - +] rss_feeds = [ - "http://feeds.bbci.co.uk/news/world/rss.xml#" - ] - +"http://feeds.bbci.co.uk/news/world/rss.xml#" +] update_interval = "60" -additional_feature = "rss" +additional_feature = "events" api_key = "" -location = "Julich, DE" +location = "Stuttgart, DE" week_starts_on = "Monday" events_max_range = "60" -calibration_hours = [1,12,18] +calibration_hours = [0,12,18] display_colours = "bwr" language = "en" units = "metric" diff --git a/Gallery/E-Paper-Calendar Software-logo.png b/Gallery/E-Paper-Calendar Software-logo.png deleted file mode 100644 index 69d44f8..0000000 Binary files a/Gallery/E-Paper-Calendar Software-logo.png and /dev/null differ diff --git a/Gallery/Inky-Calendar-logo.png b/Gallery/Inky-Calendar-logo.png new file mode 100644 index 0000000..f39dd16 Binary files /dev/null and b/Gallery/Inky-Calendar-logo.png differ diff --git a/Gallery/installer-v1.6-part1.png b/Gallery/installer-v1.6-part1.png new file mode 100644 index 0000000..09852e7 Binary files /dev/null and b/Gallery/installer-v1.6-part1.png differ diff --git a/Gallery/installer-v1.6-part2.png b/Gallery/installer-v1.6-part2.png new file mode 100644 index 0000000..7f853af Binary files /dev/null and b/Gallery/installer-v1.6-part2.png differ diff --git a/Installer-with-debug.sh b/Installer-with-debug.sh index 6dc1a01..41fc67e 100644 --- a/Installer-with-debug.sh +++ b/Installer-with-debug.sh @@ -1,8 +1,7 @@ #!/bin/bash -# E-Paper-Calendar software installer for the raspberry pi -# Version: 1.5 (Early Februrary 2019) -# Stability status of this installer: Confirmed with Raspbain Stretch Lite on 12th March 2019 -# Copyright by aceisace +# E-Paper-Calendar software installer for Raspberry pi +# Version: 1.6 (Mid April 2019) +# Stability status of this installer: Stable echo -e "\e[1mPlease select an option from below:" echo -e "\e[97mEnter \e[91m1 \e[97m to update the E-Paper software" @@ -20,49 +19,63 @@ if [ -z "$option" ]; then exit fi if [ "$option" = 3 ]; then - echo -e "Removing the E-Paper software now..." - pip3 uninstall Pillow -y && sudo pip3 uninstall Pillow -y && sudo pip3 uninstall pyowm -y&& sudo pip3 uninstall ics -y && pip3 uninstall pyowm -y && pip3 uninstall ics -y && sudo apt-get remove supervisor -y && sudo apt-get clean && sudo apt-get autoremove -y + echo -e "\e[1;36m"Removing the E-Paper software now..."\e[0m" + pip3 uninstall Pillow -y && sudo pip3 uninstall Pillow -y && sudo pip3 uninstall pyowm -y&& sudo pip3 uninstall ics -y && pip3 uninstall pyowm -y && pip3 uninstall ics -y && sudo apt-get remove supervisor -y && pip3 uninstall feedparser -y && sudo pip3 uninstall feedparser -y && sudo apt-get clean && sudo apt-get autoremove -y if [ -e /etc/supervisor/conf.d/E-Paper.conf ]; then sudo rm /etc/supervisor/conf.d/E-Paper.conf fi - echo -e "The libraries have been removed successfully" - echo -e "Removing the E-Paper-Calendar folder if it exists" - if [ -d "/home/pi/E-Paper-Calendar" ]; then - sudo rm -r /home/pi/E-Paper-Calendar/ + echo -e "\e[1;36m"The libraries have been removed successfully"\e[0m" + sleep 1 + echo -e "Removing the Inky-Calendar folder if it exists" + if [ -d "/home/pi/Inky-Calendar" ]; then + sudo rm -r /home/pi/Inky-Calendar/ + echo -e "\e[1;36m"Found the E-Paper-software folder and deleted it"\e[0m" fi + echo -e "\e[1;36m"All done!"\e[0m" fi if [ "$option" = 1 ]; then - echo "Checking if the settings.py exists..." - if [ -e /home/pi/E-Paper-Calendar/Calendar/settings.py ]; then + echo -e "\e[1;36m"Checking if the settings.py exists..."\e[0m" + if [ -e /home/pi/Inky-Calendar/Calendar/settings.py ]; then echo -e "Found an E-Paper settings file." sleep 2 echo "Backing up the current settings file in the home directory." sleep 2 - cp /home/pi/E-Paper-Calendar/Calendar/settings.py /home/pi/settings-old.py + cp /home/pi/Inky-Calendar/Calendar/settings.py /home/pi/settings-old.py echo -e "renaming the old E-Paper software folder" sleep 2 - cp -r /home/pi/E-Paper-Calendar /home/pi/E-Paper-Calendar-old - sudo rm -r /home/pi/E-Paper-Calendar + cp -r /home/pi/Inky-Calendar /home/pi/Inky-Calendar-old + sudo rm -r /home/pi/Inky-Calendar echo "Updating now..." cd else - echo -e "Could not find any settings.py file in /home/pi/E-Paper-Calendar/Calendar" - echo -e "Please uninstall the software first and then use the install option" - echo -e "Exiting now" - exit + # Ask to update anyway. May not work always, but can help with new versions. + echo -e "\e[1;36m"Could not find the configuration file -settings.py- in /home/pi/Inky-Calendar/Calendar"\e[0m" + sleep 2 + echo -e "\e[1;36m"Would you like to update the Inky-Calendar software anyway?"\e[0m" + echo -e "\e[97mPlease type [y] for yes or [n] for no and confirm your selection with [ENTER]" + read -r -p 'Waiting for input... ' update_anyway + + if [ "$update_anyway" != Y ] && [ "$update_anyway" != y ] && [ "$update_anyway" != N ] && [ "$update_anyway" != n ]; then + echo -e "invalid input, aborting now" + exit + fi + if [ -z "$update_anyway" ]; then + echo -e "You didn't enter anything, aborting now." + exit + fi + + if [ "$update_anyway" = Y ] || [ "$update_anyway" = y ]; then + echo "Updating now..." + else + echo -e "Not attempting to update, exiting now." + exit + fi fi fi if [ "$option" = 2 ]; then - echo -e "\e[1;36m"The installer will finish the rest now. You can enjoy a break in the meanwhile."\e[0m" - - # Updating and upgrading the system, without taking too much space - echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m" - echo -e "\e[1;36m"This will take a while, sometimes up to 30 mins"\e[0m" - sudo apt-get update && sudo apt-get dist-upgrade -y - echo -e "\e[1;36m"System successfully updated and upgraded!"\e[0m" - echo "" + echo -e "\e[1;36m"Setting up the system by installing some required libraries for python3"\e[0m" # Installing a few packages which are missing on Raspbian Stretch Lite echo -e "\e[1;36m"Installing a few packages that are missing on Raspbian Stretch Lite..."\e[0m" @@ -73,49 +86,145 @@ if [ "$option" = 2 ]; then echo -e "\e[1;36m"Cleaning a bit of mess to free up some space..."\e[0m" sudo apt-get clean && sudo apt-get autoremove -y echo "" - - # Installing packages required by the main script - echo -e "\e[1;36m"Installing a few required packages for the E-Paper Software"\e[0m" - sudo pip3 install pyowm - sudo pip3 install Pillow==5.3.0 - sudo pip3 install ics - sudo pip3 install feedparser - pip3 install pyowm - pip3 install ics - pip3 install feedparser - pip3 install Pillow==5.3.0 - echo -e "\e[1;36m"Finished installing libraries"\e[0m" fi if [ "$option" = 1 ] || [ "$option" = 2 ]; then - echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" + # Ask to update system + echo -e "\e[1;36m"Would you like to update and upgrade the operating system first?"\e[0m" + sleep 1 + echo -e "\e[97mIt is not scrictly required, but highly recommended." + sleep 1 + echo -e "\e[97mPlease note that updating may take quite some time, in rare cases up to 1 hour." + sleep 1 + echo -e "\e[97mPlease type [y] for yes or [n] for no and confirm your selection with [ENTER]" + read -r -p 'Waiting for input... ' update + + if [ "$update" != Y ] && [ "$update" != y ] && [ "$update" != N ] && [ "$update" != n ]; then + echo -e "invalid input, aborting now" + exit + fi + if [ -z "$update" ]; then + echo -e "You didn't enter anything, aborting now." + exit + fi + + if [ "$update" = Y ] || [ "$update" = y ]; then + # Updating and upgrading the system, without taking too much space + echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m" + sleep 1 + echo -e "\e[1;36m"This will take a while, sometimes up to 1 hour"\e[0m" + sudo apt-get update && sudo apt-get dist-upgrade -y + echo -e "\e[1;36m"System successfully updated and upgraded!"\e[0m" + echo "" + fi + + # Installing dependencies + + #PYOWM for user pi + echo -e "\e[1;36m"Installing dependencies for the Inky-Calendar software"\e[0m" + + echo -e "\e[1;36m"Checking if pyowm is installed for user pi"\e[0m" + if python3.5 -c "import pyowm" &> /dev/null; then + echo 'pyowm is installed, skipping installation of this package.' + else + echo 'pywom is not installed, attempting to install now' + pip3 install pyowm + fi + + #PYOWM for user sudo + echo -e "\e[1;36m"Checking if pyowm is installed for user sudo"\e[0m" + if sudo python3.5 -c "import pyowm" &> /dev/null; then + echo 'pyowm is installed, skipping installation of this package.' + else + echo 'pywom is not installed, attempting to install now' + sudo pip3 install pyowm + fi + + #Pillow for user pi + echo -e "\e[1;36m"Checking if Pillow is installed for user pi"\e[0m" + if python3.5 -c "import PIL" &> /dev/null; then + echo 'Pillow is installed, skipping installation of this package.' + else + echo 'Pillow is not installed, attempting to install now' + pip3 install Pillow==5.3.0 + fi + + #Pillow for user sudo + echo -e "\e[1;36m"Checking if Pillow is installed for user sudo"\e[0m" + if sudo python3.5 -c "import PIL" &> /dev/null; then + echo 'Pillow is installed, skipping installation of this package.' + else + echo 'Pillow is not installed, attempting to install now' + sudo pip3 install Pillow==5.3.0 + fi + + #Ics.py for user pi + echo -e "\e[1;36m"Checking if ics is installed for user pi"\e[0m" + if python3.5 -c "import ics" &> /dev/null; then + echo 'ics is installed, skipping installation of this package.' + else + echo 'ics is not installed, attempting to install now' + pip3 install ics + fi + + #Ics.py for user sudo + echo -e "\e[1;36m"Checking if ics is installed for user sudo"\e[0m" + if sudo python3.5 -c "import ics" &> /dev/null; then + echo 'ics is installed, skipping installation of this package.' + else + echo 'ics is not installed, attempting to install now' + sudo pip3 install ics + fi + + #feedparser for user pi + echo -e "\e[1;36m"Checking if feedparser is installed for user pi"\e[0m" + if python3.5 -c "import feedparser" &> /dev/null; then + echo 'feedparser is installed, skipping installation of this package.' + else + echo 'feedparser is not installed, attempting to install now' + pip3 install feedparser + fi + + #feedparser for user sudo + echo -e "\e[1;36m"Checking if feedparser is installed for user sudo"\e[0m" + if sudo python3.5 -c "import feedparser" &> /dev/null; then + echo 'feedparser is installed, skipping installation of this package.' + else + echo 'feedparser is not installed, attempting to install now' + sudo pip3 install feedparser + fi + + echo -e "\e[1;36m"Finished installing all dependencies"\e[0m" + + # Clone the repository, then delete some non-required files + echo -e "\e[1;36m"Installing the Inky-Calendar Software for your display"\e[0m" cd - git clone https://github.com/aceisace/Inky-Calendar - mkdir E-Paper-Calendar - cd Inky-Calendar - cp -r Calendar /home/pi/E-Paper-Calendar/ - cp README.md /home/pi/E-Paper-Calendar/ - cp LICENSE /home/pi/E-Paper-Calendar/ - cp -r .git /home/pi/E-Paper-Calendar/ + git clone https://github.com/aceisace/Inky-Calendar Inky-Calendar-temp + mkdir Inky-Calendar + cd Inky-Calendar-temp + cp -r Calendar /home/pi/Inky-Calendar/ + cp README.md /home/pi/Inky-Calendar/ + cp LICENSE /home/pi/Inky-Calendar/ + cp -r .git /home/pi/Inky-Calendar/ # Make a copy of the sample settings.py file - cd /home/pi/E-Paper-Calendar/Calendar + cd /home/pi/Inky-Calendar/Calendar cp settings.py.sample settings.py - cd # Remove the downloaded (temporary) directory - sudo rm -r Inky-Calendar + cd + sudo rm -r Inky-Calendar-temp # add a short info - cat > /home/pi/E-Paper-Calendar/Info.txt << EOF -This document contains a short info of the E-Paper-Calendar software version + cat > /home/pi/Inky-Calendar/Info.txt << EOF +This document contains a short info of the Inky-Calendar software version -Version: 1.5 -Installer version: 1.5 (Early February 2019) -configuration file: /home/pi/E-Paper-Calendar/Calendar/settings.py +Version: 1.6 +Installer version: 1.6 (Mid April 2019) +configuration file: /home/pi/Inky-Calendar/Calendar/settings.py If the time was set correctly, you installed this software on: EOF - echo "$(date)" >> /home/pi/E-Paper-Calendar/Info.txt + echo "$(date)" >> /home/pi/Inky-Calendar/Info.txt echo "" # Setting up supervisor @@ -124,20 +233,15 @@ EOF sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF [program:E-Paper] -command = sudo /usr/bin/python3.5 /home/pi/E-Paper-Calendar/Calendar/E-Paper.py -stdout_logfile = /home/pi/E-Paper-Calendar/E-Paper.log +command = sudo /usr/bin/python3.5 /home/pi/Inky-Calendar/Calendar/E-Paper.py +stdout_logfile = /home/pi/Inky-Calendar/E-Paper.log stdout_logfile_maxbytes = 1MB -stderr_logfile = /home/pi/E-Paper-Calendar/E-Paper-err.log +stderr_logfile = /home/pi/Inky-Calendar/E-Paper-err.log stderr_logfile_maxbytes = 1MB EOF sudo service supervisor start E-Paper - # Installing some new dependencies - echo "Installing some new dependencies" - sudo apt-get install python-numpy -y - sudo pip3 install feedparser - pip3 install feedparser echo "" # Final words @@ -147,7 +251,7 @@ EOF echo -e "\e[1;31m"If this file is not modified, the programm will not start"\e[0m" echo -e "\e[1;36m"To modify the settings file, enter:"\e[0m" - echo -e "\e[1;36m"nano /home/pi/E-Paper-Calendar/Calendar/settings.py"\e[0m" + echo -e "\e[1;36m"nano /home/pi/Inky-Calendar/Calendar/settings.py"\e[0m" echo -e "\e[1;36m"You can test if the programm works by typing:"\e[0m" - echo -e "\e[1;36m"python3.5 /home/pi/E-Paper-Calendar/Calendar/E-Paper.py"\e[0m" + echo -e "\e[1;36m"python3.5 /home/pi/Inky-Calendar/Calendar/E-Paper.py"\e[0m" fi diff --git a/New-version-planning.md b/New-version-planning.md index 125abe7..6dbcce1 100644 --- a/New-version-planning.md +++ b/New-version-planning.md @@ -1,24 +1,29 @@ +## This file will be deleted soon as the progress of the next release has been shifted to 'Projects' + ### This file contains features in planning for the next release # For version 1.6 ## Installer -* Optimise the installer by adding a few more options when updating +* Optimise the installer by adding a few more options when updating +* Add version number on both, the installer and the software version to allow automatic updates ## Main script | Feature | Status | | -- | -- | -|Implement daily view (will take some more time)| Not yet started | +|Use relative path instead of explicit path| work in progress | +|Implement Agenda view (will take some more time)| Work in progress | |Display more events when free space is available (below monthly calendar)| finished -> implemented in master branch| -|Implement feature to fetch tasks| work in progress. Problem encountered: Google Calendar does not support vtodo (tasks)| +|Implement feature to fetch tasks| canceled as Google Calendar does not support VTODO (Tasks)| |Add code in E-Paper.py for fixing errors related to the iCalendar (ics.py is pretty picky)| finished -> implemented in master branch | |Add support for recurring events found in iCalendars| finished -> implemented in master branch (credit to Hubert)| |Truncate event names if they're too long to be displayed|finished -> implemented in master branch| |Fix a bug where past events are shown along with ones in the future| finished -> implemented in master branch | |Add support for ics files along with iCalendar URLs| Not yet started | -|Add feature to fetch rss-feeds and display it on the E-Paper| Work in progress, nearly finished.| +|Add feature to fetch rss-feeds and display it on the E-Paper| finished -> implemented in master branch | |Add 'pre-processing' operations on the generated image to greatly improve readablity| finished -> implemented in master branch | |Fetch events in iCalendar if they are in the range specified by the settings.py file|finished -> implemented in master branch| +|Allow leaving some setting blank(iCalendar, api_key) in case users want to test the software first| -> work in progress| ## E-Paper files (epd7in5/epd7in5b) | Feature | Status | @@ -29,10 +34,10 @@ ## Settings file | Feature | Status | | -- | -- | -| Add option to switch between the monthly and daily view | not yet started | +| Add option to switch between the monthly and agenda-view | work in progress | | Add option to display one of the following below the monthly Calendar section: Tasks, RSS-feed, events| work in progress | | Add option to fetch events from a given time range in the future| finished -> implemented in master branch| -| Add option to choose the Display-update interval| work in progress | +| Add option to choose the Display-update interval| finished -> implemented in master branch | --------------------------- ## More feature suggestions (will not be implemented anytime soon) diff --git a/README.md b/README.md index 6c35a1d..6d9eb95 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- +

@@ -15,6 +15,8 @@ A software written in python3 that allows you to transform an E-Paper display (l This software fully supports the 3-Colour **and** 2-Colour version of the 7.5" E-Paper display from waveshare/gooddisplay and works with Raspberry Pi 2, 3 and 0 (Zero, Zero W, Zero WH). ## News: +* **Updated and optimised the installer for faster installation and updating (Mid April 2019) +* **Added a user-friendly Web-UI for adding details to the programm** (Credit to TobyChui for the template) * **Version 1.5 released (Early February 2019) with a new layout, displayed events and many back-end improvements** ## Preview @@ -54,17 +56,26 @@ This software fully supports the 3-Colour **and** 2-Colour version of the 7.5" E ## Installing required packages for python 3.x Execute the following command in the Terminal to install all required packages. This will work on both, Raspbian Stretch with Desktop and Raspbian Stretch lite. -**`bash -c "$(curl -sL https://raw.githubusercontent.com/aceisace/Inky-Calendar/master/Installer-with-debug.sh)"`** +**`bash -c "$(curl -sL https://raw.githubusercontent.com/aceisace/Inky-Calendar/Stable/Installer-with-debug.sh)"`** If the Installer should fail for any reason, kindly open an issue and paste the error. Thanks. **Screenshot of the installer:** - + ## Adding details to the programm -Once the packages are installed, navigate to the home directory, open 'E-Paper-Calendar' and open the file 'settings.py' inside the Calendar folder. Adjust the values using the list below as a reference. You can edit the settings.py file by typing: -`nano /home/pi/E-Paper-Calendar/Calendar/settings.py` in the Terminal. +There are currently 2 ways to add details to the programm, the user-friendly method and the legacy method. It's recommended to use the +user-friendly option first. If you encounter any bugs, please use the legacy method and write a comment describing the bug. + +1) **User-friendly method** +To use the new WEB-UI (Web-User-Interface), simply double-click the file Settings-Web-UI.html located in /home/pi/Inky-Calendar/Calendar/ to open up the document with the browser (Chrome etc.). Next, fill in the details (you can use the table below for a reference) and click on generate to create your settings.py file. Lastly, copy the generated 'settings.py' file to /home/pi/Inky-Calendar/Calendar (the same path where the settings.py file is) and try starting the main script with: +python3.5 /home/pi/Inky-Calendar/Calendar/E-Paper.py. +If you encounter any issues, please leave a comment here or via email. Thanks in advance. + +2) **Legacy method** +Navigate to the home directory, open 'Inky-Calendar' and open the file 'settings.py' inside the Calendar folder. Adjust the values using the list below as a reference. You can edit the settings.py file by typing: +`nano /home/pi/Inky-Calendar/Calendar/settings.py` in the Terminal. | Parameter | Description | | :---: | :---: | @@ -94,9 +105,9 @@ If you encounter errors related to your iCalendar, please feel free to report th ## Updating If you want to update to the latest version, run the Installer from above again and select the 'update' option. -Before updating, the Installer checks if the settings file (/home/pi/E-Paper-Calendar/Calendar/settings.py) exists. This is done to test if a previous version was installed correctly. If the settings file exists, it is copied to the home directory and renamed as 'settings.py.old'. The old software folder 'E-Paper-Calendar' is renamed to 'E-Paper-Calendar-old'. Lastly, the latest version of the software is copied to the Raspberry as 'E-Paper-Calendar'. +Before updating, the Installer checks if the settings file (/home/pi/Inky-Calendar/Calendar/settings.py) exists. This is done to test if a previous version was installed correctly. If the settings file exists, it is copied to the home directory and renamed as 'settings.py.old'. The old software folder 'Inky-Calendar' is renamed to 'Inky-Calendar-old'. Lastly, the latest version of the software is copied to the Raspberry as 'Inky-Calendar'. -After updating, copy the contents from your old settings file to the new one. There are usally more options in the new settings.py file so a 'template' is prepared with each update. This template can be found in /home/pi/E-Paper-Calendar/Calendar/settings.py.sample. +After updating, copy the contents from your old settings file to the new one. There are usally more options in the new settings.py file so a 'template' is prepared with each update. This template can be found in /home/pi/Inky-Calendar/Calendar/settings.py.sample. ## Contributing All sorts of contributions are most welcome and appreciated. To start contributing, please follow the [Contribution Guidelines](https://github.com/aceisace/Inky-Calendar/blob/master/CONTRIBUTING.md). diff --git a/developers/rss.py b/developers/rss.py deleted file mode 100644 index edf97a5..0000000 --- a/developers/rss.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python3 -# -*- coding: utf-8 -*- -""" -RSS-feed parser for multiple rss-feeds from URLs. -In development for the E-Paper-Calendar software. -Currently in alpha phase. Beta testers more than welcome. Please send me a mail to let me know what can be fixed/improved here. Thanks. - -Copyright by aceisace -""" - -import feedparser -import arrow -import datetime - -rss_feeds=[ - "http://feeds.bbci.co.uk/news/world/rss.xml#", - ] - -"""How old should the oldest posts be in days?""" -max_range = 14 # 2 weeks - - -today = datetime.date.today() -time_span = today - datetime.timedelta(days=max_range) - -for feeds in rss_feeds: - parse = feedparser.parse(feeds) - print(parse['feed']['title']) - print('________________________') - for posts in parse.entries: - # RSS feeds may contain year as '2013' or just '13', hence the 2 options below - try: - post_dt = datetime.datetime.strptime(posts.published, '%a, %d %b %Y %H:%M:%S %Z') - except Exception as e: - post_dt = datetime.datetime.strptime(posts.published, '%a, %d %b %y %H:%M:%S %Z') - - if post_dt.date() >= time_span: - print(arrow.get(post_dt).humanize(), '\n',posts.title) - #local.humanize(locale='ko_kr') diff --git a/prototype.sh b/prototype.sh index f8cd47c..bb5ad25 100644 --- a/prototype.sh +++ b/prototype.sh @@ -1,15 +1,12 @@ -# Please do not use this file. It is only intended for testing new features and can potentially damage the system. #!/bin/bash -# E-Paper-Calendar software installer for the raspberry pi -# Version: 1.5 (Early Februrary 2019) -# Stability status of this installer: pending -# Copyright by aceisace +# E-Paper-Calendar software installer for Raspberry pi +# Version: 1.6 (Mid April 2019) +# Stability status of this installer: Testing in progress echo -e "\e[1mPlease select an option from below:" echo -e "\e[97mEnter \e[91m1 \e[97m to update the E-Paper software" echo -e "\e[97mEnter \e[91m2 \e[97m to install the E-Paper software" echo -e "\e[97mEnter \e[91m3 \e[97m to uninstall the E-Paper software" -echo -e "\e[1mNote: Updating will back up just the settings.py file." echo -e "\e[97mConfirm your selection with [ENTER]" read -r -p 'Waiting for input... ' option @@ -22,95 +19,212 @@ if [ -z "$option" ]; then exit fi if [ "$option" = 3 ]; then - echo -e "Removing the E-Paper software now..." - pip3 uninstall Pillow -y && sudo pip3 uninstall Pillow -y && sudo pip3 uninstall pyowm -y&& sudo pip3 uninstall ics -y && pip3 uninstall pyowm -y && pip3 uninstall ics -y && sudo apt-get remove supervisor -y && sudo apt-get clean && sudo apt-get autoremove -y + echo -e "\e[1;36m"Removing the E-Paper software now..."\e[0m" + pip3 uninstall Pillow -y && sudo pip3 uninstall Pillow -y && sudo pip3 uninstall pyowm -y&& sudo pip3 uninstall ics -y && pip3 uninstall pyowm -y && pip3 uninstall ics -y && sudo apt-get remove supervisor -y && pip3 uninstall feedparser -y && sudo pip3 uninstall feedparser -y && sudo apt-get clean && sudo apt-get autoremove -y if [ -e /etc/supervisor/conf.d/E-Paper.conf ]; then sudo rm /etc/supervisor/conf.d/E-Paper.conf fi - echo -e "The libraries have been removed successfully" - echo -e "Removing the E-Paper-Calendar folder if it exists" - if [ -d "/home/pi/E-Paper-Master" ]; then - sudo rm -r /home/pi/E-Paper-Master/ + echo -e "\e[1;36m"The libraries have been removed successfully"\e[0m" + sleep 1 + echo -e "Removing the Inky-Calendar folder if it exists" + if [ -d "/home/pi/Inky-Calendar" ]; then + sudo rm -r /home/pi/Inky-Calendar/ + echo -e "\e[1;36m"Found the E-Paper-software folder and deleted it"\e[0m" fi + echo -e "\e[1;36m"All done!"\e[0m" fi if [ "$option" = 1 ]; then - echo "Checking if the settings.py exists..." - if [ -e /home/pi/E-Paper-Master/Calendar/settings.py ]; then + echo -e "\e[1;36m"Checking if the settings.py exists..."\e[0m" + if [ -e /home/pi/Inky-Calendar/Calendar/settings.py ]; then echo -e "Found an E-Paper settings file." sleep 2 echo "Backing up the current settings file in the home directory." sleep 2 - cp /home/pi/E-Paper-Master/Calendar/settings.py /home/pi/settings-old.py + cp /home/pi/Inky-Calendar/Calendar/settings.py /home/pi/settings-old.py echo -e "renaming the old E-Paper software folder" sleep 2 - cp -r /home/pi/E-Paper-Master /home/pi/E-Paper-Master-old - sudo rm -r /home/pi/E-Paper-Master + cp -r /home/pi/Inky-Calendar /home/pi/Inky-Calendar-old + sudo rm -r /home/pi/Inky-Calendar echo "Updating now..." - echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" cd else - echo -e "Could not find any settings.py file in /home/pi/E-Paper-Master" - echo -e "Please uninstall the software first and then use the install option" - echo -e "Exiting now" - exit + # Ask to update anyway. May not work always, but can help with new versions. + echo -e "\e[1;36m"Could not find the configuration file -settings.py- in /home/pi/Inky-Calendar/Calendar"\e[0m" + sleep 2 + echo -e "\e[1;36m"Would you like to update the Inky-Calendar software anyway?"\e[0m" + echo -e "\e[97mPlease type [y] for yes or [n] for no and confirm your selection with [ENTER]" + read -r -p 'Waiting for input... ' update_anyway + + if [ "$update_anyway" != Y ] && [ "$update_anyway" != y ] && [ "$update_anyway" != N ] && [ "$update_anyway" != n ]; then + echo -e "invalid input, aborting now" + exit + fi + if [ -z "$update_anyway" ]; then + echo -e "You didn't enter anything, aborting now." + exit + fi + + if [ "$update_anyway" = Y ] || [ "$update_anyway" = y ]; then + echo "Updating now..." + else + echo -e "Not attempting to update, exiting now." + exit + fi fi fi if [ "$option" = 2 ]; then - echo -e "\e[1;36m"The installer will finish the rest now. You can enjoy a break in the meanwhile."\e[0m" - - # Updating and upgrading the system, without taking too much space - echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m" - echo -e "\e[1;36m"This will take a while, sometimes up to 30 mins"\e[0m" - sudo apt-get update && sudo apt-get dist-upgrade -y - echo -e "\e[1;36m"System successfully updated and upgraded!"\e[0m" - echo "" + echo -e "\e[1;36m"Setting up the system by installing some required libraries for python3"\e[0m" # Installing a few packages which are missing on Raspbian Stretch Lite echo -e "\e[1;36m"Installing a few packages that are missing on Raspbian Stretch Lite..."\e[0m" - sudo apt-get install python3-pip python-rpi.gpio-dbgsym python3-rpi.gpio python-rpi.gpio python3-rpi.gpio-dbgsym python3-spidev git libopenjp2-7-dev libtiff5 -y - pip3 install Pillow==5.3.0 - sudo pip3 install Pillow==5.3.0 + sudo apt-get install python3-pip -y python-rpi.gpio-dbgsym -y python3-rpi.gpio -y python-rpi.gpio -y python3-rpi.gpio-dbgsym -y python3-spidev -y git -y libopenjp2-7-dev -y libtiff5 -y python3-numpy -y echo "" # Running apt-get clean and apt-get autoremove echo -e "\e[1;36m"Cleaning a bit of mess to free up some space..."\e[0m" sudo apt-get clean && sudo apt-get autoremove -y echo "" - - # Installing packages required by the main script - echo -e "\e[1;36m"Installing a few required packages for the E-Paper Software"\e[0m" - sudo pip3 install pyowm - sudo pip3 install ics - pip3 install pyowm - pip3 install ics - echo -e "\e[1;36m"Finished installing libraries"\e[0m" fi if [ "$option" = 1 ] || [ "$option" = 2 ]; then - echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" + # Ask to update system + echo -e "\e[1;36m"Would you like to update and upgrade the operating system first?"\e[0m" + sleep 1 + echo -e "\e[97mIt is not scrictly required, but highly recommended." + sleep 1 + echo -e "\e[97mPlease note that updating may take quite some time, in rare cases up to 1 hour." + sleep 1 + echo -e "\e[97mPlease type [y] for yes or [n] for no and confirm your selection with [ENTER]" + read -r -p 'Waiting for input... ' update + + if [ "$update" != Y ] && [ "$update" != y ] && [ "$update" != N ] && [ "$update" != n ]; then + echo -e "invalid input, aborting now" + exit + fi + if [ -z "$update" ]; then + echo -e "You didn't enter anything, aborting now." + exit + fi + + if [ "$update" = Y ] || [ "$update" = y ]; then + # Updating and upgrading the system, without taking too much space + echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m" + sleep 1 + echo -e "\e[1;36m"This will take a while, sometimes up to 1 hour"\e[0m" + sudo apt-get update && sudo apt-get dist-upgrade -y + echo -e "\e[1;36m"System successfully updated and upgraded!"\e[0m" + echo "" + fi + + # Installing dependencies + + #PYOWM for user pi + echo -e "\e[1;36m"Installing dependencies for the Inky-Calendar software"\e[0m" + + echo -e "\e[1;36m"Checking if pyowm is installed for user pi"\e[0m" + if python3.5 -c "import pyowm" &> /dev/null; then + echo 'pyowm is installed, skipping installation of this package.' + else + echo 'pywom is not installed, attempting to install now' + pip3 install pyowm + fi + + #PYOWM for user sudo + echo -e "\e[1;36m"Checking if pyowm is installed for user sudo"\e[0m" + if sudo python3.5 -c "import pyowm" &> /dev/null; then + echo 'pyowm is installed, skipping installation of this package.' + else + echo 'pywom is not installed, attempting to install now' + sudo pip3 install pyowm + fi + + #Pillow for user pi + echo -e "\e[1;36m"Checking if Pillow is installed for user pi"\e[0m" + if python3.5 -c "import PIL" &> /dev/null; then + echo 'Pillow is installed, skipping installation of this package.' + else + echo 'Pillow is not installed, attempting to install now' + pip3 install Pillow==5.3.0 + fi + + #Pillow for user sudo + echo -e "\e[1;36m"Checking if Pillow is installed for user sudo"\e[0m" + if sudo python3.5 -c "import PIL" &> /dev/null; then + echo 'Pillow is installed, skipping installation of this package.' + else + echo 'Pillow is not installed, attempting to install now' + sudo pip3 install Pillow==5.3.0 + fi + + #Ics.py for user pi + echo -e "\e[1;36m"Checking if ics is installed for user pi"\e[0m" + if python3.5 -c "import ics" &> /dev/null; then + echo 'ics is installed, skipping installation of this package.' + else + echo 'ics is not installed, attempting to install now' + pip3 install ics + fi + + #Ics.py for user sudo + echo -e "\e[1;36m"Checking if ics is installed for user sudo"\e[0m" + if sudo python3.5 -c "import ics" &> /dev/null; then + echo 'ics is installed, skipping installation of this package.' + else + echo 'ics is not installed, attempting to install now' + sudo pip3 install ics + fi + + #feedparser for user pi + echo -e "\e[1;36m"Checking if feedparser is installed for user pi"\e[0m" + if python3.5 -c "import feedparser" &> /dev/null; then + echo 'feedparser is installed, skipping installation of this package.' + else + echo 'feedparser is not installed, attempting to install now' + pip3 install feedparser + fi + + #feedparser for user sudo + echo -e "\e[1;36m"Checking if feedparser is installed for user sudo"\e[0m" + if sudo python3.5 -c "import feedparser" &> /dev/null; then + echo 'feedparser is installed, skipping installation of this package.' + else + echo 'feedparser is not installed, attempting to install now' + sudo pip3 install feedparser + fi + + echo -e "\e[1;36m"Finished installing all dependencies"\e[0m" + + # Clone the repository, then delete some non-required files + echo -e "\e[1;36m"Installing the Inky-Calendar Software for your display"\e[0m" cd - git clone https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather - mkdir E-Paper-Master - cd E-Paper-Calendar-with-iCal-sync-and-live-weather - cp -r Calendar /home/pi/E-Paper-Master/ - cp README.md /home/pi/E-Paper-Master/ - cp LICENSE /home/pi/E-Paper-Master/ - cp -r .git /home/pi/E-Paper-Master/ + git clone https://github.com/aceisace/Inky-Calendar Inky-Calendar-temp + mkdir Inky-Calendar + cd Inky-Calendar-temp + cp -r Calendar /home/pi/Inky-Calendar/ + cp README.md /home/pi/Inky-Calendar/ + cp LICENSE /home/pi/Inky-Calendar/ + cp -r .git /home/pi/Inky-Calendar/ + + # Make a copy of the sample settings.py file + cd /home/pi/Inky-Calendar/Calendar + cp settings.py.sample settings.py + + # Remove the downloaded (temporary) directory cd - sudo rm -r E-Paper-Calendar-with-iCal-sync-and-live-weather + sudo rm -r Inky-Calendar-temp # add a short info - cat > /home/pi/E-Paper-Master/Info.txt << EOF -This document contains a short info of the E-Paper-Calendar software version + cat > /home/pi/Inky-Calendar/Info.txt << EOF +This document contains a short info of the Inky-Calendar software version -Version: 1.5 -Installer version: 1.5 (Early February 2019) -configuration file: /home/pi/E-Paper-Master/Calendar/settings.py +Version: 1.6 +Installer version: 1.6 (Mid April 2019) +configuration file: /home/pi/Inky-Calendar/Calendar/settings.py If the time was set correctly, you installed this software on: EOF - echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt + echo "$(date)" >> /home/pi/Inky-Calendar/Info.txt echo "" # Setting up supervisor @@ -119,25 +233,25 @@ EOF sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF [program:E-Paper] -command = sudo /usr/bin/python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py -stdout_logfile = /home/pi/E-Paper-Master/E-Paper.log +command = sudo /usr/bin/python3.5 /home/pi/Inky-Calendar/Calendar/E-Paper.py +stdout_logfile = /home/pi/Inky-Calendar/E-Paper.log stdout_logfile_maxbytes = 1MB -stderr_logfile = /home/pi/E-Paper-Master/E-Paper-err.log +stderr_logfile = /home/pi/Inky-Calendar/E-Paper-err.log stderr_logfile_maxbytes = 1MB EOF sudo service supervisor start E-Paper + echo "" # Final words echo -e "\e[1;36m"The install was successful"\e[0m" - echo -e "\e[1;36m"The programm will now start at every boot."\e[0m" - + echo -e "\e[1;36m"The programm is set to start at every boot."\e[0m" echo -e "\e[1;31m"Please enter your details in the file 'settings.py'."\e[0m" echo -e "\e[1;31m"If this file is not modified, the programm will not start"\e[0m" echo -e "\e[1;36m"To modify the settings file, enter:"\e[0m" - echo -e "\e[1;36m"nano /home/pi/E-Paper-Master/Calendar/settings.py"\e[0m" + echo -e "\e[1;36m"nano /home/pi/Inky-Calendar/Calendar/settings.py"\e[0m" echo -e "\e[1;36m"You can test if the programm works by typing:"\e[0m" - echo -e "\e[1;36m"python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py"\e[0m" + echo -e "\e[1;36m"python3.5 /home/pi/Inky-Calendar/Calendar/E-Paper.py"\e[0m" fi