#!/usr/bin/env python

import os

from pydub import AudioSegment, effects

# DIR = "/home/kae/git/musicmuster/archive"
DIR = "/home/kae/git/musicmuster"

# Iterate through flac files


def process(path):
    audio = AudioSegment.from_file(path, "flac")
    print(path)
    print(f"audio.dBFS={audio.dBFS}")
    print(f"audio.max_dBFS={audio.max_dBFS}")
    print(f"audio.rms={audio.rms}")
    print(f"audio.max={audio.max}")
    print("-----------------")
    # normalised = effects.normalize(audio)
    # normalised.export(os.path.basename(path) + "n.flac", format="flac")


for f in os.scandir(DIR):
    if f.name.endswith(".flac"):
        process(f.path)
