Jelajahi Sumber

Add debugging for TV show ID fields in JellyStat data

- Log all available ID fields for TV shows to understand data structure
- Debug which ID is being selected for poster generation
- Will help identify correct field to use for series posters vs collection posters
mgomon 11 bulan lalu
induk
melakukan
e3a28801e5
1 mengubah file dengan 13 tambahan dan 0 penghapusan
  1. 13 0
      api/homepage/jellystat.php

+ 13 - 0
api/homepage/jellystat.php

@@ -1046,6 +1046,17 @@ trait JellyStatHomepageItem
                         // For movies, use the NowPlayingItemId
                         $actualItemId = $result['NowPlayingItemId'] ?? null;
                     } elseif ($contentType === 'show') {
+                        // Debug: Log available ID fields for TV shows
+                        $this->writeLog('debug', 'JellyStat TV Show Debug - Available fields for "' . $title . '":', [
+                            'SeriesId' => $result['SeriesId'] ?? 'null',
+                            'ShowId' => $result['ShowId'] ?? 'null', 
+                            'ParentId' => $result['ParentId'] ?? 'null',
+                            'NowPlayingItemId' => $result['NowPlayingItemId'] ?? 'null',
+                            'SeasonId' => $result['SeasonId'] ?? 'null',
+                            'SeriesName' => $result['SeriesName'] ?? 'null',
+                            'EpisodeName' => $result['EpisodeName'] ?? 'null'
+                        ]);
+                        
                         // For TV shows, try different ID fields to get the proper series ID
                         // SeriesId is most specific, then try other fields
                         $actualItemId = $result['SeriesId'] ?? $result['ShowId'] ?? $result['ParentId'] ?? $result['NowPlayingItemId'] ?? null;
@@ -1055,6 +1066,8 @@ trait JellyStatHomepageItem
                         if ($actualItemId === $result['NowPlayingItemId'] && !empty($result['ParentId']) && $result['ParentId'] !== $result['NowPlayingItemId']) {
                             $actualItemId = $result['ParentId'];
                         }
+                        
+                        $this->writeLog('debug', 'JellyStat TV Show Debug - Selected ID for "' . $title . '": ' . ($actualItemId ?? 'null'));
                     } elseif ($contentType === 'music') {
                         // For music, use NowPlayingItemId (album/track)
                         $actualItemId = $result['NowPlayingItemId'] ?? null;