Navidrome Toolbox is a utility that enhances the functionality of Navidrome Music Server using Beets and custom logic.
It aims to maintain a well-organized music library by:
- Removing duplicate tracks while preserving play counts and ratings
- Avoiding the need for user interaction as much as possible
- Offering additional helpful tools for managing your Navidrome library
To set up "Navidrome Toolbox," deploy it as a Docker container alongside your existing Navidrome installation.
Important
This repository is work in progress. Features and documentation are not yet completed.
- Docker
- Navidrome Music Server 0.53.0 or later
Use following command to start the Docker container:
docker run --rm -it \
-v $(ND_DIR):/navidrome \
-v $(MUSIC_DIR):/music \
-v $(DATA_DIR):/data \
-e TZ=${TIMEZONE} \
-e ND_BASE_PATH=${ND_BASE_PATH} \
--entrypoint bash nd-toolbox
You are now inside the Navidrome Toolbox container, prepared to utilize its commands.
If you installed Navidrome Toolbox using a Docker GUI on a NAS or similar device, enter the container shell with:
docker exec -it nd-toolbox bash
Bind-mount the following local directories into the container:
Parameter | Description |
---|---|
MUSIC_DIR |
Run the container in background. If not set, the container runs in foreground. |
DATA_DIR |
A directory where temporary processing data and logs can be stored. |
ND_DIR |
The directory where your Navidrome database is located. |
Optionally set these environment variables:
Parameter | Description |
---|---|
TZ |
Set your timezone. If not set it defaults to Europe/Vienna . |
ND_BASE_PATH |
Base path of the music library within your Navidrome container. Defaults to /music/library . |
Remove files with unsupported extensions from your music library. This is useful to clean up your library before
importing it into Beets. Set the envinronment variable UNSUPPORTED_EXTENSIONS
to a list of extensions you want to
remove. Defaults to m4p mp4 mp2
.
make sh.remove-unsupported
By default it performs a dry-run, without actually moving files. Pass an DRY_RUN=false
argument to actually move
files. Moved files are moved to a removed-media
directory inside your DATA_DIR
.
make sh.remove-unsupported DRY_RUN=true
Import music into your internal Beets library. This is required for further processing.
make beet.import
To reset your internal Beets library, removing all imported music:
make beet.reset
Get a list of duplicates according to the default behaviour, matching MusicBrainz Track ID (mb_trackid
)
and Album ID (mb_albumid
).
make beet.duplicates
Merge annotations such as play count and rating within duplicates and store the result in the Navidrome database.
The command backups the navidrome database before merging annotations. To be safe always create an additional backup of your database manually.
make nd.merge-annotations
Evaluate which duplicates have the best criteria for keeping and can be kept while deleting others.
make nd.eval-deletable
The criteria to decide on the media file to keep is as follows:
- Media file is in an album, which already contains another media file which is keepable.
- Media files have equal filenames, but one has a numeric suffix, e.g., "song.mp3" and "song1.mp3". The one with the numeric suffix is considered less important and will be removed.
- Media file title and filename are compared with fuzzy search. Higher ratio is a keeper.
- Media file has one of the preferred file extensions
- Media file has a MusicBrainz recording ID.
- Media file has an artist record available in the Navidrome database.
- Media file has an album record available in the Navidrome database.
- Media file contains a album track number.
- Media file has a better bit rate than any of the other duplicate media files.
- Media file holds a release year.
This library is based on the important groundwork provided by the iTunes Navidrome Migration scripts.
Also, kudos to the Navidrome developers for building a music server that is here to stay.