Added documentation and start stop scripts.

This commit is contained in:
2026-01-05 08:50:18 -05:00
parent bbaa0daa7b
commit 5823ca3c39
3 changed files with 132 additions and 0 deletions
@@ -0,0 +1,58 @@
# Server Manager Web App - Application Guide
## Overview
The **Server Manager Web App** is a Python-based full-stack application designed to manage home media server resources. It provides a user-friendly web interface for interacting with Samba file shares, identifying video duplicates, and organizing comic book libraries.
## Architecture
The application follows a standard client-server architecture:
### Backend
- **Framework:** FastAPI (Python)
- **Database:** SQLite (managed via SQLAlchemy)
- **Role:** Handles API requests, performs complex logic (duplicate detection, file operations, comic conversion), and manages database state.
- **Key Modules:**
- `samba_manager.py`: Handles SMB protocol interactions (listing, moving, deleting files).
- `duplicates_manager.py`: Implements logic for identifying duplicate video files based on duration, visual hashing, and metadata.
- `comics_manager.py`: Manages the conversion of `.zip` to `.cbz` and organizes files into hierarchical folders.
### Frontend
- **Framework:** Vue.js 3
- **Build Tool:** Vite
- **Styling:** CSS
- **Role:** Provides the interactive UI for the user. It communicates with the backend via RESTful API calls.
- **Key Components:**
- `SambaExplorer.vue`: A file browser interface for SMB shares.
- `VideoDuplicatesManager.vue`: A dashboard to view duplicate reports and take action (delete/archive).
- `ComicsManager.vue`: Tools for triggering comic organization tasks.
## Features
1. **Samba File Explorer**:
- Browse files on configured Samba shares.
- Upload, download, delete, and rename files.
- View file details.
2. **Video Duplicate Finder**:
- Scans specified directories for potential duplicate videos.
- Uses visual similarity (image hashing), duration, and file size.
- Presents a report allowing users to resolve duplicates.
3. **Comics Organizer**:
- Scans for comic archives (`.zip`).
- Converts them to the standard `.cbz` format.
- Sorts comics into folders based on series names.
## Configuration
- **Backend Dependencies**: Listed in `backend/requirements.txt`.
- **Frontend Dependencies**: Listed in `frontend/package.json`.
- **Database**: Uses a local SQLite file (default `test.db` or similar defined in `config.py` or `database.py`).
## Running the Application
Helper scripts are provided in the root directory:
- **Start**: `./start_app.sh` - Starts both the backend API and the frontend development server.
- **Stop**: `./stop_app.sh` - Stops the running backend and frontend processes.
+51
View File
@@ -0,0 +1,51 @@
#!/bin/bash
# Define paths
PROJECT_ROOT=$(pwd)
PID_FILE="$PROJECT_ROOT/.server_manager.pids"
# Function to start backend
start_backend() {
echo "Starting Backend..."
cd "$PROJECT_ROOT/backend"
# Check if a venv exists
if [ -d "venv" ]; then
source venv/bin/activate
elif [ -d ".venv" ]; then
source .venv/bin/activate
fi
# Run uvicorn in background
# Redirecting output to logs or /dev/null is often cleaner, but for now we keep it visible or rely on user
uvicorn app.main:app --reload --port 8000 > ../logs/backend.log 2>&1 &
BACKEND_PID=$!
echo $BACKEND_PID >> "$PID_FILE"
echo "Backend started (PID: $BACKEND_PID). Logs: logs/backend.log"
}
# Function to start frontend
start_frontend() {
echo "Starting Frontend..."
cd "$PROJECT_ROOT/frontend"
npm run dev -- --port 5173 > ../logs/frontend.log 2>&1 &
FRONTEND_PID=$!
echo $FRONTEND_PID >> "$PID_FILE"
echo "Frontend started (PID: $FRONTEND_PID). Logs: logs/frontend.log"
}
# Ensure log directory exists
mkdir -p "$PROJECT_ROOT/logs"
# Clear old pid file if it exists
if [ -f "$PID_FILE" ]; then
echo "Warning: .server_manager.pids exists. Clearing..."
rm "$PID_FILE"
fi
start_backend
start_frontend
echo "Application started."
echo "Backend: http://localhost:8000"
echo "Frontend: http://localhost:5173"
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
PROJECT_ROOT=$(pwd)
PID_FILE="$PROJECT_ROOT/.server_manager.pids"
if [ ! -f "$PID_FILE" ]; then
echo "No PID file found. Is the app running?"
exit 1
fi
echo "Stopping application..."
while read pid; do
if ps -p $pid > /dev/null; then
echo "Killing process $pid"
kill $pid
else
echo "Process $pid not found"
fi
done < "$PID_FILE"
rm "$PID_FILE"
echo "Application stopped."