@@ 12,14 12,24 @@ from melon.widgets.iconbutton import IconButton
from melon.widgets.feeditem import AdaptiveFeedItem
from melon.widgets.simpledialog import SimpleDialog
from melon.models import get_app_settings, get_local_playlist, PlaylistWrapper, ensure_playlist, ensure_delete_local_playlist
-from melon.models import is_server_enabled, ensure_server_disabled, ensure_server_enabled
+from melon.models import is_server_enabled, ensure_server_disabled, ensure_server_enabled, register_callback
class LocalPlaylistScreen(Adw.NavigationPage):
def __init__(self, playlist_id, *args, **kwargs):
super().__init__(*args, **kwargs)
app_conf = get_app_settings()
- self.playlist = get_local_playlist(playlist_id)
+
+ self.playlist_id = playlist_id
+ # register update listener
+ register_callback("playlists_changed", "playlist-view", self.do_update)
+ # draw frame
+ self.do_update()
+
+ def do_update(self):
+ # load playlist data
+ self.playlist = get_local_playlist(self.playlist_id)
+ # render new data
self.update()
def update(self):