- Updated application name to "Oliver Metadata Tool" - Updated version to 3.0.0 - Added App Info constants to config.py (APP_NAME, APP_VERSION, APP_DESCRIPTION) - Updated web interface (title, header, footer) - Updated README with new branding and description - Added AI configuration settings to config.py - Added ExifTool check method to config.py Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
572 lines
19 KiB
HTML
572 lines
19 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Oliver Metadata Tool</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
padding: 20px;
|
|
}
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
border-radius: 20px;
|
|
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
|
overflow: hidden;
|
|
}
|
|
.header {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
padding: 30px;
|
|
text-align: center;
|
|
}
|
|
.header h1 { font-size: 28px; margin-bottom: 10px; }
|
|
.header p { opacity: 0.9; font-size: 14px; }
|
|
.content { padding: 40px; }
|
|
|
|
.upload-section {
|
|
background: #f8f9ff;
|
|
border-radius: 10px;
|
|
padding: 20px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.upload-area {
|
|
border: 3px dashed #667eea;
|
|
border-radius: 10px;
|
|
padding: 60px 20px;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.3s;
|
|
background: white;
|
|
margin-bottom: 20px;
|
|
}
|
|
.upload-area:hover { background: #f0f2ff; border-color: #764ba2; }
|
|
.upload-area.dragover { background: #e8ebff; transform: scale(1.02); }
|
|
|
|
#fileInput { display: none; }
|
|
.upload-icon { font-size: 48px; margin-bottom: 15px; }
|
|
|
|
.output-dir-section {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
margin-bottom: 20px;
|
|
padding: 15px;
|
|
background: white;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.output-dir-section label {
|
|
font-weight: 600;
|
|
color: #495057;
|
|
min-width: 120px;
|
|
}
|
|
|
|
#outputDir {
|
|
flex: 1;
|
|
padding: 10px;
|
|
border: 2px solid #dee2e6;
|
|
border-radius: 5px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.output-dir-hint {
|
|
font-size: 12px;
|
|
color: #6c757d;
|
|
margin-top: 5px;
|
|
}
|
|
|
|
.btn {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
border: none;
|
|
padding: 12px 30px;
|
|
border-radius: 25px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
transition: transform 0.2s;
|
|
margin: 5px;
|
|
}
|
|
.btn:hover { transform: translateY(-2px); }
|
|
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
|
|
|
|
.btn-small {
|
|
padding: 8px 20px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.progress-bar {
|
|
width: 100%;
|
|
height: 30px;
|
|
background: #e9ecef;
|
|
border-radius: 15px;
|
|
overflow: hidden;
|
|
margin: 20px 0;
|
|
display: none;
|
|
}
|
|
|
|
.progress-fill {
|
|
height: 100%;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
transition: width 0.3s;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: white;
|
|
font-weight: 600;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.file-list {
|
|
margin-top: 30px;
|
|
display: none;
|
|
}
|
|
|
|
.file-item {
|
|
background: #f8f9fa;
|
|
border-radius: 10px;
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
border-left: 4px solid #667eea;
|
|
}
|
|
|
|
.file-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.file-name {
|
|
font-weight: 600;
|
|
font-size: 16px;
|
|
color: #495057;
|
|
}
|
|
|
|
.file-type {
|
|
background: #667eea;
|
|
color: white;
|
|
padding: 4px 12px;
|
|
border-radius: 12px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.metadata-comparison {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 15px;
|
|
}
|
|
|
|
.metadata-box {
|
|
background: white;
|
|
border-radius: 8px;
|
|
padding: 15px;
|
|
}
|
|
|
|
.metadata-box h4 {
|
|
color: #667eea;
|
|
margin-bottom: 10px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.metadata-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 8px 0;
|
|
border-bottom: 1px solid #dee2e6;
|
|
}
|
|
|
|
.metadata-item:last-child { border-bottom: none; }
|
|
.metadata-label { font-weight: 600; color: #495057; font-size: 12px; margin-bottom: 4px; }
|
|
.metadata-value { color: #6c757d; font-size: 13px; }
|
|
|
|
.alert {
|
|
padding: 15px;
|
|
border-radius: 8px;
|
|
margin: 15px 0;
|
|
display: none;
|
|
}
|
|
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
|
|
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
|
|
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
|
|
|
|
.actions {
|
|
text-align: center;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.spinner {
|
|
border: 3px solid #f3f3f3;
|
|
border-top: 3px solid #667eea;
|
|
border-radius: 50%;
|
|
width: 40px;
|
|
height: 40px;
|
|
animation: spin 1s linear infinite;
|
|
margin: 20px auto;
|
|
display: none;
|
|
}
|
|
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
.footer {
|
|
text-align: center;
|
|
padding: 20px;
|
|
color: #6c757d;
|
|
font-size: 12px;
|
|
border-top: 1px solid #dee2e6;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.metadata-comparison {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="header">
|
|
<h1>🎯 Oliver Metadata Tool</h1>
|
|
<p>Universal metadata creation and management for all file types</p>
|
|
</div>
|
|
|
|
<div class="content">
|
|
<div class="upload-section">
|
|
<div class="upload-area" id="uploadArea">
|
|
<div class="upload-icon">📁</div>
|
|
<h3>Drop files here or click to browse</h3>
|
|
<p style="color: #6c757d; margin-top: 10px;">Supported: PDF, JPG, PNG, DOCX, XLSX, PPTX, MP4, MOV</p>
|
|
<p style="color: #667eea; margin-top: 5px; font-weight: 600;">Multiple files supported!</p>
|
|
<input type="file" id="fileInput" accept=".pdf,.jpg,.jpeg,.png,.gif,.docx,.xlsx,.pptx,.mp4,.mov,.avi" multiple>
|
|
</div>
|
|
|
|
<div class="output-dir-section">
|
|
<label for="outputDir">Save to folder:</label>
|
|
<input type="text" id="outputDir" placeholder="Leave empty to save in original location" />
|
|
</div>
|
|
<div class="output-dir-hint">
|
|
💡 Tip: Paste the folder path where you want to save processed files (e.g., /Users/YourName/Desktop/ProcessedFiles)
|
|
</div>
|
|
</div>
|
|
|
|
<div class="progress-bar" id="progressBar">
|
|
<div class="progress-fill" id="progressFill">0%</div>
|
|
</div>
|
|
|
|
<div class="spinner" id="spinner"></div>
|
|
<div class="alert alert-error" id="errorAlert"></div>
|
|
<div class="alert alert-success" id="successAlert"></div>
|
|
<div class="alert alert-info" id="infoAlert"></div>
|
|
|
|
<div class="file-list" id="fileList"></div>
|
|
|
|
<div class="actions" id="actions" style="display: none;">
|
|
<button class="btn" id="updateAllBtn" onclick="updateAllFiles()">
|
|
Update All Files
|
|
</button>
|
|
<button class="btn" onclick="resetForm()">
|
|
Process More Files
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer">
|
|
Oliver Metadata Tool v3.0 | Multiple metadata sources | Excel • AI • Manual • Import
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
let currentFiles = [];
|
|
let sessionId = null;
|
|
|
|
const uploadArea = document.getElementById('uploadArea');
|
|
const fileInput = document.getElementById('fileInput');
|
|
const spinner = document.getElementById('spinner');
|
|
const progressBar = document.getElementById('progressBar');
|
|
const progressFill = document.getElementById('progressFill');
|
|
const fileList = document.getElementById('fileList');
|
|
const actions = document.getElementById('actions');
|
|
const errorAlert = document.getElementById('errorAlert');
|
|
const successAlert = document.getElementById('successAlert');
|
|
const infoAlert = document.getElementById('infoAlert');
|
|
|
|
// Click to upload
|
|
uploadArea.addEventListener('click', () => fileInput.click());
|
|
|
|
// File selection
|
|
fileInput.addEventListener('change', handleFileSelect);
|
|
|
|
// Drag and drop
|
|
uploadArea.addEventListener('dragover', (e) => {
|
|
e.preventDefault();
|
|
uploadArea.classList.add('dragover');
|
|
});
|
|
|
|
uploadArea.addEventListener('dragleave', () => {
|
|
uploadArea.classList.remove('dragover');
|
|
});
|
|
|
|
uploadArea.addEventListener('drop', (e) => {
|
|
e.preventDefault();
|
|
uploadArea.classList.remove('dragover');
|
|
const files = e.dataTransfer.files;
|
|
if (files.length > 0) {
|
|
handleFiles(files);
|
|
}
|
|
});
|
|
|
|
function handleFileSelect(e) {
|
|
const files = e.target.files;
|
|
if (files.length > 0) {
|
|
handleFiles(files);
|
|
}
|
|
}
|
|
|
|
async function handleFiles(files) {
|
|
hideAlerts();
|
|
showSpinner();
|
|
showProgress(0);
|
|
fileList.style.display = 'none';
|
|
actions.style.display = 'none';
|
|
currentFiles = [];
|
|
|
|
showInfo(`Processing ${files.length} file(s)...`);
|
|
|
|
const formData = new FormData();
|
|
for (let file of files) {
|
|
formData.append('files', file);
|
|
}
|
|
|
|
try {
|
|
const response = await fetch('/upload', {
|
|
method: 'POST',
|
|
body: formData
|
|
});
|
|
|
|
const data = await response.json();
|
|
hideSpinner();
|
|
hideProgress();
|
|
|
|
if (data.error) {
|
|
showError(data.error);
|
|
return;
|
|
}
|
|
|
|
sessionId = data.session_id;
|
|
currentFiles = data.files;
|
|
displayFiles(data.files);
|
|
showSuccess(`Successfully analyzed ${data.files.length} file(s)!`);
|
|
actions.style.display = 'block';
|
|
|
|
} catch (error) {
|
|
hideSpinner();
|
|
hideProgress();
|
|
showError('Error processing files: ' + error.message);
|
|
}
|
|
}
|
|
|
|
function displayFiles(files) {
|
|
fileList.innerHTML = '';
|
|
fileList.style.display = 'block';
|
|
|
|
files.forEach((file, index) => {
|
|
if (file.error) {
|
|
const errorItem = document.createElement('div');
|
|
errorItem.className = 'file-item';
|
|
errorItem.style.borderLeftColor = '#dc3545';
|
|
errorItem.innerHTML = `
|
|
<div class="file-header">
|
|
<div class="file-name">❌ ${file.filename}</div>
|
|
</div>
|
|
<div class="alert alert-error" style="display: block;">${file.error}</div>
|
|
`;
|
|
fileList.appendChild(errorItem);
|
|
return;
|
|
}
|
|
|
|
const fileItem = document.createElement('div');
|
|
fileItem.className = 'file-item';
|
|
fileItem.id = `file-${index}`;
|
|
|
|
fileItem.innerHTML = `
|
|
<div class="file-header">
|
|
<div class="file-name">📄 ${file.filename}</div>
|
|
<div class="file-type">${file.file_type}</div>
|
|
</div>
|
|
|
|
<div class="metadata-comparison">
|
|
<div class="metadata-box">
|
|
<h4>📋 Current Metadata</h4>
|
|
${displayMetadata(file.current_metadata)}
|
|
</div>
|
|
|
|
<div class="metadata-box">
|
|
<h4>✨ AI-Generated Metadata</h4>
|
|
${displayMetadata(file.suggested_metadata)}
|
|
</div>
|
|
</div>
|
|
`;
|
|
|
|
fileList.appendChild(fileItem);
|
|
});
|
|
}
|
|
|
|
function displayMetadata(metadata) {
|
|
if (!metadata || Object.keys(metadata).length === 0) {
|
|
return '<p style="color: #6c757d; font-size: 13px;">(empty)</p>';
|
|
}
|
|
|
|
let html = '';
|
|
for (const [key, value] of Object.entries(metadata)) {
|
|
html += `
|
|
<div class="metadata-item">
|
|
<span class="metadata-label">${key}:</span>
|
|
<span class="metadata-value">${value || '(empty)'}</span>
|
|
</div>
|
|
`;
|
|
}
|
|
return html;
|
|
}
|
|
|
|
async function updateAllFiles() {
|
|
if (currentFiles.length === 0) return;
|
|
|
|
const outputDir = document.getElementById('outputDir').value.trim();
|
|
const updateBtn = document.getElementById('updateAllBtn');
|
|
updateBtn.disabled = true;
|
|
hideAlerts();
|
|
showProgress(0);
|
|
|
|
showInfo(`Updating ${currentFiles.length} file(s)...`);
|
|
|
|
let successCount = 0;
|
|
let errorCount = 0;
|
|
|
|
for (let i = 0; i < currentFiles.length; i++) {
|
|
const file = currentFiles[i];
|
|
|
|
if (file.error) {
|
|
errorCount++;
|
|
continue;
|
|
}
|
|
|
|
const progress = ((i + 1) / currentFiles.length) * 100;
|
|
showProgress(progress);
|
|
|
|
try {
|
|
const response = await fetch('/update', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
filepath: file.filepath,
|
|
output_dir: outputDir
|
|
})
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (data.error) {
|
|
errorCount++;
|
|
const fileItem = document.getElementById(`file-${i}`);
|
|
if (fileItem) {
|
|
fileItem.style.borderLeftColor = '#dc3545';
|
|
const errorDiv = document.createElement('div');
|
|
errorDiv.className = 'alert alert-error';
|
|
errorDiv.style.display = 'block';
|
|
errorDiv.textContent = `Error: ${data.error}`;
|
|
fileItem.appendChild(errorDiv);
|
|
}
|
|
} else {
|
|
successCount++;
|
|
const fileItem = document.getElementById(`file-${i}`);
|
|
if (fileItem) {
|
|
fileItem.style.borderLeftColor = '#28a745';
|
|
const successDiv = document.createElement('div');
|
|
successDiv.className = 'alert alert-success';
|
|
successDiv.style.display = 'block';
|
|
successDiv.textContent = data.verified ?
|
|
`✅ Updated and verified! Saved to: ${data.output_path}` :
|
|
`✅ Updated! Saved to: ${data.output_path}`;
|
|
fileItem.appendChild(successDiv);
|
|
}
|
|
}
|
|
} catch (error) {
|
|
errorCount++;
|
|
console.error('Error updating file:', error);
|
|
}
|
|
}
|
|
|
|
hideProgress();
|
|
updateBtn.disabled = false;
|
|
|
|
if (successCount > 0 && errorCount === 0) {
|
|
showSuccess(`✅ All ${successCount} file(s) updated successfully!`);
|
|
} else if (successCount > 0 && errorCount > 0) {
|
|
showInfo(`⚠️ Updated ${successCount} file(s), ${errorCount} failed.`);
|
|
} else {
|
|
showError(`❌ Failed to update files. Check individual file errors above.`);
|
|
}
|
|
}
|
|
|
|
function resetForm() {
|
|
fileInput.value = '';
|
|
fileList.style.display = 'none';
|
|
actions.style.display = 'none';
|
|
hideAlerts();
|
|
hideProgress();
|
|
currentFiles = [];
|
|
sessionId = null;
|
|
}
|
|
|
|
function showSpinner() {
|
|
spinner.style.display = 'block';
|
|
}
|
|
|
|
function hideSpinner() {
|
|
spinner.style.display = 'none';
|
|
}
|
|
|
|
function showProgress(percent) {
|
|
progressBar.style.display = 'block';
|
|
progressFill.style.width = percent + '%';
|
|
progressFill.textContent = Math.round(percent) + '%';
|
|
}
|
|
|
|
function hideProgress() {
|
|
progressBar.style.display = 'none';
|
|
}
|
|
|
|
function showError(message) {
|
|
errorAlert.textContent = message;
|
|
errorAlert.style.display = 'block';
|
|
}
|
|
|
|
function showSuccess(message) {
|
|
successAlert.textContent = message;
|
|
successAlert.style.display = 'block';
|
|
}
|
|
|
|
function showInfo(message) {
|
|
infoAlert.textContent = message;
|
|
infoAlert.style.display = 'block';
|
|
}
|
|
|
|
function hideAlerts() {
|
|
errorAlert.style.display = 'none';
|
|
successAlert.style.display = 'none';
|
|
infoAlert.style.display = 'none';
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|