chapters-converter/public/index.html
2023-12-15 20:26:03 +01:00

82 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Podcast chapter converter</title>
<style>
#container {
display: flex;
align-items: center;
}
</style>
</head>
<body>
<script src="/bundle.js"></script>
<script>
function convert() {
output.value = window.encoders[to.value](
window.parsers[from.value](input.value)
);
}
function download(data, filename, type) {
var file = new Blob([data], { type: type });
var a = document.createElement("a"),
url = URL.createObjectURL(file);
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
setTimeout(function () {
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 0);
}
function download_output() {
download(
output.value,
"chapters." + to.value,
"application/json"
);
}
</script>
<h1>Convert podcast chapters</h1>
<div id="container">
<div>
<label>
From:
<select id="from">
<option value="audacity">Audacity labels export</option>
<option value="youtube">
Youtube plaintext timestamps
</option>
</select>
</label>
<div>
<textarea rows="40" cols="60" id="input"></textarea>
</div>
</div>
<div>
<button onClick="convert()">Convert→</button>
</div>
<div>
<label>
To:
<select id="to" onchange="convert()">
<option value="json">
JSON Chapters (for Castapod)
</option>
<option value="youtube">
Youtube plaintext timestamps
</option>
</select>
</label>
<button onclick="download_output()">download</button>
<div>
<textarea rows="40" cols="60" id="output"></textarea>
</div>
</div>
</div>
</body>
</html>