mihaiolteanu / vuiet

The music player and explorer for Emacs
https://mihaiolteanu.me/vuiet
GNU General Public License v3.0
277 stars 15 forks source link

vuiet-info-playing-track-album works once #73

Open kpanic opened 8 months ago

kpanic commented 8 months ago

Hello @mihaiolteanu 👋🏾 First of all thank you for this wonderful program, I am really enjoying it!

if I invoke vuiet-info-playing-track-album to see the current playing track vuiet initially opens the correct buffer. After another track is played, I see in the *Messages* buffer these error messages:

error in process filter: s-split: Wrong type argument: stringp, nil
error in process filter: Wrong type argument: stringp, nil

And if I re-invoke vuiet-info-playing-track-album it brings me to the previous track. Always that one.

I installed the package via MELPA, should I point to the git version?

Thanks in advance!

kpanic commented 8 months ago

I am also getting

[error] request--callback: peculiar error: 400
[error] request-default-error-callback: http://ws.audioscrobbler.com/2.0/ error
Error running timer ‘vuiet--scrobble-track’: (wrong-type-argument stringp t)

I am not sure if this is relevant.

mihaiolteanu commented 8 months ago

Hello Marco,

Does it happen on all albums or on a specific one?

kpanic commented 8 months ago

not 100% sure, but It looks like it's happening on all the albums

mihaiolteanu commented 8 months ago

I do get a similar error for scrobbling, regardless of how I play the song,

[error] request--callback: peculiar error: 403
[error] request-default-error-callback: http://ws.audioscrobbler.com/2.0/ error
Error running timer ‘vuiet--scrobble-track’: (wrong-type-argument stringp t)

Scrobbling is just the process of saving what you've listened to last.fm (for history purposes). It does not affect the player, though. The data sent to last.fm seems correct from my local debugging. I did get issues in the past with scrobbling from last.fm.

Just to be sure we're not confusing things, the vuiet-info-playing-track-album command opens a buffer displaying the album of the currently playing song. It's purpose is to choose another song from the album, if you so wish. Nothing more, nothing less. Maybe you are looking for vuiet-play-album command, instead, to play all the songs from a given album?

kpanic commented 8 months ago

Hello and happy new year @mihaiolteanu ! 🎉 Yup, vuiet-info-playing-track-album opens a buffer with the song that is played, however if the song changes and I redo vuiet-info-playing-track-album that buffer of the song playing does not change. The same, as far as I remember happens when checking the playing album. So the buffer looks like it's not refreshed when the song change.

A more significant "scenario" can be:

Hope that clears it up.

Thanks!

mihaiolteanu commented 8 months ago

Hello Marco,

Unfortunately I cannot reproduce this issue. Both vuiet-info-playing-track-album and vuiet-playing-artist-info open up buffers with the correct info for me, both when I let the song finish or when I skip the song with vuiet-next.

Does (vuiet--playing-track) return the correct info for you? That is, the currently playing track?

Mihai

kpanic commented 8 months ago

@mihaiolteanu it does for a short time. i.e.

And after this error occurs:

error in process filter: s-split: Wrong type argument: stringp, nil
error in process filter: Wrong type argument: stringp, nil

and then (vuiet--playing-track) returns not correct information.

kpanic commented 8 months ago

And then, sometimes. (vuiet--playing-track) It prints again correctly the track. Can I enable some backtrace thing? It might help to diagnose the issue?

Thanks a lot man for the support

mihaiolteanu commented 8 months ago

Do copy/paste the return info from (vuiet--playing-track) (maybe we're getting some special characters from last.fm that vuiet doesn't know how to parse?!).

Yes, you could use edebug (you eval the function with C-u C-M-x to enable debugging, C-x C-e to disable it) on vuiet--play and see if it sets the track correctly. Or you could check the vuiet-info-playing-track-album function with edebug and check if all the parameters are set correctly.

Edit: updated the command to enable debugging on a particular function

kpanic commented 8 months ago

