from sys import version_info
from time import time
from collections import defaultdict

from pyload.lib.SafeEval import const_eval as literal_eval
from pyload.plugins.Base import Base

from new_collections import namedtuple

#TODO: ignores not updatable

# ignore these plugin configs, mainly because plugins were wiped out
IGNORE = ("FreakshareNet", "SpeedManager", "ArchiveTo", "ShareCx",
          ('addons', 'UnRar'), 'EasyShareCom', 'FlyshareCz')

PluginTuple = namedtuple("PluginTuple", "version re deps category user path")


class BaseAttributes(defaultdict):
    """ Dictionary that loads defaults values from Base object """
    def __missing__(self, key):
        attr = "__%s__" % key
        if not hasattr(Base, attr):
            return defaultdict.__missing__(self, key)

        return getattr(Base, attr)


class PluginManager:
    ROOT = "pyload.plugins."
    LOCALROOT = "localplugins."
Exemple #2
0
import re

from os import listdir, makedirs
from os.path import isfile, join, exists, basename
from sys import version_info
from time import time
from collections import defaultdict
from logging import getLogger

from pyload.lib.SafeEval import const_eval as literal_eval
from pyload.plugins.Base import Base

from new_collections import namedtuple

PluginTuple = namedtuple("PluginTuple", "version re deps category user path")


class BaseAttributes(defaultdict):
    """ Dictionary that loads defaults values from Base object """

    def __missing__(self, key):
        attr = "__%s__" % key
        if not hasattr(Base, attr):
            return defaultdict.__missing__(self, key)

        return getattr(Base, attr)

class LoaderFactory:
    """ Container for multiple plugin loaders  """
Exemple #3
0
# -*- coding: utf-8 -*-

from gettext import gettext

from new_collections import namedtuple

from pyload.Api import Input, InputType
from pyload.utils import decode, to_bool

ConfigData = namedtuple("ConfigData", "label description input")

# Maps old config formats to new values
input_dict = {
    "int": InputType.Int,
    "bool": InputType.Bool,
    "time": InputType.Time,
    "file": InputType.File,
    "list": InputType.List,
    "folder": InputType.Folder
}


def to_input(typ):
    """ Converts old config format to input type"""
    return input_dict.get(typ, InputType.Text)


def to_configdata(entry):
    if len(entry) != 4:
        raise ValueError("Config entry must be of length 4")
Exemple #4
0
# -*- coding: utf-8 -*-

from __future__ import with_statement
from time import sleep
from os.path import exists
from gettext import gettext
from new_collections import namedtuple, OrderedDict

from module.utils import from_string
from module.utils.fs import chmod

from default import make_config

CONF_VERSION = 2
SectionTuple = namedtuple("SectionTuple", "name description long_desc config")
ConfigData = namedtuple("ConfigData", "name type description default")

class ConfigParser:
    """
    Holds and manages the configuration + meta data for config read from file.
    """

    CONFIG = "pyload.conf"

    def __init__(self, config=None):

        if config: self.CONFIG = config

        # Meta data information
        self.config = OrderedDict()
        # The actual config values
Exemple #5
0
# -*- coding: utf-8 -*-

from __future__ import with_statement
from os.path import exists
from gettext import gettext
from new_collections import namedtuple, OrderedDict

from pyload.Api import Input, InputType
from pyload.utils.fs import chmod

from default import make_config
from convert import to_configdata, from_string

CONF_VERSION = 2
SectionTuple = namedtuple("SectionTuple",
                          "label description explanation config")


class ConfigParser:
    """
    Holds and manages the configuration + meta data for config read from file.
    """

    CONFIG = "pyload.conf"

    def __init__(self, config=None):

        if config: self.CONFIG = config

        # Meta data information
        self.config = OrderedDict()
Exemple #6
0
from __future__ import with_statement
from time import sleep
from os.path import exists
from gettext import gettext
from new_collections import namedtuple, OrderedDict


from pyload.Api import Input, InputType
from pyload.utils.fs import chmod

from default import make_config
from convert import to_input, from_string

CONF_VERSION = 2
SectionTuple = namedtuple("SectionTuple", "label description explanation config")
ConfigData = namedtuple("ConfigData", "label description input")

class ConfigParser:
    """
    Holds and manages the configuration + meta data for config read from file.
    """

    CONFIG = "pyload.conf"

    def __init__(self, config=None):

        if config: self.CONFIG = config

        # Meta data information
        self.config = OrderedDict()
Exemple #7
0
# -*- coding: utf-8 -*-

from __future__ import with_statement
from time import sleep
from os.path import exists
from gettext import gettext
from new_collections import namedtuple, OrderedDict

from pyload.utils import from_string
from pyload.utils.fs import chmod

