This commit introduces several enhancements across multiple files to improve maintainability, functionality, and overall code quality. Key updates are as follows:
1. .gitignore
• Added exclusion for kindle/data/* to prevent Kindle-specific data from being tracked.
2. Dockerfile
• Added installation of OpenMoji font:
• Downloads and unzips OpenMoji font to /usr/share/fonts/openmoji.
• Updates font cache with fc-cache.
• Verifies installation with fc-list | grep "OpenMoji".
• Improves container setup for rendering Kindle dashboards with proper font support.
3. compose.yml
• Port mapping now uses an environment variable ${HOST_PORT} instead of hardcoding 56733:80.
• Enhances flexibility for port management.
4. kindle/ascwebdash.py
• Significant refactoring and cleanup:
• Removed unused signal handling and daemonization logic.
• Simplified logging configuration and added optional arguments using argparse for flexibility.
• Abstracted repetitive paths using constants for maintainability.
• Consolidated functionality for fetching images and refreshing the screen.
• Removed unused Wi-Fi and GUI toggling code.
• Focused the script’s functionality on image fetching and display for Kindle extensions.
5. CSS (style.css)
• Removed visual debugging borders (red, green, yellow).
• Improved layout styles:
• Set fixed widths for better rendering of event columns.
• Adjusted margins and paddings for cleaner alignment.
• Added a new .day .events class for consistent padding.
6. views.py
• Added error handling when fetching calendar data:
• Ensures the application doesn’t crash if calendar URLs are inaccessible.
• Logs errors to console for debugging.
Impact:
• Maintainability: Refactored scripts, improved code structure, and enhanced readability.
• Flexibility: Environment variable support for ports and dynamic script arguments.
• Functionality: Added OpenMoji font support in the Docker container.
• UI/UX: Cleaned up CSS for better layout and appearance.
• Resilience: Improved error handling in views.py to handle calendar fetch failures gracefully.
Files Modified:
• .gitignore
• Dockerfile
• compose.yml
• kindle/ascwebdash/bin/asc-webdash.py
• server/app/templates/style.css
• server/app/views.py
This ensures better extensibility and robustness across the codebase.
16 lines
583 B
Docker
16 lines
583 B
Docker
FROM tiangolo/uwsgi-nginx-flask
|
|
# Install system dependencies and wkhtmltoimage
|
|
RUN apt-get update && apt-get install -y \
|
|
wkhtmltopdf \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY ./requirements.txt /var/www/requirements.txt
|
|
COPY ./server ./app
|
|
RUN pip install -r /var/www/requirements.txt
|
|
|
|
RUN wget -O /tmp/openmoji-font.zip https://github.com/hfg-gmuend/openmoji/releases/download/15.0.0/openmoji-font.zip \
|
|
&& unzip /tmp/openmoji-font.zip -d /usr/share/fonts/openmoji \
|
|
&& rm /tmp/openmoji-font.zip
|
|
|
|
RUN fc-cache -f -v
|
|
RUN fc-list | grep "OpenMoji" |