# 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.# It's accessible as `parent.bookmarks` in the ST2 window and elsewhere.#class bookmarks(GenericChannel):# descmodule="bookmarks"
title ="bookmarks"
base_url ="file:.config/streamtuner2/bookmarks.json"
105106107108109110111112113114115116117118119
105106107108109110111112113114115116117118119
-+
defadd(self, row):# normalize data (this row originated in a gtk+ widget)
row["favourite"]=1if row.get("favicon"):
row["favicon"]= favicon.file(row.get("homepage"))ifnot row.get("listformat"): row["listformat"]=self.main.channel().listformat
row["listformat"]=self.parent.channel().listformat
# append to storageself.streams["favourite"].append(row)self.save()self.load(self.default)self.urls.append(row["url"])
154155156157158159160161162163164165166167168
154155156157158159160161162163164165166167168
-+
# 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/streamsfor chname,channel inself.main.channels.items():for chname,channel inself.parent.channels.items():for cat,streams in channel.streams.items():# keep the potentially changed rowsif(chname == updated_channel)and(cat == updated_category):
freshened_streams = streams
# remove unchanged urls/rows