feat: add manual TMDB/TVDB ID entry for failed lookups
- Add PATCH /api/anime/{key}/metadata-ids endpoint to update IDs
- Add POST /api/anime/{key}/refresh-nfo endpoint to force NFO regeneration
- Add Edit Metadata IDs modal in frontend
- Add showEditMetadataModal, saveMetadataIds, refreshSeriesNfo JS functions
- Add edit-metadata-btn to series cards with database icon
- IDs validated as positive integers or null
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -40,6 +40,31 @@ AniWorld.SeriesManager = (function() {
|
||||
if (sortBtn) {
|
||||
sortBtn.addEventListener('click', toggleAlphabeticalSort);
|
||||
}
|
||||
|
||||
// Event delegation for dynamically created edit-key buttons
|
||||
document.addEventListener('click', function(e) {
|
||||
const editKeyBtn = e.target.closest('.edit-key-btn');
|
||||
if (editKeyBtn) {
|
||||
e.preventDefault();
|
||||
const key = editKeyBtn.dataset.key;
|
||||
const folder = editKeyBtn.dataset.folder;
|
||||
if (window.showEditKeyModal) {
|
||||
window.showEditKeyModal(key, folder);
|
||||
}
|
||||
}
|
||||
|
||||
const editMetadataBtn = e.target.closest('.edit-metadata-btn');
|
||||
if (editMetadataBtn) {
|
||||
e.preventDefault();
|
||||
const key = editMetadataBtn.dataset.key;
|
||||
const name = editMetadataBtn.dataset.name;
|
||||
const tmdbId = editMetadataBtn.dataset.tmdbId || null;
|
||||
const tvdbId = editMetadataBtn.dataset.tvdbId || null;
|
||||
if (window.showEditMetadataModal) {
|
||||
window.showEditMetadataModal(key, name, tmdbId, tvdbId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -343,7 +368,8 @@ AniWorld.SeriesManager = (function() {
|
||||
const canBeSelected = hasMissingEpisodes;
|
||||
const hasNfo = serie.has_nfo || false;
|
||||
const isLoading = serie.loading_status && serie.loading_status !== 'completed' && serie.loading_status !== 'failed';
|
||||
|
||||
const hasKeyError = serie.loading_error && serie.loading_error.includes('key cannot be None or empty');
|
||||
|
||||
// Debug logging for troubleshooting
|
||||
if (serie.key === 'so-im-a-spider-so-what') {
|
||||
console.log('[createSerieCard] Spider series:', {
|
||||
@@ -356,6 +382,12 @@ AniWorld.SeriesManager = (function() {
|
||||
});
|
||||
}
|
||||
|
||||
const editKeyBtn = hasKeyError
|
||||
? '<button class="btn btn-icon edit-key-btn" title="Fix key error" data-key="' + serie.key + '" data-folder="' + serie.folder + '"><i class="fas fa-key"></i></button>'
|
||||
: '';
|
||||
|
||||
const editMetadataBtn = '<button class="btn btn-icon edit-metadata-btn" title="Edit Metadata IDs" data-key="' + serie.key + '" data-name="' + AniWorld.UI.escapeHtml(serie.name) + '" data-tmdb-id="' + (serie.tmdb_id || '') + '" data-tvdb-id="' + (serie.tvdb_id || '') + '"><i class="fas fa-database"></i></button>';
|
||||
|
||||
return '<div class="series-card ' + (isSelected ? 'selected' : '') + ' ' +
|
||||
(hasMissingEpisodes ? 'has-missing' : 'complete') + ' ' +
|
||||
(isLoading ? 'loading' : '') + '" ' +
|
||||
@@ -368,9 +400,12 @@ AniWorld.SeriesManager = (function() {
|
||||
'<div class="series-folder">' + AniWorld.UI.escapeHtml(serie.folder) + '</div>' +
|
||||
'</div>' +
|
||||
'<div class="series-status">' +
|
||||
(hasKeyError ? '<i class="fas fa-exclamation-triangle key-error-badge" title="Key error: ' + serie.loading_error + '"></i>' : '') +
|
||||
(hasMissingEpisodes ? '' : '<i class="fas fa-check-circle status-complete" title="Complete"></i>') +
|
||||
(hasNfo ? '<i class="fas fa-file-alt nfo-badge nfo-exists" title="NFO metadata available"></i>' :
|
||||
'<i class="fas fa-file-alt nfo-badge nfo-missing" title="No NFO metadata"></i>') +
|
||||
editMetadataBtn +
|
||||
editKeyBtn +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="series-stats">' +
|
||||
|
||||
Reference in New Issue
Block a user