mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Removed unused files
This commit is contained in:
@@ -1,154 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Custom Document</title>
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<h1>Manage document types</h1>
|
|
||||||
|
|
||||||
<label for="existingDocs">Vorhandene Dokumententypen auswählen (optional):</label>
|
|
||||||
<!--Drop Down-->
|
|
||||||
<select name="existingDocs" id="existingDocs">
|
|
||||||
<option value="newDoc">-- Neuen Dokumententyp erstellen --</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<div id="docNameWrapper">
|
|
||||||
<label for="docName">Name des Dokumententyps:</label>
|
|
||||||
<input type="text" id="docName" placeholder="Gib hier den Namen für den Dokumententyp ein">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label for="prompt">Dein Prompt:</label>
|
|
||||||
<textarea id="prompt" placeholder="Schreibe hier den Prompt für dein Dokumententyp..."></textarea>
|
|
||||||
|
|
||||||
<div class="buttons">
|
|
||||||
<a href="index.html">
|
|
||||||
<button id="goBackBtn">Abbrechen</button>
|
|
||||||
</a>
|
|
||||||
<button id="deleteBtn">Dokumententyp löschen</button>
|
|
||||||
<button id="generateBtn">Dokumententyp speichern</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="result"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="languages.js"></script>
|
|
||||||
<script>
|
|
||||||
const goBackBtn = document.getElementById("goBackBtn");
|
|
||||||
const generateBtn = document.getElementById("generateBtn");
|
|
||||||
const deleteBtn = document.getElementById("deleteBtn");
|
|
||||||
const existingDocs = document.getElementById("existingDocs");
|
|
||||||
const docNameInput = document.getElementById("docName");
|
|
||||||
const promptInput = document.getElementById("prompt");
|
|
||||||
const resultDiv = document.getElementById("result");
|
|
||||||
const exampleText = "";
|
|
||||||
|
|
||||||
// dokumente speichern
|
|
||||||
generateBtn.addEventListener("click", () => {
|
|
||||||
const name = docNameInput.value.trim();
|
|
||||||
const content = promptInput.value.trim();
|
|
||||||
if (!name || !content) {
|
|
||||||
resultDiv.textContent = "Bitte Name des Dokumententyps und Prompt ausfüllen.";
|
|
||||||
setTimeout(() => {
|
|
||||||
resultDiv.textContent = "";
|
|
||||||
}, 3000);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
window.api.saveTxtFile(name, content).then();
|
|
||||||
resultDiv.textContent = "Dokumententyp erfolgreich gespeichert!";
|
|
||||||
setTimeout(() => {
|
|
||||||
resultDiv.textContent = "";
|
|
||||||
}, 3000);
|
|
||||||
reloadDocuments();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// dokumente löschen
|
|
||||||
deleteBtn.addEventListener("click", () => {
|
|
||||||
const name = docNameInput.value.trim();
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
resultDiv.textContent = "Bitte Name des Dokumententyps angeben.";
|
|
||||||
setTimeout(() => {
|
|
||||||
resultDiv.textContent = "";
|
|
||||||
}, 3000);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const confirmDelete = confirm(
|
|
||||||
`Möchtest du den Dokumententyp "${name}" wirklich löschen?`
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!confirmDelete) return;
|
|
||||||
|
|
||||||
window.api.deleteTxtFile(name).then((success) => {
|
|
||||||
if (success) {
|
|
||||||
resultDiv.textContent = "Dokumententyp erfolgreich gelöscht!";
|
|
||||||
reloadDocuments();
|
|
||||||
existingDocs.value = "newDoc";
|
|
||||||
existingDocs.dispatchEvent(new Event("change"));
|
|
||||||
} else {
|
|
||||||
resultDiv.textContent = "Dokumententyp konnte nicht gelöscht werden.";
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
resultDiv.textContent = "";
|
|
||||||
}, 3000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//function to load existingDoc options to the drop down list
|
|
||||||
const select = document.getElementById('existingDocs');
|
|
||||||
|
|
||||||
window.api.getTxtFiles().then(files => {
|
|
||||||
reloadDocuments();
|
|
||||||
});
|
|
||||||
|
|
||||||
//content anzeigen
|
|
||||||
const docNameWrapper = document.getElementById("docNameWrapper");
|
|
||||||
|
|
||||||
existingDocs.addEventListener("change", async () => {
|
|
||||||
const selected = existingDocs.value;
|
|
||||||
|
|
||||||
if (selected === "newDoc") {
|
|
||||||
docNameWrapper.classList.remove("hidden");
|
|
||||||
docNameInput.value = "";
|
|
||||||
promptInput.value = exampleText;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
docNameWrapper.classList.add("hidden");
|
|
||||||
|
|
||||||
const content = await window.api.readTxtFile(selected);
|
|
||||||
promptInput.value = content;
|
|
||||||
docNameInput.value = selected.replace(".txt", "");
|
|
||||||
});
|
|
||||||
|
|
||||||
//reload drop down
|
|
||||||
function reloadDocuments() {
|
|
||||||
[...existingDocs.querySelectorAll('option:not([value="newDoc"])')]
|
|
||||||
.forEach(o => o.remove());
|
|
||||||
|
|
||||||
window.api.getTxtFiles().then(files => {
|
|
||||||
files.forEach(file => {
|
|
||||||
const option = document.createElement('option');
|
|
||||||
option.value = file;
|
|
||||||
option.textContent = file
|
|
||||||
.replace('.txt', '') // Endung entfernen
|
|
||||||
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
|
||||||
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
|
||||||
existingDocs.appendChild(option);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
import { app, BrowserWindow, ipcMain, dialog } from 'electron';
|
|
||||||
import { exec } from 'child_process';
|
|
||||||
import path from 'path';
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = path.dirname(__filename);
|
|
||||||
|
|
||||||
let mainWindow;
|
|
||||||
|
|
||||||
function createWindow() {
|
|
||||||
mainWindow = new BrowserWindow({
|
|
||||||
width: 800,
|
|
||||||
height: 600,
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: false,
|
|
||||||
contextIsolation: true,
|
|
||||||
preload: path.join(__dirname, 'preload.js')
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mainWindow.loadFile('main/index.html');
|
|
||||||
}
|
|
||||||
|
|
||||||
app.whenReady().then(createWindow);
|
|
||||||
|
|
||||||
// Kommunikation vom Renderer (Frontend)
|
|
||||||
ipcMain.handle('convert-video', async (event, filePath) => {
|
|
||||||
const output = path.join(path.dirname(filePath), 'converted.mp4');
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
exec(`ffmpeg -i "${filePath}" -vcodec libx264 "${output}"`, (error, stdout, stderr) => {
|
|
||||||
if (error) {
|
|
||||||
console.error('Fehler beim Konvertieren:', error);
|
|
||||||
reject(error);
|
|
||||||
} else {
|
|
||||||
console.log('Konvertierung abgeschlossen:', output);
|
|
||||||
resolve(output);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user