diff --git a/README.md b/README.md index f1cb33d..c9983de 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ this makes racks look like they were made with ableton live 10.0.3. most racks w windows: just drag and drop the .adg onto the converter exe macos: drag and drop doesn't work, just use the terminal (ie: `./ableton-rack-converter ../racks/incompatible-rack.adg`) +compressor/decompressor are used in the same way for if u want to manually edit/inspect the xml + not working: * vsts * you tell me (😉) \ No newline at end of file diff --git a/build-macos.sh b/build-macos.sh index f8e5de0..22f3218 100755 --- a/build-macos.sh +++ b/build-macos.sh @@ -1,4 +1,5 @@ cargo build --target-dir=./build/macos --release mkdir -p build/release/macos cp build/macos/release/converter build/release/macos/ableton-rack-converter -cp build/macos/release/compressor build/release/macos/xml-to-compressed-rack +cp build/macos/release/compressor build/release/macos/xml-to-rack +cp build/macos/release/decompressor build/release/macos/rack-to-xml diff --git a/build-windows.sh b/build-windows.sh index 83dce4f..1b8de8a 100755 --- a/build-windows.sh +++ b/build-windows.sh @@ -1,4 +1,5 @@ cargo build --target=x86_64-pc-windows-gnu --target-dir=./build/windows --release mkdir -p build/release/windows cp build/windows/x86_64-pc-windows-gnu/release/converter.exe build/release/windows/ableton-rack-converter.exe -cp build/windows/x86_64-pc-windows-gnu/release/compressor.exe build/release/windows/xml-to-compressed-rack.exe +cp build/windows/x86_64-pc-windows-gnu/release/compressor.exe build/release/windows/xml-to-rack.exe +cp build/windows/x86_64-pc-windows-gnu/release/decompressor.exe build/release/windows/rack-to-xml.exe diff --git a/src/bin/compressor.rs b/src/bin/compressor.rs index 6c5e4ec..f3d9ef8 100644 --- a/src/bin/compressor.rs +++ b/src/bin/compressor.rs @@ -1,18 +1,20 @@ #![windows_subsystem = "windows"] use ableton_rack_converter; -use std::{fs, path::PathBuf}; +use std::{env, path::PathBuf}; fn main() { - let paths = fs::read_dir(".\\test_conversion\\").unwrap(); - for path in paths { - let loadpath = path.unwrap().path(); - if loadpath.extension().expect("couldn't get extension") == "xml" { - let mut path_str = String::from(".\\exported_files\\"); - path_str.push_str(loadpath.file_stem().unwrap().to_str().unwrap()); - path_str.push_str("-compressed.adg"); - let savepath = PathBuf::from(path_str); - ableton_rack_converter::compress_file(loadpath, savepath); - } + let args: Vec = env::args().collect(); + if args.len() == 1 { + return; } + let file_load = PathBuf::from(args[1].as_str()); + if file_load.extension().expect("wrong/no extension") != "xml" { + return; + } + let mut path_str = String::from(""); + path_str.push_str(file_load.file_stem().unwrap().to_str().unwrap()); + path_str.push_str("-compressed.adg"); + let file_save = PathBuf::from(path_str); + ableton_rack_converter::compress_file(file_load, file_save); } diff --git a/src/bin/decompressor.rs b/src/bin/decompressor.rs new file mode 100644 index 0000000..67c7688 --- /dev/null +++ b/src/bin/decompressor.rs @@ -0,0 +1,21 @@ +#![windows_subsystem = "windows"] + +use ableton_rack_converter; +use std::{env, path::PathBuf}; + +fn main() { + let args: Vec = env::args().collect(); + if args.len() == 1 { + return; + } + let file_load = PathBuf::from(args[1].as_str()); + if file_load.extension().expect("wrong/no extension") != "adg" { + return; + } + let mut path_str = String::from(""); + path_str.push_str(file_load.file_stem().unwrap().to_str().unwrap()); + path_str.push_str("-decompressed.xml"); + let file_save = PathBuf::from(path_str); + let dom = ableton_rack_converter::load_adg(file_load); + ableton_rack_converter::save_uncompressed(&dom, file_save); +}