WIP
This commit is contained in:
@@ -3,7 +3,7 @@ IMAGE := akai-fetch
|
||||
REMOTE := dhg.lol
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 go build -o $(BIN) .
|
||||
CGO_ENABLED=0 go build -buildvcs=false -o $(BIN) .
|
||||
|
||||
docker:
|
||||
docker build -t $(IMAGE) .
|
||||
|
||||
@@ -374,10 +374,15 @@ func cmdExtract(args []string) {
|
||||
fs := flag.NewFlagSet("extract", flag.ExitOnError)
|
||||
isoDir := fs.String("dir", ".", "directory with ISO files")
|
||||
outDir := fs.String("out", "./wavs", "output directory for WAVs")
|
||||
toolPath := fs.String("tool", "./extract_wavs.sh", "path to extraction script")
|
||||
toolFlag := fs.String("tool", "", "path to extraction script (default: auto-detect)")
|
||||
jobs := fs.Int("jobs", 2, "concurrent extractions")
|
||||
_ = fs.Parse(args)
|
||||
|
||||
toolPath := *toolFlag
|
||||
if toolPath == "" {
|
||||
toolPath = findScript("extract_wavs.sh")
|
||||
}
|
||||
|
||||
entries, err := os.ReadDir(*isoDir)
|
||||
if err != nil {
|
||||
fatal("read dir: %v", err)
|
||||
@@ -410,7 +415,7 @@ func cmdExtract(args []string) {
|
||||
defer func() { <-sem }()
|
||||
|
||||
out := *outDir
|
||||
result, err := extractISO(*toolPath, isoPath, out)
|
||||
result, err := extractISO(toolPath, isoPath, out)
|
||||
mu.Lock()
|
||||
results[filepath.Base(isoPath)] = result
|
||||
mu.Unlock()
|
||||
@@ -505,12 +510,7 @@ func cmdPipeline(args []string) {
|
||||
|
||||
isoDir := filepath.Join(*baseDir, "isos")
|
||||
wavDir := filepath.Join(*baseDir, "wavs")
|
||||
toolPath := filepath.Join(filepath.Dir(os.Args[0]), "extract_wavs.sh")
|
||||
|
||||
if _, err := os.Stat(toolPath); os.IsNotExist(err) {
|
||||
cwd, _ := os.Getwd()
|
||||
toolPath = filepath.Join(cwd, "extract_wavs.sh")
|
||||
}
|
||||
toolPath := findScript("extract_wavs.sh")
|
||||
|
||||
// Remaining args after flags are treated as explicit identifiers
|
||||
identifiers := fs.Args()
|
||||
@@ -563,6 +563,21 @@ func cmdPipeline(args []string) {
|
||||
fmt.Printf(" WAVs: %s\n", wavDir)
|
||||
}
|
||||
|
||||
func findScript(name string) string {
|
||||
candidates := []string{
|
||||
filepath.Join(filepath.Dir(os.Args[0]), name),
|
||||
filepath.Join(filepath.Dir(os.Args[0]), "scripts", name),
|
||||
name,
|
||||
filepath.Join("scripts", name),
|
||||
}
|
||||
for _, p := range candidates {
|
||||
if _, err := os.Stat(p); err == nil {
|
||||
return p
|
||||
}
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
// ─── Helpers ───────────────────────────────────────────────────────────
|
||||
|
||||
func fatal(format string, args ...any) {
|
||||
|
||||
+10
-1
@@ -5,7 +5,16 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
AKAIUTIL="${AKAIUTIL:-akaiutil}"
|
||||
if [ -z "${AKAIUTIL:-}" ]; then
|
||||
if command -v akaiutil &>/dev/null; then
|
||||
AKAIUTIL="akaiutil"
|
||||
elif [ -x "/DATA/Downloads/akai/akaiutil-4.6.7/akaiutil" ]; then
|
||||
AKAIUTIL="/DATA/Downloads/akai/akaiutil-4.6.7/akaiutil"
|
||||
else
|
||||
echo "error: akaiutil not found — set AKAIUTIL env var" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
ISO="${1:?Usage: $0 <iso-file> [output-dir]}"
|
||||
OUTPUT="${2:-wavs}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user