The Mopidy API provides an optional refresh method to refresh the library, optionally limited by path: https://docs.mopidy.com/stable/api/backend/#mopidy.backend.LibraryProvider.refresh
AFAICS, mopidy-local does not implement this yet: https://github.com/mopidy/mopidy-local/blob/main/src/mopidy_local/library.py
Wouldn't it make sense to implement this to trigger a scan? That way, web interface extensions can provide a button to trigger a local library rescan, without the need to call mopidy or mopidyctl console commands, which is very ugly for several reasons, the latter requiring sudo (or similar), the prior obtaining at least the correct --config path, and limited it to platforms where these commands are at all available on standard PATH.
Here is what Iris currently does, which works only on a standard installation all via apt and/or pip on system level, which is increasingly difficult to achieve with pip's --breaking-system-package and recent attempts to uninstall Python packages installed via apt (or whichever distro package manager): https://github.com/jaedb/Iris/blob/master/mopidy_iris/system.sh
It should be even easy to implement the optional URI (path) parameter, e.g. as either relative path to the media dir, or absolute below the media dir, in which case the function can join/merge it with the media_dir variable, before passing it to the subfunctions.
I could try to implement this and open a PR, but just want to check back whether this is wanted, or has been intentionally skipped in the past for some reason.
The Mopidy API provides an optional
refreshmethod to refresh the library, optionally limited by path: https://docs.mopidy.com/stable/api/backend/#mopidy.backend.LibraryProvider.refreshAFAICS,
mopidy-localdoes not implement this yet: https://github.com/mopidy/mopidy-local/blob/main/src/mopidy_local/library.pyWouldn't it make sense to implement this to trigger a scan? That way, web interface extensions can provide a button to trigger a local library rescan, without the need to call
mopidyormopidyctlconsole commands, which is very ugly for several reasons, the latter requiringsudo(or similar), the prior obtaining at least the correct--configpath, and limited it to platforms where these commands are at all available on standard PATH.Here is what Iris currently does, which works only on a standard installation all via
aptand/orpipon system level, which is increasingly difficult to achieve withpip's--breaking-system-packageand recent attempts to uninstall Python packages installed viaapt(or whichever distro package manager): https://github.com/jaedb/Iris/blob/master/mopidy_iris/system.shIt should be even easy to implement the optional URI (
path) parameter, e.g. as either relative path to the media dir, or absolute below the media dir, in which case the function can join/merge it with themedia_dirvariable, before passing it to the subfunctions.I could try to implement this and open a PR, but just want to check back whether this is wanted, or has been intentionally skipped in the past for some reason.