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

⌈⌋ branch:  streamtuner2


Diff

Differences From Artifact [16bafd8a99]:

To Artifact [a5813116de]:


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89







-
















-






#  Probes a new plugins` depends: list against installed base modules.
#  Very crude and tied to streamtuner2 base names.
#
#
#


from __future__ import print_function
import sys
import os
import re
import pkgutil
import inspect
try: from compat2and3 import gzip_decode
except: from gzip import decompress as gzip_decode # Py3 only
import zipfile
import argparse

__all__ = ["get_data", "module_list", "plugin_meta", "dependency", "add_plugin_defaults"]



# Injectables
# ‾‾‾‾‾‾‾‾‾‾‾
log_WARN = lambda *x:None
log_ERR = lambda *x:None

# File lookup relation for get_data(), should name a top-level module/package
module_base = "config"

# Package names or base paths for module_list() and plugin_meta() lookups
plugin_base = ["channels"]
107
108
109
110
111
112
113
114

115
116
117
118
119
120
121
105
106
107
108
109
110
111

112
113
114
115
116
117
118
119







-
+






        if gz:
            bin = gzip_decode(bin)
        if decode:
            return bin.decode("utf-8", errors='ignore')
        else:
            return str(bin)
    except:
        pass#log_WARN("get_data() didn't find:", fn, "in", file_base)
        pass#log_ERR("get_data() didn't find:", fn, "in", file_base)



# Plugin name lookup
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Search through ./plugins/ (and other configured plugin_base
# names or paths) and get module basenames.
334
335
336
337
338
339
340
341

342
343
344
345
346
347
348
332
333
334
335
336
337
338

339
340
341
342
343
344
345
346







-
+






    typing = re.findall("bool|str|\[\]|const|false|true", opt["type"])
    naming = re.findall("\[\]", opt["name"])
    name   = re.findall("(?<!-)\\b\\w+", opt["name"])
    nargs  = re.findall("\\b\d+\\b|[\?\*\+]", opt["type"]) or [None]
    is_arr = "[]" in (naming + typing) and nargs == [None]
    is_bool= "bool" in typing
    false_b = "false" in typing or opt["value"] in ("0", "false")
    #print "\nname=", name, "is_arr=", is_arr, "is_bool=", is_bool, "bool_d=", false_b, "naming=", naming, "typing=", typing
    #print("\nname=", name, "is_arr=", is_arr, "is_bool=", is_bool, "bool_d=", false_b, "naming=", naming, "typing=", typing)

    # Populate partially - ArgumentParser has aversions to many parameter combinations
    kwargs = dict(
        args     = args,
        dest     = name[0] if not name[0] in args else None,
        action   = is_arr and "append"  or  is_bool and false_b and "store_false"  or  is_bool and "store_true"  or  "store",
        nargs    = nargs[0],