Mercurial > rinkhals
comparison data/sounds/get-sources @ 113:55105d3bdab1
Renamed fire-rifle to fire-machinegun, and added a single-shot rifle
Adjusted convert_audio so you can specify a converter, namely oggenc, as nothing else seems to handle fire-rifle.wav
author | David Fraser <davidf@sjsoft.com> |
---|---|
date | Wed, 02 Sep 2009 19:13:54 +0000 |
parents | 1fd56b625b24 |
children |
comparison
equal
deleted
inserted
replaced
112:91fd3d5d66a3 | 113:55105d3bdab1 |
---|---|
24 source_config = ConfigParser.RawConfigParser() | 24 source_config = ConfigParser.RawConfigParser() |
25 source_config.read(filename) | 25 source_config.read(filename) |
26 for section in source_config.sections(): | 26 for section in source_config.sections(): |
27 yield section, dict(source_config.items(section)) | 27 yield section, dict(source_config.items(section)) |
28 | 28 |
29 def convert_audio(source_filename, target_filename, source_format, target_format): | 29 def convert_audio(source_filename, target_filename, source_format, target_format, converter=None): |
30 """converts audio between files""" | 30 """converts audio between files""" |
31 logging.info("Converting %s (format %s) to %s (format %s)", source_filename, source_format, target_filename, target_format) | 31 logging.info("Converting %s (format %s) to %s (format %s)", source_filename, source_format, target_filename, target_format) |
32 if converter == "oggenc": | |
33 subprocess.call(["oggenc", source_filename, "-o", target_filename]) | |
34 return | |
32 if not acodec or not muxer: | 35 if not acodec or not muxer: |
33 logging.debug("pymedia not present: will try use transcode") | 36 logging.debug("pymedia not present: will try use transcode") |
34 if source_format == "aiff": | 37 if source_format == "aiff": |
35 source_format = "mplayer" | 38 source_format = "mplayer" |
36 options = ["-y", "null,%s" % target_format, "-i", source_filename, "-o", target_filename] | 39 options = ["-y", "null,%s" % target_format, "-i", source_filename, "-o", target_filename] |
146 extract_archive(download_filename, source_options.get("archivemember", filename), source_filename) | 149 extract_archive(download_filename, source_options.get("archivemember", filename), source_filename) |
147 else: | 150 else: |
148 source_filename = download_filename | 151 source_filename = download_filename |
149 orig_format = source_options.get("originalformat", orig_ext) | 152 orig_format = source_options.get("originalformat", orig_ext) |
150 target_format = source_options.get("targetformat", target_ext) | 153 target_format = source_options.get("targetformat", target_ext) |
151 convert_audio(source_filename, target_filename, orig_format, target_format) | 154 converter = source_options.get("converter", None) |
155 convert_audio(source_filename, target_filename, orig_format, target_format, converter) | |
152 | 156 |