Debian Codegraph @

docs/plugins/bpd.rst

raw
1 BPD Plugin
2 ==========
3
4 BPD is a music player using music from a beets library. It runs as a daemon and
5 implements the MPD protocol, so it's compatible with all the great MPD clients
6 out there. I'm using Theremin_, gmpc_, Sonata_, and Ario_ successfully.
7
8 .. _ario: https://sourceforge.net/projects/ario-player/
9
10 .. _gmpc: https://gmpc.fandom.com/wiki/Gnome_Music_Player_Client
11
12 .. _sonata: https://www.nongnu.org/sonata/
13
14 .. _theremin: https://github.com/TheStalwart/Theremin
15
16 Dependencies
17 ------------
18
19 Before you can use BPD, you'll need the media library called GStreamer_ (along
20 with its Python bindings) on your system.
21
22 - On Mac OS X, you can use Homebrew_. Run ``brew install gstreamer
23 gst-plugins-base pygobject3``.
24 - On Linux, you need to install GStreamer 1.0 and the GObject bindings for
25 python. Under Ubuntu, they are called ``python-gi`` and ``gstreamer1.0``.
26
27 You will also need the various GStreamer plugin packages to make everything
28 work. See the :doc:`/plugins/chroma` documentation for more information on
29 installing GStreamer plugins.
30
31 Once you have system dependencies installed, install ``beets`` with ``bpd``
32 extra which installs Python bindings for ``GStreamer``:
33
34 .. code-block:: console
35
36 pip install "beets[bpd]"
37
38 .. _gstreamer: https://gstreamer.freedesktop.org/
39
40 .. _homebrew: https://brew.sh
41
42 Usage
43 -----
44
45 To use the ``bpd`` plugin, first enable it in your configuration (see
46 :ref:`using-plugins`). Then, you can run BPD by invoking:
47
48 ::
49
50 $ beet bpd
51
52 Fire up your favorite MPD client to start playing music. The MPD site has `a
53 long list of available clients`_. Here are my favorites:
54
55 .. _a long list of available clients: https://mpd.fandom.com/wiki/Clients
56
57 - Linux: gmpc_, Sonata_
58 - Mac: Theremin_
59 - Windows: I don't know. Get in touch if you have a recommendation.
60 - iPhone/iPod touch: Rigelian_
61
62 .. _rigelian: https://www.rigelian.net/
63
64 One nice thing about MPD's (and thus BPD's) client-server architecture is that
65 the client can just as easily on a different computer from the server as it can
66 be run locally. Control your music from your laptop (or phone!) while it plays
67 on your headless server box. Rad!
68
69 Configuration
70 -------------
71
72 To configure the plugin, make a ``bpd:`` section in your configuration file. The
73 available options are:
74
75 - **host**: Default: Bind to all interfaces.
76 - **port**: Default: 6600
77 - **password**: Default: No password.
78 - **volume**: Initial volume, as a percentage. Default: 100
79 - **control_port**: Port for the internal control socket. Default: 6601
80
81 Here's an example:
82
83 ::
84
85 bpd:
86 host: 127.0.0.1
87 port: 6600
88 password: seekrit
89 volume: 100
90
91 Implementation Notes
92 --------------------
93
94 In the real MPD, the user can browse a music directory as it appears on disk. In
95 beets, we like to abstract away from the directory structure. Therefore, BPD
96 creates a "virtual" directory structure (artist/album/track) to present to
97 clients. This is static for now and cannot be reconfigured like the real on-disk
98 directory structure can. (Note that an obvious solution to this is just string
99 matching on items' destination, but this requires examining the entire library
100 Python-side for every query.)
101
102 BPD plays music using GStreamer's ``playbin`` player, which has a simple API but
103 doesn't support many advanced playback features.
104
105 Differences from the real MPD
106 -----------------------------
107
108 BPD currently supports version 0.16 of `the MPD protocol`_, but several of the
109 commands and features are "pretend" implementations or have slightly different
110 behaviour to their MPD equivalents. BPD aims to look enough like MPD that it can
111 interact with the ecosystem of clients, but doesn't try to be a fully-fledged
112 MPD replacement in terms of its playback capabilities.
113
114 .. _the mpd protocol: https://mpd.readthedocs.io/en/latest/protocol.html
115
116 These are some of the known differences between BPD and MPD:
117
118 - BPD doesn't currently support versioned playlists. Many clients, however, use
119 plchanges instead of playlistinfo to get the current playlist, so plchanges
120 contains a dummy implementation that just calls playlistinfo.
121 - Stored playlists aren't supported (BPD understands the commands though).
122 - The ``stats`` command always send zero for ``playtime``, which is supposed to
123 indicate the amount of time the server has spent playing music. BPD doesn't
124 currently keep track of this.
125 - The ``update`` command regenerates the directory tree from the beets database
126 synchronously, whereas MPD does this in the background.
127 - Advanced playback features like cross-fade, ReplayGain and MixRamp are not
128 supported due to BPD's simple audio player backend.
129 - Advanced query syntax is not currently supported.
130 - Clients can't use the ``tagtypes`` mask to hide fields.
131 - BPD's ``random`` mode is not deterministic and doesn't support priorities.
132 - Mounts and streams are not supported. BPD can only play files from disk.
133 - Stickers are not supported (although this is basically a flexattr in beets
134 nomenclature so this is feasible to add).
135 - There is only a single password, and is enabled it grants access to all
136 features rather than having permissions-based granularity.
137 - Partitions and alternative outputs are not supported; BPD can only play one
138 song at a time.
139 - Client channels are not implemented.