1# mpvfs23[9P][9P wikipedia] file server for controlling [mpv][mpv web] playback.45## Status67Toy project for experimenting with [neinp][neinp source]. Currently8provides a very buggy, incomplete, and unfinished implementation of9[playlistfs][9front playlistfs]. To work properly a patch for mpv is10required [mpv](https://github.com/mpv-player/mpv/pull/8548).1112## Installation1314Install using `go install` as follows:1516 $ go install github.com/nmeum/mpvfs@latest1718## Usage1920This software relies on mpv's IPC mechanism. Currently, mpv must be21started separately. For instance, as:2223 $ mpv --keep-open=yes --idle --pause --input-ipc-server=/tmp/mpv-socket song.flac2425Afterwards, mpvfs itself must be started as:2627 $ ./mpvfs -a localhost:9999 /tmp/mpv-socket2829The created 9P server can than be mounted using any 9P implementation.30Examples are given below. On Plan 9 derivatives, it is possible to31partially control playback using the [games/jukebox][9front jukebox]32client for playlistfs.3334### *nix3536Several 9P implementations are available for Unix-like operating37systems. Most notably, [plan9port][plan9port source] provides38[9pfuse][9pfuse] a fuse-based implementation of 9P. Using 9pfuse, mount39the file server as follows:4041 $ 9pfuse 127.0.0.1:9999 /media/9p/4243Afterwards, interaction with the `playctl`, `playvol`, and `playlist`44files provided at the given mount point is possible. For instance, `echo45play >> /media/9p/playctl` will start playback. Please refer to the46[playlistfs manual][9front playlistfs] for more information on the47provided files.4849**Notes on v9fs:** The Linux kernel provides [v9fs][v9fs documentation],50an in-tree implementation of the 9P protocol. Unfortunately, this51implementation does not work correctly with playlistfs as it continues52reading data from files after EOF has been received which doesn't work53with playlistfs as it blocks until new data is available when the callee54tries to continue reading after EOF.5556### Plan 95758If you are running Plan 9 in QEMU you need to create a corresponding59`guestfwd` rule, e.g. `guestfwd=tcp:10.0.2.4:1234-cmd:"nc 127.0.0.1 9999"`.60If you want to use jukebox, you might also need to create61`/sys/lib/music/map`, refer to the [juke man page][9front juke] for more62information.6364Mount mpvfs on `/n/mpvfs` using `srv(4)`:6566 % srv -m net!10.0.2.4!1234 mpvfs /n/mpvfs6768If jukebox is available, add the resources to the `/mnt` union directory:6970 % bind -b /n/mpvfs/ /mnt/7172Finally, start jukefs and jukebox as follows:7374 % games/jukefs75 % games/jukebox7677Controlling playback through the buttons in the top left corner should78work, changing volume should also work fine. Everything else is a bit79wonky at the moment.8081## License8283This program is free software: you can redistribute it and/or modify it84under the terms of the GNU Affero General Public License as published by85the Free Software Foundation, either version 3 of the License, or (at86your option) any later version.8788This program is distributed in the hope that it will be useful, but89WITHOUT ANY WARRANTY; without even the implied warranty of90MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero91General Public License for more details.9293You should have received a copy of the GNU Affero General Public License94along with this program. If not, see <https://www.gnu.org/licenses/>.9596[9P wikipedia]: https://en.wikipedia.org/wiki/9P_(protocol)97[mpv web]: https://mpv.io/98[9front playlistfs]: http://man.9front.org/7/playlistfs99[neinp source]: https://git.sr.ht/~rbn/neinp100[9front jukebox]: http://man.9front.org/7/juke101[9front juke]: http://man.9front.org/7/juke102[v9fs documentation]: https://www.kernel.org/doc/html/latest/filesystems/9p.html103[plan9port source]: https://github.com/9fans/plan9port104[9pfuse]: https://9fans.github.io/plan9port/man/man4/9pfuse.html