mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
...
This commit is contained in:
45
test_jellyfin_execution.php
Normal file
45
test_jellyfin_execution.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
// Test Jellyfin sync execution
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
try {
|
||||
echo "=== Testing Jellyfin Sync Execution ===\n";
|
||||
|
||||
// Load database config
|
||||
$config = require __DIR__ . '/config/database.php';
|
||||
\App\Database\Database::setConfig($config);
|
||||
|
||||
// Create a mock source for testing
|
||||
$testSource = [
|
||||
'id' => 1,
|
||||
'name' => 'jellyfin',
|
||||
'api_url' => 'http://192.168.1.102:8096', // Adjust this to your Jellyfin URL
|
||||
'api_key' => '1db2d28854e541dd90c32ea6aab5e603' // Adjust this to your API key
|
||||
];
|
||||
|
||||
echo "Testing with source: " . $testSource['name'] . "\n";
|
||||
echo "API URL: " . $testSource['api_url'] . "\n";
|
||||
|
||||
// Create Jellyfin service instance
|
||||
$pdo = \App\Database\Database::getInstance();
|
||||
$jellyfinService = new \App\Services\JellyfinSyncService($pdo, $testSource);
|
||||
|
||||
// Test basic sync execution
|
||||
echo "\nTesting basic sync execution...\n";
|
||||
try {
|
||||
// This will trigger the executeSync method which calls all the private methods
|
||||
echo "Attempting to run sync (this may fail if Jellyfin server is not accessible)...\n";
|
||||
$jellyfinService->startSync('full');
|
||||
echo "✓ Sync completed successfully\n";
|
||||
} catch (Exception $e) {
|
||||
echo "✗ Sync failed (expected if Jellyfin server not accessible): " . $e->getMessage() . "\n";
|
||||
echo "This is normal if your Jellyfin server is not running or credentials are incorrect.\n";
|
||||
}
|
||||
|
||||
echo "\n=== Test Complete ===\n";
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "Error: " . $e->getMessage() . "\n";
|
||||
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user