Second attempt at fixing #68

This commit is contained in:
Abdulmhsen B. A. A
2022-04-22 23:47:40 +03:00
parent 95bb634e59
commit 701b1364d9
2 changed files with 50 additions and 10 deletions

View File

@@ -18,6 +18,8 @@ use DateTimeInterface;
use JsonException;
use JsonMachine\Exception\PathNotFoundException;
use JsonMachine\Items;
use JsonMachine\JsonDecoder\DecodingError;
use JsonMachine\JsonDecoder\ErrorWrappingDecoder;
use JsonMachine\JsonDecoder\ExtJsonDecoder;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UriInterface;
@@ -616,13 +618,19 @@ class JellyfinServer implements ServerInterface
'pointer' => '/Items',
],
[
new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE)
new ErrorWrappingDecoder(new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE))
]
);
$this->logger->info(sprintf('Parsing %s - %s response.', $this->name, $cName));
foreach ($it as $entity) {
if ($entity instanceof DecodingError) {
$this->logger->debug(
sprintf('Failed to decode one result of %s - %s response.', $this->name, $cName)
);
continue;
}
$this->processImport($mapper, $type, $cName, $entity, $after);
}
} catch (PathNotFoundException $e) {
@@ -886,13 +894,19 @@ class JellyfinServer implements ServerInterface
'pointer' => '/Items',
],
[
new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE)
new ErrorWrappingDecoder(new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE))
]
);
$this->logger->info(sprintf('Parsing Successful %s - %s response.', $this->name, $cName));
$this->logger->info(sprintf('Parsing %s - %s response.', $this->name, $cName));
foreach ($it as $entity) {
if ($entity instanceof DecodingError) {
$this->logger->debug(
sprintf('Failed to decode one result of %s - %s response.', $this->name, $cName)
);
continue;
}
$this->processExport($mapper, $type, $cName, $entity, $after);
}
} catch (PathNotFoundException $e) {
@@ -990,15 +1004,21 @@ class JellyfinServer implements ServerInterface
'pointer' => '/Items',
],
[
new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE)
new ErrorWrappingDecoder(new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE))
]
);
$this->logger->info(
sprintf('Processing Successful %s - %s response.', $this->name, $cName)
sprintf('Parsing %s - %s response.', $this->name, $cName)
);
foreach ($it as $entity) {
if ($entity instanceof DecodingError) {
$this->logger->debug(
sprintf('Failed to decode one result of %s - %s response.', $this->name, $cName)
);
continue;
}
$this->processForCache($type, $entity);
}
} catch (PathNotFoundException $e) {

View File

@@ -18,6 +18,8 @@ use DateTimeInterface;
use JsonException;
use JsonMachine\Exception\PathNotFoundException;
use JsonMachine\Items;
use JsonMachine\JsonDecoder\DecodingError;
use JsonMachine\JsonDecoder\ErrorWrappingDecoder;
use JsonMachine\JsonDecoder\ExtJsonDecoder;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UriInterface;
@@ -628,13 +630,19 @@ class PlexServer implements ServerInterface
'pointer' => '/MediaContainer/Metadata',
],
[
new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE)
new ErrorWrappingDecoder(new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE))
]
);
$this->logger->info(sprintf('Parsing %s - %s response.', $this->name, $cName));
foreach ($it as $entity) {
if ($entity instanceof DecodingError) {
$this->logger->debug(
sprintf('Failed to decode one result of %s - %s response.', $this->name, $cName)
);
continue;
}
$this->processImport($mapper, $type, $cName, $entity, $after);
}
} catch (PathNotFoundException $e) {
@@ -896,13 +904,19 @@ class PlexServer implements ServerInterface
'pointer' => '/MediaContainer/Metadata',
],
[
new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE)
new ErrorWrappingDecoder(new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE))
]
);
$this->logger->info(sprintf('Parsing Successful %s - %s response.', $this->name, $cName));
$this->logger->info(sprintf('Parsing %s - %s response.', $this->name, $cName));
foreach ($it as $entity) {
if ($entity instanceof DecodingError) {
$this->logger->debug(
sprintf('Failed to decode one result of %s - %s response.', $this->name, $cName)
);
continue;
}
$this->processExport($mapper, $type, $cName, $entity, $after);
}
} catch (PathNotFoundException $e) {
@@ -1000,13 +1014,19 @@ class PlexServer implements ServerInterface
'pointer' => '/MediaContainer/Metadata',
],
[
new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE)
new ErrorWrappingDecoder(new ExtJsonDecoder(options: JSON_INVALID_UTF8_IGNORE))
]
);
$this->logger->info(sprintf('Parsing Successful %s - %s response.', $this->name, $cName));
$this->logger->info(sprintf('Parsing %s - %s response.', $this->name, $cName));
foreach ($it as $entity) {
if ($entity instanceof DecodingError) {
$this->logger->debug(
sprintf('Failed to decode one result of %s - %s response.', $this->name, $cName)
);
continue;
}
$this->processForCache($type, $entity);
}
} catch (PathNotFoundException $e) {