diff --git a/docs/changelog.rst b/docs/changelog.rst index 10e9484e..d5dd33a3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -132,6 +132,10 @@ Feature release. **Local backend** +- The JSON local library backend now logs a friendly message telling you about + ``mopidy local scan`` if you don't have a local library cache. (Fixes: + :issue:`711`) + - The ``local scan`` command now use multiple threads to walk the file system and check files' modification time. This speeds up scanning, escpecially when scanning remote file systems over e.g. NFS. diff --git a/mopidy/local/json.py b/mopidy/local/json.py index a8997367..927f8898 100644 --- a/mopidy/local/json.py +++ b/mopidy/local/json.py @@ -20,6 +20,14 @@ logger = logging.getLogger(__name__) # TODO: move to load and dump in models? def load_library(json_file): + if not os.path.isfile(json_file): + logger.info( + 'No local library metadata cache found at %s. Please run ' + '`mopidy local scan` to index your local music library. ' + 'If you do not have a local music collection, you can disable the ' + 'local backend to hide this message.', + json_file) + return {} try: with gzip.open(json_file, 'rb') as fp: return json.load(fp, object_hook=models.model_json_decoder)