diff --git a/src/Backends/Plex/PlexManage.php b/src/Backends/Plex/PlexManage.php index ba91a7c5..f8c029b3 100644 --- a/src/Backends/Plex/PlexManage.php +++ b/src/Backends/Plex/PlexManage.php @@ -149,6 +149,23 @@ class PlexManage implements ManageInterface if (true === ag_exists($map, $server)) { $backend = ag_set($backend, 'url', ag($map, $server)); $backend = ag_set($backend, 'uuid', ag($uuid, $server)); + + try { + $this->output->writeln( + r( + 'Successfully contacted the Backed. It responded with [{version}] as it\'s version.', + [ + 'version' => makeBackend(ag_set($backend, 'user', '1'))->getVersion() + ] + ) + ); + } catch (Throwable $e) { + $this->output->writeln(r('Unable to contact [{url}]. {error}', [ + 'url' => ag($backend, 'url'), + 'error' => $e->getMessage() + ])); + goto re_select; + } return; } } @@ -180,12 +197,13 @@ class PlexManage implements ManageInterface $chosen ); - $question->setValidator(function ($answer) { + $question->setValidator(function ($answer) use ($backend) { if (false === isValidURL($answer)) { throw new RuntimeException( 'Invalid URL was selected/given. Expecting something like http://plex:32400.' ); } + return $answer; }); @@ -195,6 +213,23 @@ class PlexManage implements ManageInterface goto re_select; } + try { + $this->output->writeln( + r( + 'Successfully contacted the Backed. It responded with [{version}] as it\'s version.', + [ + 'version' => makeBackend(ag_set(ag_set($backend, 'url', $url), 'user', '1'))->getVersion() + ] + ) + ); + } catch (Throwable $e) { + $this->output->writeln(r('Unable to contact {url}. {error}', [ + 'url' => $url, + 'error' => $e->getMessage() + ])); + goto re_select; + } + $backend = ag_set($backend, 'url', $url); })(); $this->output->writeln('');