Open Daxtear opened 2 years ago
It's the responsibility of foobar2000 core or other component adding/removing files to call undo backup. This is not a job to be handled inside the callback. Lots of components will be capturing the same notification. Your history would be ruined if they all did the same thing.
Example one:
Empty playlist, drag files from album list to it. Press Ctrl+Z. Contents cleared. You didn't have to do anything.
Example two:
Empty playlist, you use plman.InsertPlaylistItems to add a handle list. Ctrl+Z... nothing happens. This is because it's your responsibility to call plman.UndoBackup BEFORE InsertPlaylistItems.
In both of these examples, on_playlist_items_removed is triggered after the CTRL+Z.
That is not what I'm doing. I'm using a panel in conjunction with the default DUI playlist view. On playlist_item_added for a specific playlist, I then execute code to also add those items to another playlist. Same deal for removed. Basically I want to keep them synced WITHOUT just pasting all contents of one into the other. It's for "items recently added to this playlist". Sometimes I make mistakes though and want to delete them again. If I do that by simply deleting them, no problem. If I do that by using undo, on_playlist_items_removed is not triggered and so the "recently added to this playlist"-playlist doesn't apply the changes made to the main playlist by undoing.
I am executing code when adding/removing files from a certain playlist. This works fine until I decide to undo, which has no way to be caught as far as I'm aware, causing things to desync. So there'd either be the need for new callbacks for undo/redo, or what would at least also work in my usecase is having undo/redo trigger on_playlist_item_added/removed when it should.