Yoni Rabkin <[email protected]> writes:

> Such a change would be indeed ephemeral, since the track doesn't
> represent a file, but this information would survive if you then saved
> the playlist as a native emms playlist to load it later on.

Well the saving is not even that important to me, it's more about managing the
playlist and when I add 10 20 urls that I can find a particular url to
play next, when I did not add them in the same order I want to play
them.

I put together the pieces now and got it working I wonder if there would
be a better solution but for now that works, so thanks for the tipp:

  (defun emms-set-title (title)
    (let ((track (emms-playlist-track-at (point))))
      (emms-track-set track 'info-title title)
      (emms-with-inhibit-read-only-t
       (kill-line 2)
       (emms-playlist-insert-track track))))

  (defun ytel-emms-append ()
    "Add video at point in emms."
    (interactive)
    (let* ((video (ytel-get-current-video))
           (id    (ytel-video-id-fun video))
           (title (assoc-default 'title video)))
      (emms-add-url (format "%s/watch?v=%s" ytel-invidious-api-url id))
      (save-current-buffer
        (set-buffer "Emms Streams")
        (goto-char (buffer-end 1))
        (beginning-of-line)
        (forward-line -1)
        (emms-set-title title))
      (message title)))


Reply via email to