# HG changeset patch # User Neil Muller # Date 1328969085 -7200 # Node ID ccc26c23d2c17f4c1c74bf693d05bd27a10c2158 # Parent 1b1ab71535bd92f6ced219c73a709a348ab58060 Fix sound loading diff -r 1b1ab71535bd -r ccc26c23d2c1 pyntnclick/sound.py --- a/pyntnclick/sound.py Sat Feb 11 16:02:06 2012 +0200 +++ b/pyntnclick/sound.py Sat Feb 11 16:04:45 2012 +0200 @@ -85,13 +85,12 @@ def get_sound(self, *names): if not self.sound_enabled: return DummySound() - soundfile = os.path.join(names) sound = None try: - path = self._resource_finder("sounds", soundfile) + path = self._resource_finder.get_resource_path("sounds", *names) sound = self.sound_cache.get(path, None) except ResourceNotFound: - print "Sound file not found: %s" % soundfile + print "Sound file not found: %s" % names # Cache failed lookup sound = DummySound() self.sound_cache[path] = sound @@ -99,7 +98,7 @@ try: sound = pygame_Sound(path) except pygame.error: - print "Sound file not found: %s" % soundfile + print "Sound file not found: %s" % names sound = DummySound() self.sound_cache[path] = sound return sound @@ -108,13 +107,16 @@ return albow.music.PlayList(pieces, random, repeat) def get_music(self, name, prefix): - return albow.music.get_music(name, prefix=prefix) + if self.sound_enabled: + return albow.music.get_music(name, prefix=prefix) def change_playlist(self, new_playlist): - albow.music.change_playlist(new_playlist) + if self.sound_enabled: + albow.music.change_playlist(new_playlist) - def get_current_playlist(): - if albow.music.music_enabled and albow.music.current_playlist: + def get_current_playlist(self): + if self.sound_enabled and albow.music.music_enabled and \ + albow.music.current_playlist: return albow.music.current_playlist