From a85862381649c1ea203dded468831383a600dc95 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Sat, 20 Oct 2018 16:40:34 +0200
Subject: [PATCH] Fix # #562: Document how to find and use library id when
 importing files in CLI

---
 changes/changelog.d/562.doc |  1 +
 docs/importing-music.rst    | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100644 changes/changelog.d/562.doc

diff --git a/changes/changelog.d/562.doc b/changes/changelog.d/562.doc
new file mode 100644
index 00000000..664a94f0
--- /dev/null
+++ b/changes/changelog.d/562.doc
@@ -0,0 +1 @@
+Document how to find and use library id when importing files in CLI (#562)
diff --git a/docs/importing-music.rst b/docs/importing-music.rst
index 4b4ea7c1..965b2068 100644
--- a/docs/importing-music.rst
+++ b/docs/importing-music.rst
@@ -14,14 +14,25 @@ You can import those tracks as follows, assuming they are located in
 
 .. code-block:: bash
 
-    python api/manage.py import_files "/srv/funkwhale/data/music/**/*.ogg" --recursive --noinput
+    export LIBRARY_ID="<your_libary_id>"
+    python api/manage.py import_files $LIBRARY_ID "/srv/funkwhale/data/music/**/*.ogg" --recursive --noinput
 
 When you use docker, the ``/srv/funkwhale/data/music`` is mounted from the host
 to the ``/music`` directory on the container:
 
 .. code-block:: bash
 
-    docker-compose run --rm api python manage.py import_files "/music/**/*.ogg" --recursive --noinput
+    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"``
 
 The import command supports several options, and you can check the help to
 get details::
-- 
GitLab