Added trait function to check if the content type is supported.
This commit is contained in:
@@ -81,9 +81,8 @@ trait JellyfinActionTrait
|
||||
str_pad((string)ag($item, 'IndexNumber', 0), 3, '0', STR_PAD_LEFT),
|
||||
),
|
||||
default => throw new InvalidArgumentException(
|
||||
r("Unexpected Content type '{type}' was received. '{content}'.", [
|
||||
r("Unexpected Content type '{type}' was received.", [
|
||||
'type' => $type,
|
||||
'content' => arrayToString($item),
|
||||
])
|
||||
),
|
||||
},
|
||||
@@ -320,4 +319,16 @@ trait JellyfinActionTrait
|
||||
|
||||
return $response->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the content type is supported WatchState.
|
||||
*
|
||||
* @param string $type The type to check.
|
||||
*
|
||||
* @return bool Returns true if the type is supported.
|
||||
*/
|
||||
protected function isSupportedType(string $type): bool
|
||||
{
|
||||
return in_array(JellyfinClient::TYPE_MAPPER[$type] ?? $type, iState::TYPES_LIST, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,4 +350,16 @@ trait PlexActionTrait
|
||||
|
||||
return $response->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the content type is supported WatchState.
|
||||
*
|
||||
* @param string $type The type to check.
|
||||
*
|
||||
* @return bool Returns true if the type is supported.
|
||||
*/
|
||||
protected function isSupportedType(string $type): bool
|
||||
{
|
||||
return in_array(PlexClient::TYPE_MAPPER[$type] ?? $type, iState::TYPES_LIST, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user