1# mpvfs 2 3[9P][9P wikipedia] file server for controlling [mpv][mpv web] playback. 4 5## Status 6 7Toy project for experimenting with [neinp][neinp source]. Currently 8provides a very buggy, incomplete, and unfinished implementation of 9[playlistfs][9front playlistfs]. To work properly a patch for mpv is 10required [mpv](https://github.com/mpv-player/mpv/pull/8548). 11 12## Installation 13 14Install using `go install` as follows: 15 16 $ go install github.com/nmeum/mpvfs@latest 17 18## Usage 19 20This software relies on mpv's IPC mechanism. Currently, mpv must be 21started separately. For instance, as: 22 23 $ mpv --keep-open=yes --idle --pause --input-ipc-server=/tmp/mpv-socket song.flac 24 25Afterwards, mpvfs itself must be started as: 26 27 $ ./mpvfs -a localhost:9999 /tmp/mpv-socket 28 29The created 9P server can than be mounted using any 9P implementation. 30Examples are given below. On Plan 9 derivatives, it is possible to 31partially control playback using the [games/jukebox][9front jukebox] 32client for playlistfs. 33 34### *nix 35 36Several 9P implementations are available for Unix-like operating 37systems. Most notably, [plan9port][plan9port source] provides 38[9pfuse][9pfuse] a fuse-based implementation of 9P. Using 9pfuse, mount 39the file server as follows: 40 41 $ 9pfuse 127.0.0.1:9999 /media/9p/ 42 43Afterwards, interaction with the `playctl`, `playvol`, and `playlist` 44files provided at the given mount point is possible. For instance, `echo 45play >> /media/9p/playctl` will start playback. Please refer to the 46[playlistfs manual][9front playlistfs] for more information on the 47provided files. 48 49**Notes on v9fs:** The Linux kernel provides [v9fs][v9fs documentation], 50an in-tree implementation of the 9P protocol. Unfortunately, this 51implementation does not work correctly with playlistfs as it continues 52reading data from files after EOF has been received which doesn't work 53with playlistfs as it blocks until new data is available when the callee 54tries to continue reading after EOF. 55 56### Plan 9 57 58If you are running Plan 9 in QEMU you need to create a corresponding 59`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 create 61`/sys/lib/music/map`, refer to the [juke man page][9front juke] for more 62information. 63 64Mount mpvfs on `/n/mpvfs` using `srv(4)`: 65 66 % srv -m net!10.0.2.4!1234 mpvfs /n/mpvfs 67 68If jukebox is available, add the resources to the `/mnt` union directory: 69 70 % bind -b /n/mpvfs/ /mnt/ 71 72Finally, start jukefs and jukebox as follows: 73 74 % games/jukefs 75 % games/jukebox 76 77Controlling playback through the buttons in the top left corner should 78work, changing volume should also work fine. Everything else is a bit 79wonky at the moment. 80 81## License 82 83This program is free software: you can redistribute it and/or modify it 84under the terms of the GNU Affero General Public License as published by 85the Free Software Foundation, either version 3 of the License, or (at 86your option) any later version. 87 88This program is distributed in the hope that it will be useful, but 89WITHOUT ANY WARRANTY; without even the implied warranty of 90MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero 91General Public License for more details. 92 93You should have received a copy of the GNU Affero General Public License 94along with this program. If not, see <https://www.gnu.org/licenses/>. 95 96[9P wikipedia]: https://en.wikipedia.org/wiki/9P_(protocol) 97[mpv web]: https://mpv.io/ 98[9front playlistfs]: http://man.9front.org/7/playlistfs 99[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