On Mon, 09 Dec 2024 08:25:56 -0500 Yoni Rabkin <[email protected]> wrote:
> > I can access it through tramp(emacs) and add a file to emms > > playlist. > > As the result, in the playlist buffer i get a file, for example: > > /ssh:Server:/home/user/1.mp3 > > (One can use other protocols /rsync:, /sshx:, /sftp:) > > > > But emms-mpv does not play such files. > > I would like to ask a question is it possible to fix it? > > > > As i see it, there are two reasons why mpv doesn't play such files. > > (As i understand vlc also) > > 1. Mpv uses different naming scheme than tramp. > > So instead of /sftp: one should write sftp:// > > > > 2. mpv does not support protocols rsync, sshx, ssh only sftp > > > > I would suggest changing few lines in emms-player-mpv-start. > > (Although i did it through advice-add) > > > > --- emms-player-mpv.el 2024-12-02 17:19:18.807604784 +0100 > > +++ emms-player-mpv-new.el 2024-12-04 15:36:39.132959493 +0100 > > @@ -722,7 +722,10 @@ > > (setq emms-player-mpv-stopped nil) > > (emms-player-mpv-proc-playing nil) > > (let* > > - ((track-name (emms-track-get track 'name)) > > + ((name-origin (emms-track-get track 'name)) > > + (track-name (if (string-match > > "^/ssh:\\|^/sshx:\\|^/rsync:\\|^/sftp:" name-origin) > > + (replace-match "sftp://" nil nil name-origin) > > + name-origin)) > > (track-playlist-option > > (and emms-player-mpv-use-playlist-option > > (memq (emms-track-get track 'type) > > > > What would be better solution? > > Perhaps this is a good solution (taking the above into consideration); I > haven't looked into it yet. I would like to read Mike Kazantsev's view > on it first. I've never used emacs tramp mode myself, but it seem to make sense to translate track URLs passed to mpv there. One concern might be that it'd include an otherwise-legitimate filenames by accident, but I think chance of someone naming a file "/ssh:..." under root dir is low enough to probably not even bother making an option to disable it. I'd condense regexp to "^/\\(ssh\\|sshx\\|rsync\\|sftp\\):" - might express "/one-of-protocols:" intent a bit better, with an identical start/end character, but it should work fine either way of course. Also, if rsync's on the list, maybe all other ssh-related tramp access methods can be added too - plink, plinkx, scp, scpx, pscp, psftp, fcp. https://www.gnu.org/software/emacs/manual/html_node/tramp/Inline-methods.html https://www.gnu.org/software/emacs/manual/html_node/tramp/External-methods.html I think all the extra ones listed above basically mean "ssh connection follows" and for mpv that always translates to sftp:// method. Same as with tramp mode, never used sftp:// file paths myself either. As far as I can tell it'd be an URL that mpv passes to ffmpeg's libav as-is, and it's documented to use libssh to handle those. Afaik emacs uses OpenSSH for tramp mode, and libssh is a different ssh implementation from that, so its access might work differently from tramp mode due to emacs-side configuration, OpenSSH configuration, and more general differences between OpenSSH and libssh. (I think libssh does read e.g. ~/.ssh configs and pickup ssh-agent from env though, so should probably not give any surprises) I'd be a bit uneasy about giving mpv an ssh access to any ssh user not strictly locked to sftp tbh (which can be easily configured in openssh), but this doesn't enable any new access methods, as sftp:// URLs were implicitly supported by emms before, I think. > > My entire music collection is on the remote server, to which i have > > access trough ssh. > > I think of this as a file-system level issue. Why not mount the remote > directory instead? I also always just mounted stuff using sshfs, and have always been using it as a primary way for accessing any media files or often editing remote configuration files as well. (as using NFS was always more difficult and not required performance-wise) But that's just me, tramp mode might have some advantages over that, idk. -- Mike Kazantsev // fraggod.net