from default import make_config

CONF_VERSION = 2
SectionTuple = namedtuple("SectionTuple", "name description long_desc config")
ConfigData = namedtuple("ConfigData", "name type description default")


class ConfigParser:
    """
    Holds and manages the configuration + meta data for config read from file.
    """

    CONFIG = "pyload.conf"

    def __init__(self, config=None):

        if config: self.CONFIG = config

        # Meta data information
        self.config = OrderedDict()
Exemple #8
0
# -*- coding: utf-8 -*-

from gettext import gettext

from new_collections import namedtuple

from pyload.Api import Input, InputType
from pyload.utils import decode, to_bool

ConfigData = namedtuple("ConfigData", "label description input")

# Maps old config formats to new values
input_dict = {
    "int": InputType.Int,
    "bool": InputType.Bool,
    "time": InputType.Time,
    "file": InputType.File,
    "list": InputType.List,
    "folder": InputType.Folder,
}


def to_input(typ):
    """ Converts old config format to input type"""
    return input_dict.get(typ, InputType.Text)


def to_configdata(entry):
    if len(entry) != 4:
        raise ValueError("Config entry must be of length 4")
Exemple #9
0
from os.path import isfile, join, exists, abspath, basename
from sys import version_info
from time import time

from module.lib.SafeEval import const_eval as literal_eval
from module.plugins.Base import Base

from new_collections import namedtuple

#TODO: ignores not updatable

# ignore these plugin configs, mainly because plugins were wiped out
IGNORE = ("FreakshareNet", "SpeedManager", "ArchiveTo", "ShareCx",
          ('addons', 'UnRar'), 'EasyShareCom', 'FlyshareCz')

PluginTuple = namedtuple("PluginTuple", "version re deps user path")


class PluginManager:
    ROOT = "module.plugins."
    USERROOT = "userplugins."
    TYPES = ("crypter", "hoster", "accounts", "addons", "internal")

    BUILTIN = re.compile(
        r'__(?P<attr>[a-z0-9_]+)__\s*=\s?(True|False|None|[0-9x.]+)', re.I)
    SINGLE = re.compile(
        r'__(?P<attr>[a-z0-9_]+)__\s*=\s*(?:r|u|_)?((?:(?<!")"(?!")|\'|\().*(?:(?<!")"(?!")|\'|\)))',
        re.I)
    # note the nongreedy character: that means we can not embed list and dicts
    MULTI = re.compile(
        r'__(?P<attr>[a-z0-9_]+)__\s*=\s*((?:\{|\[|"{3}).*?(?:"""|\}|\]))',
Exemple #10
0
from time import time

from module.lib.SafeEval import const_eval as literal_eval
from module.plugins.Base import Base

from new_collections import namedtuple

#TODO: ignores not updatable

# ignore these plugin configs, mainly because plugins were wiped out
IGNORE = (
    "FreakshareNet", "SpeedManager", "ArchiveTo", "ShareCx", ('addons', 'UnRar'),
    'EasyShareCom', 'FlyshareCz'
    )

PluginTuple = namedtuple("PluginTuple", "version re deps user path")

class PluginManager:
    ROOT = "module.plugins."
    USERROOT = "userplugins."
    TYPES = ("crypter", "hoster", "accounts", "addons", "internal")

    BUILTIN = re.compile(r'__(?P<attr>[a-z0-9_]+)__\s*=\s?(True|False|None|[0-9x.]+)', re.I)
    SINGLE = re.compile(r'__(?P<attr>[a-z0-9_]+)__\s*=\s*(?:r|u|_)?((?:(?<!")"(?!")|\'|\().*(?:(?<!")"(?!")|\'|\)))',
        re.I)
    # note the nongreedy character: that means we can not embed list and dicts
    MULTI = re.compile(r'__(?P<attr>[a-z0-9_]+)__\s*=\s*((?:\{|\[|"{3}).*?(?:"""|\}|\]))', re.DOTALL | re.M | re.I)

    NO_MATCH = re.compile(r'^no_match$')

    def __init__(self, core):
Exemple #11
0
# -*- coding: utf-8 -*-

from __future__ import with_statement
from os.path import exists
from gettext import gettext
from new_collections import namedtuple, OrderedDict

from pyload.Api import Input, InputType
from pyload.utils.fs import chmod

from default import make_config
from convert import to_configdata, from_string

CONF_VERSION = 2
SectionTuple = namedtuple("SectionTuple", "label description explanation config")


class ConfigParser:
    """
    Holds and manages the configuration + meta data for config read from file.
    """

    CONFIG = "pyload.conf"

    def __init__(self, config=None):

        if config: self.CONFIG = config

        # Meta data information
        self.config = OrderedDict()
        # The actual config values