This commit is contained in:
@@ -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'")
|
raise HTTPException(status_code=400, detail="scan_type must be 'both', 'tv', or 'movies'")
|
||||||
|
|
||||||
async def run_scan():
|
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 = []
|
paths_to_scan = []
|
||||||
if path:
|
if path:
|
||||||
paths_to_scan = [Path(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}")
|
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)
|
background_tasks.add_task(run_scan)
|
||||||
return {"status": "started", "message": f"Manual {scan_type} scan started"}
|
return {"status": "started", "message": f"Manual {scan_type} scan started"}
|
||||||
|
|
||||||
|
|||||||
+8
-4
@@ -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']
|
movie['title'] = Path(movie['path']).name if movie['path'] else movie['imdb_id']
|
||||||
except:
|
except:
|
||||||
movie['title'] = movie['imdb_id']
|
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)
|
movies_missing.append(movie)
|
||||||
|
|
||||||
# Episodes without dates - PostgreSQL compatible
|
# 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']
|
episode['series_title'] = Path(episode['path']).name if episode['path'] else episode['imdb_id']
|
||||||
except:
|
except:
|
||||||
episode['series_title'] = episode['imdb_id']
|
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)
|
episodes_missing.append(episode)
|
||||||
|
|
||||||
# Summary statistics - PostgreSQL compatible
|
# Summary statistics - PostgreSQL compatible
|
||||||
@@ -556,9 +560,9 @@ async def get_dashboard_stats(dependencies: dict):
|
|||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
""")
|
""")
|
||||||
if db.db_type == "postgresql":
|
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:
|
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
|
# Source distribution for episodes
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
@@ -569,9 +573,9 @@ async def get_dashboard_stats(dependencies: dict):
|
|||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
""")
|
""")
|
||||||
if db.db_type == "postgresql":
|
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:
|
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)
|
# Calculate total missing dates (movies + episodes)
|
||||||
total_missing_dates = movies_without_dates + episodes_without_dates
|
total_missing_dates = movies_without_dates + episodes_without_dates
|
||||||
|
|||||||
+5
-5
@@ -253,7 +253,7 @@ function updateMoviesTable(data) {
|
|||||||
<td><code>${movie.imdb_id}</code></td>
|
<td><code>${movie.imdb_id}</code></td>
|
||||||
<td>${movie.released || '-'}</td>
|
<td>${movie.released || '-'}</td>
|
||||||
<td>${dateadded || '-'}</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><span class="badge ${dateTypeBadge}">${dateType}</span></td>
|
||||||
<td>${hasVideoBadge}</td>
|
<td>${hasVideoBadge}</td>
|
||||||
<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>S${episode.season.toString().padStart(2, '0')}E${episode.episode.toString().padStart(2, '0')}</td>
|
||||||
<td>${episode.aired || '-'}</td>
|
<td>${episode.aired || '-'}</td>
|
||||||
${dateCell}
|
${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>${hasVideoBadge}</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-sm btn-primary" onclick="editEpisode('${data.series.imdb_id}', ${episode.season}, ${episode.episode}, '${dateadded}', '${episode.source || ''}')">
|
<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>${escapeHtml(movie.title)}</td>
|
||||||
<td><code>${movie.imdb_id}</code></td>
|
<td><code>${movie.imdb_id}</code></td>
|
||||||
<td>${movie.released || '-'}</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>
|
<td>
|
||||||
<button class="btn btn-sm btn-success" onclick="smartFixMovie('${movie.imdb_id}')">
|
<button class="btn btn-sm btn-success" onclick="smartFixMovie('${movie.imdb_id}')">
|
||||||
<i class="fas fa-magic"></i> Smart Fix
|
<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>S${episode.season.toString().padStart(2, '0')}E${episode.episode.toString().padStart(2, '0')}</td>
|
||||||
<td><code>${episode.imdb_id}</code></td>
|
<td><code>${episode.imdb_id}</code></td>
|
||||||
<td>${episode.aired || '-'}</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>
|
<td>
|
||||||
<button class="btn btn-sm btn-success" onclick="smartFixEpisode('${episode.imdb_id}', ${episode.season}, ${episode.episode})">
|
<button class="btn btn-sm btn-success" onclick="smartFixEpisode('${episode.imdb_id}', ${episode.season}, ${episode.episode})">
|
||||||
<i class="fas fa-magic"></i> Smart Fix
|
<i class="fas fa-magic"></i> Smart Fix
|
||||||
@@ -1221,7 +1221,7 @@ Raw Database Data:
|
|||||||
Analysis:
|
Analysis:
|
||||||
- Movie Released: ${data.raw_data.released || 'Not set'}
|
- Movie Released: ${data.raw_data.released || 'Not set'}
|
||||||
- Library Import Date: ${data.raw_data.dateadded || '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);
|
alert(debugInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user