fix script and systemd service for manager
This commit is contained in:
parent
08dd69217d
commit
4592ffffa9
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
22
src/utils.py
22
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
|
||||
|
||||
|
||||
|
||||
@ -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 "# ------------------------------ #"
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user