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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [2e6c240bb2]:

To Artifact [3d2cb45781]:


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# layout. Which is why it derives from GenericChannel, and requires
# less setup.
#
# Furthermore it pretty much only handles a static streams{} list.
# Sub-plugins simply append a new category, and populate the streams
# list themselves.
#
# It's accessible as `main.bookmarks` in the ST2 window and elsewhere.
#
class bookmarks(GenericChannel):

    # desc
    module = "bookmarks"
    title = "bookmarks"
    base_url = "file:.config/streamtuner2/bookmarks.json"







|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# layout. Which is why it derives from GenericChannel, and requires
# less setup.
#
# Furthermore it pretty much only handles a static streams{} list.
# Sub-plugins simply append a new category, and populate the streams
# list themselves.
#
# It's accessible as `parent.bookmarks` in the ST2 window and elsewhere.
#
class bookmarks(GenericChannel):

    # desc
    module = "bookmarks"
    title = "bookmarks"
    base_url = "file:.config/streamtuner2/bookmarks.json"
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
    def add(self, row):

        # normalize data (this row originated in a gtk+ widget)
        row["favourite"] = 1
        if row.get("favicon"):
           row["favicon"] = favicon.file(row.get("homepage"))
        if not row.get("listformat"):
            row["listformat"] = self.main.channel().listformat
           
        # append to storage
        self.streams["favourite"].append(row)
        self.save()
        self.load(self.default)
        self.urls.append(row["url"])








|







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
    def add(self, row):

        # normalize data (this row originated in a gtk+ widget)
        row["favourite"] = 1
        if row.get("favicon"):
           row["favicon"] = favicon.file(row.get("homepage"))
        if not row.get("listformat"):
            row["listformat"] = self.parent.channel().listformat
           
        # append to storage
        self.streams["favourite"].append(row)
        self.save()
        self.load(self.default)
        self.urls.append(row["url"])

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
        # First we'll generate a list of current bookmark stream urls, and then
        # remove all but those from the currently UPDATED_channel + category.
        # This step is most likely redundant, but prevents accidently re-rewriting
        # stations that are in two channels (=duplicates with different PLS urls).
        check = {"http//": "[row]"}
        check = dict((row.get("url", "http//"),row) for row in fav)
        # walk through all channels/streams
        for chname,channel in self.main.channels.items():
            for cat,streams in channel.streams.items():

                # keep the potentially changed rows
                if (chname == updated_channel) and (cat == updated_category):
                    freshened_streams = streams

                # remove unchanged urls/rows







|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
        # First we'll generate a list of current bookmark stream urls, and then
        # remove all but those from the currently UPDATED_channel + category.
        # This step is most likely redundant, but prevents accidently re-rewriting
        # stations that are in two channels (=duplicates with different PLS urls).
        check = {"http//": "[row]"}
        check = dict((row.get("url", "http//"),row) for row in fav)
        # walk through all channels/streams
        for chname,channel in self.parent.channels.items():
            for cat,streams in channel.streams.items():

                # keep the potentially changed rows
                if (chname == updated_channel) and (cat == updated_category):
                    freshened_streams = streams

                # remove unchanged urls/rows