| @@ -19,7 +19,10 @@ body{ | |||||||
|   <div class="ts segment"> |   <div class="ts segment"> | ||||||
|     <div class="ts header"> |     <div class="ts header"> | ||||||
|       Setting Generator |       Setting Generator | ||||||
| 			<div class="sub header"><a href="https://github.com/aceisace/Inky-Calendar">For Inky-Calendar Project of Ace-Innovation Laboratory (by aceisace)</a> Project<br> |       <div class="sub header"><a href="https://github.com/aceisace/Inky-Calendar">For Inky-Calendar Project of Ace-Innovation Laboratory (by aceisace)</a><br> | ||||||
|  |       <img src="https://github.com/aceisace/Inky-Calendar/blob/Stable/Gallery/Inky-Calendar-logo.png?raw=true" width="800"> | ||||||
|  |       <div> | ||||||
|  |       </div> | ||||||
|       <ins>If no value is filled in for any of the row, the default value will be used.</ins> |       <ins>If no value is filled in for any of the row, the default value will be used.</ins> | ||||||
|       </div> |       </div> | ||||||
|        |        | ||||||
| @@ -27,12 +30,12 @@ body{ | |||||||
|   </div> |   </div> | ||||||
|     <form class="ts form"> |     <form class="ts form"> | ||||||
|       <div class="field"> |       <div class="field"> | ||||||
| 				<label>iCalendar URL/s</label> |         <label>iCalendar URL. If you want to add multiple URLs, seperate each one with a comma.</label> | ||||||
|         <input id="ical_urls" type="text" placeholder="https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics"> |         <input id="ical_urls" type="text" placeholder="https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics"> | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|             <div class="field"> |             <div class="field"> | ||||||
| 				<label>RSS-Feed URLs</label> |         <label>RSS-Feed URL. To add more than one feed, seperate each URL with a comma.</label> | ||||||
|         <input id="rss_urls" type="text" placeholder="http://feeds.bbci.co.uk/news/world/rss.xml#"> |         <input id="rss_urls" type="text" placeholder="http://feeds.bbci.co.uk/news/world/rss.xml#"> | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
| @@ -52,7 +55,7 @@ body{ | |||||||
|             <label for="update_30_mins">every 30 minutes</label> |             <label for="update_30_mins">every 30 minutes</label> | ||||||
|           </div> |           </div> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| 						<input id="update_60_mins" type="radio" name="aa"> |             <input id="update_60_mins" type="radio" name="aa" checked> | ||||||
|             <label for="update_60_mins">every 60 minutes</label> |             <label for="update_60_mins">every 60 minutes</label> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
| @@ -66,7 +69,7 @@ body{ | |||||||
|             <label for="event_feature">Events from my iCalendar</label> |             <label for="event_feature">Events from my iCalendar</label> | ||||||
|           </div> |           </div> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| 						<input id="rss_feature" type="radio" name="af"> |             <input id="rss_feature" type="radio" name="af" checked> | ||||||
|             <label for="rss_feature">RSS-Feeds</label> |             <label for="rss_feature">RSS-Feeds</label> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
| @@ -85,7 +88,7 @@ body{ | |||||||
|         <label>Week starts on</label> |         <label>Week starts on</label> | ||||||
|         <div class="ts checkboxes"> |         <div class="ts checkboxes"> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| 						<input id="week_monday" type="radio" name="hr"> |             <input id="week_monday" type="radio" name="hr" checked> | ||||||
|             <label for="week_monday">Monday</label> |             <label for="week_monday">Monday</label> | ||||||
|           </div> |           </div> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| @@ -109,7 +112,7 @@ body{ | |||||||
|         <label>Which Colours does your E-Paper Display support?</label> |         <label>Which Colours does your E-Paper Display support?</label> | ||||||
|         <div class="ts checkboxes"> |         <div class="ts checkboxes"> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| 						<input id="b_w_r" type="radio" name="dp"> |             <input id="b_w_r" type="radio" name="dp" checked> | ||||||
|             <label for="b_w_r">Black-White-Red</label> |             <label for="b_w_r">Black-White-Red</label> | ||||||
|           </div> |           </div> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| @@ -123,7 +126,7 @@ body{ | |||||||
|         <label>Which language do you prefer for the Calendar?</label> |         <label>Which language do you prefer for the Calendar?</label> | ||||||
|         <div class="ts checkboxes"> |         <div class="ts checkboxes"> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| 						<input id="language_en" type="radio" name="la"> |             <input id="language_en" type="radio" name="la" checked> | ||||||
|             <label for="language_en">English</label> |             <label for="language_en">English</label> | ||||||
|           </div> |           </div> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| @@ -141,7 +144,7 @@ body{ | |||||||
|         <label>Which units are used in your country?</label> |         <label>Which units are used in your country?</label> | ||||||
|         <div class="ts checkboxes"> |         <div class="ts checkboxes"> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| 						<input id="metric" type="radio" name="un"> |             <input id="metric" type="radio" name="un" checked> | ||||||
|             <label for="metric">Metric</label> |             <label for="metric">Metric</label> | ||||||
|           </div> |           </div> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| @@ -159,7 +162,7 @@ body{ | |||||||
|             <label for="12_hours">12-hour format</label> |             <label for="12_hours">12-hour format</label> | ||||||
|           </div> |           </div> | ||||||
|           <div class="ts radio checkbox"> |           <div class="ts radio checkbox"> | ||||||
| 						<input id="24_hours" type="radio" name="tf"> |             <input id="24_hours" type="radio" name="tf" checked> | ||||||
|             <label for="24_hours">24-hour format</label> |             <label for="24_hours">24-hour format</label> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
| @@ -189,7 +192,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||||||
|   <br> |   <br> | ||||||
|    |    | ||||||
|   <script> |   <script> | ||||||
| 	var template = 'ical_urls = [\n"{ical_urls}"\n]\nrss_feeds = [\n"{rss_urls}"\n]\nupdate_interval = "{update_interval}"\nadditional_feature = "{additional_feature}"\napi_key = "{api_key}"\nlocation = "{location}"\nweek_starts_on = "{week_starts_on}"\nevents_max_range = "{events_max_range}"\ndisplay_colours = "{display_colours}"\nlanguage = "{language}"\nunits = "{units}"\nhours = "{hours}"'; |   var template = 'ical_urls = [\n"{ical_urls}"\n]\nrss_feeds = [\n"{rss_urls}"\n]\nupdate_interval = "{update_interval}"\nadditional_feature = "{additional_feature}"\napi_key = "{api_key}"\nlocation = "{location}"\nweek_starts_on = "{week_starts_on}"\nevents_max_range = "{events_max_range}"\ncalibration_hours = [{calibration_hours}]\ndisplay_colours = "{display_colours}"\nlanguage = "{language}"\nunits = "{units}"\nhours = "{hours}"'; | ||||||
|    |    | ||||||
|   function generate(){ |   function generate(){ | ||||||
|     var ical_urls = $("#ical_urls").val().trim(); |     var ical_urls = $("#ical_urls").val().trim(); | ||||||
| @@ -216,7 +219,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||||||
|  |  | ||||||
|     var additional_feature = "events"; |     var additional_feature = "events"; | ||||||
|     if ($('#rss').is(':checked')){ |     if ($('#rss').is(':checked')){ | ||||||
| 			hours = "rss"; |       additional_feature = "rss"; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     var api_key = $("#api_key").val().trim(); |     var api_key = $("#api_key").val().trim(); | ||||||
| @@ -231,7 +234,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||||||
|  |  | ||||||
|     var week_starts_on = "Monday"; |     var week_starts_on = "Monday"; | ||||||
|     if ($('#week_sunday').is(':checked')){ |     if ($('#week_sunday').is(':checked')){ | ||||||
| 			hours = "Sunday"; |       week_starts_on = "Sunday"; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     var events_max_range = $("#events_max_range").val().trim(); |     var events_max_range = $("#events_max_range").val().trim(); | ||||||
| @@ -239,6 +242,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||||||
|       events_max_range = $("#events_max_range").attr("placeholder"); |       events_max_range = $("#events_max_range").attr("placeholder"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     var calibration_hours = $("#calibration_hours").val().trim(); | ||||||
|  |     if (calibration_hours == ""){ | ||||||
|  |       calibration_hours = $("#calibration_hours").attr("placeholder"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     var display_colours = "bw"; |     var display_colours = "bw"; | ||||||
|     if ($('#b_w_r').is(':checked')){ |     if ($('#b_w_r').is(':checked')){ | ||||||
|       display_colours = "bwr"; |       display_colours = "bwr"; | ||||||
| @@ -292,7 +300,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |||||||
|     a.href = link.href; |     a.href = link.href; | ||||||
|     a.download = link.href.substr(link.href.lastIndexOf('/') + 1); |     a.download = link.href.substr(link.href.lastIndexOf('/') + 1); | ||||||
|     document.body.appendChild(a); |     document.body.appendChild(a); | ||||||
| 		$(a).attr('download','setting.py'); |     $(a).attr('download','settings.py'); | ||||||
|     a.click(); |     a.click(); | ||||||
|     document.body.removeChild(a); |     document.body.removeChild(a); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ from PIL import Image | |||||||
| from settings import language | from settings import language | ||||||
| im_open = Image.open | im_open = Image.open | ||||||
|  |  | ||||||
| path = '/home/pi/Calendar/Calendar/' | path = '/home/pi/Inky-Calendar/Calendar/' | ||||||
| wpath = path+'weather-icons/' | wpath = path+'weather-icons/' | ||||||
| mpath = path+'translations/'+language+'/months/' | mpath = path+'translations/'+language+'/months/' | ||||||
| weekpath = path+'translations/'+language+'/week/' | weekpath = path+'translations/'+language+'/week/' | ||||||
|   | |||||||
| @@ -1,20 +1,16 @@ | |||||||
| """ To quickly get started, fill in the following details:""" |  | ||||||
|  |  | ||||||
| ical_urls = [ | ical_urls = [ | ||||||
| "https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics" | "https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics" | ||||||
|     ] | ] | ||||||
|  |  | ||||||
| rss_feeds = [ | rss_feeds = [ | ||||||
|     "http://feeds.bbci.co.uk/news/world/rss.xml#" | "http://feeds.bbci.co.uk/news/world/rss.xml#" | ||||||
|     ] | ] | ||||||
|  |  | ||||||
| update_interval = "60" | update_interval = "60" | ||||||
| additional_feature = "rss" | additional_feature = "events" | ||||||
| api_key = "" | api_key = "" | ||||||
| location = "Julich, DE" | location = "Stuttgart, DE" | ||||||
| week_starts_on = "Monday" | week_starts_on = "Monday" | ||||||
| events_max_range = "60" | events_max_range = "60" | ||||||
| calibration_hours = [1,12,18] | calibration_hours = [0,12,18] | ||||||
| display_colours = "bwr" | display_colours = "bwr" | ||||||
| language = "en" | language = "en" | ||||||
| units = "metric" | units = "metric" | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 130 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Gallery/Inky-Calendar-logo.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Gallery/Inky-Calendar-logo.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 22 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Gallery/installer-v1.6-part1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Gallery/installer-v1.6-part1.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 870 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Gallery/installer-v1.6-part2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Gallery/installer-v1.6-part2.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 372 KiB | 
| @@ -1,8 +1,7 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| # E-Paper-Calendar software installer for the raspberry pi | # E-Paper-Calendar software installer for Raspberry pi | ||||||
| # Version: 1.5 (Early Februrary 2019) | # Version: 1.6 (Mid April 2019) | ||||||
| # Stability status of this installer: Confirmed with Raspbain Stretch Lite on 12th March 2019 | # Stability status of this installer: Stable | ||||||
| # Copyright by aceisace |  | ||||||
|  |  | ||||||
| echo -e "\e[1mPlease select an option from below:" | 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[91m1 \e[97m to update the E-Paper software" | ||||||
| @@ -20,49 +19,63 @@ if [ -z "$option" ]; then | |||||||
|     exit |     exit | ||||||
| fi | fi | ||||||
| if [ "$option" = 3 ]; then | if [ "$option" = 3 ]; then | ||||||
|     echo -e "Removing the E-Paper software now..." |     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 && sudo apt-get clean && sudo apt-get autoremove -y |     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 |     if [ -e /etc/supervisor/conf.d/E-Paper.conf ]; then | ||||||
|         sudo rm /etc/supervisor/conf.d/E-Paper.conf |         sudo rm /etc/supervisor/conf.d/E-Paper.conf | ||||||
|     fi |     fi | ||||||
|     echo -e "The libraries have been removed successfully" |     echo -e "\e[1;36m"The libraries have been removed successfully"\e[0m" | ||||||
|     echo -e "Removing the E-Paper-Calendar folder if it exists" |     sleep 1 | ||||||
|     if [ -d "/home/pi/E-Paper-Calendar" ]; then |     echo -e "Removing the Inky-Calendar folder if it exists" | ||||||
|         sudo rm -r /home/pi/E-Paper-Calendar/ |     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 |     fi | ||||||
|  |     echo -e "\e[1;36m"All done!"\e[0m" | ||||||
| fi | fi | ||||||
|  |  | ||||||
| if [ "$option" = 1 ]; then | if [ "$option" = 1 ]; then | ||||||
|     echo "Checking if the settings.py exists..." |     echo -e "\e[1;36m"Checking if the settings.py exists..."\e[0m" | ||||||
|     if [ -e /home/pi/E-Paper-Calendar/Calendar/settings.py ]; then |     if [ -e /home/pi/Inky-Calendar/Calendar/settings.py ]; then | ||||||
|         echo -e "Found an E-Paper settings file." |         echo -e "Found an E-Paper settings file." | ||||||
|         sleep 2 |         sleep 2 | ||||||
| 	echo "Backing up the current settings file in the home directory." | 	echo "Backing up the current settings file in the home directory." | ||||||
| 	sleep 2 | 	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" | 	echo -e "renaming the old E-Paper software folder" | ||||||
| 	sleep 2 | 	sleep 2 | ||||||
| 	cp -r /home/pi/E-Paper-Calendar /home/pi/E-Paper-Calendar-old | 	cp -r /home/pi/Inky-Calendar /home/pi/Inky-Calendar-old | ||||||
| 	sudo rm -r /home/pi/E-Paper-Calendar | 	sudo rm -r /home/pi/Inky-Calendar | ||||||
| 	echo "Updating now..." | 	echo "Updating now..." | ||||||
|         cd |         cd | ||||||
|     else |     else | ||||||
|         echo -e "Could not find any settings.py file in /home/pi/E-Paper-Calendar/Calendar" |         # Ask to update anyway. May not work always, but can help with new versions. | ||||||
| 	echo -e "Please uninstall the software first and then use the install option" | 	echo -e "\e[1;36m"Could not find the configuration file -settings.py- in /home/pi/Inky-Calendar/Calendar"\e[0m" | ||||||
| 	echo -e "Exiting now" | 	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 |             exit | ||||||
|         fi |         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 | fi | ||||||
|  |  | ||||||
| if [ "$option" = 2 ]; then | 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" |     echo -e "\e[1;36m"Setting up the system by installing some required libraries for python3"\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 "" |  | ||||||
|  |  | ||||||
|     # Installing a few packages which are missing on Raspbian Stretch Lite |     # 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" |     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" |     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 |     sudo apt-get clean && sudo apt-get autoremove -y | ||||||
|     echo "" |     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 | fi | ||||||
|  |  | ||||||
| if [ "$option" = 1 ] || [ "$option" = 2 ]; then | 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 |     cd | ||||||
|     git clone https://github.com/aceisace/Inky-Calendar |     git clone https://github.com/aceisace/Inky-Calendar Inky-Calendar-temp | ||||||
|     mkdir E-Paper-Calendar |     mkdir Inky-Calendar | ||||||
|     cd Inky-Calendar |     cd Inky-Calendar-temp | ||||||
|     cp -r Calendar /home/pi/E-Paper-Calendar/ |     cp -r Calendar /home/pi/Inky-Calendar/ | ||||||
|     cp README.md /home/pi/E-Paper-Calendar/ |     cp README.md /home/pi/Inky-Calendar/ | ||||||
|     cp LICENSE /home/pi/E-Paper-Calendar/ |     cp LICENSE /home/pi/Inky-Calendar/ | ||||||
|     cp -r .git /home/pi/E-Paper-Calendar/ |     cp -r .git /home/pi/Inky-Calendar/ | ||||||
|      |      | ||||||
|     # Make a copy of the sample settings.py file |     # 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 |     cp settings.py.sample settings.py | ||||||
|     cd |  | ||||||
|  |  | ||||||
|     # Remove the downloaded (temporary) directory |     # Remove the downloaded (temporary) directory | ||||||
|     sudo rm -r Inky-Calendar |     cd | ||||||
|  |     sudo rm -r Inky-Calendar-temp | ||||||
|  |  | ||||||
|     # add a short info |     # add a short info | ||||||
|     cat > /home/pi/E-Paper-Calendar/Info.txt << EOF |     cat > /home/pi/Inky-Calendar/Info.txt << EOF | ||||||
| This document contains a short info of the E-Paper-Calendar software version | This document contains a short info of the Inky-Calendar software version | ||||||
|  |  | ||||||
| Version: 1.5 | Version: 1.6 | ||||||
| Installer version: 1.5 (Early February 2019) | Installer version: 1.6 (Mid April 2019) | ||||||
| configuration file: /home/pi/E-Paper-Calendar/Calendar/settings.py | configuration file: /home/pi/Inky-Calendar/Calendar/settings.py | ||||||
| If the time was set correctly, you installed this software on: | If the time was set correctly, you installed this software on: | ||||||
| EOF | EOF | ||||||
|     echo "$(date)" >> /home/pi/E-Paper-Calendar/Info.txt |     echo "$(date)" >> /home/pi/Inky-Calendar/Info.txt | ||||||
|     echo "" |     echo "" | ||||||
|  |  | ||||||
|     # Setting up supervisor |     # Setting up supervisor | ||||||
| @@ -124,20 +233,15 @@ EOF | |||||||
|  |  | ||||||
|     sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF |     sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF | ||||||
| [program:E-Paper] | [program:E-Paper] | ||||||
| command = sudo /usr/bin/python3.5 /home/pi/E-Paper-Calendar/Calendar/E-Paper.py | command = sudo /usr/bin/python3.5 /home/pi/Inky-Calendar/Calendar/E-Paper.py | ||||||
| stdout_logfile = /home/pi/E-Paper-Calendar/E-Paper.log | stdout_logfile = /home/pi/Inky-Calendar/E-Paper.log | ||||||
| stdout_logfile_maxbytes = 1MB | 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 | stderr_logfile_maxbytes = 1MB | ||||||
| EOF | EOF | ||||||
|  |  | ||||||
|     sudo service supervisor start E-Paper |     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 "" |     echo "" | ||||||
|  |  | ||||||
|     # Final words |     # 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;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"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"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 | fi | ||||||
|   | |||||||
| @@ -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 | ### This file contains features in planning for the next release | ||||||
|  |  | ||||||
| # For version 1.6 | # For version 1.6 | ||||||
|  |  | ||||||
| ## Installer | ## 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 | ## Main script | ||||||
| | Feature | Status | | | 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| | |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 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)| | |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| | |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 | | |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 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 | | |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| | |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) | ## E-Paper files (epd7in5/epd7in5b) | ||||||
| | Feature | Status | | | Feature | Status | | ||||||
| @@ -29,10 +34,10 @@ | |||||||
| ## Settings file | ## Settings file | ||||||
| | Feature | Status | | | 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 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 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) | ## More feature suggestions (will not be implemented anytime soon) | ||||||
|   | |||||||
							
								
								
									
										25
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | |||||||
| <p align="center"> | <p align="center"> | ||||||
| <img src="https://github.com/aceisace/Inky-Calendar/blob/master/Gallery/E-Paper-Calendar%20Software-logo.png" width="800"> | <img src="https://github.com/aceisace/Inky-Calendar/blob/Stable/Gallery/Inky-Calendar-logo.png" width="800"> | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
| <p align="center"> | <p align="center"> | ||||||
| @@ -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). | 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: | ## 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** | * **Version 1.5 released (Early February 2019) with a new layout, displayed events and many back-end improvements** | ||||||
|  |  | ||||||
| ## Preview | ## 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 | ## 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.  | 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. | If the Installer should fail for any reason, kindly open an issue and paste the error. Thanks. | ||||||
|  |  | ||||||
| **Screenshot of the installer:** | **Screenshot of the installer:** | ||||||
|  |  | ||||||
| <img src="https://github.com/aceisace/Inky-Calendar/blob/master/Gallery/installer-v1-5-p1.png" width="650"><img src="https://github.com/aceisace/Inky-Calendar/blob/master/Gallery/installer-v1-5-p2.png" width="650"> | <img src="https://github.com/aceisace/Inky-Calendar/blob/Stable/Gallery/installer-v1.6-part1.png" width="650"><img src="https://github.com/aceisace/Inky-Calendar/blob/Stable/Gallery/installer-v1.6-part2.png" width="650"> | ||||||
|  |  | ||||||
| ## Adding details to the programm | ## 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: | 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  | ||||||
| `nano /home/pi/E-Paper-Calendar/Calendar/settings.py` in the Terminal.  | 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 | | | Parameter |  Description | | ||||||
| | :---: | :---: | | | :---: | :---: | | ||||||
| @@ -94,9 +105,9 @@ If you encounter errors related to your iCalendar, please feel free to report th | |||||||
| ## Updating | ## Updating | ||||||
| If you want to update to the latest version, run the Installer from above again and select the 'update' option.  | 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 | ## 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). | 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). | ||||||
|   | |||||||
| @@ -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') |  | ||||||
							
								
								
									
										238
									
								
								prototype.sh
									
									
									
									
									
								
							
							
						
						
									
										238
									
								
								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 | #!/bin/bash | ||||||
| # E-Paper-Calendar software installer for the raspberry pi | # E-Paper-Calendar software installer for Raspberry pi | ||||||
| # Version: 1.5 (Early Februrary 2019) | # Version: 1.6 (Mid April 2019) | ||||||
| # Stability status of this installer: pending | # Stability status of this installer: Testing in progress | ||||||
| # Copyright by aceisace |  | ||||||
|  |  | ||||||
| echo -e "\e[1mPlease select an option from below:" | 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[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[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[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]" | echo -e "\e[97mConfirm your selection with [ENTER]" | ||||||
| read -r -p 'Waiting for input...  ' option | read -r -p 'Waiting for input...  ' option | ||||||
|  |  | ||||||
| @@ -22,95 +19,212 @@ if [ -z "$option" ]; then | |||||||
|     exit |     exit | ||||||
| fi | fi | ||||||
| if [ "$option" = 3 ]; then | if [ "$option" = 3 ]; then | ||||||
|     echo -e "Removing the E-Paper software now..." |     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 && sudo apt-get clean && sudo apt-get autoremove -y |     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 |     if [ -e /etc/supervisor/conf.d/E-Paper.conf ]; then | ||||||
|         sudo rm /etc/supervisor/conf.d/E-Paper.conf |         sudo rm /etc/supervisor/conf.d/E-Paper.conf | ||||||
|     fi |     fi | ||||||
|     echo -e "The libraries have been removed successfully" |     echo -e "\e[1;36m"The libraries have been removed successfully"\e[0m" | ||||||
|     echo -e "Removing the E-Paper-Calendar folder if it exists" |     sleep 1 | ||||||
|     if [ -d "/home/pi/E-Paper-Master" ]; then |     echo -e "Removing the Inky-Calendar folder if it exists" | ||||||
|         sudo rm -r /home/pi/E-Paper-Master/ |     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 |     fi | ||||||
|  |     echo -e "\e[1;36m"All done!"\e[0m" | ||||||
| fi | fi | ||||||
|  |  | ||||||
| if [ "$option" = 1 ]; then | if [ "$option" = 1 ]; then | ||||||
|     echo "Checking if the settings.py exists..." |     echo -e "\e[1;36m"Checking if the settings.py exists..."\e[0m" | ||||||
|     if [ -e /home/pi/E-Paper-Master/Calendar/settings.py ]; then |     if [ -e /home/pi/Inky-Calendar/Calendar/settings.py ]; then | ||||||
|         echo -e "Found an E-Paper settings file." |         echo -e "Found an E-Paper settings file." | ||||||
|         sleep 2 |         sleep 2 | ||||||
| 	echo "Backing up the current settings file in the home directory." | 	echo "Backing up the current settings file in the home directory." | ||||||
| 	sleep 2 | 	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" | 	echo -e "renaming the old E-Paper software folder" | ||||||
| 	sleep 2 | 	sleep 2 | ||||||
| 	cp -r /home/pi/E-Paper-Master /home/pi/E-Paper-Master-old | 	cp -r /home/pi/Inky-Calendar /home/pi/Inky-Calendar-old | ||||||
| 	sudo rm -r /home/pi/E-Paper-Master | 	sudo rm -r /home/pi/Inky-Calendar | ||||||
| 	echo "Updating now..." | 	echo "Updating now..." | ||||||
| 	echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" |  | ||||||
|         cd |         cd | ||||||
|     else |     else | ||||||
|         echo -e "Could not find any settings.py file in /home/pi/E-Paper-Master" |         # Ask to update anyway. May not work always, but can help with new versions. | ||||||
| 	echo -e "Please uninstall the software first and then use the install option" | 	echo -e "\e[1;36m"Could not find the configuration file -settings.py- in /home/pi/Inky-Calendar/Calendar"\e[0m" | ||||||
| 	echo -e "Exiting now" | 	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 |             exit | ||||||
|         fi |         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 | fi | ||||||
|  |  | ||||||
| if [ "$option" = 2 ]; then | 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" |     echo -e "\e[1;36m"Setting up the system by installing some required libraries for python3"\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 "" |  | ||||||
|  |  | ||||||
|     # Installing a few packages which are missing on Raspbian Stretch Lite |     # 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" |     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 |     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 | ||||||
|     pip3 install Pillow==5.3.0 |  | ||||||
|     sudo pip3 install Pillow==5.3.0 |  | ||||||
|     echo "" |     echo "" | ||||||
|  |  | ||||||
|     # Running apt-get clean and apt-get autoremove |     # 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" |     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 |     sudo apt-get clean && sudo apt-get autoremove -y | ||||||
|     echo "" |     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 | fi | ||||||
|  |  | ||||||
| if [ "$option" = 1 ] || [ "$option" = 2 ]; then | 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 |     cd | ||||||
|     git clone https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather |     git clone https://github.com/aceisace/Inky-Calendar Inky-Calendar-temp | ||||||
|     mkdir E-Paper-Master |     mkdir Inky-Calendar | ||||||
|     cd E-Paper-Calendar-with-iCal-sync-and-live-weather |     cd Inky-Calendar-temp | ||||||
|     cp -r Calendar /home/pi/E-Paper-Master/ |     cp -r Calendar /home/pi/Inky-Calendar/ | ||||||
|     cp README.md /home/pi/E-Paper-Master/ |     cp README.md /home/pi/Inky-Calendar/ | ||||||
|     cp LICENSE /home/pi/E-Paper-Master/ |     cp LICENSE /home/pi/Inky-Calendar/ | ||||||
|     cp -r .git /home/pi/E-Paper-Master/ |     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 |     cd | ||||||
|     sudo rm -r E-Paper-Calendar-with-iCal-sync-and-live-weather |     sudo rm -r Inky-Calendar-temp | ||||||
|  |  | ||||||
|     # add a short info |     # add a short info | ||||||
|     cat > /home/pi/E-Paper-Master/Info.txt << EOF |     cat > /home/pi/Inky-Calendar/Info.txt << EOF | ||||||
| This document contains a short info of the E-Paper-Calendar software version | This document contains a short info of the Inky-Calendar software version | ||||||
|  |  | ||||||
| Version: 1.5 | Version: 1.6 | ||||||
| Installer version: 1.5 (Early February 2019) | Installer version: 1.6 (Mid April 2019) | ||||||
| configuration file: /home/pi/E-Paper-Master/Calendar/settings.py | configuration file: /home/pi/Inky-Calendar/Calendar/settings.py | ||||||
| If the time was set correctly, you installed this software on: | If the time was set correctly, you installed this software on: | ||||||
| EOF | EOF | ||||||
|     echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt |     echo "$(date)" >> /home/pi/Inky-Calendar/Info.txt | ||||||
|     echo "" |     echo "" | ||||||
|  |  | ||||||
|     # Setting up supervisor |     # Setting up supervisor | ||||||
| @@ -119,25 +233,25 @@ EOF | |||||||
|  |  | ||||||
|     sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF |     sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF | ||||||
| [program:E-Paper] | [program:E-Paper] | ||||||
| command = sudo /usr/bin/python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py | command = sudo /usr/bin/python3.5 /home/pi/Inky-Calendar/Calendar/E-Paper.py | ||||||
| stdout_logfile = /home/pi/E-Paper-Master/E-Paper.log | stdout_logfile = /home/pi/Inky-Calendar/E-Paper.log | ||||||
| stdout_logfile_maxbytes = 1MB | 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 | stderr_logfile_maxbytes = 1MB | ||||||
| EOF | EOF | ||||||
|  |  | ||||||
|     sudo service supervisor start E-Paper |     sudo service supervisor start E-Paper | ||||||
|  |  | ||||||
|     echo "" |     echo "" | ||||||
|  |  | ||||||
|     # Final words |     # Final words | ||||||
|     echo -e "\e[1;36m"The install was successful"\e[0m" |     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"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;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"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"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 | fi | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user