nfo: improvments
Local Docker Build (Dev) / build-dev (push) Successful in 5s

This commit is contained in:
2025-10-26 15:54:01 -04:00
parent 9072c86779
commit 6673ef8465
4 changed files with 121 additions and 12 deletions
+30 -4
View File
@@ -2725,17 +2725,43 @@ def register_routes(app, dependencies: dict):
print(f" Episodes: {episodes_with_dates}/{total_episodes} found in DB, {episodes_missing_db} missing from DB") print(f" Episodes: {episodes_with_dates}/{total_episodes} found in DB, {episodes_missing_db} missing from DB")
print(f" Movies: {movies_with_dates}/{total_movies} found in DB, {movies_missing_db} missing from DB") print(f" Movies: {movies_with_dates}/{total_movies} found in DB, {movies_missing_db} missing from DB")
total_missing = len(missing_items["episodes"]) + len(missing_items["movies"]) # Calculate comprehensive statistics
print(f"✅ NFO repair scan complete: {total_missing} items missing dateadded elements") total_nfo_files_missing = len(missing_tv_nfo_files) + len(missing_movie_nfo_files)
total_with_imdb_and_db = len(missing_items["episodes"]) + len(missing_items["movies"])
print(f"✅ NFO repair scan complete:")
print(f" 📄 {total_nfo_files_missing} NFO files missing dateadded elements")
print(f" 🎬 {len(missing_tv_nfo_files)} TV episodes, {len(missing_movie_nfo_files)} movies")
print(f" 🔍 {total_with_imdb_and_db} items with IMDb IDs found in database (can be fixed)")
return { return {
"status": "success", "status": "success",
"total_missing": total_missing, "total_missing": total_with_imdb_and_db, # Items that can be fixed
"total_nfo_files_missing": total_nfo_files_missing, # All NFO files missing dateadded
"episodes_missing": len(missing_items["episodes"]), "episodes_missing": len(missing_items["episodes"]),
"movies_missing": len(missing_items["movies"]), "movies_missing": len(missing_items["movies"]),
"tv_nfo_files_missing": len(missing_tv_nfo_files),
"movie_nfo_files_missing": len(missing_movie_nfo_files),
"total_tv_files_checked": total_tv_files_checked, "total_tv_files_checked": total_tv_files_checked,
"total_movie_files_checked": total_movie_files_checked, "total_movie_files_checked": total_movie_files_checked,
"missing_items": missing_items "missing_items": missing_items,
"statistics": {
"nfo_files_scanned": {
"tv": total_tv_files_checked,
"movies": total_movie_files_checked,
"total": total_tv_files_checked + total_movie_files_checked
},
"nfo_files_missing_dateadded": {
"tv": len(missing_tv_nfo_files),
"movies": len(missing_movie_nfo_files),
"total": total_nfo_files_missing
},
"items_with_imdb_and_database": {
"tv": len(missing_items["episodes"]),
"movies": len(missing_items["movies"]),
"total": total_with_imdb_and_db
}
}
} }
except Exception as e: except Exception as e:
+6 -2
View File
@@ -1597,14 +1597,18 @@ async def get_episodes_missing_nfo_dateadded(dependencies: dict):
"total_episodes_checked": result.get('total_tv_files_checked', 0), "total_episodes_checked": result.get('total_tv_files_checked', 0),
"total_movies_checked": result.get('total_movie_files_checked', 0), "total_movies_checked": result.get('total_movie_files_checked', 0),
"total_items_checked": result.get('total_tv_files_checked', 0) + result.get('total_movie_files_checked', 0), "total_items_checked": result.get('total_tv_files_checked', 0) + result.get('total_movie_files_checked', 0),
"missing_dateadded_count": result['total_missing'], "missing_dateadded_count": result['total_missing'], # Items that can be fixed
"total_nfo_files_missing": result.get('total_nfo_files_missing', result['total_missing']), # All NFO files missing dateadded
"tv_nfo_files_missing": result.get('tv_nfo_files_missing', 0),
"movie_nfo_files_missing": result.get('movie_nfo_files_missing', 0),
"items": all_missing[:50], # Limit display to first 50 "items": all_missing[:50], # Limit display to first 50
"debug_info": { "debug_info": {
"scan_method": "core_container_filesystem", "scan_method": "core_container_filesystem",
"core_container_response": "success", "core_container_response": "success",
"episodes_missing": result['episodes_missing'], "episodes_missing": result['episodes_missing'],
"movies_missing": result['movies_missing'], "movies_missing": result['movies_missing'],
"core_response_keys": list(result.keys()) "core_response_keys": list(result.keys()),
"statistics": result.get('statistics', {})
} }
} }
else: else:
+57
View File
@@ -1249,6 +1249,63 @@ textarea {
min-width: auto; min-width: auto;
} }
/* NFO Statistics Styling */
.nfo-stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin: 1rem 0;
}
.stat-box {
background-color: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 1rem;
text-align: center;
}
.stat-number {
font-size: 2rem;
font-weight: 700;
color: var(--primary-color);
margin-bottom: 0.5rem;
}
.stat-label {
font-size: 0.875rem;
color: var(--text-secondary);
font-weight: 500;
}
.recommendation-box {
background-color: #fff3cd;
border: 1px solid #ffeaa7;
border-radius: 8px;
padding: 1rem;
margin: 1rem 0;
}
.recommendation-box ul {
margin: 0.5rem 0 0 1rem;
padding: 0;
}
.recommendation-box li {
margin-bottom: 0.5rem;
}
.success-box {
background-color: #d4edda;
border: 1px solid #c3e6cb;
color: #155724;
border-radius: 8px;
padding: 1rem;
margin: 1rem 0;
text-align: center;
font-weight: 600;
}
/* Responsive adjustments for admin tools */ /* Responsive adjustments for admin tools */
@media (max-width: 768px) { @media (max-width: 768px) {
.table-container { .table-container {
+28 -6
View File
@@ -2013,13 +2013,35 @@ async function showEpisodesMissingNFODateadded() {
const response = await apiCall('/api/admin/nfo/missing-dateadded'); const response = await apiCall('/api/admin/nfo/missing-dateadded');
if (response.success) { if (response.success) {
const totalFiles = response.total_nfo_files_missing || response.missing_dateadded_count;
const fixableItems = response.missing_dateadded_count;
const tvFiles = response.tv_nfo_files_missing || 0;
const movieFiles = response.movie_nfo_files_missing || 0;
const html = ` const html = `
<h4>Episodes Missing NFO dateadded</h4> <h4>NFO Files Missing dateadded Elements</h4>
<p><strong>Found:</strong> ${response.missing_dateadded_count} episodes missing dateadded in NFO files</p> <div class="nfo-stats-grid">
<p><strong>Total checked:</strong> ${response.total_episodes_checked} episodes</p> <div class="stat-box">
${response.missing_dateadded_count > 0 ? <div class="stat-number">${totalFiles}</div>
'<p><strong>Recommendation:</strong> Use the "NFO File Repair" tool to fix these issues.</p>' : <div class="stat-label">Total NFO Files Missing dateadded</div>
'<p>✅ All NFO files are properly maintained!</p>' </div>
<div class="stat-box">
<div class="stat-number">${fixableItems}</div>
<div class="stat-label">Can Be Fixed Automatically</div>
</div>
</div>
<p><strong>Breakdown:</strong> ${tvFiles} TV episodes, ${movieFiles} movies</p>
<p><strong>Scanned:</strong> ${response.total_episodes_checked} TV NFO files, ${response.total_movies_checked} movie NFO files</p>
${totalFiles > 0 ? `
<div class="recommendation-box">
<p><strong>📋 Action Required:</strong></p>
<ul>
<li><strong>${fixableItems} items</strong> have IMDb IDs and database entries - use "NFO File Repair" tool to fix</li>
${totalFiles > fixableItems ? `<li><strong>${totalFiles - fixableItems} items</strong> need IMDb IDs first - check "Items Missing IMDb IDs" tool</li>` : ''}
</ul>
</div>
` :
'<div class="success-box">✅ All NFO files are properly maintained!</div>'
} }
`; `;
resultsContent.innerHTML = html; resultsContent.innerHTML = html;