# HG changeset patch # User Emmanuel Gil Peyrot # Date 1396698691 -7200 # Node ID a50c0a1b628f9a909285909c8309151aae9f7f89 # Parent 346cbf2668566ea12e5f1c908e7969f583fac23f Don’t stop music loading if the pos file isn’t found. diff --git a/pytouhou/ui/music.pyx b/pytouhou/ui/music.pyx --- a/pytouhou/ui/music.pyx +++ b/pytouhou/ui/music.pyx @@ -36,9 +36,8 @@ cdef class BGMPlayer(MusicPlayer): try: track = resource_loader.get_track(posname) except KeyError: - self.bgms.append(None) - logger.warn(u'Music description “%s” not found.', posname) - continue + track = None + logger.warn(u'Music description “%s” not found, continuing without looping data.', posname) globname = join(resource_loader.game_dir, bgm[1].encode('ascii')).replace('.mid', '.*') filenames = glob(globname) for filename in reversed(filenames): @@ -48,7 +47,8 @@ cdef class BGMPlayer(MusicPlayer): logger.debug(u'Music file “%s” unreadable: %s', filename, error) continue else: - source.set_loop_points(track.start / 44100., track.end / 44100.) #TODO: retrieve the sample rate from the actual track. + if track is not None: + source.set_loop_points(track.start / 44100., track.end / 44100.) #TODO: retrieve the sample rate from the actual track. self.bgms.append(source) logger.debug(u'Music file “%s” opened.', filename) break