dotfiles

Configuration for the software I use.
git clone https://git.sr.ht/~jbauer/dotfiles
Log | Files | Refs | README | LICENSE

commit 97b2c4bff2aa92bf3a767056366eb4043020fa67
parent 1519e58a8d2a929e671887cec344b6f394a674b9
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Tue,  5 Jul 2022 18:22:24 -0400

Update flac-to-mp3

Diffstat:
A.local/bin/flac-to-mp3 | 28++++++++++++++++++++++++++++
D.local/bin/flac-to-mp3.sh | 27---------------------------
2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/.local/bin/flac-to-mp3 b/.local/bin/flac-to-mp3 @@ -0,0 +1,28 @@ +#!/bin/bash + +MUSICDIR="$HOME/Downloads" +MAXJOBS=$(nproc) + +convert() +{ + for thing in "$@"; do + if [ -d "$thing" ]; then + convert "$thing"/* + else + if [ "$numJobs" -gt "$MAXJOBS" ] || [ "$numJobs" -eq "$MAXJOBS" ]; then + wait -n; + numJobs=$((numJobs-1)) + fi + fileName=$(basename -s .flac "$thing") + dirName=$(dirname "$thing") + mkdir -vp "$MUSICDIR/$dirName" + echo "Converting $thing" + ffmpeg -y -hide_banner -loglevel error -i "$thing" -q:a 1 \ + "$MUSICDIR/$dirName/$fileName".mp3 & + numJobs=$((numJobs+1)) + fi + done +} + +numJobs=0 +convert "$@" diff --git a/.local/bin/flac-to-mp3.sh b/.local/bin/flac-to-mp3.sh @@ -1,27 +0,0 @@ -#!/bin/bash - -MUSICDIR="/home/jbauer/media/audio/music-mp3" -MAXJOBS=$(nproc) - -convert() -{ - for thing in "$@"; do - if [ -d "$thing" ]; then - convert "$thing"/* - else - if [ "$numJobs" -gt "$MAXJOBS" ] || [ "$numJobs" -eq "$MAXJOBS" ]; then - wait -n; - numJobs=$((numJobs-1)) - fi - fileName=$(basename -s .flac "$thing") - dirName=$(dirname "$thing") - mkdir -vp "$MUSICDIR/$dirName" - ffmpeg -y -hide_banner -i "$thing" -q:a 1 \ - "$MUSICDIR/$dirName/$fileName".mp3 & - numJobs=$((numJobs+1)) - fi - done -} - -numJobs=0 -convert "$@"