problem with youtube in docker

This commit is contained in:
2025-12-30 01:06:33 +01:00
parent 0656ca54b2
commit aa4b10c991
6 changed files with 1138 additions and 0 deletions

434
templates/index.html Normal file
View File

@@ -0,0 +1,434 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YouTube Concert Splitter</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
margin: 0;
padding: 20px;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.container {
background: #fff;
padding: 40px;
border-radius: 12px;
box-shadow: 0 8px 20px rgba(0,0,0,0.2);
width: 100%;
max-width: 700px;
}
h1 {
margin-bottom: 10px;
color: #333;
font-size: 28px;
text-align: center;
}
.subtitle {
text-align: center;
color: #666;
margin-bottom: 30px;
font-size: 14px;
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
margin-bottom: 20px;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group.full-width {
grid-column: 1 / -1;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: #444;
font-size: 14px;
}
input[type="text"] {
width: 100%;
padding: 12px;
border: 2px solid #e0e0e0;
border-radius: 6px;
font-size: 14px;
transition: border-color 0.3s;
box-sizing: border-box;
}
input[type="text"]:focus {
outline: none;
border-color: #667eea;
}
textarea {
width: 100%;
padding: 12px;
border: 2px solid #e0e0e0;
border-radius: 6px;
font-size: 13px;
font-family: 'Courier New', monospace;
resize: vertical;
min-height: 200px;
transition: border-color 0.3s;
box-sizing: border-box;
}
textarea:focus {
outline: none;
border-color: #667eea;
}
.help-text {
font-size: 12px;
color: #777;
margin-top: 5px;
margin-bottom: 0;
font-style: italic;
}
button {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
padding: 14px 30px;
font-size: 16px;
font-weight: 600;
border-radius: 6px;
cursor: pointer;
width: 100%;
transition: transform 0.2s, box-shadow 0.2s;
margin-top: 10px;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
button:active {
transform: translateY(0);
}
button:disabled {
background: #ccc;
cursor: not-allowed;
transform: none;
}
.loader-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.loader-content {
background: white;
padding: 40px;
border-radius: 12px;
text-align: center;
max-width: 400px;
}
.spinner {
border: 6px solid #f3f3f3;
border-top: 6px solid #667eea;
border-radius: 50%;
width: 60px;
height: 60px;
animation: spin 1s linear infinite;
margin: 0 auto 20px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.loader-text {
font-size: 18px;
color: #333;
font-weight: 600;
margin-bottom: 10px;
}
.loader-subtext {
font-size: 14px;
color: #666;
}
.message {
padding: 15px;
border-radius: 6px;
margin-top: 20px;
font-size: 14px;
}
.error {
background: #fee;
color: #c33;
border: 1px solid #fcc;
}
.success {
background: #efe;
color: #3a3;
border: 1px solid #cfc;
}
.warning {
background: #fef7e0;
color: #8a6d3b;
border: 1px solid #faebcc;
}
.results {
margin-top: 20px;
padding: 20px;
background: #f9f9f9;
border-radius: 6px;
border: 1px solid #e0e0e0;
}
.results h3 {
margin-top: 0;
color: #333;
font-size: 18px;
}
.track-list {
list-style: none;
padding: 0;
margin: 10px 0;
}
.track-list li {
padding: 8px;
background: white;
margin-bottom: 5px;
border-radius: 4px;
font-size: 13px;
color: #555;
}
.track-list li.skipped {
background: #fff9e6;
color: #856404;
}
.track-list li.created {
background: #e8f5e9;
color: #2e7d32;
}
.download-info {
margin-top: 15px;
padding: 15px;
background: #e8f4f8;
border-radius: 6px;
border-left: 4px solid #2196F3;
}
.download-info strong {
color: #1976D2;
}
.stats {
display: flex;
gap: 20px;
margin-top: 15px;
flex-wrap: wrap;
}
.stat-item {
flex: 1;
min-width: 120px;
padding: 10px;
background: white;
border-radius: 4px;
text-align: center;
}
.stat-number {
font-size: 24px;
font-weight: bold;
color: #667eea;
}
.stat-label {
font-size: 12px;
color: #666;
margin-top: 5px;
}
</style>
</head>
<body>
<div class="container">
<h1>🎵 YouTube Concert Splitter</h1>
<p class="subtitle">Download and split concert videos into individual tracks</p>
<form id="splitterForm">
<div class="form-group full-width">
<label for="youtube_url">YouTube URL:</label>
<input type="text"
id="youtube_url"
name="youtube_url"
placeholder="https://www.youtube.com/watch?v=..."
required>
</div>
<div class="form-row">
<div class="form-group">
<label for="artist">Artist Name:</label>
<input type="text"
id="artist"
name="artist"
placeholder="e.g., Bob Dylan"
required>
</div>
<div class="form-group">
<label for="album">Album Name:</label>
<input type="text"
id="album"
name="album"
placeholder="e.g., Live at Madison Square Garden"
required>
</div>
</div>
<div class="form-group full-width">
<label for="setlist">Setlist (timestamps and track titles) - Optional:</label>
<textarea id="setlist"
name="setlist"
placeholder="0:00 Opening Song&#10;3:45 Second Track&#10;7:30 Third Song&#10;&#10;(Leave empty to download as single track - no splitting)"></textarea>
<div class="help-text">
<strong>Split Mode:</strong> Enter "TIMESTAMP TRACK_TITLE" per line (e.g., "0:00 Song Name")<br>
<strong>Single Mode:</strong> Leave this field completely empty to download entire video as one track
</div>
</div>
<button type="submit" id="submitBtn">Split Concert</button>
</form>
<div id="message"></div>
<div id="results"></div>
</div>
<div id="loader" class="loader-overlay" style="display: none;">
<div class="loader-content">
<div class="spinner"></div>
<div class="loader-text">Processing...</div>
<div class="loader-subtext">Downloading and splitting tracks. This may take several minutes.</div>
</div>
</div>
<script>
document.getElementById('splitterForm').addEventListener('submit', function(e) {
e.preventDefault();
// Clear previous messages
document.getElementById('message').innerHTML = '';
document.getElementById('results').innerHTML = '';
// Show loader
document.getElementById('loader').style.display = 'flex';
document.getElementById('submitBtn').disabled = true;
const url = document.getElementById('youtube_url').value;
const artist = document.getElementById('artist').value;
const album = document.getElementById('album').value;
const setlist = document.getElementById('setlist').value;
const formData = new FormData();
formData.append('youtube_url', url);
formData.append('artist', artist);
formData.append('album', album);
formData.append('setlist', setlist);
fetch('/split', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
document.getElementById('loader').style.display = 'none';
document.getElementById('submitBtn').disabled = false;
if (data.error) {
document.getElementById('message').innerHTML =
`<div class="message error"><strong>Error:</strong> ${data.error}</div>`;
} else {
// Display success message with stats
let html = '';
if (data.skipped_count > 0) {
html += `<div class="message warning"><strong>Note:</strong> ${data.skipped_count} track(s) already existed and were skipped.</div>`;
}
html += `<div class="message success"><strong>Success!</strong> Processing complete.</div>`;
html += `<div class="results">`;
html += `<h3>🎸 ${data.artist} - ${data.album}</h3>`;
html += `<div class="stats">`;
html += `<div class="stat-item">`;
html += `<div class="stat-number">${data.created_count}</div>`;
html += `<div class="stat-label">Created</div>`;
html += `</div>`;
html += `<div class="stat-item">`;
html += `<div class="stat-number">${data.skipped_count}</div>`;
html += `<div class="stat-label">Skipped</div>`;
html += `</div>`;
html += `<div class="stat-item">`;
html += `<div class="stat-number">${data.total_tracks}</div>`;
html += `<div class="stat-label">Total Tracks</div>`;
html += `</div>`;
html += `</div>`;
html += `<div class="download-info"><strong>📁 Output Directory:</strong> ${data.output_dir}</div>`;
html += `<h4>Track Details:</h4>`;
html += `<ul class="track-list">`;
data.tracks.forEach(track => {
const className = track.status === 'created' ? 'created' : 'skipped';
const icon = track.status === 'created' ? '✓' : '⊘';
const statusText = track.status === 'created' ? 'Created' : 'Already exists';
html += `<li class="${className}">${icon} ${track.filename} <em>(${statusText})</em></li>`;
});
html += `</ul>`;
html += `</div>`;
document.getElementById('results').innerHTML = html;
}
})
.catch(error => {
document.getElementById('loader').style.display = 'none';
document.getElementById('submitBtn').disabled = false;
document.getElementById('message').innerHTML =
`<div class="message error"><strong>Error:</strong> ${error.message}</div>`;
});
});
</script>
</body>
</html>