Handle missing tag cache better
This commit is contained in:
parent
a222a49799
commit
fa362ce936
@ -185,6 +185,7 @@ class GStreamerLibraryController(BaseLibraryController):
|
||||
def __init__(self, backend):
|
||||
super(GStreamerLibraryController, self).__init__(backend)
|
||||
self._uri_mapping = {}
|
||||
self.refresh()
|
||||
|
||||
def refresh(self, uri=None):
|
||||
tracks, artists, albums = parse_mpd_tag_cache(settings.TAG_CACHE,
|
||||
|
||||
@ -140,12 +140,17 @@ def parse_mpd_tag_cache(tag_cache, music_dir=''):
|
||||
"""
|
||||
Converts a MPD tag_cache into a lists of tracks, artists and albums.
|
||||
"""
|
||||
with open(tag_cache) as library:
|
||||
contents = library.read()
|
||||
|
||||
tracks = set()
|
||||
artists = set()
|
||||
albums = set()
|
||||
|
||||
try:
|
||||
with open(tag_cache) as library:
|
||||
contents = library.read()
|
||||
except IOError, e:
|
||||
logger.error('Could not tag cache: %s', e)
|
||||
return tracks, artists, albums
|
||||
|
||||
current = {}
|
||||
state = None
|
||||
|
||||
|
||||
@ -989,7 +989,6 @@ class BaseLibraryControllerTest(object):
|
||||
def setUp(self):
|
||||
self.backend = self.backend_class(mixer=DummyMixer())
|
||||
self.library = self.backend.library
|
||||
self.library.refresh() # FIXME init should call refresh instead
|
||||
|
||||
def tearDown(self):
|
||||
self.backend.destroy()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user