update with the ability to add IMDB to skipped
Local Docker Build (Dev) / build-dev (push) Successful in 35s
Local Docker Build (Dev) / build-dev (push) Successful in 35s
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>NFOGuard - Database Management</title>
|
||||
<link rel="stylesheet" href="/static/css/styles.css?v=2.10.0-skipped-tracking-v5">
|
||||
<link rel="stylesheet" href="/static/css/styles.css?v=2.10.0-skipped-imdb-edit">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
@@ -12,7 +12,7 @@
|
||||
<!-- Header -->
|
||||
<header class="app-header">
|
||||
<div class="header-content">
|
||||
<h1><i class="fas fa-shield-alt"></i> NFOGuard <span style="font-size: 0.5em; color: #888;">v2.10.0-skipped-tracking-v5</span></h1>
|
||||
<h1><i class="fas fa-shield-alt"></i> NFOGuard <span style="font-size: 0.5em; color: #888;">v2.10.0-skipped-imdb-edit</span></h1>
|
||||
<p>Database Management & Reporting</p>
|
||||
</div>
|
||||
<div class="auth-status" id="auth-status" style="display: none;">
|
||||
@@ -727,6 +727,6 @@
|
||||
<!-- Toast Notifications -->
|
||||
<div class="toast-container" id="toast-container"></div>
|
||||
|
||||
<script src="/static/js/app.js?v=2.10.0-skipped-tracking-v5"></script>
|
||||
<script src="/static/js/app.js?v=2.10.0-skipped-imdb-edit"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -340,10 +340,22 @@ function updateMoviesTable(data) {
|
||||
dateTypeBadge = 'badge-warning';
|
||||
}
|
||||
|
||||
// Check if skipped and if IMDb ID is placeholder
|
||||
const isSkipped = movie.skipped === true;
|
||||
const isPlaceholder = movie.imdb_id && movie.imdb_id.startsWith('missing-');
|
||||
const skipReasonBadge = isSkipped ? `<br><span class="badge badge-warning" title="${escapeHtml(movie.skip_reason || 'Skipped')}"">Skipped</span>` : '';
|
||||
|
||||
// Add Update IMDb ID button for placeholder IDs
|
||||
const updateImdbButton = isPlaceholder ? `
|
||||
<button class="btn btn-sm btn-info" onclick="updateMovieImdbId('${movie.imdb_id}')" title="Update IMDb ID" style="margin-left: 5px;">
|
||||
<i class="fas fa-id-card"></i> Update IMDb
|
||||
</button>
|
||||
` : '';
|
||||
|
||||
return `
|
||||
<tr>
|
||||
<td>${escapeHtml(movie.title)}</td>
|
||||
<td><code>${movie.imdb_id}</code></td>
|
||||
<td><code>${movie.imdb_id}</code>${skipReasonBadge}</td>
|
||||
<td>${movie.released || '-'}</td>
|
||||
<td>${dateadded || '-'}</td>
|
||||
<td><span class="badge badge-secondary">${movie.source_description || movie.source || 'Unknown'}</span></td>
|
||||
@@ -356,6 +368,7 @@ function updateMoviesTable(data) {
|
||||
<button class="btn btn-sm btn-secondary" onclick="debugMovie('${movie.imdb_id}')" title="Debug Data">
|
||||
<i class="fas fa-bug"></i>
|
||||
</button>
|
||||
${updateImdbButton}
|
||||
<button class="btn btn-sm btn-danger" onclick="deleteMovie('${movie.imdb_id}')" style="margin-left: 5px;" title="Delete Movie">
|
||||
<i class="fas fa-trash"></i> Delete
|
||||
</button>
|
||||
@@ -475,6 +488,16 @@ function updateSeriesTable(data) {
|
||||
const progressPercent = series.total_episodes > 0 ?
|
||||
((series.episodes_with_dates / series.total_episodes) * 100).toFixed(1) : 0;
|
||||
|
||||
// Check if IMDb ID is placeholder
|
||||
const isPlaceholder = series.imdb_id && series.imdb_id.startsWith('missing-');
|
||||
|
||||
// Add Update IMDb ID button for placeholder IDs
|
||||
const updateImdbButton = isPlaceholder ? `
|
||||
<button class="btn btn-sm btn-info" onclick="updateSeriesImdbId('${series.imdb_id}')" title="Update IMDb ID" style="margin-left: 5px;">
|
||||
<i class="fas fa-id-card"></i> Update IMDb
|
||||
</button>
|
||||
` : '';
|
||||
|
||||
return `
|
||||
<tr>
|
||||
<td>${escapeHtml(series.title)}</td>
|
||||
@@ -490,6 +513,7 @@ function updateSeriesTable(data) {
|
||||
<button class="btn btn-sm btn-primary" onclick="viewSeriesEpisodes('${series.imdb_id}')">
|
||||
<i class="fas fa-list"></i> Episodes
|
||||
</button>
|
||||
${updateImdbButton}
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
@@ -1505,6 +1529,92 @@ async function deleteMovie(imdbId) {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateMovieImdbId(oldImdbId) {
|
||||
// Prompt for new IMDb ID
|
||||
const newImdbId = prompt(`Update IMDb ID\n\nCurrent: ${oldImdbId}\n\nEnter the correct IMDb ID (with or without 'tt' prefix):`);
|
||||
|
||||
if (!newImdbId || newImdbId.trim() === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
const cleanImdbId = newImdbId.trim();
|
||||
|
||||
// Confirmation
|
||||
if (!confirm(`Update IMDb ID?\n\nOld: ${oldImdbId}\nNew: ${cleanImdbId}\n\nThis will migrate the movie record to the new IMDb ID. Continue?`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/movies/${oldImdbId}/migrate-imdb`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ new_imdb_id: cleanImdbId })
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (response.ok && result.success) {
|
||||
showToast(`✅ IMDb ID updated successfully to ${result.new_imdb_id}`, 'success');
|
||||
|
||||
// Refresh the movies table
|
||||
loadMovies(currentMoviesPage);
|
||||
|
||||
} else {
|
||||
const errorMsg = result.message || result.detail || 'Unknown error';
|
||||
showToast(`❌ Failed to update IMDb ID: ${errorMsg}`, 'error');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Update IMDb ID failed:', error);
|
||||
showToast(`❌ Update failed: ${error.message}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function updateSeriesImdbId(oldImdbId) {
|
||||
// Prompt for new IMDb ID
|
||||
const newImdbId = prompt(`Update Series IMDb ID\n\nCurrent: ${oldImdbId}\n\nEnter the correct IMDb ID (with or without 'tt' prefix):`);
|
||||
|
||||
if (!newImdbId || newImdbId.trim() === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
const cleanImdbId = newImdbId.trim();
|
||||
|
||||
// Confirmation
|
||||
if (!confirm(`Update Series IMDb ID?\n\nOld: ${oldImdbId}\nNew: ${cleanImdbId}\n\nThis will migrate the series and ALL its episodes to the new IMDb ID. Continue?`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/series/${oldImdbId}/migrate-imdb`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ new_imdb_id: cleanImdbId })
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (response.ok && result.success) {
|
||||
showToast(`✅ Series IMDb ID updated successfully to ${result.new_imdb_id}`, 'success');
|
||||
|
||||
// Refresh the series table
|
||||
loadSeries(currentSeriesPage);
|
||||
|
||||
} else {
|
||||
const errorMsg = result.message || result.detail || 'Unknown error';
|
||||
showToast(`❌ Failed to update IMDb ID: ${errorMsg}`, 'error');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Update series IMDb ID failed:', error);
|
||||
showToast(`❌ Update failed: ${error.message}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// Update episode counts in modal after deletion
|
||||
function updateEpisodeModalCounts() {
|
||||
const remainingRows = document.querySelectorAll('#episodes-table-body tr');
|
||||
|
||||
Reference in New Issue
Block a user