fine tunings

This commit is contained in:
Remy Moll 2023-11-02 12:21:20 +01:00
parent 1e6f248da1
commit a6c139ec08
6 changed files with 14 additions and 9 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ keys.py
*.pyc *.pyc
.image-cache/ .image-cache/
test.png test.png
*.j2

View File

@ -13,7 +13,7 @@
version: main version: main
- name: Install from the pipenv-file - name: Install from the pipenv-file
command: "pipenv install --system --deploy" command: "pipenv install --system --deploy --categories=\"packages prod-packages\""
args: args:
chdir: "{{ code_dest }}" chdir: "{{ code_dest }}"

View File

@ -8,7 +8,6 @@
user: "{{ ansible_user }}" user: "{{ ansible_user }}"
state: present state: present
# copy file present on the controller to the remote host # copy file present on the controller to the remote host
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
key: "{{ lookup('file', '~/.ssh/default.pub') }}" key: "{{ lookup('file', '~/.ssh/default.pub') }}"
- name: apt update all packages - name: apt update all packages
@ -48,7 +47,7 @@
delay: 5 delay: 5
timeout: 300 timeout: 300
- name: Add wifi networks from secrets - name: Add wifi networks from template
template: template:
src: templates/wpa_supplicant.conf.j2 src: templates/wpa_supplicant.conf.j2
dest: /etc/wpa_supplicant/wpa_supplicant.conf dest: /etc/wpa_supplicant/wpa_supplicant.conf

View File

@ -2,7 +2,8 @@
Description=Run photo update regularly Description=Run photo update regularly
[Timer] [Timer]
OnCalendar=Tue 11:00 OnCalendar=08:00
OnCalendar=16:00
Persistent=true Persistent=true
[Install] [Install]

View File

@ -1,4 +1,4 @@
from PIL import Image from PIL import Image, ImageOps
import io import io
import os import os
@ -24,7 +24,6 @@ oranges = [int_mult(orange_base, x/42) for x in range(1,43)]
palette_unflat = [black_base, *whites, *greens, *blues, *reds, *yellows, *oranges] palette_unflat = [black_base, *whites, *greens, *blues, *reds, *yellows, *oranges]
palette = [item for sublist in palette_unflat for item in sublist] palette = [item for sublist in palette_unflat for item in sublist]
# print(len(palette))
ref_image = Image.new("P", (1,1)) ref_image = Image.new("P", (1,1))
ref_image.putpalette(palette) ref_image.putpalette(palette)
@ -49,7 +48,12 @@ class ImageShrink:
def shrink(self, image: Image) -> Image: def shrink(self, image: Image) -> Image:
""""Shrinks a given image (bytearray) to a given resolution (width, height)""" """"Shrinks a given image (bytearray) to a given resolution (width, height)"""
image.thumbnail(self.resolution) # image = ImageOps.contain(image, self.resolution)
# maintains the aspect ratio of the original image and leaves empty space
image = ImageOps.fit(image, self.resolution, centering=(0.5, 0.5))
# crops the image to the given resolution from the center on
# image.thumbnail(self.resolution)
return image return image

View File

@ -1,5 +1,5 @@
from PIL import Image, ImageDraw from PIL import Image, ImageDraw
from waveshare-epaper import epd7in3f from waveshare_epaper import epd7in3f
# BLACK = 0x000000 # 0000 BGR # BLACK = 0x000000 # 0000 BGR
# WHITE = 0xffffff # 0001 # WHITE = 0xffffff # 0001