Initial commit
This commit is contained in:
21
scripts/estimate-musicdir
Executable file
21
scripts/estimate-musicdir
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# Estimate the size of a music directory if FLACs are lossy compressed
|
||||
|
||||
MUSIC_DIR="${1:-/home/bryan/media/music}"
|
||||
|
||||
# Sum existing MP3s
|
||||
MP3_BYTES=$(find "$MUSIC_DIR" -type f -iname "*.mp3" -exec du -b {} + | awk '{sum+=$1} END{print sum}')
|
||||
|
||||
# Sum FLACs
|
||||
FLAC_BYTES=$(find "$MUSIC_DIR" -type f -iname "*.flac" -exec du -b {} + | awk '{sum+=$1} END{print sum}')
|
||||
|
||||
# Estimate FLACs as 160k Ogg (roughly 1/8 size of FLAC)
|
||||
EST_FLAC_OGG=$(( FLAC_BYTES / 8 ))
|
||||
|
||||
# Total estimated size
|
||||
TOTAL_EST=$(( MP3_BYTES + EST_FLAC_OGG ))
|
||||
|
||||
# Human-readable
|
||||
EST_HR=$(numfmt --to=iec-i --suffix=B "$TOTAL_EST")
|
||||
echo "Estimated total size (MP3 + FLAC → 160k Ogg): $EST_HR"
|
||||
|
||||
Reference in New Issue
Block a user