I was able to obtain

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  edebug(error (wrong-type-argument stringp nil))
  split-string(nil "=" nil)
  s-split("=" nil)
  vuiet--track-from-youtube-url(nil)
  vuiet--mpv-playing-track()
  #f(compiled-function (event) #<bytecode 0xc3c6b15c7b6d574>)(((event . "file-loaded")))
  run-hook-with-args(#f(compiled-function (event) #<bytecode 0xc3c6b15c7b6d574>) ((event . "file-loaded")))
  mpv--tq-process-buffer((nil #<process mpv-socket> . #<buffer  tq-temp-mpv-socket>))
  mpv--tq-process-buffer((nil #<process mpv-socket> . #<buffer  tq-temp-mpv-socket>))
  mpv--tq-filter((nil #<process mpv-socket> . #<buffer  tq-temp-mpv-socket>) "{\"event\":\"audio-reconfig\"}\n{\"event\":\"file-loaded\"}...")
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_25>(#<process mpv-socket> "{\"event\":\"audio-reconfig\"}\n{\"event\":\"file-loaded\"}...")
  edebug--recursive-edit(before)
  edebug--display-1(nil 0 before)
  edebug--display(nil 0 before)
  edebug-debugger(0 before nil)
  edebug-before(0)
  (edebug-after (edebug-before 0) 1 (vuiet-info-playing-track-album))
  (closure (t) nil (edebug-after (edebug-before 0) 1 (vuiet-info-playing-track-album)))()
  edebug-default-enter(edebug-anon14 nil (closure (t) nil (edebug-after (edebug-before 0) 1 (vuiet-info-playing-track-album))))
  edebug-default-enter(edebug-anon14 nil (closure (t) nil (edebug-after (edebug-before 0) 1 (vuiet-info-playing-track-album))))
  edebug-enter(edebug-anon14 nil (closure (t) nil (edebug-after (edebug-before 0) 1 (vuiet-info-playing-track-album))))
  (progn (edebug-enter 'edebug-anon14 nil #'(lambda nil (edebug-after (edebug-before 0) 1 (vuiet-info-playing-track-album)))))
  (let ((print-level nil) (print-length nil)) (progn (edebug-enter 'edebug-anon14 nil #'(lambda nil (edebug-after (edebug-before 0) 1 (vuiet-info-playing-track-album))))))
  (setq elisp--eval-defun-result (let ((print-level nil) (print-length nil)) (progn (edebug-enter 'edebug-anon14 nil #'(lambda nil (edebug-after (edebug-before 0) 1 (vuiet-info-playing-track-album)))))))
  elisp--eval-defun()
  #<subr eval-defun>(nil)
  edebug--eval-defun(#<subr eval-defun> (4))
  apply(edebug--eval-defun #<subr eval-defun> (4))
  #f(advice edebug--eval-defun :around #<subr eval-defun>)((4))
  ad-Advice-eval-defun(#f(advice edebug--eval-defun :around #<subr eval-defun>) (4))
  apply(ad-Advice-eval-defun #f(advice edebug--eval-defun :around #<subr eval-defun>) (4))
  eval-defun((4))
  funcall-interactively(eval-defun (4))
  command-execute(eval-defun)

while doing C-u C-M-x on vuiet-info-playing-track-album

does it help? 🤔

Edit: this is my mpv version

$ mpv --version
mpv 0.36.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
 built on Sun Jul 23 05:49:29 2023
libplacebo version: v5.264.1
FFmpeg version: n6.1
FFmpeg library versions:
   libavutil       58.2.100 (runtime 58.29.100)
   libavcodec      60.3.100 (runtime 60.31.102)
   libavformat     60.3.100 (runtime 60.16.100)
   libswscale      7.1.100 (runtime 7.5.100)
   libavfilter     9.3.100 (runtime 9.12.100)
   libswresample   4.10.100 (runtime 4.12.100)
kpanic commented 8 months ago

Oh, one other note. I am using

(setq vuiet-youtube-dl-command "yt-dlp")`

as a vuiet-youtube-dl-command. I am wondering if it might make a difference..

mihaiolteanu commented 8 months ago

Yes, I've officially switched to yt-dlp too with the latest commit.

Ok, either mpv integration issue or the track is not added to the list properly,

Can you eval (that is, C-x C-e) these in a scratch buffer, or directly in the vuiet.el buffer,

(mpv-get-property "filename") 

(this should return the youtube watch id, like "watch?v=gOU_zWdhAoE"

and

(vuiet--track-from-youtube-url
   (mpv-get-property "filename"))

(this should return the name of the song for that id, saved previously by vuiet)

kpanic commented 8 months ago

This is the return value of (mpv-get-property "filename") "watch?v=PTAacByc5wA"

and

(vuiet--track-from-youtube-url
   (mpv-get-property "filename"))
#s(vuiet-track "Tiromancino" "Come l'aria" "4:47")

Maybe it's the apostrophe? ' 🤔

If you have other debugging hints please share. I would be glad to help.

mihaiolteanu commented 8 months ago

The edebug output from above says the vuiet--track-from-youtube-url receives a nil argument, though (mpv-get-property "filename") doesn't return a nil argument, but a proper track.

Well...

kpanic commented 8 months ago

I can live with it, but yes, it's weird 🤷🏾‍♂️ Thanks again for all the support 🙇🏾

kpanic commented 8 months ago

Hey there, I was able to collect a little bit more info:

I did:

  1. vuiet-play-track-search and searched for Abitudine by Subsonica
  2. I put edebug on (vuiet-info-playing-track-album) and I had the same nil backtrace.
  3. I did vuiet--playing-track and it was nil.
  4. I did vuiet-info-playing-track-album and it was nil. Usually I get at least one successful lookup for the album but in this case it does not work.

PS: Hope you like the song!

mihaiolteanu commented 8 months ago

Nice, but I don't get the same results...

(vuiet--playing-track)
#s(vuiet-track "Subsonica" "Abitudine" "3:26")
(vuiet-info-playing-track-album)

Jan05-110303

The plot thickens, then... :))

kpanic commented 8 months ago

eheh. ;)

By the way, what mpv version do you have?

mihaiolteanu commented 8 months ago

mpv 0.36.0