Debian Codegraph @

docs/plugins/plexupdate.rst

raw
1 PlexUpdate Plugin
2 =================
3
4 The ``plexupdate`` plugin automatically refreshes the music library on your
5 Plex_ Media Server whenever your beets library changes.
6
7 Why Use the PlexUpdate Plugin?
8 ------------------------------
9
10 The PlexUpdate plugin allows you to:
11
12 - Keep the music library on your Plex Media Server in sync with beets
13 - Avoid having to trigger a library scan in Plex manually
14 - Refresh Plex automatically after imports, edits, moves, and other commands
15 that modify your library
16
17 Once configured, the refresh happens automatically whenever a beets command
18 changes your library, so you don't need to think about it.
19
20 Requirements
21 ------------
22
23 - A running Plex Media Server instance that beets can reach over the network
24
25 Installation
26 ------------
27
28 To use the ``plexupdate`` plugin, first enable it in your configuration (see
29 :ref:`using-plugins`). Then, install ``beets`` with the ``plexupdate`` extra:
30
31 .. code-block:: bash
32
33 pip install "beets[plexupdate]"
34
35 Authentication
36 --------------
37
38 Plex requires an authentication token for API requests. The easiest way to
39 obtain one is the interactive login:
40
41 .. code-block:: bash
42
43 beet plexupdate --auth
44
45 This opens a browser window where you can log in to your Plex account and
46 authorize beets. After a successful login, the access token is stored in the
47 token file (see the ``tokenfile`` option below), and beets uses it to update
48 your library on subsequent runs.
49
50 .. dropdown:: Alternative Authentication
51
52 Alternatively, the ``token`` configuration option provides a legacy way to
53 authenticate: it accepts a token from your Plex account directly (see Plex's
54 `documentation about tokens`_). It should not be used for new setups, though --
55 run ``beet plexupdate --auth`` instead, which stores the token in the token
56 file and keeps it out of your configuration.
57
58 Basic Usage
59 -----------
60
61 Enable the ``plexupdate`` plugin (see :ref:`using-plugins`) and, optionally,
62 configure your Plex server as described below. Whenever a beets command modifies
63 your library (for example ``beet import``, ``beet modify``, or ``beet move``)
64 the plugin tells Plex to refresh its music library when the command finishes.
65
66 You can verify the refresh in the Plex web interface: the activity view of your
67 music library shows the scan started by beets.
68
69 Configuration
70 -------------
71
72 The plugin is configured under the ``plex:`` section!
73
74 Default
75 ~~~~~~~
76
77 .. code-block:: yaml
78
79 plex:
80 host: localhost
81 port: 32400
82 library_name: Music
83 secure: no
84 ignore_cert_errors: no
85 tokenfile: plex_token.json
86
87 .. conf:: host
88 :default: localhost
89
90 The hostname or IP address of the Plex Media Server.
91
92 .. conf:: port
93 :default: 32400
94
95 The port on which the Plex Media Server listens.
96
97 .. conf:: library_name
98 :default: Music
99
100 The name of the Plex library to refresh.
101
102 .. conf:: secure
103 :default: no
104
105 Use HTTPS instead of HTTP when connecting to the Plex Media Server.
106 Enable this when your server is only reachable over a secure connection,
107 for example through a reverse proxy.
108
109 .. conf:: ignore_cert_errors
110 :default: no
111
112 Ignore TLS certificate errors when ``secure`` is enabled. Useful when
113 the server uses a self-signed certificate.
114
115 .. conf:: tokenfile
116 :default: plex_token.json
117
118 The file where the token obtained via ``beet plexupdate --auth`` is
119 stored together with the client identifier used for the login. The file
120 is created in the beets configuration directory.
121
122 .. conf:: token
123 :default: ""
124
125 .. deprecated:: 2.14 Use ``beet plexupdate --auth`` instead.
126
127 A Plex token that overrides the token stored by ``beet plexupdate
128 --auth``. Kept for legacy configurations that cannot use the interactive
129 login, for example Plex Home accounts. This value is never written to the
130 token file and is redacted in beets' configuration listings.
131
132 .. _documentation about tokens: https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
133
134 .. _plex: https://www.plex.tv/