deps and envs
This commit is contained in:
11
.env.sample
Normal file
11
.env.sample
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Video Player Environment Configuration
|
||||||
|
# Copy this file to .env and modify the values as needed
|
||||||
|
|
||||||
|
# Video folder path - where video files are stored
|
||||||
|
# Default: /home/pi/Videos
|
||||||
|
VIDEO_FOLDER=/home/pi/Videos
|
||||||
|
|
||||||
|
# Optional: Override other configuration values
|
||||||
|
# LOG_LEVEL=INFO
|
||||||
|
# IR_PIN=18
|
||||||
|
# DEFAULT_CHANNEL=1
|
||||||
@@ -12,12 +12,16 @@ from pathlib import Path
|
|||||||
from typing import Dict, List, Optional, Any, Union
|
from typing import Dict, List, Optional, Any, Union
|
||||||
from dataclasses import dataclass, asdict
|
from dataclasses import dataclass, asdict
|
||||||
import shutil
|
import shutil
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
# Load environment variables
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class VideoPlayerConfig:
|
class VideoPlayerConfig:
|
||||||
"""Video Player Configuration"""
|
"""Video Player Configuration"""
|
||||||
# Video settings
|
# Video settings
|
||||||
video_folder: str = "/home/pi/Videos"
|
video_folder: str = os.getenv("VIDEO_FOLDER", "/home/pi/Videos")
|
||||||
supported_formats: List[str] = None
|
supported_formats: List[str] = None
|
||||||
default_channel: int = 1
|
default_channel: int = 1
|
||||||
auto_play: bool = True
|
auto_play: bool = True
|
||||||
|
|||||||
10
install.sh
10
install.sh
@@ -17,7 +17,7 @@ INSTALL_DIR="/opt/video_player"
|
|||||||
CONFIG_DIR="/etc/video_player"
|
CONFIG_DIR="/etc/video_player"
|
||||||
SERVICE_NAME="video-player"
|
SERVICE_NAME="video-player"
|
||||||
USER="pi"
|
USER="pi"
|
||||||
VIDEO_FOLDER="/home/pi/Videos"
|
VIDEO_FOLDER="${VIDEO_FOLDER:-/home/pi/Videos}"
|
||||||
|
|
||||||
# Function to print colored output
|
# Function to print colored output
|
||||||
print_status() {
|
print_status() {
|
||||||
@@ -76,6 +76,7 @@ install_packages() {
|
|||||||
vlc \
|
vlc \
|
||||||
vlc-plugin-base \
|
vlc-plugin-base \
|
||||||
vlc-plugin-video-output \
|
vlc-plugin-video-output \
|
||||||
|
ffmpeg \
|
||||||
git \
|
git \
|
||||||
curl \
|
curl \
|
||||||
wget \
|
wget \
|
||||||
@@ -97,12 +98,11 @@ install_packages() {
|
|||||||
libatlas-base-dev \
|
libatlas-base-dev \
|
||||||
gfortran \
|
gfortran \
|
||||||
libhdf5-dev \
|
libhdf5-dev \
|
||||||
libhdf5-serial-dev \
|
|
||||||
libhdf5-103 \
|
libhdf5-103 \
|
||||||
libqtgui4 \
|
|
||||||
libqtwebkit4 \
|
|
||||||
libqt4-test \
|
|
||||||
python3-pyqt5 \
|
python3-pyqt5 \
|
||||||
|
python3-pyqt5.qtwidgets \
|
||||||
|
python3-pyqt5.qtgui \
|
||||||
|
python3-pyqt5.qtcore \
|
||||||
libgtk-3-dev \
|
libgtk-3-dev \
|
||||||
libcanberra-gtk3-module \
|
libcanberra-gtk3-module \
|
||||||
libcanberra-gtk3-dev \
|
libcanberra-gtk3-dev \
|
||||||
|
|||||||
6
setup.py
6
setup.py
@@ -12,6 +12,10 @@ import subprocess
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
import logging
|
import logging
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
# Load environment variables
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
class VideoPlayerSetup:
|
class VideoPlayerSetup:
|
||||||
"""Interactive setup for Video Player system"""
|
"""Interactive setup for Video Player system"""
|
||||||
@@ -19,7 +23,7 @@ class VideoPlayerSetup:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.config_dir = Path("/etc/video_player")
|
self.config_dir = Path("/etc/video_player")
|
||||||
self.install_dir = Path("/opt/video_player")
|
self.install_dir = Path("/opt/video_player")
|
||||||
self.video_folder = Path("/home/pi/Videos")
|
self.video_folder = Path(os.getenv('VIDEO_FOLDER', '/home/pi/Videos'))
|
||||||
self.logger = self.setup_logging()
|
self.logger = self.setup_logging()
|
||||||
|
|
||||||
def setup_logging(self):
|
def setup_logging(self):
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class VideoPlayer:
|
|||||||
self.ir_codes = self.config.get('ir_codes', {})
|
self.ir_codes = self.config.get('ir_codes', {})
|
||||||
|
|
||||||
# Channel settings
|
# Channel settings
|
||||||
self.video_folder = Path(self.config.get('video_folder', '/home/pi/Videos'))
|
self.video_folder = Path(self.config.get('video_folder', os.getenv('VIDEO_FOLDER', '/home/pi/Videos')))
|
||||||
self.default_channel = self.config.get('default_channel', 1)
|
self.default_channel = self.config.get('default_channel', 1)
|
||||||
self.channel_timeout = self.config.get('channel_timeout', 3.0)
|
self.channel_timeout = self.config.get('channel_timeout', 3.0)
|
||||||
self.multi_digit_timeout = self.config.get('multi_digit_timeout', 1.0)
|
self.multi_digit_timeout = self.config.get('multi_digit_timeout', 1.0)
|
||||||
@@ -71,7 +71,7 @@ class VideoPlayer:
|
|||||||
def get_default_config(self) -> Dict:
|
def get_default_config(self) -> Dict:
|
||||||
"""Get default configuration"""
|
"""Get default configuration"""
|
||||||
return {
|
return {
|
||||||
"video_folder": "/home/pi/Videos",
|
"video_folder": os.getenv('VIDEO_FOLDER', '/home/pi/Videos'),
|
||||||
"ir_pin": 18,
|
"ir_pin": 18,
|
||||||
"default_channel": 1,
|
"default_channel": 1,
|
||||||
"channel_timeout": 3.0,
|
"channel_timeout": 3.0,
|
||||||
|
|||||||
Reference in New Issue
Block a user