fix: use mid2v3 to handle special characters
Some checks failed
Code Analysis / SonarQube (push) Failing after 46s

This commit is contained in:
2025-03-25 01:01:16 -07:00
parent 00dc40ba47
commit b191f14a0b
3 changed files with 5004 additions and 321 deletions

View File

@ -10,15 +10,8 @@ current=0
for file in $(find /home/naomi/music -type f -print0 | tr '\0' '\n'); do
current=$((current + 1))
echo -ne "Processing $current/$filecount\r"
title=$(id3v2 -l "$file" | grep "TIT2" | cut -d ":" -f 2 | sed -e 's/^[[:space:]]*//')
artist=$(id3v2 -l "$file" | grep "TPE1" | cut -d ":" -f 2 | sed -e 's/^[[:space:]]*//')
if [ -z "$title" ]; then
title=$(id3v2 -l "$file" | grep "TT2" | cut -d ":" -f 2 | sed -e 's/^[[:space:]]*//')
fi
if [ -z "$artist" ]; then
artist=$(id3v2 -l "$file" | grep "TP1" | cut -d ":" -f 2 | sed -e 's/^[[:space:]]*//')
fi
title=$(mid3v2 -l "$file" | grep "TIT2\|TT2" | cut -d "=" -f 2)
artist=$(mid3v2 -l "$file" | grep "TPE1\|TP1" | cut -d "=" -f 2)
if [ -z "$title" ]; then
# remove .mp3 from the title
title=$(basename "$file" | sed -e 's/\.mp3//g')