// Most Watched Movies with Posters
if (' . $showMostWatchedMovies . ' && stats.most_watched_movies && stats.most_watched_movies.length > 0) {
console.log("Rendering most watched movies:", stats.most_watched_movies);
html += "
";
html += "
Most Watched Movies
";
html += "
";
stats.most_watched_movies.forEach(function(movie) {
console.log("Processing movie:", movie);
var posterUrl = getPosterUrl(movie.poster_path, movie.id, movie.server_id);
var playCount = movie.play_count || 0;
var year = movie.year || "N/A";
var title = movie.title || "Unknown Movie";
html += "
";
html += "
";
// Poster image container
html += "
";
if (posterUrl) {
html += "";
}
html += "
";
html += "";
html += "
";
// Play count badge
html += "
";
html += " " + playCount;
html += "
";
html += "
";
// Movie info with improved height and text clipping
html += "
";
html += "
" + title + "
";
html += "" + year + "";
html += "
";
html += "
";
});
html += "
";
} else {
console.log("Movies not showing because:");
console.log("- Setting enabled:", ' . $showMostWatchedMovies . ');
console.log("- Has data:", stats.most_watched_movies && stats.most_watched_movies.length > 0);
console.log("- Data:", stats.most_watched_movies);
}
// Most Watched TV Shows with Posters (updated to match movies)
if (' . $showMostWatchedShows . ' && stats.most_watched_shows && stats.most_watched_shows.length > 0) {
html += "
";
html += "
Most Watched TV Shows
";
html += "
";
stats.most_watched_shows.forEach(function(show) {
var posterUrl = getPosterUrl(show.poster_path, show.id, show.server_id);
var playCount = show.play_count || 0;
var year = show.year || "N/A";
var title = show.title || "Unknown Show";
html += "
";
html += "
";
// Poster image with fixed dimensions like movies
html += "
";
if (posterUrl) {
html += "";
}
html += "
";
html += "";
html += "
";
// Play count badge
html += "
";
html += " " + playCount;
html += "
";
html += "
";
// Show info matching movies format
html += "
";
html += "
" + title + "
";
html += "" + year + "";
html += "
";
html += "
";
});
html += "
";
}
// Most Listened Music with Cover Art (updated to match movies)
if (' . $showMostListenedMusic . ' && stats.most_listened_music && stats.most_listened_music.length > 0) {
html += "
";
html += "
Most Listened Music
";
html += "
";
stats.most_listened_music.forEach(function(music) {
var posterUrl = getPosterUrl(music.poster_path || music.cover_art, music.id, music.server_id);
var playCount = music.play_count || 0;
var artist = music.artist || "Unknown Artist";
var title = music.title || music.album || "Unknown";
html += "
";
html += "
";
// Cover art with fixed dimensions like movies (square for music)
html += "
";
if (posterUrl) {
html += "";
}
html += "
";
html += "";
html += "
";
// Play count badge
html += "
";
html += " " + playCount;
html += "
";
html += "
";
// Music info with proper space for title and artist
html += "