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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [4b3498e020]

Overview
Comment:Add debug/logging to plugin dependency checks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4b3498e0205b029bd2f6f52adae83381e671d979
User & Date: mario on 2018-12-17 16:50:07
Other Links: manifest | tags
Context
2018-12-17
16:50
shoutcast: reenable referer sending check-in: e5e2175cfc user: mario tags: trunk
16:50
Add debug/logging to plugin dependency checks. check-in: 4b3498e020 user: mario tags: trunk
16:49
Support for RT-NG direct bookmarks.json saving. check-in: b5f2654777 user: mario tags: trunk
Changes

Modified channels/pluginmanager2.py from [1b1b12b5ad] to [04d5a6de37].

131
132
133
134
135
136
137
138

139


140
141
142
143
144
145
146
131
132
133
134
135
136
137

138
139
140
141
142
143
144
145
146
147
148







-
+

+
+







        # Clean up placeholders in vbox
        _ = [self.vbox.remove(c) for c in self.vbox.get_children()[3:]]
        
        # Attach available downloads after checking dependencies
        # e.g. newpl["depends"] = "streamtuner2 < 2.2.0, config >= 2.5"
        dep = pluginconf.dependency()
        for newpl in meta:
            if dep.valid(newpl) and dep.depends(newpl):
            if dep.valid(newpl, log.DEBUG_VALIDITY) and dep.depends(newpl, log.DEBUG_DEPENDS):
                self.add_plugin(newpl)
            else:
                log.DEBUG("plugin fails dependencies:", newpl)

        # Readd some filler labels
        _ = [self.add_(uikit.label("")) for i in range(1,3)]


    # Append to vbox
    def add_(self, w, label=None, markup=0, align=10, label_size=400):

Modified pluginconf.py from [8ae013bd93] to [b740a1a82c].

420
421
422
423
424
425
426
427

428
429
430

431
432

433
434

435
436

437
438
439
440
441
442

443
444
445
446
447

448
449
450
451
452
453
454
420
421
422
423
424
425
426

427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445

446
447
448
449
450
451
452
453
454
455
456
457
458
459







-
+



+


+


+


+





-
+





+







        for name, meta in self.have.items():
            if meta.get("alias"):
                for alias in re.split("\s*[,;]\s*", meta["alias"]):
                    self.have[alias] = self.have[name]

    # basic plugin pre-screening (skip __init__, filter by api:,
    # exclude installed & same-version plugins)
    def valid(self, newpl):
    def valid(self, newpl, _log=lambda *x:0):
        id = newpl.get("$name", "__invalid")
        have_ver = self.have.get(id, {}).get("version", "0")
        if id.find("__") == 0:
            _log("wrong id")
            pass
        elif newpl.get("api") not in ("python", "streamtuner2"):
            _log("wrong api")
            pass
        elif set((newpl.get("status"), newpl.get("priority"))).intersection(set(("obsolete", "broken"))):
            _log("wrong status")
            pass
        elif have_ver >= newpl.get("version", "0.0"):
            _log("newer version already installed")
            pass
        else:
            return True

    # Verify depends: and breaks: against existing plugins/modules
    def depends(self, plugin):
    def depends(self, plugin, _log=lambda *x:0):
        r = True
        if plugin.get("depends"):
            r &= self.and_or(self.split(plugin["depends"]), self.have)
        if plugin.get("breaks"):
            r &= self.neither(self.split(plugin["breaks"]), self.have)
        _log(r)
        return r

    # Split trivial "pkg | alt, mod >= 1, uikit < 4.0" string into nested list [[dep],[alt,alt],[dep]]
    def split(self, dep_str):
        dep_cmp = []
        for alt_str in re.split(r"\s*[,;]+\s*", dep_str):
            alt_cmp = []