nd-backerupper/README.md

2.8 KiB

A CLI tool to manage Navidrome annotations persistently.

Helps backing up (and restoring) annotation data from Navidrome databases. Aimed at mp3 files.

Table of Contents

Introduction

This script facilitates backups of the Navidrome annotation data (playcount, rating, starred) for mp3 files. This persistence only depends on the actual mp3 files in question (so no relative filepaths determining the entire database state). It's great for when you want to have that annotation data actually stored somewhere, as opposed to having it be entirely dependent on the whims of the Navidrome db.

The Export functionality works by writing to 3 custom 'TXXX' ID3 tags - which are stored as metadata on the music file itself. Similarly, Importing reads these data from the music files, and adds the appropriate entries in the Navidrome database.

Usage

There's a few optional arguments, and one mandatory one:

  • -u | --user : the username(or real name) of the Navidrome user for which annotations should be managed.
  • -d | --db : path to the Navidrome database file.
  • -p | --path (import only): path to the root of your music folder.
  • -f | --replace-navidrome: substitution to make between Navidrome paths and actual paths; Navidrome component. See substitution.
  • -t | --replace-real: substitution to make between Navidrome paths and actual paths; real component. See substitution.
  • import|export : whether to import annotations (from file -> db) or export them (from db -> file). Note that importing is destructive, that is, it will overwrite existing annotation data.

Substitution

As most Navidrome installations live within a Docker environment, generally with a mounted music folder, the filepaths Navidrome sees may not line up with the actual folder structure. For these cases, the flag -r | --replace can be used to 'translate' between Docker environment and real folder structure.

An example: suppose your music folder lives in /data/music and your Navidrome configuration has this folder mounted under /media/drive/music, like so:

...
    volumes:
     - /data/music:/media/drive/music:ro
...

Without the replace flag, backerupper would not be able to find your music files - as it would read the Navidrome database and try to look under /media/drive/music - which may or may not exist (but in any case does not contain your music files). By instead using backeruppry.py -f '/media/drive/' -t '/data/, backerupper will translate these paths appropriately.

Keep in mind that this is a very limited feature, using essentially direct substitution. Results may vary - be sure make Backups of your Navidrome database.