# Projekcija besedil (Lyrics Projector) A Tkinter-based song projector application with a Flask web interface for remote control. Designed for displaying lyrics on a large screen while controlling them from a computer or mobile device. ## Features - **Tkinter GUI**: Full-screen song display with customizable fonts, colors, and sizing. - **Smart Text Wrapping**: Automatically splits long lines and divides lyrics into pages based on screen height and stanza breaks. - **Song Database**: SQLite database with lyrics and metadata. - **Web Interface**: Comprehensive remote control via web browser. - Load songs by number or search by title. - Real-time status synchronization across multiple devices. - Navigate between lyrics pages. - **Song Editor**: Edit existing songs or add new ones directly from the web interface. - Toggle uppercase display. - Clear/dim the screen. - Virtual keypad for mobile-friendly input. - **Keyboard Shortcuts**: Quick navigation and screen control using physical or numeric keypad. - **Settings**: JSON-based configuration for fonts, colors, display options, and remote update URLs. - **System Integration**: - Prevents screen sleep/saver on Windows and Linux (GNOME). - Automatic cursor hiding. - Remote system commands (shutdown, restart). - Remote database updates via URL. ## Project Structure ``` Projekcija/ ├── projector.py # Main Tkinter application ├── settings.json # User configuration (generated from sample) ├── settings.json.sample # Template for settings ├── songs.db # SQLite database with lyrics ├── startup.sh # Linux launcher script ├── startup.bat # Windows launcher script ├── tools/ # Utility scripts │ ├── add_song.py # Import songs into database │ ├── nastavitve.py # Settings management │ └── ... ├── web/ # Flask web server package │ ├── server.py # Flask app and API endpoints │ ├── static/ # Web assets (JS, CSS) │ └── templates/ # HTML templates ├── tests/ # Test suite └── ... ``` ## Installation ### Requirements - Python 3.8+ - **Tkinter** (usually included with Python, but may require `python3-tk` on some Linux distributions) - **Flask** (for web interface) - `sqlite3` (included with Python) - `requests` (for remote database updates and notifications) ### Setup 1. **Install Dependencies**: ```bash pip install flask requests ``` 2. **Configure Settings**: Copy `settings.json.sample` to `settings.json` and adjust values as needed. 3. **Prepare Database**: Ensure `songs.db` exists. You can use tools in the `tools/` directory to manage songs. ## Usage ### Launch the Application **Windows:** ```bash startup.bat ``` **Linux:** ```bash ./startup.sh ``` **Manual:** ```bash python projector.py ``` ### Keyboard Shortcuts (Projector Window) - **0-9**: Type song number - **Enter**: Load song by number / Next page - **+** (plus): Clear/dim the screen - **-** (minus): Previous page - **\*** (multiply): Toggle uppercase - **/** (slash): Search songs by title - **Backspace**: Delete last digit of song number ### Special Commands (Input as song number) - **9999**: Shutdown system (Windows/Linux) - **9998**: Restart system (Windows/Linux) - **9997**: Restart application - **9988**: Exit application - **9901**: Update songs database from `db_update_url` - **9900**: Show application information (version, author, license) ### Configuration Edit `settings.json` to customize: - **font_name**: Font family (e.g., "Arial") - **font_size**: Base font size - **fg_color**: Text color (HEX) - **bg_color**: Background color (HEX) - **screen_width_percent**: Width of the text area (e.g., 60) - **font_bold**: Use bold font (true/false) - **show_song_info**: Show song number and page info at bottom (true/false) - **split_by_stanza**: If true, each stanza starts on a new page (true/false) - **web_port**: Port for web interface (0 to disable) - **db_update_url**: URL for remote database synchronization - **ntfy_topic**: Topic for ntfy.sh notifications - **installation_label**: Custom label for the installation (shown in app info) ### Web Interface Access the control panel at: ``` http://:/ ``` Features: - **Load by Number**: Input song ID and press "Naloži" (or Enter). - **Search**: Real-time search by title. - **Navigation**: Next/Previous buttons. - **Edit Mode**: Click "Uredi besedilo" to modify the current song or add a new one. - **Virtual Keypad**: Toggleable numeric keypad for touch devices. - **Wake Lock**: Attempts to keep the mobile screen on while the interface is open. ## API Endpoints - `GET /api/state` – Current projector state (text, page info, modes) - `GET /api/events` – SSE endpoint for real-time update notifications - `GET /api/app_info` – Application metadata (version, author, song count) - `POST /api/load_song` – Load a song by number - `POST /api/next_page` – Next page - `POST /api/prev_page` – Previous page - `POST /api/clear_screen` – Clear display - `POST /api/toggle_caps` – Toggle uppercase - `POST /api/toggle_split` – Toggle stanza split mode - `POST /api/search_songs` – Search songs by title - `GET /api/get_song_details` – Get lyrics and title for editing - `POST /api/update_song` – Save song changes or create new ## Testing Run the test suite: ```bash python -m tests.test_integration ``` ## Avtorstvo in Licenca (Authorship and License) **Izvorna zasnova in implementacija:** Uroš Urbanija **Nadgradnje in vzdrževanje:** Valentin Korenjak Ta projekt je licenciran pod pogoji **GNU GPL v3**. Za več informacij si oglejte datoteko [LICENSE](LICENSE). This project is licensed under the terms of the **GNU GPL v3**. See the [LICENSE](LICENSE) file for details.