diff --git a/home/stormux/.local/upload_server/templates/index.html b/home/stormux/.local/upload_server/templates/index.html index 0f7170d..333ac4e 100644 --- a/home/stormux/.local/upload_server/templates/index.html +++ b/home/stormux/.local/upload_server/templates/index.html @@ -243,7 +243,7 @@

Upload Music Folder

Upload an entire music folder with its structure directly to your Music directory.

- +
@@ -255,14 +255,38 @@

Selected folder: None

- +
- + + +
+

Upload Audiobooks

+

Upload audiobook files (.m4b, .epub, or .zip) to your Library directory.

+ +
+
+
+ + +

Selected files: None

+
+
+ +
+ + +
+
+
+
Shutdown Server
@@ -274,12 +298,18 @@ if (e.target !== this) return; document.getElementById('file-upload').click(); }); - + // Make the entire area clickable for folder selection document.getElementById('folder-drop-area').addEventListener('click', function(e) { if (e.target !== this) return; document.getElementById('folder-upload').click(); }); + + // Make the entire area clickable for audiobook selection + document.getElementById('audiobook-drop-area').addEventListener('click', function(e) { + if (e.target !== this) return; + document.getElementById('audiobook-upload').click(); + }); // Show selected files document.getElementById('file-upload').addEventListener('change', function(e) { @@ -303,29 +333,50 @@ const fileList = e.target.files; const fileCount = fileList.length; const selectedFolder = document.getElementById('selected-folder'); - + if (fileCount > 0) { // Get the common folder path from the first file const firstFile = fileList[0]; const folderPath = firstFile.webkitRelativePath.split('/')[0]; - + selectedFolder.textContent = `${folderPath} (${fileCount} files)`; // Announce to screen readers - document.getElementById('status-announcer').textContent = + document.getElementById('status-announcer').textContent = `Selected folder: ${folderPath} containing ${fileCount} files`; } else { selectedFolder.textContent = 'None'; document.getElementById('status-announcer').textContent = 'No folder selected'; } }); + + // Show selected audiobooks + document.getElementById('audiobook-upload').addEventListener('change', function(e) { + const fileList = e.target.files; + const fileNames = Array.from(fileList).map(file => file.name); + const selectedAudiobooks = document.getElementById('selected-audiobooks'); + + if (fileNames.length > 0) { + selectedAudiobooks.textContent = fileNames.join(', '); + // Announce to screen readers + document.getElementById('status-announcer').textContent = + `Selected ${fileNames.length} audiobook files: ${fileNames.join(', ')}`; + } else { + selectedAudiobooks.textContent = 'None'; + document.getElementById('status-announcer').textContent = 'No audiobook files selected'; + } + }); // Handle drag and drop for files const fileDropArea = document.getElementById('file-drop-area'); setupDragDrop(fileDropArea, 'file-upload'); - + // Handle drag and drop for folders const folderDropArea = document.getElementById('folder-drop-area'); setupDragDrop(folderDropArea, 'folder-upload'); + + // Handle drag and drop for audiobooks + const audiobookDropArea = document.getElementById('audiobook-drop-area'); + setupDragDrop(audiobookDropArea, 'audiobook-upload'); function setupDragDrop(dropArea, inputId) { ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { @@ -354,17 +405,17 @@ dropArea.addEventListener('drop', function(e) { const dt = e.dataTransfer; const files = dt.files; - - if (inputId === 'file-upload') { + + if (inputId === 'file-upload' || inputId === 'audiobook-upload') { document.getElementById(inputId).files = files; // Trigger change event const event = new Event('change'); document.getElementById(inputId).dispatchEvent(event); } else { // Show message that folder drop might not be supported - document.getElementById('status-announcer').textContent = + document.getElementById('status-announcer').textContent = 'For folder upload, please use the file picker'; - document.getElementById('selected-folder').textContent = + document.getElementById('selected-folder').textContent = 'Please use the folder selection button'; } }, false); @@ -394,9 +445,23 @@ }); } - // Set up progress handling for both forms + // Set up progress handling for all forms setupUploadProgress('form[action="/upload"]', 'upload-button', 'upload-status'); setupUploadProgress('form[action="/upload_music"]', 'upload-folder-button', 'upload-folder-status'); + + // Handle audiobook form separately (also uses /upload action but different button) + const audiobookForm = document.getElementById('upload-audiobook-button').closest('form'); + const audiobookButton = document.getElementById('upload-audiobook-button'); + const audiobookStatus = document.getElementById('upload-audiobook-status'); + const announcer = document.getElementById('status-announcer'); + + audiobookForm.addEventListener('submit', function(e) { + audiobookButton.disabled = true; + audiobookButton.textContent = 'Uploading...'; + audiobookStatus.style.display = 'block'; + audiobookStatus.textContent = 'Upload in progress, please wait...'; + announcer.textContent = 'Audiobook upload started, please wait while files are being processed'; + }); // Check if the client is on local network fetch('/check_local') diff --git a/home/stormux/.local/upload_server/uploader.py b/home/stormux/.local/upload_server/uploader.py index e4885ca..2ad3d13 100755 --- a/home/stormux/.local/upload_server/uploader.py +++ b/home/stormux/.local/upload_server/uploader.py @@ -46,6 +46,7 @@ FINAL_DESTINATIONS = { 'SNES': '/home/stormux/Roms/Super Nintendo Entertainment System', 'SMS': '/home/stormux/Roms/Sega Master System', 'music': '/home/stormux/Music', + 'audiobook': '/home/stormux/Library', 'voxin': '/home/stormux/Downloads', 'other': '/home/stormux/Downloads' } @@ -57,6 +58,7 @@ FILE_TYPES = { 'SNES': ['.fig', '.smc'], 'SMS': ['.sms'], 'music': ['.mp3', '.ogg', '.flac', '.wav', '.m4a', '.opus'], + 'audiobook': ['.m4b', '.epub', '.zip'], 'voxin': ['.tgz'], 'other': [] # Empty list to represent any other file type } diff --git a/home/stormux/Documents/change_log.md b/home/stormux/Documents/change_log.md index de87a06..aca790a 100644 --- a/home/stormux/Documents/change_log.md +++ b/home/stormux/Documents/change_log.md @@ -5,12 +5,17 @@ Dates are given for the image. All items listed are available for the listed ima ## October 1, 2025 +- Update system added +- Add upload audiobook capability to upload server - Wine configuration update (x86_64) - System updates - Update Toby Doom +- Wreckingball added to installable games - Extend install system to get games not included in the image - Work on system to require fewer reinstallations +- Add Wicked Christmas level pack - Update Wicked Quest +- Initial work on book reader ## September 1, 2025