From 52265c4f3e0f89d58b1d5872ad7fca9770527182 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 18 Jun 2019 16:36:45 -0500 Subject: [PATCH] Services may be disabled from config --- src/app-configuration.defaults | 8 ++++++-- src/extractors/youtube.py | 1 + src/extractors/zaycev.py | 1 + src/utils.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app-configuration.defaults b/src/app-configuration.defaults index 7905564..5c547ca 100644 --- a/src/app-configuration.defaults +++ b/src/app-configuration.defaults @@ -4,10 +4,14 @@ language = string(default="system") [services] [[tidal]] +enabled = boolean(default=True) username = string(default="") password = string(default="") quality=string(default="lossless") - [[youtube]] -transcode = boolean(default=True) \ No newline at end of file +enabled = boolean(default=True) +transcode = boolean(default=True) + +[[zaycev.net]] +enabled = boolean(default=True) \ No newline at end of file diff --git a/src/extractors/youtube.py b/src/extractors/youtube.py index ae7ddae..7f86635 100644 --- a/src/extractors/youtube.py +++ b/src/extractors/youtube.py @@ -120,6 +120,7 @@ class settings(base.baseSettings): self.map.append(("transcode", self.transcode)) sizer.Add(self.transcode, 0, wx.ALL, 5) self.SetSizer(sizer) + self.on_enabled() def on_enabled(self, *args, **kwargs): for i in self.map: diff --git a/src/extractors/zaycev.py b/src/extractors/zaycev.py index fc899de..f15bb7e 100644 --- a/src/extractors/zaycev.py +++ b/src/extractors/zaycev.py @@ -12,6 +12,7 @@ log = logging.getLogger("extractors.zaycev.net") class interface(object): name = "zaycev.net" + enabled = True def __init__(self): self.results = [] diff --git a/src/utils.py b/src/utils.py index 34f3be9..be00c38 100644 --- a/src/utils.py +++ b/src/utils.py @@ -74,5 +74,5 @@ def get_extractors(): """ Function for importing everything wich is located in the extractors package and has a class named interface.""" import extractors module_type = types.ModuleType - classes = [m for m in extractors.__dict__.values() if type(m) == module_type and hasattr(m, 'interface')] + classes = [m for m in extractors.__dict__.values() if type(m) == module_type and hasattr(m, 'interface') and m.interface.enabled != False] return classes#sorted(classes, key=lambda c: c.name) \ No newline at end of file