Could you please help me add and change the metadata of music in the entire directory or folder? I created a Python script/command that changes the audio metadata, only applicable on a single file or single audio. You can see the script below, but all I need to know is how I can execute in a one-time process to change the metadata of many audio files located in one folder or one directory. I hope anyone can help me with this. TIA.
Change Metadata of an Audio (e.g., MP3) on Colab:
#@title » Change-Audio-Metadata
import os, sys, re
audio_file_path = "" #@param {type:"string"}
output_file_path = re.search("^[\/].+\/", audio_file_path)
output_file_path_raw = output_file_path.group(0)
delsplit = re.search("\/(?:.(?!\/))+$", audio_file_path)
filename = re.sub("^[\/]", "", delsplit.group(0))
filename_raw = re.sub(".{4}$", "", filename)
file_extension = re.search(".{3}$", filename)
file_extension_raw = file_extension.group(0)
os.environ['inputFile'] = audio_file_path
os.environ['outputPath'] = output_file_path_raw
os.environ['fileName'] = filename_raw
os.environ['fileExtension'] = file_extension_raw
!ffmpeg -hide_banner -i "$inputFile" -metadata comment="SAMPLECOMMENT" -metadata note="SAMPLENOTE" -codec copy "$outputPath"/"$fileName"-OK.mp3
Again, that is only applicable in a single audio file; all I need is to add and change the metadata of an audio (e.g., MP3s) in the entire directory or folder script/command.