48 lines
1.1 KiB
Bash
Executable File
48 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "Removing thumbnails and associated CDs from MP3 files..."
|
|
echo ""
|
|
|
|
counter=0
|
|
|
|
# Process all mp3 files
|
|
for file in *.mp3 */*.mp3 */*/*.mp3; do
|
|
# Skip if file doesn't exist
|
|
[ -e "$file" ] || continue
|
|
|
|
filename=$(basename "$file")
|
|
|
|
echo "Processing: $file"
|
|
|
|
# Create temp file
|
|
temp_file="/tmp/strip_${counter}_$$.mp3"
|
|
|
|
# Remove all images/artwork and strip video streams
|
|
ffmpeg -i "$file" \
|
|
-map 0:a \
|
|
-c copy \
|
|
-map_metadata 0 \
|
|
-id3v2_version 3 \
|
|
-vn \
|
|
"$temp_file" -y >/dev/null 2>&1
|
|
|
|
if [ -f "$temp_file" ] && [ -s "$temp_file" ]; then
|
|
# Remove disc number metadata using eyeD3 if available
|
|
if command -v eyeD3 &> /dev/null; then
|
|
eyeD3 --remove-images \
|
|
--disc-num "" \
|
|
"$temp_file" >/dev/null 2>&1
|
|
fi
|
|
|
|
mv "$temp_file" "$file"
|
|
echo " ✓ Done"
|
|
((counter++))
|
|
else
|
|
echo " ✗ Failed"
|
|
[ -f "$temp_file" ] && rm "$temp_file"
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "Processed $counter files"
|