Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Check-in [1efa95be56]

Overview
Comment:Add value unserialization for plugin config `type: array/list` using format "1,2,3|4,5,6|..." and `dict` type with "1 => 2, 3 => 4, ..."
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1efa95be5695330b3ee943f3b1141611e1d41e34
User & Date: mario on 2016-10-31 21:49:09
Other Links: manifest | tags
Context
2016-10-31
21:50
Slim down comment (too lengthy contents break gtk tooltip) check-in: 2b17639821 user: mario tags: trunk
21:49
Add value unserialization for plugin config `type: array/list` using format "1,2,3|4,5,6|..." and `dict` type with "1 => 2, 3 => 4, ..." check-in: 1efa95be56 user: mario tags: trunk
16:16
Document house-mixes plugin. check-in: eb226c6d4b user: mario tags: trunk
Changes

Modified pluginconf.py from [25ef6eb532] to [98d9350ac0].

473
474
475
476
477
478
479



480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# depending on priority: classifier.
#
def add_plugin_defaults(conf_options, conf_plugins, meta={}, module=""):

    # Option defaults, if not yet defined
    for opt in meta.get("config", []):
        if "name" in opt and "value" in opt:



            if opt["name"] not in conf_options:
                # typemap "bool" and "int" here
                if opt["type"] in ("bool", "boolean"):
                    val = opt["value"].lower() in ("1", "true", "yes", "on")
                elif opt["type"] in ("int", "integer", "numeric"):
                    val = int(opt["value"])
                elif opt["type"] in ("array", "table", "list"):
                    val = [ opt["value"].split(",") ]
                elif opt["type"] in ("dict"):
                    val = dict(opt["value"].split(","))
                else:
                    val = str(opt["value"])
                conf_options[opt["name"]] = val

    # Initial plugin activation status
    if module and module not in conf_plugins:
        conf_plugins[module] = meta.get("priority") in (
            "core", "builtin", "always", "default", "standard"
        )









>
>
>
|

|
|
|
|
|
|
|
|

|
|








473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# depending on priority: classifier.
#
def add_plugin_defaults(conf_options, conf_plugins, meta={}, module=""):

    # Option defaults, if not yet defined
    for opt in meta.get("config", []):
        if "name" in opt and "value" in opt:
            _value = opt.get("value", "")
            _name = opt.get("name")
            _type = opt.get("type")
            if _name not in conf_options:
                # typemap "bool" and "int" here
                if _type in ("bool", "boolean"):
                    val = _value.lower() in ("1", "true", "yes", "on")
                elif _type in ("int", "integer", "numeric"):
                    val = int(_value)
                elif _type in ("array", "table", "list"):
                    val = [ re.split("\s*[,;]\s*", s.strip()) for s in re.split("\s[|]\s*", _value) ]
                elif _type in ("dict"):
                    val = dict([ re.split("\s*(?:=>+|==*|-+>|:=+)\s*", s.strip()) for s in re.split("\s*[|;,]\s*", _value) ])
                else:
                    val = str(_value)
                conf_options[_name] = val

    # Initial plugin activation status
    if module and module not in conf_plugins:
        conf_plugins[module] = meta.get("priority") in (
            "core", "builtin", "always", "default", "standard"
        )