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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [120249ab54]

Overview
Comment:Simplify core plugin dependency lookups.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 120249ab54179255ace5f876aebaf7a08b676853
User & Date: mario on 2015-05-05 10:44:03
Other Links: manifest | tags
Context
2015-05-05
10:45
Readd plugin_base paths in addition to module basenames, otherwise pluginconf.get_data won't find plugins/* either in the module_list() or per get_data() - one uses paths, the other pkg names. check-in: 68107d7f9a user: mario tags: trunk
10:44
Simplify core plugin dependency lookups. check-in: 120249ab54 user: mario tags: trunk
10:43
Support direct URLs in DND import (only used as literal url=, brings up streamedit window afterwards). check-in: 5fe8de1fd7 user: mario tags: trunk
Changes

Modified pluginconf.py from [e41a1aac5c] to [16bafd8a99].

107
108
109
110
111
112
113
114

115
116
117
118
119
120
121
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121







-
+







        if gz:
            bin = gzip_decode(bin)
        if decode:
            return bin.decode("utf-8", errors='ignore')
        else:
            return str(bin)
    except:
        log_WARN("get_data() didn't find:", fn, "in", file_base)
        pass#log_WARN("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.
159
160
161
162
163
164
165
166

167
168
169
170
171
172
173
159
160
161
162
163
164
165

166
167
168
169
170
171
172
173







-
+








    # Try via pkgutil first,
    # find any plugins.* modules, or main packages
    if module:
       fn = module
       for base in plugin_base + extra_base:
           try:
               src = get_data(fn+".py", decode=True, file_base=base)
               src = get_data(fn=fn+".py", decode=True, file_base=base)
               if src: break
           except:
               continue  # plugin_meta_extract() will print a notice later

    # Real filename/path
    elif fn and os.path.exists(fn):
        src = open(fn).read(4096)
377
378
379
380
381
382
383
384
385
386
387
388


389

390
391
392
393
394
395
396
377
378
379
380
381
382
383





384
385

386
387
388
389
390
391
392
393







-
-
-
-
-
+
+
-
+







#
class dependency(object):

    # prepare list of known plugins and versions
    def __init__(self):
        self.have = all_plugin_meta()
        # dependencies on core modules are somewhat more interesting:
        self.have.update({
            "streamtuner2": plugin_meta(module="st2", extra_base=["config"]),
            "uikit": plugin_meta(module="uikit", extra_base=["config"]),
            "config": plugin_meta(module="config", extra_base=["config"]),
            "action": plugin_meta(module="action", extra_base=["config"]),
        for name in ("st2", "uikit", "config", "action"):
            self.have[name] = plugin_meta(module=name, extra_base=["config"])
        })
        self.have["streamtuner2"] = self.have["st2"]
    have = {}

    # depends:    
    def depends(self, plugin):
        if plugin.get("depends"):
            d = self.deps(plugin["depends"])
            if not self.cmp(d, self.have):