diff --git a/docs/setup-run-headless.md b/docs/setup-run-headless.md index 925f596..19da716 100644 --- a/docs/setup-run-headless.md +++ b/docs/setup-run-headless.md @@ -48,7 +48,7 @@ sudo apt-get update sudo apt-get install -y git python3-pip python3-venv # Get files -git clone https://github.com/jr-k/obscreen.git && cd obscreen +cd ~ && git clone https://github.com/jr-k/obscreen.git && cd obscreen # Install application dependencies python3 -m venv venv diff --git a/docs/setup-run-on-rpi.md b/docs/setup-run-on-rpi.md index d58e4c7..eb49913 100644 --- a/docs/setup-run-on-rpi.md +++ b/docs/setup-run-on-rpi.md @@ -7,7 +7,7 @@ ## 🎛️ Hardware installation 1. Download RaspberryPi Imager and setup an sdcard with `Raspberry Pi OS Lite` (🚨without desktop, only `Lite` version!). You'll find it under category `Raspberry PI OS (other)` -2. Log into your pi user locally or via ssh (`ssh pi@raspberrypi.local`) +2. Log into your RaspberryPi locally or via ssh (by default it's `ssh pi@raspberrypi.local`) ## 📺 Run the player Install player autorun by executing following script @@ -65,7 +65,7 @@ sudo apt-get update sudo apt-get install -y git python3-pip python3-venv # Get files -git clone https://github.com/jr-k/obscreen.git && cd obscreen +cd ~ && git clone https://github.com/jr-k/obscreen.git && cd obscreen # Install application dependencies python3 -m venv venv diff --git a/src/utils.py b/src/utils.py index 920d5e2..5998c9c 100644 --- a/src/utils.py +++ b/src/utils.py @@ -1,5 +1,6 @@ import os import re +import logging import subprocess import platform @@ -125,25 +126,14 @@ def get_ip_address() -> Optional[str]: try: os_name = platform.system().lower() if os_name == "linux": - result = subprocess.run( - ["ip", "-4", "route", "get", "8.8.8.8"], - capture_output=True, - text=True - ) + result = subprocess.run(["ip", "-4", "route", "get", "8.8.8.8"], capture_output=True, text=True) ip_address = result.stdout.split()[6] elif os_name == "darwin": result = subprocess.run( - ["ipconfig", "getifaddr", "en0"], - capture_output=True, - text=True - ) + ["ipconfig", "getifaddr", "en0"], capture_output=True, text=True) ip_address = result.stdout.strip() elif os_name == "windows": - result = subprocess.run( - ["ipconfig"], - capture_output=True, - text=True - ) + result = subprocess.run(["ipconfig"], capture_output=True, text=True) lines = result.stdout.split('\n') ip_address = None for line in lines: @@ -151,11 +141,11 @@ def get_ip_address() -> Optional[str]: ip_address = line.split(': ')[1].strip() break else: - print(f"Unsupported OS: {os_name}") + logging.warn(f"Unsupported OS: {os_name}") return None return ip_address except Exception as e: - print(f"Error obtaining IP address: {e}") + logging.error(f"Error obtaining IP address: {e}") return None diff --git a/system/install-autorun-rpi.sh b/system/install-autorun-rpi.sh index 47432e4..3adee71 100644 --- a/system/install-autorun-rpi.sh +++ b/system/install-autorun-rpi.sh @@ -4,7 +4,7 @@ OWNER=${1:-$USER} WORKING_DIR=${2:-$HOME} echo "### Installing Obscreen Player ###" -echo "# Using user: $USER_ARG" +echo "# Using user: $OWNER" echo "# Working Directory: $WORKING_DIR" echo "# ------------------------------ #" diff --git a/system/obscreen-manager.service b/system/obscreen-manager.service index aed42d9..baccadd 100644 --- a/system/obscreen-manager.service +++ b/system/obscreen-manager.service @@ -6,7 +6,6 @@ After=network.target User=pi Group=pi Environment=VIRTUAL_ENV="/home/pi/obscreen/venv" -Environment=PATH="$VIRTUAL_ENV/bin:$PATH" WorkingDirectory=/home/pi/obscreen ExecStart=/home/pi/obscreen/venv/bin/python /home/pi/obscreen/obscreen.py Restart=always