From 2a1db299c83e96171dcc5b47acc6af489b610d16 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Wed, 21 Jan 2026 17:01:38 +0100 Subject: [PATCH] add function for splitting cue sheets --- modules/transcode.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/transcode.nix b/modules/transcode.nix index ee40b81..78b60ee 100644 --- a/modules/transcode.nix +++ b/modules/transcode.nix @@ -3,6 +3,8 @@ { home.packages = with pkgs; [ ffmpeg + shntool + cuetools ]; programs.zsh.initContent = '' @@ -31,5 +33,22 @@ fi done } + + function cuesplit() { + local audio="$1" + local cue="''${2:-''${audio%.*}.cue}" + if [[ ! -f "$audio" ]]; then + echo "Audio file not found: $audio" >&2 + return 1 + fi + if [[ ! -f "$cue" ]]; then + echo "Cue file not found: $cue" >&2 + return 1 + fi + local ext="''${audio##*.}" + local fmt="''${ext:l}" + mkdir -p ./tracks + shnsplit -f "$cue" -t "%n - %t" -o "$fmt" -d ./tracks "$audio" + } ''; }