~comcloudway/melon

c8dd1f65433c08b99ac294e4f6b441ec04c686fa — Jakob Meier 3 months ago 72cde06
update playlist view, when adding a new video

fixes: bug where using the context menu in the playlist view, to addd a
video to the current playlist, the view would not show the new video
1 files changed, 12 insertions(+), 2 deletions(-)

M melon/playlist/__init__.py
M melon/playlist/__init__.py => melon/playlist/__init__.py +12 -2
@@ 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):