local: Log how many tracks and playlists are loaded

This commit is contained in:
Stein Magnus Jodal 2013-04-09 11:05:55 +02:00
parent f9f80e264e
commit 796f7302aa
2 changed files with 8 additions and 6 deletions

View File

@ -32,15 +32,15 @@ class LocalLibraryProvider(base.BaseLibraryProvider):
'Could not create empty tag cache: %s', locale_decode(error))
return
logger.info(
'Loading tracks from %s using %s',
self._media_dir, self._tag_cache_file)
tracks = parse_mpd_tag_cache(self._tag_cache_file, self._media_dir)
for track in tracks:
self._uri_mapping[track.uri] = track
logger.info(
'Loaded %d local tracks from %s using %s',
len(tracks), self._media_dir, self._tag_cache_file)
def lookup(self, uri):
try:
return [self._uri_mapping[uri]]

View File

@ -42,8 +42,6 @@ class LocalPlaylistsProvider(base.BasePlaylistsProvider):
return playlist
def refresh(self):
logger.info('Loading playlists from %s', self._playlists_dir)
playlists = []
for m3u in glob.glob(os.path.join(self._playlists_dir, '*.m3u')):
@ -65,6 +63,10 @@ class LocalPlaylistsProvider(base.BasePlaylistsProvider):
self.playlists = playlists
listener.BackendListener.send('playlists_loaded')
logger.info(
'Loaded %d local playlists from %s',
len(playlists), self._playlists_dir)
def save(self, playlist):
assert playlist.uri, 'Cannot save playlist without URI'