Deduplicate unxwb code
This commit is contained in:
parent
7dbb8c1e62
commit
8afe245e05
15
src/main.rs
15
src/main.rs
|
@ -102,16 +102,16 @@ fn main() -> Result<()> {
|
|||
let wave_bank = WaveBank::parse(&xwb_data)?;
|
||||
info!("Opened wave bank “{}” from {:?}", wave_bank.name, opts.file);
|
||||
|
||||
match opts.single_entry {
|
||||
Some(name) => {
|
||||
let sound = match wave_bank.sounds.get(&name) {
|
||||
Some(sound) => sound,
|
||||
let entries = match opts.single_entry {
|
||||
Some(name) => match wave_bank.sounds.get(&name) {
|
||||
Some(_) => vec![name],
|
||||
None => return error(format!("Entry {} not found in wave bank", name)),
|
||||
},
|
||||
None => wave_bank.sounds.keys().cloned().collect(),
|
||||
};
|
||||
fs::write(format!("{}.wav", name), &sound.to_wav()?)?;
|
||||
}
|
||||
None => {
|
||||
|
||||
for (name, sound) in wave_bank.sounds {
|
||||
if entries.contains(&name) {
|
||||
if opts.list_entries {
|
||||
println!("{}", name);
|
||||
continue;
|
||||
|
@ -121,7 +121,6 @@ fn main() -> Result<()> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SubCommand::DDR2osu(opts) => {
|
||||
let sound_name = &opts
|
||||
.sound_name
|
||||
|
|
Reference in a new issue