0

I'm trying to use the emms-state package to get a nice-looking description of the currently playing track in the mode line. It mostly works -- track name, artist, year, and current timestamp -- but I can't see how long the current track is.

 

I think the problem is that the emms-track-get function doesn't retrieve the info-playing-time key/variable. I can test this by editing the emms-track-description-function to try to retrieve info-playing-time, but the track listings in a playlist buffer do not show this.

 

Is there any way to fix this? I'm using emms-player-mpv as the only player, could that be the origin of this issue?

This answer to a similar post suggests "installing emms from the package repository. Not from the GNU site." Not quite sure what that means, but I'm using emms from MELPA.

EDIT: Meant emms-state, found here, not emms-status.

nonreligious
  • 473
  • 2
  • 14
  • Where does the `emms-status` package come from? I cannot find it on MELPA. – Fran Burstall Nov 18 '22 at 18:38
  • @FranBurstall Whoops, meant `emms-state`: https://github.com/alezost/emms-state.el . But the problem is independent of this package. – nonreligious Nov 19 '22 at 10:44
  • I cannot reproduce your issue: if I evaluate `(emms-track-get (emms-playlist-current-selected-track) 'info-playing-time)` in the scratch buffer, I get the track length. – Fran Burstall Nov 21 '22 at 17:59
  • @FranBurstall Hmm... I get `nil` when I do the same (while a track is playing), while e.g. `'info-artist` gives the correct value. Do I need something like `emms-info-libtag`, as in this [answer](https://emacs.stackexchange.com/a/45942/24188) (which I've realized is also by you!). – nonreligious Nov 23 '22 at 05:48
  • You probably need some `emms-info-*` loaded (I think the default these days is `emms-info-native` which has no external dependencies and is pretty good). – Fran Burstall Nov 23 '22 at 22:25
  • Hmm ... `emms-info-function` contained `emms-info-native` and `emms-info-cueinfo`, and adding `emms-info-exiftool` and `emms-info-tinytag` don't make a difference. – nonreligious Nov 24 '22 at 14:11
  • I am mystified then: any of these should populate `info-playing-time`. – Fran Burstall Nov 24 '22 at 20:30
  • @FranBurstall I've fixed my problem -- I don't think `emms-print-metadata` was available to me before, so I cloned the `emms` repo in order to `make` it. See my answer below. Thanks for your suggestions. – nonreligious Nov 25 '22 at 15:18

1 Answers1

0

After trying to add various different emms-info-functions, I found this thread and started working through the suggested solutions.

What I think has ended up working for me is:

  • Doing git clone https://git.savannah.gnu.org/git/emms.git to some local directory (which is what I think this post was suggesting).

  • As suggested in the thread, running make emms-print-metadata inside the emms directory, and moving emms-print-metadata via sudo cp src/emms-print-metadata /usr/local/bin/.

I am now able to do $ emms-print-metadata ~/Music/song.mp3 and get the artist name etc. and now the total time. Restarting Emacs to make sure emms is configured properly now results in the total time being shown in the mode-line, and (emms-track-get (emms-playlist-current-selected-track) 'info-playing-time) working when called via M-:.

I had actually found this answer describing the same procedure beforehand, although I thought that the problem described there was specific to emms-info-libtag.

Also, for anyone else using emms-mpv-player, the following might help when adding a new file (e.g. a recently downloaded podcast ep.) to a playlist:

(setq emms-player-mpv-update-metadata t)

EDIT

I realize now that the above is incomplete -- I need

(require 'emms-info-libtag)
(setq emms-info-functions '(emms-info-libtag)) 

as well, which I apparently tried at some point. This was after doing another emms-cache-reset and having all the time info disappear, (with the currently playing track being showing its time info via emms-player-mpv-update-metadata, but unplayed tracks being unaffected).

nonreligious
  • 473
  • 2
  • 14
  • 1
    Glad this all worked out for you. I did a little experimentation and it turns out that `emms-info-native` is not extracting the playing time (I am sure it used to). I shall report this to the emms devs. – Fran Burstall Nov 25 '22 at 20:14
  • @FranBurstall Ah good - glad it's not something specific to my setup. FWIW I had this issue on Emacs v 27.2 and now on 28.2, with emms version 20220908.122. – nonreligious Nov 26 '22 at 11:57