fix: update to not add empty dirs
This commit is contained in:
@@ -289,6 +289,9 @@ 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>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
@@ -1315,6 +1318,40 @@ async function deleteEpisode(imdbId, season, episode) {
|
||||
}
|
||||
}
|
||||
|
||||
// Movie deletion functionality
|
||||
async function deleteMovie(imdbId) {
|
||||
// Confirmation dialog
|
||||
if (!confirm(`⚠️ Delete Movie?\n\nThis will permanently remove the movie (${imdbId}) from the database.\n\nAre you sure you want to continue?`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/database/movie/${imdbId}`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (response.ok && result.success) {
|
||||
showToast(`✅ Movie deleted successfully`, 'success');
|
||||
|
||||
// Refresh the movies table
|
||||
loadMovies(currentMoviesPage);
|
||||
|
||||
} else {
|
||||
const errorMsg = result.message || result.error || 'Unknown error';
|
||||
showToast(`❌ Failed to delete movie: ${errorMsg}`, 'error');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Delete movie failed:', error);
|
||||
showToast(`❌ Delete 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