added basic web files and updated readme commands

Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-09 17:46:49 +01:00
parent 5a407f877c
commit da7af7d650
48 changed files with 60 additions and 117 deletions

View File

@ -1,9 +1,10 @@
# PiXelTubes
sudo apt install python3 python3-pip git python3-flask python3-flask-mysqldb python3-adafruit-circuitpython-neopixel python3-wifi apache2 php mariadb-server mariadb-client -y
sudo mysql -u root -p
CREATE DATABASE IF NOT EXISTS pixeltube_db;
USE pixeltube_db;
CREATE TABLE IF NOT EXISTS tubes (
id INT AUTO_INCREMENT PRIMARY KEY,
mac_address VARCHAR(17) NOT NULL UNIQUE,
@ -11,15 +12,6 @@ CREATE TABLE IF NOT EXISTS tubes (
dmx_address INT NOT NULL,
CONSTRAINT mac_address_format CHECK (LENGTH(mac_address) = 17 AND mac_address REGEXP '([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})')
);
create user 'pxm'@'localhost' IDENTIFIED by 'pixel';
grant all privileges on pixeltube_db . * to 'pxm'@'localhost';
flush privileges;
sudo apt install python3-flask -y
sudo apt install python3-flask-mysqldb -y
sudo apt install python3-osc -y
sudo apt install python3-rpi-ws281x python3-adafruit-circuitpython-neopixel -y
sudo apt install python3-wifi -y
flush privileges;

File diff suppressed because one or more lines are too long

View File

@ -1,103 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PiXelTube Web Interface</title>
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css')}}">
</head>
<body>
<div class="container mt-5">
<h1 class="mb-4">PiXelTube Web Interface</h1>
<!-- Tube List Table -->
<table class="table">
<thead>
<tr>
<th scope="col">Tube ID</th>
<th scope="col">Universe</th>
<th scope="col">DMX Address</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody id="tubeList">
<!-- Tube information will be dynamically added here -->
</tbody>
</table>
<!-- Tube Settings Modal -->
<div class="modal fade" id="tubeSettingsModal" tabindex="-1" role="dialog" aria-labelledby="tubeSettingsModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="tubeSettingsModalLabel">Tube Settings</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="tubeSettingsForm">
<div class="form-group">
<label for="universeInput">Universe:</label>
<input type="number" class="form-control" id="universeInput" required>
</div>
<div class="form-group">
<label for="dmxAddressInput">DMX Address:</label>
<input type="number" class="form-control" id="dmxAddressInput" required>
</div>
<button type="submit" class="btn btn-primary">Save Changes</button>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Include Bootstrap JS and jQuery (assuming you've downloaded them locally) -->
<script src="{{ url_for('static', filename='jquery.min.js')}}"></script>
<script src="{{ url_for('static', filename='bootstrap/js/bootstrap.bundle.min.js')}}"></script>
<script>
// Function to handle tube toggle switch changes
function handleTubeToggle(tubeId) {
// Replace this with your actual logic to handle the toggle switch change
console.log(`Tube ${tubeId} toggle switched`);
}
// Function to handle master toggle switch change
function handleMasterToggle() {
// Replace this with your actual logic to handle the master toggle switch change
console.log('Master toggle switched');
}
// Function to handle settings modal open
function openSettingsModal(tubeId) {
// Replace this with your actual logic to open the settings modal for the specified tube
console.log(`Opening settings modal for Tube ${tubeId}`);
}
// Assign event listeners to the toggle switches
document.addEventListener('DOMContentLoaded', function () {
// Replace 'toggleTube1', 'toggleTube2', etc., with the actual IDs of your toggle switches
document.getElementById('toggleTube1').addEventListener('change', function () {
handleTubeToggle(1);
});
// Add more event listeners for additional toggle switches
// Assign event listener for the master toggle switch
document.getElementById('masterToggle').addEventListener('change', handleMasterToggle);
// Assign event listeners for settings buttons to open respective modals
// Replace 'settingsModalTube1', 'settingsModalTube2', etc., with the actual IDs of your modal buttons
document.getElementById('settingsModalTube1').addEventListener('click', function () {
openSettingsModal(1);
});
// Add more event listeners for additional settings buttons
});
</script>
</body>
</html>

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PiXelTube Web Interface</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<script src="bootstrap/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div class="container mt-5">
<h1 class="mb-4">PiXelTube Web Interface</h1>
<table class="table">
<thead>
<tr>
<th scope="col">Tube ID</th>
<th scope="col">Universe</th>
<th scope="col">DMX Address</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody id="tubeList">
</tbody>
</table>
<div class="modal fade" id="tubeSettingsModal" tabindex="-1" role="dialog" aria-labelledby="tubeSettingsModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="tubeSettingsModalLabel">Tube Settings</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="tubeSettingsForm">
<div class="form-group">
<label for="universeInput">Universe:</label>
<input type="number" class="form-control" id="universeInput" required>
</div>
<div class="form-group">
<label for="dmxAddressInput">DMX Address:</label>
<input type="number" class="form-control" id="dmxAddressInput" required>
</div>
<button type="submit" class="btn btn-primary">Save Changes</button>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>