fix: log start of manual scan and stop
Local Docker Build (Dev) / build-dev (push) Successful in 4s

This commit is contained in:
2025-10-18 14:38:38 -04:00
parent 852c45bbb5
commit c8b98f6765
4 changed files with 25 additions and 10 deletions
+1 -1
View File
@@ -1 +1 @@
2.4.3
2.4.4
+11
View File
@@ -541,6 +541,10 @@ async def manual_scan(background_tasks: BackgroundTasks, path: Optional[str] = N
raise HTTPException(status_code=400, detail="scan_type must be 'both', 'tv', or 'movies'")
async def run_scan():
from datetime import datetime
start_time = datetime.now()
print(f"🚀 MANUAL SCAN STARTED: {scan_type} scan initiated at {start_time.strftime('%Y-%m-%d %H:%M:%S')}")
paths_to_scan = []
if path:
paths_to_scan = [Path(path)]
@@ -621,6 +625,13 @@ async def manual_scan(background_tasks: BackgroundTasks, path: Optional[str] = N
print(f"INFO: Completed movie scan: {movie_count} movies processed in {scan_path}")
# Log scan completion with duration
end_time = datetime.now()
duration = end_time - start_time
duration_str = str(duration).split('.')[0] # Remove microseconds
print(f"✅ MANUAL SCAN COMPLETED: {scan_type} scan finished at {end_time.strftime('%Y-%m-%d %H:%M:%S')}")
print(f"⏱️ MANUAL SCAN DURATION: {duration_str} (total time: {duration.total_seconds():.1f} seconds)")
background_tasks.add_task(run_scan)
return {"status": "started", "message": f"Manual {scan_type} scan started"}
+8 -4
View File
@@ -427,6 +427,8 @@ async def get_missing_dates_report(dependencies: dict):
movie['title'] = Path(movie['path']).name if movie['path'] else movie['imdb_id']
except:
movie['title'] = movie['imdb_id']
# Map source to user-friendly description
movie['source_description'] = map_source_to_description(movie.get('source'))
movies_missing.append(movie)
# Episodes without dates - PostgreSQL compatible
@@ -453,6 +455,8 @@ async def get_missing_dates_report(dependencies: dict):
episode['series_title'] = Path(episode['path']).name if episode['path'] else episode['imdb_id']
except:
episode['series_title'] = episode['imdb_id']
# Map source to user-friendly description
episode['source_description'] = map_source_to_description(episode.get('source'))
episodes_missing.append(episode)
# Summary statistics - PostgreSQL compatible
@@ -556,9 +560,9 @@ async def get_dashboard_stats(dependencies: dict):
ORDER BY count DESC
""")
if db.db_type == "postgresql":
movie_sources = [{"source": list(row.values())[0], "count": list(row.values())[1]} for row in cursor.fetchall()]
movie_sources = [{"source": list(row.values())[0], "source_description": map_source_to_description(list(row.values())[0]), "count": list(row.values())[1]} for row in cursor.fetchall()]
else:
movie_sources = [{"source": row[0], "count": row[1]} for row in cursor.fetchall()]
movie_sources = [{"source": row[0], "source_description": map_source_to_description(row[0]), "count": row[1]} for row in cursor.fetchall()]
# Source distribution for episodes
cursor.execute("""
@@ -569,9 +573,9 @@ async def get_dashboard_stats(dependencies: dict):
ORDER BY count DESC
""")
if db.db_type == "postgresql":
episode_sources = [{"source": list(row.values())[0], "count": list(row.values())[1]} for row in cursor.fetchall()]
episode_sources = [{"source": list(row.values())[0], "source_description": map_source_to_description(list(row.values())[0]), "count": list(row.values())[1]} for row in cursor.fetchall()]
else:
episode_sources = [{"source": row[0], "count": row[1]} for row in cursor.fetchall()]
episode_sources = [{"source": row[0], "source_description": map_source_to_description(row[0]), "count": row[1]} for row in cursor.fetchall()]
# Calculate total missing dates (movies + episodes)
total_missing_dates = movies_without_dates + episodes_without_dates
+5 -5
View File
@@ -253,7 +253,7 @@ function updateMoviesTable(data) {
<td><code>${movie.imdb_id}</code></td>
<td>${movie.released || '-'}</td>
<td>${dateadded || '-'}</td>
<td><span class="badge badge-secondary">${movie.source || 'Unknown'}</span></td>
<td><span class="badge badge-secondary">${movie.source_description || movie.source || 'Unknown'}</span></td>
<td><span class="badge ${dateTypeBadge}">${dateType}</span></td>
<td>${hasVideoBadge}</td>
<td>
@@ -495,7 +495,7 @@ function showEpisodesModal(data) {
<td>S${episode.season.toString().padStart(2, '0')}E${episode.episode.toString().padStart(2, '0')}</td>
<td>${episode.aired || '-'}</td>
${dateCell}
<td><span class="badge badge-secondary">${episode.source || 'Unknown'}</span></td>
<td><span class="badge badge-secondary">${episode.source_description || episode.source || 'Unknown'}</span></td>
<td>${hasVideoBadge}</td>
<td>
<button class="btn btn-sm btn-primary" onclick="editEpisode('${data.series.imdb_id}', ${episode.season}, ${episode.episode}, '${dateadded}', '${episode.source || ''}')">
@@ -576,7 +576,7 @@ function updateReportTables(data) {
<td>${escapeHtml(movie.title)}</td>
<td><code>${movie.imdb_id}</code></td>
<td>${movie.released || '-'}</td>
<td><span class="badge badge-warning">${movie.source || 'Unknown'}</span></td>
<td><span class="badge badge-warning">${movie.source_description || movie.source || 'Unknown'}</span></td>
<td>
<button class="btn btn-sm btn-success" onclick="smartFixMovie('${movie.imdb_id}')">
<i class="fas fa-magic"></i> Smart Fix
@@ -597,7 +597,7 @@ function updateReportTables(data) {
<td>S${episode.season.toString().padStart(2, '0')}E${episode.episode.toString().padStart(2, '0')}</td>
<td><code>${episode.imdb_id}</code></td>
<td>${episode.aired || '-'}</td>
<td><span class="badge badge-warning">${episode.source || 'Unknown'}</span></td>
<td><span class="badge badge-warning">${episode.source_description || episode.source || 'Unknown'}</span></td>
<td>
<button class="btn btn-sm btn-success" onclick="smartFixEpisode('${episode.imdb_id}', ${episode.season}, ${episode.episode})">
<i class="fas fa-magic"></i> Smart Fix
@@ -1221,7 +1221,7 @@ Raw Database Data:
Analysis:
- Movie Released: ${data.raw_data.released || 'Not set'}
- Library Import Date: ${data.raw_data.dateadded || 'Not set'}
- Date Source: ${data.raw_data.source || 'Unknown'}
- Date Source: ${data.raw_data.source_description || data.raw_data.source || 'Unknown'}
`;
alert(debugInfo);