[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding lisp functions to the playlist

From: Yoni Rabkin
Subject: Re: Adding lisp functions to the playlist
Date: Tue, 12 Jul 2022 17:08:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1.90 (gnu/linux)

Alex Griffin <a@ajgrf.com> writes:

> I finally got around to trying this branch, but I'm afraid I can't get
> it to work. I'm able to evaluate your `emms-actions-add` examples
> (with point at the target track), but when the song comes up in the
> playlist, nothing happens. I also tried different functions, like just
> printing a message to the echo area, and nothing seemed to execute
> then either.
> I'm using the mpv backend if that helps you reproduce the
> issue. Thanks for working on this, and sorry it took me so long to
> respond!

OK, let us try this again. I've updated the actions branch, please grab
that code first. Define two functions, such as these (assuming of course
that emms-volume is set up on your machine):

(defun __emms_action_volume_raise (track)
  (ignore track)

(defun __emms_action_volume_lower (track)
  (ignore track)

Then place point over a track and evaluate:

(emms-actions-add-at-point #'__emms_action_volume_raise 'before-action)
(emms-actions-add-at-point #'__emms_action_volume_lower 'after-action)

You can then make sure that the track has been modified by:

(emms-playlist-track-at (point))

...and seeing that it has `before-action' and `after-action' set at the
very end.

Finally, play the track, and if it all works the volume should go up
when the track starts playing, and go down when the track finishes.

Note that `after-action' is currently set up to run when the track
finishes, but not when the user stops the track. We can discuss the
details after we have this basic stuff working.

> --
> Alex Griffin
> ------- Original Message -------
> On Wednesday, June 8th, 2022 at 7:15 PM, Yoni Rabkin <yoni@rabkins.net> wrote:
>> I pushed a simple implementation of the idea to the "actions" branch on
>> the git repo. It is a few functions added to emms.el. Please check it
>> out.
>> It operates on the track at point. So once you are over a playlist
>> track you can eval something like:
>> (emms-actions-add #'(lambda (track)
>> (ignore track)
>> (emms-volume-raise))
>> 'before-action)
>> ...and then also:
>> (emms-actions-add #'(lambda (track)
>> (ignore track)
>> (emms-volume-lower))
>> 'after-action)
>> Then, when you play the track as part of the playlist, the volume should
>> be raised before the tracks starts, and lowered after it completes.
>> Tell me what you think.
>> --
>> "Cut your own wood and it will warm you twice"

   "Cut your own wood and it will warm you twice"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]