2017-06-25 21:33:19 +00:00
|
|
|
Importing music
|
|
|
|
================
|
|
|
|
|
|
|
|
From music directory on the server
|
|
|
|
----------------------------------
|
|
|
|
|
2018-07-01 09:33:55 +00:00
|
|
|
You can import music files in Funkwhale assuming they are located on the server
|
|
|
|
and readable by the Funkwhale application. Your music files should contain at
|
2018-05-21 17:55:06 +00:00
|
|
|
least an ``artist``, ``album`` and ``title`` tags, but we recommend you tag
|
|
|
|
it extensively using a proper tool, such as Beets or Musicbrainz Picard.
|
2017-06-25 21:33:19 +00:00
|
|
|
|
2017-07-17 20:00:32 +00:00
|
|
|
You can import those tracks as follows, assuming they are located in
|
|
|
|
``/srv/funkwhale/data/music``:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-10-20 14:40:34 +00:00
|
|
|
export LIBRARY_ID="<your_libary_id>"
|
|
|
|
python api/manage.py import_files $LIBRARY_ID "/srv/funkwhale/data/music/**/*.ogg" --recursive --noinput
|
2017-07-17 20:00:32 +00:00
|
|
|
|
|
|
|
When you use docker, the ``/srv/funkwhale/data/music`` is mounted from the host
|
|
|
|
to the ``/music`` directory on the container:
|
2017-06-25 21:33:19 +00:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-10-20 14:40:34 +00:00
|
|
|
export LIBRARY_ID="<your_libary_id>"
|
|
|
|
docker-compose run --rm api python manage.py import_files $LIBRARY_ID "/music/**/*.ogg" --recursive --noinput
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Library IDs are available in library urls or sharing link. In this example:
|
|
|
|
https://funkwhale.instance/content/libraries/769a2ae3-eb3d-4aff-9f94-2c4d80d5c2d1,
|
|
|
|
the library ID is 769a2bc3-eb1d-4aff-9f84-2c4d80d5c2d1
|
|
|
|
|
|
|
|
You can use only the first characters of the ID when calling the command, like that:
|
|
|
|
``export LIBRARY_ID="769a2bc3"``
|
2017-06-25 21:33:19 +00:00
|
|
|
|
2018-04-21 17:30:55 +00:00
|
|
|
The import command supports several options, and you can check the help to
|
|
|
|
get details::
|
|
|
|
|
|
|
|
docker-compose run --rm api python manage.py import_files --help
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
For the best results, we recommand tagging your music collection through
|
|
|
|
`Picard <http://picard.musicbrainz.org/>`_ in order to have the best quality metadata.
|
2017-06-26 19:56:24 +00:00
|
|
|
|
2017-06-25 21:33:19 +00:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
This command is idempotent, meaning you can run it multiple times on the same
|
|
|
|
files and already imported files will simply be skipped.
|
|
|
|
|
2017-06-26 19:56:24 +00:00
|
|
|
.. note::
|
|
|
|
|
2018-05-21 17:55:06 +00:00
|
|
|
At the moment, only Flac, OGG/Vorbis and MP3 files with ID3 tags are supported
|
2017-06-25 21:33:19 +00:00
|
|
|
|
2017-07-17 20:00:32 +00:00
|
|
|
|
2018-04-21 17:30:55 +00:00
|
|
|
.. _in-place-import:
|
|
|
|
|
|
|
|
In-place import
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
By default, the CLI-importer will copy imported files to Funkwhale's internal
|
|
|
|
storage. This means importing a 1Gb library will result in the same amount
|
|
|
|
of space being used by Funkwhale.
|
|
|
|
|
|
|
|
While this behaviour has some benefits (easier backups and configuration),
|
|
|
|
it's not always the best choice, especially if you have a huge library
|
|
|
|
to import and don't want to double your disk usage.
|
|
|
|
|
|
|
|
The CLI importer supports an additional ``--in-place`` option that triggers the
|
|
|
|
following behaviour during import:
|
|
|
|
|
2018-07-01 09:33:55 +00:00
|
|
|
1. Imported files are not store in Funkwhale anymore
|
2018-04-21 17:30:55 +00:00
|
|
|
2. Instead, Funkwhale will store the file path and use it to serve the music
|
|
|
|
|
|
|
|
Because those files are not managed by Funkwhale, we offer additional
|
|
|
|
configuration options to ensure the webserver can serve them properly:
|
|
|
|
|
|
|
|
- :ref:`setting-MUSIC_DIRECTORY_PATH`
|
|
|
|
- :ref:`setting-MUSIC_DIRECTORY_SERVE_PATH`
|
2017-07-17 20:00:32 +00:00
|
|
|
|
2018-04-21 17:30:55 +00:00
|
|
|
.. warning::
|
2017-07-17 20:00:32 +00:00
|
|
|
|
2018-04-21 17:30:55 +00:00
|
|
|
While in-place import is faster and less disk-space-hungry, it's also
|
|
|
|
more fragile: if, for some reason, you move or rename the source files,
|
|
|
|
Funkwhale will not be able to serve those files anymore.
|
2017-07-17 20:00:32 +00:00
|
|
|
|
2018-04-21 17:30:55 +00:00
|
|
|
Thus, be especially careful when you manipulate the source files.
|
2017-06-25 21:33:19 +00:00
|
|
|
|
2018-06-17 10:59:08 +00:00
|
|
|
We recommend you symlink all your music directories into ``/srv/funkwhale/data/music``
|
|
|
|
and run the `import_files` command from that directory. This will make it possible
|
2018-10-09 12:07:13 +00:00
|
|
|
to use multiple music directories, without any additional configuration
|
2018-06-17 10:59:08 +00:00
|
|
|
on the webserver side.
|
|
|
|
|
|
|
|
For instance, if you have a NFS share with your music mounted at ``/media/mynfsshare``,
|
|
|
|
you can create a symlink like this::
|
|
|
|
|
|
|
|
ln -s /media/mynfsshare /srv/funkwhale/data/music/nfsshare
|
|
|
|
|
|
|
|
And import music from this share with this command::
|
|
|
|
|
|
|
|
python api/manage.py import_files "/srv/funkwhale/data/music/nfsshare/**/*.ogg" --recursive --noinput --in-place
|
|
|
|
|
|
|
|
On docker setups, it will require a bit more work, because while the ``/srv/funkwhale/data/music`` is mounted
|
|
|
|
in containers, symlinked directories are not. To fix that, in your ``docker-compose.yml`` file, ensure each symlinked
|
|
|
|
directory is mounted as a volume as well::
|
|
|
|
|
|
|
|
celeryworker:
|
|
|
|
volumes:
|
|
|
|
- ./data/music:/music:ro
|
|
|
|
- ./data/media:/app/funkwhale_api/media
|
2018-07-06 18:44:47 +00:00
|
|
|
# add your symlinked dirs here
|
2018-06-17 10:59:08 +00:00
|
|
|
- /media/nfsshare:/media/nfsshare:ro
|
|
|
|
|
|
|
|
api:
|
|
|
|
volumes:
|
|
|
|
- ./data/music:/music:ro
|
|
|
|
- ./data/media:/app/funkwhale_api/media
|
2018-07-06 18:44:47 +00:00
|
|
|
# add your symlinked dirs here
|
2018-06-17 10:59:08 +00:00
|
|
|
- /media/nfsshare:/media/nfsshare:ro
|
|
|
|
|
|
|
|
|
2018-06-02 07:21:55 +00:00
|
|
|
Album covers
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Whenever possible, Funkwhale will import album cover, with the following precedence:
|
|
|
|
|
|
|
|
1. It will use the cover embedded in the audio files themeselves, if any (Flac/MP3 only)
|
|
|
|
2. It will use a cover.jpg or a cover.png file from the imported track directory, if any
|
|
|
|
3. It will fectch cover art from musicbrainz, assuming the file is tagged correctly
|
|
|
|
|
2017-06-25 21:33:19 +00:00
|
|
|
Getting demo tracks
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
If you do not have any music on your server but still want to test the import
|
|
|
|
process, you can call the following methods do download a few albums licenced
|
|
|
|
under creative commons (courtesy of Jamendo):
|
|
|
|
|
2017-07-17 20:00:32 +00:00
|
|
|
.. parsed-literal::
|
2017-06-25 21:33:19 +00:00
|
|
|
|
2017-07-17 20:00:32 +00:00
|
|
|
curl -L -o download-tracks.sh "https://code.eliotberriot.com/funkwhale/funkwhale/raw/|version|/demo/download-tracks.sh"
|
|
|
|
curl -L -o music.txt "https://code.eliotberriot.com/funkwhale/funkwhale/raw/|version|/demo/music.txt"
|
2017-06-25 21:33:19 +00:00
|
|
|
chmod +x download-tracks.sh
|
|
|
|
./download-tracks.sh music.txt
|
|
|
|
|
|
|
|
This will download a bunch of zip archives (one per album) under the ``data/music`` directory and unzip their content.
|
2018-04-13 20:47:55 +00:00
|
|
|
|
|
|
|
From other instances
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
Funkwhale also supports importing music from other instances. Please refer
|
|
|
|
to :doc:`federation` for more details.
|