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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [720f2889ce]:

To Artifact [9432295735]:


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
#
# encoding: UTF-8
# api: streamtuner2
# title: Plugin handling
# description: Channels and feature plugins reside in channels/
# type: R
# category: core
# priority: core
# pack:
#   file.py, _generic.py, global_key.py, history.py, icast.py,
#   internet_radio.py, itunes.py, jamendo.py, links.py, live365.py,
#   modarchive.py, myoggradio.py, punkcast.py, shoutcast.py,
#   surfmusik.py, tunein.py, timer.py, xiph.py, youtube.py, *.png
# obsolete:
#   dirble.py 
#
#






from channels._generic import *

# Only reexport plugin classes
__all__ = [
    "GenericChannel", "ChannelPlugin"
]












|
<
|


>
>
>
|
>







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
#
# encoding: UTF-8
# api: streamtuner2
# title: Plugin handling
# description: Channels and feature plugins reside in channels/
# type: R
# category: core
# priority: core
# pack:
#   file.py, _generic.py, global_key.py, history.py, icast.py,
#   internet_radio.py, itunes.py, jamendo.py, links.py, live365.py,
#   modarchive.py, myoggradio.py, punkcast.py, shoutcast.py,
#   surfmusik.py, tunein.py, timer.py, xiph.py, youtube.py,

#   radiotray.py, *.png
#
#
# Just exports GenericChannel and ChannelPlugin. Makes module
# scanning and meta data parsing available.  Currently just for
# globally-installed /usr/share/streamtuner2/channel/*.py plugins.
#
#

from channels._generic import *

# Only reexport plugin classes
__all__ = [
    "GenericChannel", "ChannelPlugin"
]
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    ls = [fn[:-3] for fn in ls if re.match("^[a-z][\w\d_]+\.py$", fn)]
    
    # resort with tab order
    order = [module.strip() for module in conf.channel_order.lower().replace(".","_").replace("-","_").split(",")]
    ls = [module for module in (order) if (module in ls)] + [module for module in (ls) if (module not in order)]

    return ls


# Parse plugin comment blocks.
#
def module_meta():
    meta = {}

    rx_meta = re.compile(r"""^#\s*(\w+):\s*(.+)$""", re.M)

    # Loop through all existing module.py scripts
    for name in module_list():
       meta[name] = dict(title="", type="", description="")

       # Read and regex-extract into dict
       with open("%s/channels/%s.py" % (conf.share, name)) as f:
           for field in re.findall(rx_meta, f.read(1024)):
               meta[name][field[0]] = field[1]

    return meta












<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
39
40
41
42
43
44
45
46






















    ls = [fn[:-3] for fn in ls if re.match("^[a-z][\w\d_]+\.py$", fn)]
    
    # resort with tab order
    order = [module.strip() for module in conf.channel_order.lower().replace(".","_").replace("-","_").split(",")]
    ls = [module for module in (order) if (module in ls)] + [module for module in (ls) if (module not in order)]

    return ls