[zaycev.net]: Added settings GUI

This commit is contained in:
Manuel Cortez 2019-06-21 17:12:15 -05:00
parent a80bfd53c1
commit bb411e7bbc

View File

@ -4,6 +4,7 @@ import re
import json import json
import requests import requests
import logging import logging
import wx
import config import config
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from . import base from . import base
@ -12,7 +13,8 @@ log = logging.getLogger("extractors.zaycev.net")
class interface(base.baseInterface): class interface(base.baseInterface):
name = "zaycev.net" name = "zaycev.net"
enabled = True enabled = config.app["services"]["zaycev"].get("enabled")
print(enabled)
def search(self, text, page=1): def search(self, text, page=1):
if text == "" or text == None: if text == "" or text == None:
@ -45,4 +47,16 @@ class interface(base.baseInterface):
return data["url"] return data["url"]
def format_track(self, item): def format_track(self, item):
return "{0}. {1}. {2}".format(item.title, item.duration, item.size) return "{0}. {1}. {2}".format(item.title, item.duration, item.size)
class settings(base.baseSettings):
name = _("zaycev.net")
config_section = "zaycev"
def __init__(self, parent):
super(settings, self).__init__(parent=parent)
sizer = wx.BoxSizer(wx.VERTICAL)
self.enabled = wx.CheckBox(self, wx.NewId(), _("Enable this service (it only works in the Russian Federation)"))
self.map.append(("enabled", self.enabled))
sizer.Add(self.enabled, 0, wx.ALL, 5)
self.SetSizer(sizer)