Make plugins disabled by default

Users need to explicitly set plugins_dir parameter
This commit is contained in:
Dan 2018-10-21 09:42:22 +02:00
parent 077e7c00d5
commit 1fe46610cd
2 changed files with 10 additions and 11 deletions

View File

@ -169,7 +169,7 @@ class Client(Methods, BaseClient):
workers: int = BaseClient.WORKERS,
workdir: str = BaseClient.WORKDIR,
config_file: str = BaseClient.CONFIG_FILE,
plugins_dir: str or None = BaseClient.PLUGINS_DIR):
plugins_dir: str = None):
super().__init__()
self.session_name = session_name
@ -983,9 +983,6 @@ class Client(Methods, BaseClient):
try:
dirs = os.listdir(self.plugins_dir)
except FileNotFoundError:
if self.plugins_dir == Client.PLUGINS_DIR:
log.info("No plugin loaded: default directory is missing")
else:
log.warning('No plugin loaded: "{}" directory is missing'.format(self.plugins_dir))
else:
plugins_dir = self.plugins_dir.lstrip("./").replace("/", ".")
@ -1010,11 +1007,14 @@ class Client(Methods, BaseClient):
except Exception:
pass
if plugins_count > 0:
log.warning('Successfully loaded {} plugin{} from "{}"'.format(
plugins_count,
"s" if plugins_count > 1 else "",
self.plugins_dir
))
else:
log.warning('No plugin loaded: "{}" doesn\'t contain any valid plugin'.format(self.plugins_dir))
def save_session(self):
auth_key = base64.b64encode(self.auth_key).decode()

View File

@ -52,7 +52,6 @@ class BaseClient:
WORKERS = 4
WORKDIR = "."
CONFIG_FILE = "./config.ini"
PLUGINS_DIR = "./plugins"
MEDIA_TYPE_ID = {
0: "thumbnail",