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

⌈⌋ branch:  streamtuner2


Diff

Differences From Artifact [ffc788c6a2]:

To Artifact [1a05b24e01]:


1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27


28
29
30
31
32
33
34
1
2
3
4
5
6

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21






22
23
24
25
26
27
28
29
30






-
+














-
-
-
-
-
-
+
+






# encoding: UTF-8
# api: streamtuner2
# title: Gtk2 theme installer
# description: Shows themes in the bookmarks pane for installation
# type: feature
# category: ui
# version: 0.4.2
# version: 0.5
# priority: experimental
#
# Downloads a list of Gtk themes and presents it in the bookmarks
# tab under... »themes«. Double clicking will download and install
# a theme right away.
#
# Note that this is primarily meant for Windows, as it unpacks
# *.dll engines if found. Should work on BSD/Linux still, but would
# require setting up .gtkrc, and writeable module_path for engines.
# It only handles Gtk2 themes currently.
#
# Reuses the `conf.theme` setting from the `gtk_theme` plugin, and
# should work in conjunction to it.
#
# The theme repository is a CSV file of:
#   themepkg.zip, theme.png, Title, Author, http://homepage/
# with the packages residing next to it.
#
# Using a repo.json works better however, and would allow to
# integrate it with the regular plugin manager somewhen.
# Using a repo.json-style format, which mirrors the station row{}
# layout however. Allows later integration with pluginmanager2...
# The bookmark/themes channel provides the nicer UI however.
#
# A theme.zip should contain a structure like:
#    ---------  ---------- -----   ----
#        62937  2016-12-12 16:39   librezlooks.dll
#            0  2016-12-12 16:40   Rezlooks-dark/
#            0  2016-12-03 20:58   Rezlooks-dark/gtk-2.0/
42
43
44
45
46
47
48

49
50
51
52
53
54
55
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52







+






import os, shutil
import csv
import zipfile
import re
import json
import ahttp
from config import *
from config import pluginconf
import uikit
from compat2and3 import *
import action
import channels.favicon as fi


# register a key
123
124
125
126
127
128
129
130

131
132
133

134
135
136
137
138
139
140
141
142
143
144
145
146
147
120
121
122
123
124
125
126

127



128







129
130
131
132
133
134
135







-
+
-
-
-
+
-
-
-
-
-
-
-






                    state = "gtk-zoom-fit",
                    format = self.mime,
                    listformat = "href"
                )
                # add
                r.append(d)

        # filter on properties
        # filter on depends: (such as "gtk => 2.0, win32")
        d_platform = "win32" if conf.windows else "linux"
        d_gtk = "gtk2" if uikit.ver == 2 else "gtk3"
        for i,d in enumerate(r):
        r = [d for d in r if self.deps(d)]
            if not d.get("depends"):
                continue
            for dep in re.split("\s*,\s*", d["depends"]):
                if dep in ("gtk", "streamtuner2", "theme_installer", "gtk2|gtk3", "win32|linux"):
                    continue
                if not dep in (d_platform, d_gtk):
                    del r[i]

        # convert relative references
        for d in r:
            for field in ("url", "img", '$file'):
                v = str(d.get(field))
                if v  and v.find("://") < 0:
                    d[field] = self.themes_url + v
217
218
219
220
221
222
223















205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
        if dll:
            self.clear_dll(dll)

    # delete theme engine dll
    def clear_dll(self, dll):
        for fn in dll:
            os.remove(self.theme_dir + fn)

    # instantiate pluginconf.dependency()
    def deps(self, theme):
        d = pluginconf.dependency()
        d.have.update(dict([name, {"version": str(ver)}] for name,ver in [
            ("gtk", ".".join(str(i) for i in uikit.gtk.gtk_version)),
            ("gtk2", "2" if uikit.ver == 2 else "-1"),
            ("gtk3", "3" if uikit.ver == 3 else "-1"),
            ("linux", "-1" if conf.windows else "4.0.0"),
            ("win32", "6.1" if conf.windows else "-1")
        ]))
        #log.HAVE(dict((k,d.have[k].get("version")) for k in d.have))
        self.deps = d.depends
        return self.deps(theme)