rombat / musicbee-navidrome-sync

CLI tool to sync a Navidrome DB with data from a MusicBee DB (playcounts, ratings, loved tracks, last played date...)
GNU General Public License v3.0
21 stars 2 forks source link
musicbee navidrome sync

MusicBee to Navidrome Sync (MBNDS)

🎶 Preamble

I've been using MusicBee for more than a decade. That means years of playcounts, ratings, loved tracks and so on.
When I set up myself a Navidrome server, I didn't want to lose all those years of data, so I decided to do something to import them. And I actually still use MusicBee, I only use Navidrome when I'm not home, so I wanted to be able to sync my local ratings/playcounts etc. from time to time. Hence this project. It's probably a niche use case, but who knows, it can be useful to somebody?

🤔 Purpose

MusicBee to Navidrome Sync allows you to:

❔ How to use it

  1. First, you need MusicBee 3.5 with its language set as English and Additional Tagging & Reporting Tools plugin installed
  2. Once it's done, select Music under the Collection menu. Then click on MusicBee > Tools > Additional Tagging Tools > Library Report... to export library data in a CSV
  3. Here, you have to select tags that will be exported as headers for your CSV. You need to select at least the following ones for MBNDS to work properly:
    • <File Path>
    • <Filename>
    • <Folder>
    • Title
    • Last Played
    • Play Count
    • Rating
    • Love
    • Skip Count
  4. Click on Preview, MusicBee will scan your entire collection, so it can take some time depending on its size. Once it's done, select CSV in Format (in necessary), click on Export and name your file MusicBee_Export.csv
  5. Shutdown Navidrome properly. This is mandatory to avoid backing up its database while there's still operations going on with it.
  6. Once Navidrome is shut down, backup its database file, navidrome.db. Its location is usually in navidrome /data folder. You can back up it either by copying it or with sqlite3 CLI if installed (sqlite3 <path to original file> ".timeout 30000" ".backup <path to backup file>" for instance). If you back it up by copying, you can also back up navidrome.db-shm or navidrome.db-wal somewhere too if present, just for precaution.
  7. Download this repository latest release .exe
  8. Copy only navidrome.db and MusicBee_Export.csv in the same folder as this .exe (or you can provide pathes with CLI, see Commands below).
  9. Run the command you want to run (, see Commands below), your database file will be updated
  10. Once it's done, go back to navidrome /data folder where you found navidrome.db and overwrite it with the updated one. Remove any remaining navidrome.db-shm or navidrome.db-wal or you will probably get some errors on navidrome startup.
  11. Restart Navidrome, and that's it !

⌨️ Commands

All commands must be run this way: musicbee-navidrome-sync.exe [command name] [options].
For instance, musicbee-navidrome-sync.exe fullSync -h

fullSync

Syncs playcounts, track ratings, loved tracks and last played date from MusicBee DB to Navidrome DB. Runs on tracks first, then updates albums and artists accordingly.

Available options :

albumsSync

Updates all albums playcounts and ratings based on existing Navidrome DB.

artistsSync

Updates all artists playcounts and ratings based on existing Navidrome DB

Common options

All commands have these options available:

📋 Notes

➡️ What's next ?

Maybe build it as a .exe GUI ? If you have any enhancements suggestions, don't hesitate!

☕ Did you like this tool ?

If you found this tool useful, if it saved you some time, you can buy me a coffee !
I'm more of a tea (or beer >_>) drinker, but I can appreciate a good coffee too.

Buy Me a Coffee at ko-fi.com