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

0 potential tracks to be updated #3

Closed subatomiq closed 2 years ago

subatomiq commented 2 years ago

Hi there, thanks for your work on this project. it looks like a really useful tool for my musicbee/navidrome system also, however it's' not working for me

navidrome.db (and the db-shm+db-wal files) was copied from a local ubuntu 22.04 machine running docker to my windows machine, and Musicbee 3.5.8150 has produced a report with all the specified/required fields for the report, and have a 2.9 MB CSV file, named correctly, and checked that all my songs are contained in the file. (17797 tracks in total)

sample exe output is below, using the command:
musicbee-navidrome-sync.exe fullSync -f

note that it does see the content, but finds no potential tracks to update

\Musicbee-Navidrome-Sync>musicbee-navidrome-sync.exe fullSync -f
Command running with following options: { csv: 'MusicBee_Export.csv', db: 'navidrome.db', first: true }
DB has been backed up to ./backups/navidrome_2022-09-22_19-43-01_backup.db
Connection has been established successfully.
MusicBee_Export.csv parsed successfully, 0 potential tracks to be updated
Processing tracks...
 ████████████████████████████████████████ 100% | ETA: 0s | 0/0
0 tracks updated
0 tracks not found
Processing albums...
 ████████████████████████████████████████ 100% | ETA: 0s | 1269/1269
0 albums updated
Processing artists...
 ████████████████████████████████████████ 100% | ETA: 0s | 335/335
0 artists updated
fullSync completed successfully in a few seconds

any suggestions?

rombat commented 2 years ago

Hi, It seems that your CSV can't be parsed correctly, or at least not how MBNDS is expecting. Can you share it somewhere so I can check what's wrong ? Or at least an extract, like the first 20 lines or so ? Thanks in advance and have a nice day

subatomiq commented 2 years ago

sure - i've attached a truncated version of the CSV file MusicBee_Export.csv

rombat commented 2 years ago

Ok I see exactly what seems to be the problem. The separator in your CSV is ,, while I'm expecting a ;. Since MusicBee generated me CSVs with ; as a separator, I assumed that it was the same for everyone else, but it does not seem to be the case. I'll fix this after work and release a new version.

rombat commented 2 years ago

@subatomiq I've published a new version, can you try this one and tell me if it's ok please ? Thanks in advance

subatomiq commented 2 years ago

it's finding tracks now, which is good, (although weirdly only 2106 of the total 17902 tracks)

however it also now throws a new error (referencing a folder does not exist on my machine C:\snapshot\musicbee-navidrome-sync)

DB has been backed up to ./backups/navidrome_2022-09-24_11-58-15_backup.db
Connection has been established successfully.
MusicBee_Export.csv parsed successfully, 2106 potential tracks to be updated
Processing tracks...
 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0% | ETA: 0s | 0/2106An error as occured, restoring DB file...
 ████████████████████████████████████████ 100% | ETA: 0s | 2106/2106C:\snapshot\musicbee-navidrome-sync\node_modules\se5
      throw new Error(`WHERE parameter "${key}" has invalid "undefined" value`);
            ^

Error: WHERE parameter "title" has invalid "undefined" value
    at SQLiteQueryGenerator.whereItemQuery (C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\abs)
    at C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\abstract\query-generator.js:1646:25
    at Array.forEach (<anonymous>)
    at SQLiteQueryGenerator.whereItemsQuery (C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\ab)
    at C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\abstract\query-generator.js:1752:30
    at Array.map (<anonymous>)
    at SQLiteQueryGenerator._whereGroupBind (C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\ab)
    at SQLiteQueryGenerator.whereItemQuery (C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\abs)
    at C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\abstract\query-generator.js:1646:25
    at Array.forEach (<anonymous>)
    at SQLiteQueryGenerator.whereItemsQuery (C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\ab)
    at SQLiteQueryGenerator.getWhereConditions (C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects)
    at SQLiteQueryGenerator.selectQuery (C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\abstra)
    at SQLiteQueryInterface.select (C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\dialects\abstract\qu)
    at Function.findAll (C:\snapshot\musicbee-navidrome-sync\node_modules\sequelize\lib\model.js:1134:47)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
rombat commented 2 years ago

C:\snapshot\ is ok, it's a virtual file system created by pkg, the lib I'm using to build a .exe for a node app

Your CSV file may have 17902 tracks in it, but MBNDS only processes the ones that can be processed, i.e:

The others are irrelevant for a potential update You probably have lots of tracks that don't meet these requirements?

Can you please run it with the --verbose flag and share the log just before the error ?

Or share your full CSV and Navidrome DB so I can have a look

Edit: Fuck I know what's wrong. I use MusicBee title property, but I've not listed it as required, and so it's missing from your CSV, hence the error. I'll fix this quickly, sorry about that

rombat commented 2 years ago

Done. Can you try this version and tell me if it's ok @subatomiq ? You'll have to add Title property in your MusicBee extract.

subatomiq commented 2 years ago

@rombat all good! ...with the included title property, the process now works beautifully..
and all the relevant field data is appearing in navidrome. which is bloody great - thanks!

rombat commented 2 years ago

You're welcome ! Have a nice day 👍🏼