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

⌈⌋ branch:  streamtuner2


Check-in [f48ad79aa1]

Overview
SHA1 Hash:f48ad79aa146966bc51ed81ffc896fcec1c281d1
Date: 2017-01-05 21:33:50
User: mario
Comment:Fix `links` plugin format: attribute; make it understood by channel.play() that a homepage-only row triggers the web browser.
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2017-01-08
12:46
[49f14d5102] Check for windows-style paths in specbuttons file lookup (user: mario, tags: trunk)
2017-01-05
21:33
[f48ad79aa1] Fix `links` plugin format: attribute; make it understood by channel.play() that a homepage-only row triggers the web browser. (user: mario, tags: trunk)
21:23
[ea924e3c27] Introduce FeaturePlugin as new base class for channels and all other plugins. Pre-defines the meta, module attributes and calls init2(). (user: mario, tags: trunk)
Changes

Modified channels/__init__.py from [4a4e01489e] to [e9d8c94f99].

600
601
602
603
604
605
606


607
608
609
610
611
612
613
        row = self.row()
        if row and "url" in row:
            # playlist and audio type
            audioformat = row.get("format", self.audioformat)
            listformat = row.get("listformat", self.listformat)
            # invoke audio player
            action.play(row, audioformat, listformat)


        else:
            self.status("No station selected for playing.")
        return row

    # Start streamripper/youtube-dl/etc
    def record(self):
        row = self.row()







>
>







600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
        row = self.row()
        if row and "url" in row:
            # playlist and audio type
            audioformat = row.get("format", self.audioformat)
            listformat = row.get("listformat", self.listformat)
            # invoke audio player
            action.play(row, audioformat, listformat)
        elif row.get("homepage") and row.get("format") == "text/html":
            action.browser(row["homepage"])
        else:
            self.status("No station selected for playing.")
        return row

    # Start streamripper/youtube-dl/etc
    def record(self):
        row = self.row()

Modified channels/links.py from [2ae7536a04] to [d07c682e01].

1
2
3
4
5
6
7
8
9
10
11
12
13
..
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
..
59
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
92
93
94
95
96
97
# api: streamtuner2
# title: Links to directory services
# description: Static list of various music directory websites.
# type: group
# category: web
# version: 0.2
# priority: standard
# config: -
#
# Simply adds a "links" entry in bookmarks tab, where known services
# are listed with homepage links. Registered plugins automatically
# end up on top of that list.
#
................................................................................
from config import *
from channels import *
import copy



# hooks into main.bookmarks
class links (object):

    # plugin info
    module = 'links'
    meta = plugin_meta()
    
    # list
    streams = [    ]
    default = [
        ("stream", "rad.io", "http://www.rad.io/"),
        ("stream", "RadioTower", "http://www.radiotower.com/"),
        ("stream", "8tracks", "http://8tracks.com/"),
        ("stream", "TuneIn", "http://tunein.com/"),
................................................................................
        ("commercial", "Deezer", "http://www.deezer.com/features/music.html"),
       #("stream", "SurfMusik.de", "http://www.surfmusic.de/"),
    ]
    
    
    
    # prepare gui
    def __init__(self, parent):

        if parent:


            # prepare target category
            bookmarks = parent.bookmarks
            if not bookmarks.streams.get(self.module):
                bookmarks.streams[self.module] = []
            bookmarks.add_category(self.module)
            
            # fill it up later
            parent.hooks["init"].append(self.populate)


    def populate(self, parent):
    
        # Collect links from channel plugins
        for name,channel in parent.channels.items():
            try:
                self.streams.append({
                    "favourite": 1,
                    "genre": "channel",
                    "title": channel.meta.get("title", channel.module),
                    "homepage": channel.meta.get("url", ""),
                    "type": "text/html",
                })
            except Exception as e:
                log.ERR("links: adding entry failed:", e)

        # Add built-in link list
        for row in self.default:
            (genre, title, homepage) = row





|







 







|

<
<
<
<







 







|
<
|
>

|
|
|
|
|
|
|
|












|







1
2
3
4
5
6
7
8
9
10
11
12
13
..
16
17
18
19
20
21
22
23
24




25
26
27
28
29
30
31
..
55
56
57
58
59
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
92
93
# api: streamtuner2
# title: Links to directory services
# description: Static list of various music directory websites.
# type: group
# category: web
# version: 0.3
# priority: standard
# config: -
#
# Simply adds a "links" entry in bookmarks tab, where known services
# are listed with homepage links. Registered plugins automatically
# end up on top of that list.
#
................................................................................
from config import *
from channels import *
import copy



# hooks into main.bookmarks
class links (FeaturePlugin):





    # list
    streams = [    ]
    default = [
        ("stream", "rad.io", "http://www.rad.io/"),
        ("stream", "RadioTower", "http://www.radiotower.com/"),
        ("stream", "8tracks", "http://8tracks.com/"),
        ("stream", "TuneIn", "http://tunein.com/"),
................................................................................
        ("commercial", "Deezer", "http://www.deezer.com/features/music.html"),
       #("stream", "SurfMusik.de", "http://www.surfmusic.de/"),
    ]
    
    
    
    # prepare gui
    def init2(self, parent):

        if not parent:
            return

        # prepare target category
        bookmarks = parent.bookmarks
        if not bookmarks.streams.get(self.module):
            bookmarks.streams[self.module] = []
        bookmarks.add_category(self.module)
        
        # fill it up later
        parent.hooks["init"].append(self.populate)


    def populate(self, parent):
    
        # Collect links from channel plugins
        for name,channel in parent.channels.items():
            try:
                self.streams.append({
                    "favourite": 1,
                    "genre": "channel",
                    "title": channel.meta.get("title", channel.module),
                    "homepage": channel.meta.get("url", ""),
                    "format": "text/html",
                })
            except Exception as e:
                log.ERR("links: adding entry failed:", e)

        # Add built-in link list
        for row in self.default:
            (genre, title, homepage) = row