Fixed bug in plex webhook push sync.
This commit is contained in:
@@ -83,7 +83,7 @@ class PushCommand extends Command
|
||||
protected function process(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
if (!$this->cache->has('queue')) {
|
||||
$output->writeln('<info>No items in the queue.</info>', OutputInterface::VERBOSITY_DEBUG);
|
||||
$output->writeln('<info>No items in the queue.</info>', OutputInterface::VERBOSITY_VERY_VERBOSE);
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class PushCommand extends Command
|
||||
|
||||
if (empty($entities)) {
|
||||
$this->cache->delete('queue');
|
||||
$output->writeln('<info>No items in the queued.</info>', OutputInterface::VERBOSITY_DEBUG);
|
||||
$output->writeln('<info>No items in the queue.</info>', OutputInterface::VERBOSITY_VERY_VERBOSE);
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class PushCommand extends Command
|
||||
$type = strtolower(ag($server, 'type', 'unknown'));
|
||||
|
||||
if (true !== (bool)ag($server, 'webhook.push')) {
|
||||
$this->logger->info(sprintf('%s: Ignoring this backend as requested by user config.', $serverName));
|
||||
$this->logger->info(sprintf('%s: Ignoring backend as requested by user config.', $serverName));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -159,8 +159,13 @@ class PushCommand extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
if (null === ag($server, 'url') || false === filter_var(ag($server, 'url'), FILTER_VALIDATE_URL)) {
|
||||
$this->logger->error(sprintf('%s: Backend does not have valid URL.', $serverName));
|
||||
if (null === ($url = ag($server, 'url')) || false === filter_var($url, FILTER_VALIDATE_URL)) {
|
||||
$this->logger->error(
|
||||
sprintf('%s: Backend does not have valid url.', $serverName),
|
||||
[
|
||||
'url' => $url ?? 'None'
|
||||
]
|
||||
);
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
@@ -169,7 +174,7 @@ class PushCommand extends Command
|
||||
}
|
||||
|
||||
if (empty($list)) {
|
||||
$output->writeln('No servers were found with \'webhook.push\' enabled.');
|
||||
$output->writeln('No Backends have push via webhook enabled.');
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -675,11 +675,11 @@ class JellyfinServer implements ServerInterface
|
||||
$requests = $stateRequests = [];
|
||||
|
||||
foreach ($entities as $key => $entity) {
|
||||
if (null === $entity) {
|
||||
if (true !== ($entity instanceof StateEntity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (false === (ag($this->options, Options::IGNORE_DATE, false))) {
|
||||
if (false === (bool)ag($this->options, Options::IGNORE_DATE, false)) {
|
||||
if (null !== $after && $after->getTimestamp() > $entity->updated) {
|
||||
continue;
|
||||
}
|
||||
@@ -687,8 +687,11 @@ class JellyfinServer implements ServerInterface
|
||||
|
||||
$iName = $entity->getName();
|
||||
|
||||
if (null === ($entity->metadata[$this->name][iFace::COLUMN_ID] ?? null)) {
|
||||
$this->logger->warning(sprintf('%s: Ignoring \'%s\'. No relation map.', $this->name, $iName));
|
||||
if (null === $entity->metadata[$this->name][iFace::COLUMN_ID] ?? null) {
|
||||
$this->logger->warning(
|
||||
sprintf('%s: Ignoring \'%s\'. No relation map.', $this->name, $iName),
|
||||
[$this->name => ag($entity->metadata, $this->name, 'no metadata found')]
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -712,11 +712,11 @@ class PlexServer implements ServerInterface
|
||||
$requests = $stateRequests = [];
|
||||
|
||||
foreach ($entities as $key => $entity) {
|
||||
if (null === $entity) {
|
||||
if (true !== ($entity instanceof StateEntity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (false === (ag($this->options, Options::IGNORE_DATE, false))) {
|
||||
if (false === (bool)ag($this->options, Options::IGNORE_DATE, false)) {
|
||||
if (null !== $after && $after->getTimestamp() > $entity->updated) {
|
||||
continue;
|
||||
}
|
||||
@@ -724,13 +724,15 @@ class PlexServer implements ServerInterface
|
||||
|
||||
$iName = $entity->getName();
|
||||
|
||||
if (null === ($entity->metdata[$this->name][iFace::COLUMN_ID] ?? null)) {
|
||||
$this->logger->warning(sprintf('%s: Ignoring \'%s\'. No relation map.', $this->name, $iName));
|
||||
if (null === $entity->metadata[$this->name][iFace::COLUMN_ID] ?? null) {
|
||||
$this->logger->warning(
|
||||
sprintf('%s: Ignoring \'%s\'. No relation map.', $this->name, $iName),
|
||||
[$this->name => ag($entity->metadata, $this->name, 'no metadata found')]
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$url = $this->url->withPath('/library/metadata/' . $entity->metdata[$this->name][iFace::COLUMN_ID])
|
||||
$url = $this->url->withPath('/library/metadata/' . $entity->metadata[$this->name][iFace::COLUMN_ID])
|
||||
->withQuery(
|
||||
http_build_query(
|
||||
[
|
||||
@@ -750,7 +752,7 @@ class PlexServer implements ServerInterface
|
||||
'user_data' => [
|
||||
'id' => $key,
|
||||
'state' => &$entity,
|
||||
'suid' => $entity->metdata[$this->name][iFace::COLUMN_ID],
|
||||
'suid' => $entity->metadata[$this->name][iFace::COLUMN_ID],
|
||||
]
|
||||
])
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user