from mutagen.flac import FLAC
audio = FLAC("/file/path")
audio["comment"] = "This is my comment"
audio.save()
I checked it tags the Flac file if I give file path. But how to run this on all files present in their respective album name folders? Like recursively?
I get IsADirectory
error on giving a directory path.
I'm literally not a coder. It would be awesome if someone could help me in this. I have been searching for python cli program for the same but couldn't find any.
So I literally using common sense, copy pasting and trial and error wrote the answer to my own question. More or less worked for me.
import os
from mutagen.flac import FLAC
for root, dirs, files in os.walk(os.path.abspath("/path/of/directory/")):
for file in files:
if file.endswith(".flac"):
print(os.path.join(root, file))
audio = FLAC(os.path.join(root, file))
audio["comment"] = "This is my comment"
audio.save()