mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
...
This commit is contained in:
90
debug_jellyfin_sync.php
Normal file
90
debug_jellyfin_sync.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
// Debug script to check Jellyfin sync issues
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
try {
|
||||
echo "=== Jellyfin Sync Debug ===\n";
|
||||
|
||||
// Check if TvEpisode model exists and works
|
||||
echo "Checking TvEpisode model...\n";
|
||||
if (class_exists('App\Models\TvEpisode')) {
|
||||
echo "✓ TvEpisode model exists\n";
|
||||
} else {
|
||||
echo "✗ TvEpisode model missing\n";
|
||||
}
|
||||
|
||||
// Check if database tables exist
|
||||
echo "\nChecking database tables...\n";
|
||||
$config = require __DIR__ . '/config/database.php';
|
||||
\App\Database\Database::setConfig($config);
|
||||
|
||||
try {
|
||||
$pdo = \App\Database\Database::getInstance();
|
||||
|
||||
$tables = ['tv_episodes', 'tv_shows', 'actors', 'actor_tv_episode', 'actor_tv_show', 'actor_movie'];
|
||||
foreach ($tables as $table) {
|
||||
try {
|
||||
$stmt = $pdo->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";
|
||||
}
|
||||
Reference in New Issue
Block a user