#!/bin/bash

# Iterate through each MP3 file in the current directory
for file in *.mp3; do
    if [[ -f "$file" ]]; then
        echo "Editing tags for: $file"
        eyeD3 -v "$file"

        # Get user input for tags
        read -t 2 -p "(s)kip, (q)uit, or nothing to continue: " sqc
        if [ -z "$sqc" ]; then
            read -p "Enter Song Name: " song_name
            read -p "Enter Artist Name: " artist_name
            read -p "Enter Album Name: " album_name
            read -p "Enter Year: " year

            # Update tags using eyeD3
            eyeD3 --title "$song_name" --artist "$artist_name" --album "$album_name" --release-year "$year" "$file"

            echo "Updated tags for $file"
            echo "----------------------------"
        elif [ "$sqc" == "q" ]; then
            echo "Quitter!"
            exit 0
        elif [ "$sqc" == "s" ]; then
            echo "Skipping $file"
        fi
    fi
done
