comparison pytouhou/resource/loader.py @ 325:cddfd3cb4797

Add music support for >PCB.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 21 Jun 2012 15:01:01 +0200
parents 61adb5453e46
children 65453340ae95
comparison
equal deleted inserted replaced
324:c412df42aa15 325:cddfd3cb4797
23 from pytouhou.formats.anm0 import ANM0 23 from pytouhou.formats.anm0 import ANM0
24 from pytouhou.formats.msg import MSG 24 from pytouhou.formats.msg import MSG
25 from pytouhou.formats.sht import SHT 25 from pytouhou.formats.sht import SHT
26 from pytouhou.formats.exe import SHT as EoSDSHT, InvalidExeException 26 from pytouhou.formats.exe import SHT as EoSDSHT, InvalidExeException
27 from pytouhou.formats.music import Track 27 from pytouhou.formats.music import Track
28 from pytouhou.formats.fmt import FMT
28 29
29 30
30 from pytouhou.resource.anmwrapper import AnmWrapper 31 from pytouhou.resource.anmwrapper import AnmWrapper
31 32
32 from pytouhou.utils.helpers import get_logger 33 from pytouhou.utils.helpers import get_logger
106 self.instanced_anms = {} 107 self.instanced_anms = {}
107 self.instanced_stages = {} 108 self.instanced_stages = {}
108 self.instanced_msgs = {} 109 self.instanced_msgs = {}
109 self.instanced_shts = {} 110 self.instanced_shts = {}
110 self.instanced_tracks = {} 111 self.instanced_tracks = {}
112 self.instanced_fmts = {}
111 113
112 114
113 def scan_archives(self, paths_lists): 115 def scan_archives(self, paths_lists):
114 for paths in paths_lists: 116 for paths in paths_lists:
115 def _expand_paths(): 117 def _expand_paths():
192 file = self.get_file(posname) 194 file = self.get_file(posname)
193 self.instanced_tracks[name] = Track.read(file) #TODO: modular 195 self.instanced_tracks[name] = Track.read(file) #TODO: modular
194 return self.instanced_tracks[name] 196 return self.instanced_tracks[name]
195 197
196 198
199 def get_fmt(self, name):
200 if name not in self.instanced_fmts:
201 file = self.get_file(name)
202 self.instanced_fmts[name] = FMT.read(file) #TODO: modular
203 return self.instanced_fmts[name]
204
205
197 def get_anm_wrapper(self, names, offsets=None): 206 def get_anm_wrapper(self, names, offsets=None):
198 """Create an AnmWrapper for ANM files “names”. 207 """Create an AnmWrapper for ANM files “names”.
199 208
200 If one of the files “names” does not exist or is not a valid ANM file, 209 If one of the files “names” does not exist or is not a valid ANM file,
201 raises an exception. 210 raises an exception.