mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-30 19:03:25 +01:00
Fix: Improve checks for TMDb API key and genre handling in watch_item and player_api
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ if (posix_getpwuid(posix_geteuid())['name'] == 'xc_vm') {
|
||||
cli_set_process_title('XC_VM[Plex Sync]');
|
||||
$rScanOffset = (intval(CoreUtilities::$rSettings['scan_seconds']) ?: 3600);
|
||||
set_time_limit(0);
|
||||
if (strlen(CoreUtilities::$rSettings['tmdb_api_key']) != 0) {
|
||||
if (!empty(CoreUtilities::$rSettings['tmdb_api_key'])) {
|
||||
loadCron();
|
||||
} else {
|
||||
exit('No TMDb API key.');
|
||||
|
||||
@@ -368,16 +368,18 @@ function loadcli() {
|
||||
}
|
||||
$rImportArray['order'] = getNextOrder();
|
||||
$rImportArray['tmdb_language'] = $rLanguage;
|
||||
if (count($rCategoryIDs) == 0) {
|
||||
if (count($rCategoryIDs) == 0 && !empty($rMovieData['genres']) && is_array($rMovieData['genres'])) {
|
||||
if (0 < $rThreadData['max_genres']) {
|
||||
$rParsed = array_slice($rMovieData['genres'], 0, $rThreadData['max_genres']);
|
||||
$rParsed = array_slice($rMovieData['genres'], 0, (int) $rThreadData['max_genres']);
|
||||
} else {
|
||||
$rParsed = $rMovieData['genres'];
|
||||
}
|
||||
|
||||
foreach ($rParsed as $rGenre) {
|
||||
$rCategoryID = intval($rWatchCategories[1][intval($rGenre['id'])]['category_id']);
|
||||
if ($rCategoryID > 0) {
|
||||
if (!in_array($rCategoryID, $rCategoryIDs)) {
|
||||
$rGenreId = (int) ($rGenre['id'] ?? 0);
|
||||
if ($rGenreId > 0 && isset($rWatchCategories[1][$rGenreId]['category_id'])) {
|
||||
$rCategoryID = (int) $rWatchCategories[1][$rGenreId]['category_id'];
|
||||
if ($rCategoryID > 0 && !in_array($rCategoryID, $rCategoryIDs, true)) {
|
||||
$rCategoryIDs[] = $rCategoryID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,9 +175,9 @@ if ($rUserInfo) {
|
||||
}
|
||||
$rBackdrops = json_decode($rSeriesInfo['backdrop_path'], true);
|
||||
|
||||
if (count($rBackdrops) > 0) {
|
||||
foreach (range(0, count($rBackdrops) - 1) as $i) {
|
||||
$rBackdrops[$i] = StreamingUtilities::validateImage($rBackdrops[$i]);
|
||||
if (!empty($rBackdrops) && is_array($rBackdrops)) {
|
||||
foreach ($rBackdrops as $i => $rBackdrop) {
|
||||
$rBackdrops[$i] = StreamingUtilities::validateImage($rBackdrop);
|
||||
}
|
||||
}
|
||||
$rating = is_numeric($rSeriesInfo['rating']) ? floatval($rSeriesInfo['rating']) : 0.0;
|
||||
|
||||
Reference in New Issue
Block a user