Compare commits
No commits in common. "f9c40f79f1c847cdcbf0f4871cffe5691c0b2167" and "018eb21ecde04a85a120772845328b661c1fa026" have entirely different histories.
f9c40f79f1
...
018eb21ecd
3 changed files with 6 additions and 36 deletions
12
readme.md
12
readme.md
|
@ -26,9 +26,7 @@ The input music folder needs the following structure:
|
||||||
└ 💾 Music 1
|
└ 💾 Music 1
|
||||||
```
|
```
|
||||||
|
|
||||||
Directory/File names must not exceed 31~ characters.
|
Directory/File names must not exceed 31 characters.
|
||||||
|
|
||||||
If you encounter issues with song not playing you could try to change the codec to wmav1 or lower the bitrate.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
Usage: xbst [OPTIONS] [INPUT] [OUTPUT]
|
Usage: xbst [OPTIONS] [INPUT] [OUTPUT]
|
||||||
|
@ -38,16 +36,14 @@ Arguments:
|
||||||
[OUTPUT] Output folder for the database and converted musics [default: ./output]
|
[OUTPUT] Output folder for the database and converted musics [default: ./output]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-b, --bitrate <BITRATE> Bitrate for the output [default: 128]
|
-b, --bitrate <BITRATE> Bitrate for the output [default: 192]
|
||||||
-c, --codec <CODEC> Codec to use for conversion [default: wmav2] [possible values: wmav1, wmav2]
|
|
||||||
-h, --help Print help
|
-h, --help Print help
|
||||||
-V, --version Print version
|
-V, --version Print version
|
||||||
```
|
```
|
||||||
|
|
||||||
## Known issues
|
## Known issues
|
||||||
|
|
||||||
- The progress bar on soundtrack other than the first one doesn't progress.
|
- The progress bar on soundtrack other than the first one doesn't progress
|
||||||
- Some files, once converted, are quieter than usual?
|
- Some files, once converted, are quieter than usual?
|
||||||
- When using wmav1, some audio files might sounds absolute ass.
|
|
||||||
- Untested with a large library, probably has issues?
|
- Untested with a large library, probably has issues?
|
||||||
- Code is poo poo :(
|
- Code is poo poo
|
15
src/main.rs
15
src/main.rs
|
@ -14,7 +14,7 @@ use deunicode::AsciiChars;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use zerocopy::IntoBytes;
|
use zerocopy::IntoBytes;
|
||||||
|
|
||||||
use crate::utils::{Codec, Header, MusicFile, Song, Soundtrack};
|
use crate::utils::{Header, MusicFile, Song, Soundtrack};
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
enum Errors {
|
enum Errors {
|
||||||
|
@ -47,10 +47,6 @@ struct Args {
|
||||||
/// Bitrate for the output
|
/// Bitrate for the output
|
||||||
#[arg(short, long, default_value_t = 128)]
|
#[arg(short, long, default_value_t = 128)]
|
||||||
bitrate: i16,
|
bitrate: i16,
|
||||||
/// Codec to use for conversion
|
|
||||||
#[clap(value_enum)]
|
|
||||||
#[arg(short, long, default_value_t = Codec::Wmav2)]
|
|
||||||
codec: Codec,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -143,11 +139,6 @@ fn process(args: &Args) -> Result<(), Errors> {
|
||||||
let song = f.as_ref().unwrap();
|
let song = f.as_ref().unwrap();
|
||||||
let song_path = song.path();
|
let song_path = song.path();
|
||||||
|
|
||||||
// Ignore non files for song groups
|
|
||||||
if !song_path.is_file() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
song_id[g] = total_songs_count as i32;
|
song_id[g] = total_songs_count as i32;
|
||||||
song_time_miliseconds[g] = match get_duration(song_path) {
|
song_time_miliseconds[g] = match get_duration(song_path) {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
|
@ -287,7 +278,6 @@ fn process(args: &Args) -> Result<(), Errors> {
|
||||||
f.path,
|
f.path,
|
||||||
&args.output,
|
&args.output,
|
||||||
args.bitrate,
|
args.bitrate,
|
||||||
&args.codec,
|
|
||||||
f.soundtrack_index as usize,
|
f.soundtrack_index as usize,
|
||||||
f.index as usize,
|
f.index as usize,
|
||||||
)?;
|
)?;
|
||||||
|
@ -322,7 +312,6 @@ fn convert_to_wma(
|
||||||
input: PathBuf,
|
input: PathBuf,
|
||||||
output: &String,
|
output: &String,
|
||||||
bitrate: i16,
|
bitrate: i16,
|
||||||
codec: &Codec,
|
|
||||||
soundtrack_index: usize,
|
soundtrack_index: usize,
|
||||||
song_index: usize,
|
song_index: usize,
|
||||||
) -> Result<(), Errors> {
|
) -> Result<(), Errors> {
|
||||||
|
@ -337,7 +326,7 @@ fn convert_to_wma(
|
||||||
"-i",
|
"-i",
|
||||||
input,
|
input,
|
||||||
"-acodec",
|
"-acodec",
|
||||||
&codec.to_string(),
|
"wmav1",
|
||||||
"-ac",
|
"-ac",
|
||||||
"2",
|
"2",
|
||||||
"-ar",
|
"-ar",
|
||||||
|
|
15
src/utils.rs
15
src/utils.rs
|
@ -9,21 +9,6 @@ pub struct MusicFile {
|
||||||
pub index: u32,
|
pub index: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(clap::ValueEnum, Debug, Clone)]
|
|
||||||
pub enum Codec {
|
|
||||||
Wmav1,
|
|
||||||
Wmav2,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToString for Codec {
|
|
||||||
fn to_string(&self) -> String {
|
|
||||||
match self {
|
|
||||||
Codec::Wmav1 => String::from("wmav1"),
|
|
||||||
Codec::Wmav2 => String::from("wmav2"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://xboxdevwiki.net/Soundtracks#ST.DB
|
// https://xboxdevwiki.net/Soundtracks#ST.DB
|
||||||
#[derive(Debug, Immutable, IntoBytes)]
|
#[derive(Debug, Immutable, IntoBytes)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue