Navidrome: Add support for forcing a complete re-scan

Created on 31 Mar 2020  路  10Comments  路  Source: deluan/navidrome

It would be nice to be able to force navidrome to rescan the music folder, while ignoring the timestamps.

Bonus point if this is made accessible to admin users via a button in the web interface.

enhancement

Most helpful comment

I'll be working on it very soon鈩笍

In the meantime, here are a couple of workarounds:

1) Using SQLite cmd line, run the following SQL command:

delete from property where id like 'LastScan%';
update media_file set updated_at = '0001-01-01';

This will force a full rescan for all files, when the next scan happens.

2) Whenever you want to force Navidrome to update a folder, touch the files in it with a command like this:

$ find R.E.M_ -name "*.mp3" -exec touch "{}" \;

Note: Keep ND_SCANINTERVAL=1m (1 minute) in your configuration, so new changes are quickly picked-up. Frequent scans are not too demanding on the server as the scan takes less than 2secs even with really large libraries.


I've being thinking about creating a command line tool to rescan the whole library or parts of it, while I don't create a UI for it.

Another (or additional) option would be to implement the startScan API method. That would even enable us to use the beets' subsonic update plugin, that triggers rescans after changing the library (for those who use beets, of course). Thoughts?

All 10 comments

I'll be working on it very soon鈩笍

In the meantime, here are a couple of workarounds:

1) Using SQLite cmd line, run the following SQL command:

delete from property where id like 'LastScan%';
update media_file set updated_at = '0001-01-01';

This will force a full rescan for all files, when the next scan happens.

2) Whenever you want to force Navidrome to update a folder, touch the files in it with a command like this:

$ find R.E.M_ -name "*.mp3" -exec touch "{}" \;

Note: Keep ND_SCANINTERVAL=1m (1 minute) in your configuration, so new changes are quickly picked-up. Frequent scans are not too demanding on the server as the scan takes less than 2secs even with really large libraries.


I've being thinking about creating a command line tool to rescan the whole library or parts of it, while I don't create a UI for it.

Another (or additional) option would be to implement the startScan API method. That would even enable us to use the beets' subsonic update plugin, that triggers rescans after changing the library (for those who use beets, of course). Thoughts?

@deluan that beets integration idea is awesome. I don't add things to my library without it going through beets import first to ensure cover art is embedded, a cover.jpg is included in the album folder and fixing up metadata. So I would only need to trigger a library rescan on import or delete with beets.

So a big +1 from me 馃憤

I would suggest making ND_SCANINTERVAL an optional setting then if this is implemented. Some people may be adverse to scanning large file system trees on slow spinning disks regularly if they have very large libraries.

@madcatsu That's also my use case, beets for all my music. But keep in mind that Navidrome only uses the embedded album art, it does not read cover.jpg or any other image files.

By the way ND_SCANINTERVAL can be set to 0 to disable scan altogether.

Navidrome only uses the embedded album art, it does not read cover.jpg or any other image files

That's fine, I've got those there for Plex support :)

There's now a scan command that can be issued from the command line:

$ navidrome scan [-f]

Use -f to scan all folders (not only the ones with detected changes)

I'll leaving this open, as it is still missing from the UI and API

How to use it in docker?
Version is V0.24

Would be fine to have a solution that fixes the wrong scan algo. In almost every music folder are songs missing.

It will be available in V0.25.0. I'm still figuring out the details and will update the docs explaining how to use it.

Regarding the issues you are having, can you please open a ticket for that? It should not have missing songs.... even when there were some issues with the scan algorithm (that were fixed in #347)

Forcing a re-scan when running with docker-compose is:

docker-compose exec navidrome /app/navidrome scan -f

Subsonic API endpoints startScan and getScanStatus are now implemented in 0.37.0. beets integration is working (use the subsonicupdate plugin), and clients that support these endpoints can now trigger scans:

ezgif-6-4a45132b37b0

I can finally close this, as the functionality is now fully implemented as of version 0.38.0 (both in the API and UI). To trigger a new rescan, use the new Activity Panel (top right, near the settings menu).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericgaspar picture ericgaspar  路  4Comments

axllent picture axllent  路  8Comments

pagdot picture pagdot  路  4Comments

TheForcer picture TheForcer  路  5Comments

AvdWerfhorst picture AvdWerfhorst  路  6Comments