[Rhythmbox-devel] Watching playlists



I'm just starting to write a Python RB plugin which syncs my playlists
elsewhere. After conversations with moch, I now get that I pay attention
to the treemodel that holds the playlists. However...in a plugin's
activate() method, the playlists don't yet seem to have seen
created...but they might be on someone else's (faster) computer. So, I
have lots of code that looks like

playlists = [x for x in
            list(shell.props.sourcelist.props.model)
            if list(x)[2] == "Playlists"]
if playlists:
    (the playlists exist right now, so do something)
else:
    def ins(model, path, iter):
        (if the inserted treemodelrow is the playlist row)
        (do the above thing)
    shell.props.sourcelist.props.model.connect("row-inserted", ins)

and this is really annoying. Is there some place in a Python plugin
where I can be sure either (a) that the playlists have definitely not
been created or (b) that the playlists definitely have been created, so
that I don't need to cater for the idea that that process is happening
while I'm running?

sil


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]