imdb: missing imdge improvments
This commit is contained in:
@@ -2031,6 +2031,90 @@ async function showEpisodesMissingNFODateadded() {
|
||||
}
|
||||
}
|
||||
|
||||
async function showMissingImdbItems() {
|
||||
const resultsDiv = document.getElementById('admin-results');
|
||||
const resultsContent = document.getElementById('admin-results-content');
|
||||
|
||||
try {
|
||||
resultsContent.innerHTML = '<div class="loading">Checking for items missing IMDb IDs...</div>';
|
||||
resultsDiv.style.display = 'block';
|
||||
|
||||
const response = await apiCall('/api/admin/missing-imdb');
|
||||
|
||||
if (response.success) {
|
||||
let html = `
|
||||
<h4>Items Missing IMDb IDs</h4>
|
||||
<p><strong>Found:</strong> ${response.total_missing} items missing IMDb IDs</p>
|
||||
<p><strong>TV Series:</strong> ${response.tv_series_missing} | <strong>Movies:</strong> ${response.movies_missing}</p>
|
||||
`;
|
||||
|
||||
if (response.total_missing > 0) {
|
||||
html += `
|
||||
<p><strong>Recommendation:</strong> These items need manual IMDb ID assignment or folder/filename correction.</p>
|
||||
<div class="missing-imdb-table-container">
|
||||
<table class="missing-imdb-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10%">Type</th>
|
||||
<th style="width: 25%">Folder Name</th>
|
||||
<th style="width: 35%">File Path</th>
|
||||
<th style="width: 15%">Discovered</th>
|
||||
<th style="width: 10%">Checks</th>
|
||||
<th style="width: 5%">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`;
|
||||
|
||||
response.items.forEach(item => {
|
||||
const discoveredDate = item.discovered_at ? new Date(item.discovered_at).toLocaleDateString() : 'Unknown';
|
||||
const checkCount = item.check_count || 1;
|
||||
|
||||
html += `
|
||||
<tr>
|
||||
<td>
|
||||
<span class="media-type-badge ${item.type.toLowerCase().replace(' ', '-')}">${item.type}</span>
|
||||
</td>
|
||||
<td title="${item.folder_name}">${item.folder_name}</td>
|
||||
<td title="${item.file_path}" class="file-path">${item.file_path}</td>
|
||||
<td>${discoveredDate}</td>
|
||||
<td>${checkCount}</td>
|
||||
<td>
|
||||
<button class="btn btn-small btn-info" title="Copy path to clipboard" onclick="copyToClipboard('${item.file_path}')">
|
||||
<i class="fas fa-copy"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
html += `
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="missing-imdb-actions">
|
||||
<p><strong>How to fix:</strong></p>
|
||||
<ul>
|
||||
<li>Add IMDb ID to folder name: <code>[imdb-tt1234567]</code></li>
|
||||
<li>Add IMDb ID to filename: <code>Movie.Name.2023.imdb-tt1234567.mkv</code></li>
|
||||
<li>Add IMDb ID to NFO file content</li>
|
||||
<li>Check folder structure and naming conventions</li>
|
||||
</ul>
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
html += '<p>✅ All items have valid IMDb IDs!</p>';
|
||||
}
|
||||
|
||||
resultsContent.innerHTML = html;
|
||||
} else {
|
||||
resultsContent.innerHTML = `<div class="error">Error: ${response.message}</div>`;
|
||||
}
|
||||
} catch (error) {
|
||||
resultsContent.innerHTML = `<div class="error">Failed to check missing IMDb items: ${error.message}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
async function exportDatabaseReport() {
|
||||
alert('Database export functionality will be implemented in a future update.');
|
||||
}
|
||||
@@ -2092,4 +2176,30 @@ async function showRecentWebhookActivity() {
|
||||
} catch (error) {
|
||||
resultsContent.innerHTML = `<div class="error">Failed to load webhook activity: ${error.message}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
async function copyToClipboard(text) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
// Show a temporary success message
|
||||
const button = event.target.closest('button');
|
||||
const originalIcon = button.innerHTML;
|
||||
button.innerHTML = '<i class="fas fa-check"></i>';
|
||||
button.style.backgroundColor = '#4CAF50';
|
||||
|
||||
setTimeout(() => {
|
||||
button.innerHTML = originalIcon;
|
||||
button.style.backgroundColor = '';
|
||||
}, 1500);
|
||||
} catch (err) {
|
||||
// Fallback for older browsers
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.value = text;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(textArea);
|
||||
|
||||
alert('Path copied to clipboard!');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user