query("SHOW TABLES LIKE '$table'"); if ($stmt->rowCount() > 0) { echo "✓ Table '$table' exists\n"; } else { echo "✗ Table '$table' missing\n"; } } catch (Exception $e) { echo "✗ Error checking table '$table': " . $e->getMessage() . "\n"; } } } catch (Exception $e) { echo "Database connection error: " . $e->getMessage() . "\n"; } // Test episode data structure echo "\nTesting episode data structure...\n"; $testEpisodeData = [ 'Id' => 'test-episode-123', 'Name' => 'Test Episode 1', 'ParentIndexNumber' => 1, 'IndexNumber' => 1, 'PremiereDate' => '2023-01-01T00:00:00Z', 'RunTimeTicks' => 18000000000, // 30 minutes 'CommunityRating' => 8.5, 'Overview' => 'Test episode overview', 'ProviderIds' => [ 'Imdb' => 'tt1234567', 'Tmdb' => '123456' ], 'People' => [ [ 'Name' => 'Test Actor', 'Type' => 'Actor' ] ] ]; echo "✓ Episode has required fields:\n"; echo " - ID: " . $testEpisodeData['Id'] . "\n"; echo " - Name: " . $testEpisodeData['Name'] . "\n"; echo " - Season: " . $testEpisodeData['ParentIndexNumber'] . "\n"; echo " - Episode: " . $testEpisodeData['IndexNumber'] . "\n"; echo " - People: " . (isset($testEpisodeData['People']) ? 'Yes' : 'No') . "\n"; echo " - ProviderIds: " . (isset($testEpisodeData['ProviderIds']) ? 'Yes' : 'No') . "\n"; if (isset($testEpisodeData['People']) && is_array($testEpisodeData['People'])) { foreach ($testEpisodeData['People'] as $person) { if (isset($person['Type']) && $person['Type'] === 'Actor') { echo " - Actor found: " . $person['Name'] . "\n"; } } } echo "\n=== Debug Complete ===\n"; echo "The sync should work if:\n"; echo "1. All models exist ✓\n"; echo "2. Database tables exist ✓\n"; echo "3. Jellyfin API returns 'People' field ✓\n"; echo "4. syncTvShows() is called in executeSync() ✓\n"; } catch (Exception $e) { echo "Error: " . $e->getMessage() . "\n"; }