Services may be disabled from config

This commit is contained in:
Manuel Cortez 2019-06-18 16:36:45 -05:00
parent b105dd649d
commit 52265c4f3e
4 changed files with 9 additions and 3 deletions

View File

@ -4,10 +4,14 @@ language = string(default="system")
[services] [services]
[[tidal]] [[tidal]]
enabled = boolean(default=True)
username = string(default="") username = string(default="")
password = string(default="") password = string(default="")
quality=string(default="lossless") quality=string(default="lossless")
[[youtube]] [[youtube]]
enabled = boolean(default=True)
transcode = boolean(default=True) transcode = boolean(default=True)
[[zaycev.net]]
enabled = boolean(default=True)

View File

@ -120,6 +120,7 @@ class settings(base.baseSettings):
self.map.append(("transcode", self.transcode)) self.map.append(("transcode", self.transcode))
sizer.Add(self.transcode, 0, wx.ALL, 5) sizer.Add(self.transcode, 0, wx.ALL, 5)
self.SetSizer(sizer) self.SetSizer(sizer)
self.on_enabled()
def on_enabled(self, *args, **kwargs): def on_enabled(self, *args, **kwargs):
for i in self.map: for i in self.map:

View File

@ -12,6 +12,7 @@ log = logging.getLogger("extractors.zaycev.net")
class interface(object): class interface(object):
name = "zaycev.net" name = "zaycev.net"
enabled = True
def __init__(self): def __init__(self):
self.results = [] self.results = []

View File

@ -74,5 +74,5 @@ def get_extractors():
""" Function for importing everything wich is located in the extractors package and has a class named interface.""" """ Function for importing everything wich is located in the extractors package and has a class named interface."""
import extractors import extractors
module_type = types.ModuleType 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) return classes#sorted(classes, key=lambda c: c.name)