Skip to content

Implement mopidy.backend.LibraryProvider.refresh #88

@MichaIng

Description

@MichaIng

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions