Merge pull request #747 from jodal/feature/friendly-no-local-library-help

local: Add friendly help if no local library cache found
This commit is contained in:
Stein Magnus Jodal 2014-06-20 23:32:11 +02:00
commit 715e3e24c2
2 changed files with 12 additions and 0 deletions

View File

@ -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.

View File

@ -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)