Importing Existing Downloads into Lidarr

  1. Importing Existing Downloads into Lidarr
    1. Background
    2. 1. Find the album’s internal ID
    3. 2. Check the copy mode first
    4. 3. Run the import
    5. 4. Verify
    6. Gotchas

Importing Existing Downloads into Lidarr

Background

I keep my qBittorrent complete directory on my NAS (data/torrents/complete). When a download finishes, I want Lidarr to pick the album up and hard-link it into the library — no re-download, no duplicate data.

Lidarr 3.1 removed the old “Import Existing” command and the import-folders configuration entirely, which made the obvious paths dead ends. But the import pipeline still accepts an explicit path, so the whole thing is doable through the REST API. Here is the process, including the gotchas I hit.

1. Find the album’s internal ID

The album URL in the web UI uses the MusicBrainz UUID (foreignAlbumId), but the API uses the internal integer ID. They’re different — don’t paste the UUID from the URL into API calls.

# List artists, find the internal artist ID
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/artist" \
| jq '.[] | select(.artistName | test("jony"; "i")) | {id, artistName}'

# List that artist's albums
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/album?artistId=557" \
| jq '.[] | {id, title, releaseDate}'

2. Check the copy mode first

In 3.1.x the media-management settings moved out of the old /config/import endpoint (which now returns 404) into /config/mediamanagement. The hard-link setting is copyUsingHardlinks:

curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/config/mediamanagement" \
| jq '{copyUsingHardlinks, skipFreeSpaceCheckWhenImporting}'
# { "copyUsingHardlinks": true, ... }

With copyUsingHardlinks: true, import transfers use hard links (falling back to a real copy only if the filesystem can’t link — i.e. source and destination are on different filesystems).

3. Run the import

The command in 3.1.x is DownloadedAlbumsScan (the old ImportExistingCommand is gone). It takes the album folder’s absolute path as seen from inside the Lidarr container:

curl -sk -X POST -H "X-Api-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '{
"name": "DownloadedAlbumsScan",
"path": "/mnt/unas/data/torrents/complete/Jony - Список твоих мыслей (2019) [FLAC]",
"importMode": 0
}' \
"$LIDARR_URL/api/v1/command"

importMode is 0 = auto (follows copyUsingHardlinks), 1 = move, 2 = copy. Auto is what you want for hard links.

The response is a command object with an id and status: "started".

4. Verify

Poll the command, then confirm the tracks landed in the library:

# Command result
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/command/791772" \
| jq '{status, result}'

# Album statistics
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/album/3982" \
| jq '.statistics'

# Track file paths
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/trackfile?albumId=3982" \
| jq '.[].path'

Finally, confirm they’re actually hard links (matching inodes, link count 2) from a shell on the NAS:

ls -li '/mnt/unas/data/torrents/complete/Jony - Список твоих мыслей (2019) [FLAC]' \
'/mnt/unas/data/media/music/JONY (Russian artist)/Список твоих мыслей (2019)'

Since they’re hard links, deleting the complete/ folder afterwards is safe — the library keeps the data and nothing is freed on disk.

Gotchas