From 97976242cba52b0484145c5be59ac7148d5b38a5 Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 23 Jul 2024 01:33:28 +0200 Subject: [PATCH 1/5] facelift & landing page --- inkycal/modules/inkycal_webshot.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/inkycal/modules/inkycal_webshot.py b/inkycal/modules/inkycal_webshot.py index 8d08cc6..299145d 100644 --- a/inkycal/modules/inkycal_webshot.py +++ b/inkycal/modules/inkycal_webshot.py @@ -8,7 +8,6 @@ from htmlwebshot import WebShot from inkycal.custom import * from inkycal.modules.inky_image import Inkyimage as Images, image_to_palette from inkycal.modules.template import inkycal_module -from tests import Config logger = logging.getLogger(__name__) @@ -80,7 +79,7 @@ class Webshot(inkycal_module): """Generate image for this module""" # Create tmp path - tmpFolder = Config.TEMP_PATH + tmpFolder = "temp" if not os.path.exists(tmpFolder): print(f"Creating tmp directory {tmpFolder}") From 561424b19fab4a2a9e1bd04715b2da11cace741d Mon Sep 17 00:00:00 2001 From: Harry Twyford Date: Tue, 27 Aug 2024 08:06:32 -0400 Subject: [PATCH 2/5] Add apt update command to README The README suggests that the user download an old version of Raspbian. On this version, a `sudo apt update` is required before installing packages from apt-get. Otherwise, some of the packages 404 because the package servers changed branch names: ``` htwyford@inkycal:~ $ sudo apt update Get:1 http://archive.raspberrypi.org/debian bullseye InRelease [39.0 kB] Get:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease [15.0 kB] Get:3 http://archive.raspberrypi.org/debian bullseye/main armhf Packages [321 kB] Get:4 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages [13.2 MB] Get:5 http://raspbian.raspberrypi.org/raspbian bullseye/non-free armhf Packages [106 kB] Fetched 13.7 MB in 14s (990 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done 109 packages can be upgraded. Run 'apt list --upgradable' to see them. N: Repository 'http://archive.raspberrypi.org/debian bullseye InRelease' changed its 'Suite' value from 'stable' to 'oldstable' N: Repository 'http://raspbian.raspberrypi.org/raspbian bullseye InRelease' changed its 'Suite' value from 'stable' to 'oldstable' ``` --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 20a9dd2..fe93170 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,7 @@ Run the following steps to install Inkycal. Do **not** use sudo for this, except ```bash # Raspberry Pi specific section start +sudo apt update sudo apt-get install git zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python-dev-is-python3 scons libssl-dev python3-venv python3-pip git libfreetype6-dev wkhtmltopdf libopenblas-dev git clone https://github.com/WiringPi/WiringPi cd WiringPi From bef2efcbdfc8de45f32f5260b29ea7ff763dcf6a Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 27 Aug 2024 15:04:09 +0200 Subject: [PATCH 3/5] improve handling when piSugar is off --- inkycal/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inkycal/main.py b/inkycal/main.py index cef0e11..6238082 100644 --- a/inkycal/main.py +++ b/inkycal/main.py @@ -163,7 +163,12 @@ class Inkycal: self.pisugar = PiSugar() self.battery_capacity = self.pisugar.get_battery() - logger.info(f"PiSugar battery capacity: {self.battery_capacity}%") + + if not self.battery_capacity: + logger.warning("[PISUGAR] Could not get battery capacity! Is the board off? Setting battery capacity to 0%") + self.battery_capacity = 100 + else: + logger.info(f"PiSugar battery capacity: {self.battery_capacity}%") if self.battery_capacity < 20: logger.warning("Battery capacity is below 20%!") From f08907eb8ac09b3741437736d8e43b4ab62dbd68 Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 27 Aug 2024 15:09:03 +0200 Subject: [PATCH 4/5] fix showing only single feed --- inkycal/modules/inkycal_feeds.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inkycal/modules/inkycal_feeds.py b/inkycal/modules/inkycal_feeds.py index 38a6294..99f1854 100644 --- a/inkycal/modules/inkycal_feeds.py +++ b/inkycal/modules/inkycal_feeds.py @@ -114,7 +114,7 @@ class Feeds(inkycal_module): # if "description" in posts: if parsed_feeds: - parsed_feeds = [i.split("\n") for i in parsed_feeds][0] + parsed_feeds = [i.split("\n") for i in parsed_feeds] parsed_feeds = [i for i in parsed_feeds if i] # Shuffle the list to prevent showing the same content @@ -129,7 +129,7 @@ class Feeds(inkycal_module): filtered_feeds, counter = [], 0 for posts in parsed_feeds: - wrapped = text_wrap(posts, font=self.font, max_width=line_width) + wrapped = text_wrap(posts[0], font=self.font, max_width=line_width) counter += len(wrapped) if counter < max_lines: filtered_feeds.append(wrapped) From 05cd1e13a57f3639bf4b4657d0e1eb825248ba41 Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 27 Aug 2024 15:11:11 +0200 Subject: [PATCH 5/5] update apt as otherwise, apt gets 404s --- .github/workflows/test-on-rpi.yml | 1 + .github/workflows/update-os.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/test-on-rpi.yml b/.github/workflows/test-on-rpi.yml index 5e3f014..1dffda5 100644 --- a/.github/workflows/test-on-rpi.yml +++ b/.github/workflows/test-on-rpi.yml @@ -41,6 +41,7 @@ jobs: echo $HOME whoami cd /home/inky + sudo apt update sudo apt-get update -y sudo apt-get install git zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python3-dev scons libssl-dev python3-venv python3-pip git libfreetype6-dev wkhtmltopdf libopenblas-dev -y echo $PWD && ls diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index 9641a76..f298e71 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -37,6 +37,7 @@ jobs: # get kernel info uname -srm cd /home/inky + sudo apt update sudo apt-get update -y # sudo apt-get dist-upgrade -y