[Top][All Lists]

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

Re: [emms-help] emms-info-youtube

From: Konstantin Reich
Subject: Re: [emms-help] emms-info-youtube
Date: Fri, 06 Sep 2019 15:02:35 +0300


> via process-put/process-get instead of using its buffer.

Thank you for your help. This helped, although it is a puzzle  for me why 
buffer-locals did not work.

The result looks like this:

  (defun emms-info-youtube (track)
    (when (eq 'url (emms-track-type track))
      (let ((url (emms-track-name track)))
        (when (string-match-p "youtube" url)
          (let* ((id (make-temp-name ""))
                 (process-name (format "youtube-%s" id))
                 (buffer-name (format "*youtube-%s*" id))
                 (buffer (get-buffer-create buffer-name))
                 (process (start-process process-name buffer "youtube-dl" "-e" 
            (process-put process 'track track)
            (process-put process 'url url)
            (set-process-sentinel process 
                                  '(lambda (process event) (let ((buffer 
(process-buffer process))
(process-get process 'track))
(process-get process 'url)))
(with-current-buffer buffer
(string-match-p "finished" event)
                                                                 (let ((title 
(buffer-substring (point-min) (1- (line-end-position)))))
(emms-track-set track 'info-title title)
(emms-playlist-track-updated track)
(string-match-p "abnormal" event)
"youtube-dl failed: %s" url)))))))))))

05.09.2019, 21:52, "Mike Kazantsev" <address@hidden>:
> On Thu, 05 Sep 2019 20:40:14 +0300
> Konstantin Reich <address@hidden> wrote:
>>  Indeed the problem in the updating. For example, If I add the same
>>  url twice (emms-add-url), both urls are displayed correctly.
>>  However, I do not know how to properly update track.
>>  When i add (emms-track-updated track) just after (emms-track-set track 
>> 'info-title title) I get
>>  error in process sentinel: mapc: Symbol’s value as variable is void: track
>>  error in process sentinel: Symbol’s value as variable is void: track
>>  Which does not make any sense for me.
> It sounds kinda silly and obvious, but assuming that emms-track-set
> within buffer worked with buffer-local "track" set, and there's a
> kill-buffer right after it, maybe you put emms-track-updated after
> kill-buffer or outside of with-current-buffer by accident?
> If it's not that trivial, maybe double-check that emms-track-set didn't
> signal same errors and worst-case you can attack "track" to the process
> via process-put/process-get instead of using its buffer.
> Though not sure why buffer-locals won't work for same purpose.
> --
> Mike Kazantsev // fraggod.net

reply via email to

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