renamed backends: namespace into config:
This commit is contained in:
16
FAQ.md
16
FAQ.md
@@ -123,7 +123,7 @@ can run the same command with `[-h, --help]` to see more options to extend the l
|
||||
Run the following command:
|
||||
|
||||
```bash
|
||||
$ docker exec -ti watchstate console backends:edit --key options.ignore --set 'id1,id2,id3' -- [BACKEND_NAME]
|
||||
$ docker exec -ti watchstate console config:edit --key options.ignore --set 'id1,id2,id3' -- [BACKEND_NAME]
|
||||
```
|
||||
|
||||
where `id1,id2,id3` refers to backend library id
|
||||
@@ -132,7 +132,7 @@ If you ignored a library by mistake you can run the same command again and omit
|
||||
entirely by running the following command
|
||||
|
||||
```bash
|
||||
$ docker exec -ti watchstate console backends:edit --delete --key options.ignore -- [BACKEND_NAME]
|
||||
$ docker exec -ti watchstate console config:edit --delete --key options.ignore -- [BACKEND_NAME]
|
||||
```
|
||||
|
||||
##### Note
|
||||
@@ -161,7 +161,7 @@ after that you can do `./ws command` for example, `./ws db:list`
|
||||
Sometimes there are problems related to HTTP/2, so before reporting bug please try running the following command:
|
||||
|
||||
```bash
|
||||
$ docker exec -ti watchstate console backends:edit --key options.client.http_version --set 1.0 -- [BACKEND_NAME]
|
||||
$ docker exec -ti watchstate console config:edit --key options.client.http_version --set 1.0 -- [BACKEND_NAME]
|
||||
```
|
||||
|
||||
This will force set the internal http client to use http v1 if it does not fix your problem, please open bug report
|
||||
@@ -174,7 +174,7 @@ about it.
|
||||
If you want to increase the timeout for specific backend you can run the following command:
|
||||
|
||||
```bash
|
||||
$ docker exec -ti watchstate console backends:edit --key options.client.timeout --set 600 -- [BACKEND_NAME]
|
||||
$ docker exec -ti watchstate console config:edit --key options.client.timeout --set 600 -- [BACKEND_NAME]
|
||||
```
|
||||
|
||||
where `600` is the number of secs before the timeout handler kill the request.
|
||||
@@ -361,13 +361,13 @@ X-apikey: [WEBHOOK_TOKEN]
|
||||
where `[WEBHOOK_TOKEN]` Should match the backend specific `webhook.token` value. to see the token for each backend run
|
||||
|
||||
```bash
|
||||
$ docker exec -ti watchstate console backends:view --select-backends [BACKEND_NAME] -- webhook.token
|
||||
$ docker exec -ti watchstate console config:view --select-backends [BACKEND_NAME] -- webhook.token
|
||||
```
|
||||
|
||||
If you see 'Not configured, or invalid key.' or empty value. run the following command
|
||||
|
||||
```bash
|
||||
$ docker exec -ti watchstate console backends:edit --regenerate-webhook-token -- [BACKEND_NAME]
|
||||
$ docker exec -ti watchstate console config:edit --regenerate-webhook-token -- [BACKEND_NAME]
|
||||
```
|
||||
|
||||
#### Emby (you need "Emby Premiere" to use webhooks).
|
||||
@@ -403,7 +403,7 @@ If you have multiple plex backends and use the same PlexPass account for all of
|
||||
running the following command:
|
||||
|
||||
```bash
|
||||
$ docker exec -ti watchstate console backends:unify plex
|
||||
$ docker exec -ti watchstate console config:unify plex
|
||||
Plex global webhook API key is: [random_string]
|
||||
```
|
||||
|
||||
@@ -412,7 +412,7 @@ identify the backends, The unify command will do the necessary adjustments to ha
|
||||
information run.
|
||||
|
||||
```bash
|
||||
$ docker exec -ti watchstate console help backends:unify
|
||||
$ docker exec -ti watchstate console help config:unify
|
||||
```
|
||||
|
||||
#### Jellyfin (Free)
|
||||
|
||||
@@ -16,7 +16,7 @@ services:
|
||||
image: ghcr.io/arabcoders/watchstate:latest
|
||||
container_name: watchstate
|
||||
restart: unless-stopped
|
||||
# For information about supported environment variables head to FAQ.md page.
|
||||
# For information about supported environment variables visit FAQ page.
|
||||
# works for both global and container specific environment variables.
|
||||
environment:
|
||||
- WS_UID=${UID:-1000} # Set container user id.
|
||||
@@ -38,7 +38,7 @@ $ docker-compose pull && docker-compose up -d
|
||||
after starting the container for the first time you need to add your backends, and to do so run the following command:
|
||||
|
||||
```bash
|
||||
$ docker exec -ti watchstate console backends:manage --add -- [BACKEND_NAME]
|
||||
$ docker exec -ti watchstate console config:add [BACKEND_NAME]
|
||||
```
|
||||
|
||||
This command is interactive and will ask you for some questions to add your backend, if you want to edit the backend
|
||||
|
||||
@@ -39,9 +39,6 @@ if [ 0 = "${WS_DISABLE_CHOWN}" ]; then
|
||||
chown -R www-data:www-data /app /config /var/lib/nginx/ /etc/redis.conf
|
||||
fi
|
||||
|
||||
/usr/bin/console config:php >"${PHP_INI_DIR}/conf.d/zz-app-custom-ini-settings.ini"
|
||||
/usr/bin/console config:php --fpm >"${PHP_INI_DIR}/../php-fpm.d/zzz-app-pool-settings.conf"
|
||||
|
||||
if [ 0 = "${WS_DISABLE_HTTP}" ]; then
|
||||
TIME_DATE=$(date +"%Y-%m-%dT%H:%M:%S%z")
|
||||
echo "[${TIME_DATE}] Starting HTTP Server."
|
||||
@@ -79,6 +76,9 @@ echo "[${TIME_DATE}] Ensuring State table has correct indexes."
|
||||
TIME_DATE=$(date +"%Y-%m-%dT%H:%M:%S%z")
|
||||
echo "[${TIME_DATE}] Running - $(/usr/bin/console --version)"
|
||||
|
||||
/usr/bin/console system:php >"${PHP_INI_DIR}/conf.d/zz-app-custom-ini-settings.ini"
|
||||
/usr/bin/console system:php --fpm >"${PHP_INI_DIR}/../php-fpm.d/zzz-app-pool-settings.conf"
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
if [ "${1#-}" != "$1" ]; then
|
||||
set -- php-fpm "$@"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Commands\Backends;
|
||||
namespace App\Commands\Backend;
|
||||
|
||||
use App\Command;
|
||||
use App\Libs\Config;
|
||||
@@ -26,7 +26,7 @@ use Throwable;
|
||||
#[Routable(command: self::ROUTE)]
|
||||
class RestoreCommand extends Command
|
||||
{
|
||||
public const ROUTE = 'backends:restore';
|
||||
public const ROUTE = 'backend:restore';
|
||||
|
||||
public const TASK_NAME = 'export';
|
||||
|
||||
45
src/Commands/Config/AddCommand.php
Normal file
45
src/Commands/Config/AddCommand.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Commands\Config;
|
||||
|
||||
use App\Command;
|
||||
use App\Libs\Routable;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
#[Routable(command: self::ROUTE)]
|
||||
final class AddCommand extends Command
|
||||
{
|
||||
public const ROUTE = 'config:add';
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setName(self::ROUTE)
|
||||
->setDescription('Add new backend.')
|
||||
->addOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use Alternative config file.')
|
||||
->addArgument('backend', InputArgument::REQUIRED, 'Backend name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function runCommand(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$opts = [
|
||||
'--add' => true,
|
||||
];
|
||||
|
||||
if ($input->getOption('config')) {
|
||||
$opts['--config'] = $input->getOption('config');
|
||||
}
|
||||
|
||||
$opts['backend'] = $input->getArgument('backend');
|
||||
|
||||
return $this->getApplication()?->find(ManageCommand::ROUTE)->run(new ArrayInput($opts), $output);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Commands\Backends;
|
||||
namespace App\Commands\Config;
|
||||
|
||||
use App\Command;
|
||||
use App\Libs\Config;
|
||||
@@ -19,7 +19,7 @@ use Throwable;
|
||||
#[Routable(command: self::ROUTE), Routable(command: 'servers:edit')]
|
||||
final class EditCommand extends Command
|
||||
{
|
||||
public const ROUTE = 'backends:edit';
|
||||
public const ROUTE = 'config:edit';
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Commands\Backends;
|
||||
namespace App\Commands\Config;
|
||||
|
||||
use App\Command;
|
||||
use App\Libs\Config;
|
||||
@@ -19,7 +19,7 @@ use Symfony\Component\Yaml\Yaml;
|
||||
#[Routable(command: self::ROUTE), Routable(command: 'servers:list')]
|
||||
final class ListCommand extends Command
|
||||
{
|
||||
public const ROUTE = 'backends:list';
|
||||
public const ROUTE = 'config:list';
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Commands\Backends;
|
||||
namespace App\Commands\Config;
|
||||
|
||||
use App\Command;
|
||||
use App\Commands\State\ImportCommand;
|
||||
use App\Commands\System\IndexCommand;
|
||||
use App\Libs\Config;
|
||||
use App\Libs\Options;
|
||||
@@ -24,12 +25,12 @@ use Throwable;
|
||||
#[Routable(command: self::ROUTE), Routable(command: 'servers:manage')]
|
||||
final class ManageCommand extends Command
|
||||
{
|
||||
public const ROUTE = 'backends:manage';
|
||||
public const ROUTE = 'config:manage';
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setName(self::ROUTE)
|
||||
->setDescription('Add/Edit backend settings.')
|
||||
->setDescription('Manage backend settings.')
|
||||
->addOption('add', 'a', InputOption::VALUE_NONE, 'Add Backend.')
|
||||
->addOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use Alternative config file.')
|
||||
->addArgument('backend', InputArgument::REQUIRED, 'Backend name.')
|
||||
@@ -53,7 +54,7 @@ final class ManageCommand extends Command
|
||||
'<comment>If you are running this tool inside docker, you have to enable interaction using "-ti" flag</comment>'
|
||||
);
|
||||
$output->writeln(
|
||||
'<comment>For example: docker exec -ti watchstate console backends:manage my_home_server</comment>'
|
||||
'<comment>For example: docker exec -ti watchstate console config:manage my_server</comment>'
|
||||
);
|
||||
return self::FAILURE;
|
||||
}
|
||||
@@ -514,25 +515,60 @@ final class ManageCommand extends Command
|
||||
|
||||
$output->writeln('<info>Config updated.</info>');
|
||||
|
||||
if ($input->getOption('add')) {
|
||||
if (false === $custom && $input->getOption('add')) {
|
||||
$helper = $this->getHelper('question');
|
||||
$text =
|
||||
<<<TEXT
|
||||
|
||||
Create Database indexes now? <comment>[Y|N] [Default: Yes]</comment>
|
||||
-----------------
|
||||
<info>
|
||||
This is necessary action to ensure speedy operations on database,
|
||||
<info>This is necessary action to ensure speedy operations on database,
|
||||
If not run now, you have to manually run the system:index command, or restart the container
|
||||
which will trigger index check to make sure your database data is fully indexed.
|
||||
</info>
|
||||
-----------------
|
||||
which will trigger index check to make sure your database data is fully indexed.</info>
|
||||
<comment>P.S: this could take few minutes to execute depending on your disk speed.</comment>
|
||||
-----------------
|
||||
|
||||
TEXT;
|
||||
|
||||
$question = new ConfirmationQuestion($text . PHP_EOL . '> ', true);
|
||||
|
||||
if (true === $helper->ask($input, $output, $question)) {
|
||||
return $this->getApplication()?->find(IndexCommand::ROUTE)->run(new ArrayInput([]), $output);
|
||||
$this->getApplication()?->find(IndexCommand::ROUTE)->run(new ArrayInput([]), $output);
|
||||
}
|
||||
|
||||
$importEnabled = (bool)ag($u, 'import.enabled');
|
||||
$metaEnabled = (bool)ag($u, 'options.' . Options::IMPORT_METADATA_ONLY);
|
||||
|
||||
if (true === $importEnabled || true === $metaEnabled) {
|
||||
$importType = $importEnabled ? 'play state & metadata' : 'metadata only.';
|
||||
|
||||
$helper = $this->getHelper('question');
|
||||
$text =
|
||||
<<<TEXT
|
||||
|
||||
Would you like to import <info>{type}</info> from the backend now? <comment>[Y|N] [Default: No]</comment>
|
||||
-----------------
|
||||
<comment>P.S: this could take few minutes to execute.</comment>
|
||||
-----------------
|
||||
|
||||
TEXT;
|
||||
|
||||
$text = replacer($text, ['type' => $importType]);
|
||||
|
||||
$question = new ConfirmationQuestion($text . PHP_EOL . '> ', false);
|
||||
|
||||
if (true === $helper->ask($input, $output, $question)) {
|
||||
$output->writeln(
|
||||
replacer('<info>Importing {type} from {name}</info>', [
|
||||
'name' => $name,
|
||||
'type' => $importType
|
||||
])
|
||||
);
|
||||
$cmd = $this->getApplication()?->find(ImportCommand::ROUTE);
|
||||
$cmd->run(new ArrayInput(['--quiet', '--select-backends' => $name]), $output);
|
||||
}
|
||||
|
||||
$output->writeln('<info>Import complete</info>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Commands\Backends;
|
||||
namespace App\Commands\Config;
|
||||
|
||||
use App\Command;
|
||||
use App\Libs\Config;
|
||||
@@ -19,7 +19,7 @@ use Throwable;
|
||||
#[Routable(command: self::ROUTE), Routable(command: 'servers:unify')]
|
||||
final class UnifyCommand extends Command
|
||||
{
|
||||
public const ROUTE = 'backends:unify';
|
||||
public const ROUTE = 'config:unify';
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
@@ -162,7 +162,7 @@ final class UnifyCommand extends Command
|
||||
|
||||
$output->writeln(sprintf('<error>ERROR %s: does not have backend unique id set.</error>', $backendName));
|
||||
$output->writeln('<comment>Please run this command to update backend info.</comment>');
|
||||
$output->writeln(sprintf(commandContext() . 'backends:manage \'%s\' ', $backendName));
|
||||
$output->writeln(sprintf(commandContext() . 'config:manage \'%s\' ', $backendName));
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Commands\Backends;
|
||||
namespace App\Commands\Config;
|
||||
|
||||
use App\Command;
|
||||
use App\Libs\Config;
|
||||
@@ -22,7 +22,7 @@ use Symfony\Component\Yaml\Yaml;
|
||||
#[Routable(command: self::ROUTE), Routable(command: 'servers:view')]
|
||||
final class ViewCommand extends Command
|
||||
{
|
||||
public const ROUTE = 'backends:view';
|
||||
public const ROUTE = 'config:view';
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
@@ -225,7 +225,7 @@ final class LogsCommand extends Command
|
||||
'<comment>If you are running this tool inside docker, you have to enable interaction using "-ti" flag</comment>'
|
||||
);
|
||||
$output->writeln(
|
||||
'<comment>For example: docker exec -ti watchstate console backends:manage my_plex</comment>'
|
||||
'<comment>For example: docker exec -ti watchstate console config:manage my_server</comment>'
|
||||
);
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Commands\Config;
|
||||
namespace App\Commands\System;
|
||||
|
||||
use App\Command;
|
||||
use App\Libs\Config;
|
||||
@@ -14,7 +14,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
#[Routable(command: self::ROUTE)]
|
||||
final class PHPCommand extends Command
|
||||
{
|
||||
public const ROUTE = 'config:php';
|
||||
public const ROUTE = 'system:php';
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
Reference in New Issue
Block a user