On Thu, 14 Oct 2021 17:12:50 -0400 Yoni Rabkin <[email protected]> wrote:
> Yuchen Pei <[email protected]> writes: > > > Yoni Rabkin <[email protected]> writes: > > > >> `emms-bookmarks' has code to support this, but it isn't extensively > >> developed because this is an edge case and doesn't come up very > >> often. I > >> have used `emms-bookmarks' in the (far) past and I remember it > >> working > >> well enough at the time. > > > > Thanks for the pointer. > > > > As I understand it emms-bookmarks's goal is to restore the playback > > position in a media file, but not to restore to the item in a playlist > > across emacs sessions (my second problem). I tried emms-bookmark-add > > on an item, switched to another playlist and played something there, > > and came back to the item, and did emms-bookmark-next. It didn't > > restore the position. I'll have to look more into it. > > The bookmark data is stored natively as part of the track, so it would > be written to disk in a emms-playlist-save, and equally read back of > course. If mpv player is used, I'd also suspect that immediately restoring position might not work due to race with async playback start - e.g. "seek" command being sent before playback actually starts in mpv or something like that. Don't think I've tested restoring bookmarks myself, but if it doesn't look like tagging issue of some kind, maybe try doing this before starting playback/bookmark-restore: (setq emms-player-mpv-debug t) And then check *Messages* buffer to see whether: - "seek" command is being sent to mpv at all. - Whether it precedes {"event": "playback-restart"} there. Not entirely sure if "seek" might work just fine if sent right after "loadfile" though - mpv is not very consistent wrt how/when it processes some of these in my experience (incl. between diff versions of it). > >>> 2. Say I have one playlist A at track 42 at 23:00. How do I save > >>> it, close emacs and resume at track 42 at 23:00 next time I open emacs > >>> and load the playlist? I tried saving the playlist as a native > >>> playlist, but when I load it starts from track 1 again. I generally start using emms after opening emacs by pressing a hotkey that either takes me to one of the playlist buffers (almost always) or runs emms-play-directory-tree if there are none, via this code: https://github.com/mk-fg/emacs-setup/blob/b7c739a/core/fg_emms.el#L383-L403 (pressing same hotkey again returns to previous buffer) And pretty sure it restores position via something like this: (emms-playlist-select (marker-position emms-playlist-selected-marker)) But maybe double-check the actual code link above if that doesn't work. Pretty sure after this initial restore, cycling to any other playlist buffer restores position in them without any extra code, as I have like 15 of them open just now, and they all have some position stored there. (cycling is done via fg-emms-playlist-cycle defined in the same file above, and I don't see any extra position-restore code in there) But I think buffers themselves are saved as a part of general emacs desktop save/restore feature. Some of the playlists that I just cycled through were likely thrown together years ago, and still hang around since then with stored position and all. This is just about "which track to play" position, but if emms-bookmark functionality stores a seek position tag, it'd probably hang around forever in these as well. -- Mike Kazantsev // fraggod.net
