Debian Codegraph @

docs/plugins/ipfs.rst

raw
1 IPFS Plugin
2 ===========
3
4 The ``ipfs`` plugin makes it easy to share your library and music with friends.
5 The plugin uses ipfs_ for storing the library and file content.
6
7 .. _ipfs: https://about.ipfs.io/
8
9 Installation
10 ------------
11
12 This plugin requires go-ipfs_ to be running as a daemon and that the associated
13 ``ipfs`` command is on the user's ``$PATH``.
14
15 .. _go-ipfs: https://github.com/ipfs/kubo
16
17 Once you have the client installed, enable the ``ipfs`` plugin in your
18 configuration (see :ref:`using-plugins`).
19
20 Usage
21 -----
22
23 This plugin can store and retrieve music individually, or it can share entire
24 library databases.
25
26 Adding
27 ~~~~~~
28
29 To add albums to ipfs, making them shareable, use the ``-a`` or ``--add`` flag.
30 If used without arguments it will add all albums in the local library. When
31 added, all items and albums will get an "ipfs" field in the database containing
32 the hash of that specific file/folder. Newly imported albums will be added
33 automatically to ipfs by default (see below).
34
35 Retrieving
36 ~~~~~~~~~~
37
38 You can give the ipfs hash for some music to a friend. They can get that album
39 from ipfs, and import it into beets, using the ``-g`` or ``--get`` flag. If the
40 argument passed to the ``-g`` flag isn't an ipfs hash, it will be used as a
41 query instead, getting all albums matching the query.
42
43 Sharing Libraries
44 ~~~~~~~~~~~~~~~~~
45
46 Using the ``-p`` or ``--publish`` flag, a copy of the local library will be
47 published to ipfs. Only albums/items with ipfs records in the database will
48 published, and local paths will be stripped from the library. A hash of the
49 library will be returned to the user.
50
51 A friend can then import this remote library by using the ``-i`` or ``--import``
52 flag. To tag an imported library with a specific name by passing a name as the
53 second argument to ``-i,`` after the hash. The content of all remote libraries
54 will be combined into an additional library as long as the content doesn't
55 already exist in the joined library.
56
57 When remote libraries has been imported you can search them by using the ``-l``
58 or ``--list`` flag. The hash of albums matching the query will be returned, and
59 this can then be used with ``-g`` to fetch and import the album to the local
60 library.
61
62 Ipfs can be mounted as a FUSE file system. This means that music in a remote
63 library can be streamed directly, without importing them to the local library
64 first. If the ``/ipfs`` folder is mounted then matching queries will be sent to
65 the :doc:`/plugins/play` using the ``-m`` or ``--play`` flag.
66
67 Configuration
68 -------------
69
70 The ipfs plugin will automatically add imported albums to ipfs and add those
71 hashes to the database. This can be turned off by setting the ``auto`` option in
72 the ``ipfs:`` section of the config to ``no``.
73
74 If the setting ``nocopy`` is true (defaults false) then the plugin will pass the
75 ``--nocopy`` option when adding things to ipfs. If the filestore option of ipfs
76 is enabled this will mean files are neither removed from beets nor copied
77 somewhere else.