From 51eb11db1604d70b25bf69dae32f43271a989f70 Mon Sep 17 00:00:00 2001 From: Flinner Yuu Date: Fri, 31 Mar 2023 13:28:16 +0300 Subject: [PATCH] feat: idk --- bin/bin/autostart | 20 ++++++++++++++++---- bin/bin/demusicify.sh | 34 +++++++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/bin/bin/autostart b/bin/bin/autostart index 01f9d21..51b65ac 100755 --- a/bin/bin/autostart +++ b/bin/bin/autostart @@ -23,7 +23,6 @@ source ~/.fehbg #(sleep 1 && keynav)& # warped > keynav (sleep 1 && warpd)& -(sleep 0 && ~/bin/keyboard ) & killall wired (sleep 1 && wired ) & #(sleep 3 && optimus-manager-qt) & @@ -33,8 +32,10 @@ killall wired (sleep 6 && bspc rule -r KeePassXC ) & (sleep 5 && syncthing -no-browser) & +(sleep 100 && nextcloud --background) & + #(sleep 5 && thunderbird ) & -(sleep 7 && bspc rule -r Thunderbird ) & +#(sleep 7 && bspc rule -r Thunderbird ) & # Kill all davail instances before launching a single one kill $(pgrep --full "davmail") @@ -54,9 +55,20 @@ killall goimapnotify #done ~/bin/run_goimapnotify.sh & +## Keyboard +# ibus-daemon & +# uim-toolbar-gtk3-systray & #uim Japanses Input +# Japanses Input +#(sleep 1 && fcitx -d ) & +(sleep 0 && ~/bin/keyboard ) & + +## Audio +(sleep 0 && dbus-run-session pipewire ) & +(sleep 2 && dbus-run-session pipewire-pulse ) & +(sleep 2 && dbus-run-session wireplumber ) & + +#(sleep 2 && polkit-dumb-agent) & -#ibus-daemon & -#uim-toolbar-gtk3-systray & #uim Japanses Input #if bspwm diff --git a/bin/bin/demusicify.sh b/bin/bin/demusicify.sh index f9439f2..ae7428f 100755 --- a/bin/bin/demusicify.sh +++ b/bin/bin/demusicify.sh @@ -1,14 +1,35 @@ #!/bin/bash +PYTORCH_NO_CUDA_MEMORY_CACHING=1 + [ -z "$2" ] && echo "usage: input.mp4 output.mp4" [ -z "$2" ] && exit VIDEO="$1" VIDEO_OUTPUT="$2" -TMP_RAW_AUDIO=$(mktemp --suffix ".mp3") -TMP_VOCALS_DIR=$(mktemp --directory) -TMP_VOCALS=$(mktemp --suffix ".mp3") +mkdir -p ~/tmp/demusicify +echo "Created ~/tmp/demusicify" + +echo "Using ~/tmp/demusicify as a temp directory" +TMP_RAW_AUDIO=$(mktemp -p ~/tmp/demusicify --suffix ".mp3") +TMP_VOCALS_DIR=$(mktemp -p ~/tmp/demusicify --directory) +TMP_VOCALS=$(mktemp -p ~/tmp/demusicify --suffix ".mp3") + +function cleanup () { + + read -p "Do you want to cleanup? y/n" -n 1 -r + echo # (optional) move to a new line + if [[ ! $REPLY =~ ^[Yy]$ ]] + then + [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell + echo "Cleaning up!" + rm "$TMP_RAW_AUDIO" + rm "$TMP_VOCALS" + rm -rf "$TMP_VOCALS_DIR" + fi +} +trap cleanup EXIT # Extract Audio from Video ffmpeg -i "$VIDEO" -vn "$TMP_RAW_AUDIO" -y @@ -16,7 +37,7 @@ ffmpeg -i "$VIDEO" -vn "$TMP_RAW_AUDIO" -y # move to a tmp file, becuase demucs creates a lot of garbage pushd "$TMP_VOCALS_DIR" || exit -demucs --two-stems=vocals --segment 10 "$TMP_RAW_AUDIO" +demucs --two-stems=vocals --segment 15 "$TMP_RAW_AUDIO" cp ./separated/*/*/vocals.wav "$TMP_VOCALS" @@ -29,8 +50,3 @@ ffmpeg \ -c:v copy \ -map 0 -map 1:a \ -y "$VIDEO_OUTPUT" - - -rm "$TMP_RAW_AUDIO" -rm "$TMP_VOCALS" -rm -rf "$TMP_VOCALS_DIR"